This is a first draft. Just trying to do some basic breakpoint and line
number checks on a split dwarf compiled binary for now.
Also, is there an LLDB phabricator? I didn't notice it in the project
listing in reviews.llvm.org.
PL
commit 901971ff8bfcc42679eb8113b5f2a251bc0b9094
Author: Puyan Lotfi
Date: Mon Jun 25 20:55:36 2018 -0700
Adding some additional testing for split-dwarf.
diff --git a/packages/Python/lldbsuite/test/linux/split-dwo-basics/Makefile b/packages/Python/lldbsuite/test/linux/split-dwo-basics/Makefile
new file mode 100644
index 0..8d0ca6ea3
--- /dev/null
+++ b/packages/Python/lldbsuite/test/linux/split-dwo-basics/Makefile
@@ -0,0 +1,11 @@
+LEVEL := ../../make
+
+C_SOURCES := a.c b.c
+a.o: CFLAGS_EXTRAS += -gsplit-dwarf
+b.o: CFLAGS_EXTRAS += -gsplit-dwarf
+
+include $(LEVEL)/Makefile.rules
+
+.PHONY: clean
+clean::
+ $(RM) -f a.dwo a.o b.o main
diff --git a/packages/Python/lldbsuite/test/linux/split-dwo-basics/TestSplitDwarfBinary.py b/packages/Python/lldbsuite/test/linux/split-dwo-basics/TestSplitDwarfBinary.py
new file mode 100644
index 0..44b131569
--- /dev/null
+++ b/packages/Python/lldbsuite/test/linux/split-dwo-basics/TestSplitDwarfBinary.py
@@ -0,0 +1,63 @@
+""" Testing debugging of a binary with split dwarf (with fission). """
+import os
+import lldb
+import sys
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestSplitDwarfBinary(TestBase):
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+TestBase.setUp(self)
+
+@no_debug_info_test # Prevent the genaration of the dwarf version of this test
+@add_test_categories(["dwo"])
+@skipUnlessPlatform(["linux"])
+def test_split_dwarf(self):
+"""Test that 'frame variable' works
+for the executable built from two source files compiled
+with/whithout -gsplit-dwarf correspondingly."""
+
+self.build()
+exe = self.getBuildArtifact("a.out")
+
+
+self.target = self.dbg.CreateTarget(exe)
+self.assertTrue(self.target, VALID_TARGET)
+
+main_bp = self.target.BreakpointCreateByName("g", "a.out")
+self.assertTrue(main_bp, VALID_BREAKPOINT)
+
+y_bp = self.set_breakpoint('b.c', line_number('b.c', '// line 4'))
+x_bp = self.set_breakpoint('b.c', line_number('b.c', '// line 5'))
+self.assertTrue(y_bp, VALID_BREAKPOINT)
+self.assertTrue(x_bp, VALID_BREAKPOINT)
+
+
+self.process = self.target.LaunchSimple(
+None, None, self.get_process_working_directory())
+self.assertTrue(self.process, PROCESS_IS_VALID)
+
+# The stop reason of the thread should be breakpoint.
+self.assertTrue(self.process.GetState() == lldb.eStateStopped,
+STOPPED_DUE_TO_BREAKPOINT)
+
+frame = self.process.GetThreadAtIndex(0).GetFrameAtIndex(0)
+x = frame.FindVariable("x")
+self.assertTrue(x.IsValid(), "x is not valid")
+y = frame.FindVariable("y")
+self.assertTrue(y.IsValid(), "y is not valid")
+
+xDecl = x.GetDeclaration()
+yDecl = y.GetDeclaration()
+
+self.assertTrue(5 == xDecl.GetLine(), "x is not at expected line (5).")
+self.assertTrue(4 == yDecl.GetLine(), "x is not at expected line (4).")
+
+def set_breakpoint(self, filename, line):
+return lldbutil.run_break_set_by_file_and_line(self, filename, line, num_expected_locations=1, loc_exact=True)
+
+
diff --git a/packages/Python/lldbsuite/test/linux/split-dwo-basics/a.c b/packages/Python/lldbsuite/test/linux/split-dwo-basics/a.c
new file mode 100644
index 0..047e78a9b
--- /dev/null
+++ b/packages/Python/lldbsuite/test/linux/split-dwo-basics/a.c
@@ -0,0 +1,3 @@
+int f() {
+ return 1;
+}
diff --git a/packages/Python/lldbsuite/test/linux/split-dwo-basics/b.c b/packages/Python/lldbsuite/test/linux/split-dwo-basics/b.c
new file mode 100644
index 0..719c3d1e4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/linux/split-dwo-basics/b.c
@@ -0,0 +1,11 @@
+extern int f();
+
+void g() {
+ int y = 14; // line 4
+ int x = f(); // line 5
+}
+
+int main() {
+ g();
+ return 0;
+}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits