summaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/linux
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-07-28 11:09:23 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-07-28 11:09:23 +0000
commitf73363f1dd94996356cefbf24388f561891acf0b (patch)
treee3c31248bdb36eaec5fd833490d4278162dba2a0 /packages/Python/lldbsuite/test/linux
parent160ee69dd7ae18978f4068116777639ea98dc951 (diff)
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/linux')
-rw-r--r--packages/Python/lldbsuite/test/linux/add-symbols/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py7
-rw-r--r--packages/Python/lldbsuite/test/linux/builtin_trap/TestBuiltinTrap.py2
-rw-r--r--packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile10
-rw-r--r--packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py46
-rw-r--r--packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c3
-rw-r--r--packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c11
-rw-r--r--packages/Python/lldbsuite/test/linux/sepdebugsymlink/Makefile20
-rw-r--r--packages/Python/lldbsuite/test/linux/sepdebugsymlink/TestTargetSymbolsSepDebugSymlink.py23
-rw-r--r--packages/Python/lldbsuite/test/linux/sepdebugsymlink/main.c3
-rw-r--r--packages/Python/lldbsuite/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py2
11 files changed, 127 insertions, 9 deletions
diff --git a/packages/Python/lldbsuite/test/linux/add-symbols/Makefile b/packages/Python/lldbsuite/test/linux/add-symbols/Makefile
index c701797f0a7d..71a5c11a83d1 100644
--- a/packages/Python/lldbsuite/test/linux/add-symbols/Makefile
+++ b/packages/Python/lldbsuite/test/linux/add-symbols/Makefile
@@ -2,11 +2,12 @@ LEVEL = ../../make
CXX_SOURCES := main.cpp
LD_EXTRAS += -Wl,--build-id=none
-localall : stripped.out all
+all: stripped.out
+
stripped.out : a.out
- $(OBJCOPY) --remove-section=.note.gnu.build-id --remove-section=.gnu_debuglink --strip-debug a.out stripped.out
+ $(OBJCOPY) --remove-section=.note.gnu.build-id --remove-section=.gnu_debuglink --strip-debug $< $@
clean::
- $(RM) stripped.out
+ $(RM) stripped.out
-include $(LEVEL)/Makefile.rules \ No newline at end of file
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py b/packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py
index 477ddf9c15b1..946c151bb8fa 100644
--- a/packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py
+++ b/packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py
@@ -22,8 +22,8 @@ class TargetSymbolsAddCommand(TestBase):
"""Test that 'target symbols add' can load the symbols
even if gnu.build-id and gnu_debuglink are not present in the module.
Similar to test_add_dsym_mid_execution test for macos."""
- self.build(clean=True)
- exe = os.path.join(os.getcwd(), "stripped.out")
+ self.build()
+ exe = self.getBuildArtifact("stripped.out")
self.target = self.dbg.CreateTarget(exe)
self.assertTrue(self.target, VALID_TARGET)
@@ -46,7 +46,8 @@ class TargetSymbolsAddCommand(TestBase):
self.expect("frame select", substrs=['main.c'], matching=False)
# Tell LLDB that a.out has symbols for stripped.out
- self.runCmd("target symbols add -s stripped.out a.out")
+ self.runCmd("target symbols add -s %s %s" %
+ (exe, self.getBuildArtifact("a.out")))
# Check that symbols are now loaded and main.c is in the output.
self.expect("frame select", substrs=['main.c'])
diff --git a/packages/Python/lldbsuite/test/linux/builtin_trap/TestBuiltinTrap.py b/packages/Python/lldbsuite/test/linux/builtin_trap/TestBuiltinTrap.py
index f24cae9ee0d9..7ffc29fd4981 100644
--- a/packages/Python/lldbsuite/test/linux/builtin_trap/TestBuiltinTrap.py
+++ b/packages/Python/lldbsuite/test/linux/builtin_trap/TestBuiltinTrap.py
@@ -30,7 +30,7 @@ class BuiltinTrapTestCase(TestBase):
def test_with_run_command(self):
"""Test that LLDB handles a function with __builtin_trap correctly."""
self.build()
- self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+ self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
lldbutil.run_break_set_by_file_and_line(self, "main.cpp", self.line,
num_expected_locations=1,
diff --git a/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile b/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile
new file mode 100644
index 000000000000..7cfad32f8272
--- /dev/null
+++ b/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile
@@ -0,0 +1,10 @@
+LEVEL := ../../make
+
+C_SOURCES := a.c b.c
+a.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/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py b/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py
new file mode 100644
index 000000000000..db91c39c3983
--- /dev/null
+++ b/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/TestMixedDwarfBinary.py
@@ -0,0 +1,46 @@
+""" Testing debugging of a binary with "mixed" dwarf (with/without fission). """
+import os
+import lldb
+import sys
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestMixedDwarfBinary(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_mixed_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)
+
+ 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")
+
diff --git a/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c b/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c
new file mode 100644
index 000000000000..047e78a9b295
--- /dev/null
+++ b/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/a.c
@@ -0,0 +1,3 @@
+int f() {
+ return 1;
+}
diff --git a/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c b/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c
new file mode 100644
index 000000000000..d79970e13d49
--- /dev/null
+++ b/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/b.c
@@ -0,0 +1,11 @@
+extern int f();
+
+void g() {
+ int y = 14;
+ int x = f();
+}
+
+int main() {
+ g();
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/linux/sepdebugsymlink/Makefile b/packages/Python/lldbsuite/test/linux/sepdebugsymlink/Makefile
new file mode 100644
index 000000000000..3fd14a74bf36
--- /dev/null
+++ b/packages/Python/lldbsuite/test/linux/sepdebugsymlink/Makefile
@@ -0,0 +1,20 @@
+LEVEL = ../../make
+C_SOURCES := main.c
+
+all: dirsymlink
+
+dirreal: a.out
+ $(RM) -r $@
+ mkdir $@
+ $(OBJCOPY) --only-keep-debug $< $@/stripped.debug
+ $(OBJCOPY) --strip-all --add-gnu-debuglink=$@/stripped.debug $< $@/stripped.out
+
+dirsymlink: dirreal
+ $(RM) -r $@
+ mkdir $@
+ ln -s ../$</stripped.out $@/stripped.symlink
+
+clean::
+ $(RM) -r dirreal dirsymlink
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/linux/sepdebugsymlink/TestTargetSymbolsSepDebugSymlink.py b/packages/Python/lldbsuite/test/linux/sepdebugsymlink/TestTargetSymbolsSepDebugSymlink.py
new file mode 100644
index 000000000000..12506811c5e2
--- /dev/null
+++ b/packages/Python/lldbsuite/test/linux/sepdebugsymlink/TestTargetSymbolsSepDebugSymlink.py
@@ -0,0 +1,23 @@
+""" Testing separate debug info loading for base binary with a symlink. """
+import os
+import time
+import lldb
+import sys
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestTargetSymbolsSepDebugSymlink(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @no_debug_info_test # Prevent the genaration of the dwarf version of this test
+ @skipUnlessPlatform(['linux'])
+ @skipIf(hostoslist=["windows"])
+ @skipIfRemote # llvm.org/pr36237
+ def test_target_symbols_sepdebug_symlink_case(self):
+ self.build()
+ exe = self.getBuildArtifact("dirsymlink/stripped.symlink")
+
+ lldbutil.run_to_name_breakpoint(self, "main", exe_name = exe)
diff --git a/packages/Python/lldbsuite/test/linux/sepdebugsymlink/main.c b/packages/Python/lldbsuite/test/linux/sepdebugsymlink/main.c
new file mode 100644
index 000000000000..4cce7f667ff7
--- /dev/null
+++ b/packages/Python/lldbsuite/test/linux/sepdebugsymlink/main.c
@@ -0,0 +1,3 @@
+int main() {
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py b/packages/Python/lldbsuite/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
index 068594701507..702d124834b2 100644
--- a/packages/Python/lldbsuite/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
+++ b/packages/Python/lldbsuite/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
@@ -26,7 +26,7 @@ class CreateDuringInstructionStepTestCase(TestBase):
bugnumber="llvm.org/pr24737")
def test_step_inst(self):
self.build(dictionary=self.getBuildFlags())
- exe = os.path.join(os.getcwd(), "a.out")
+ exe = self.getBuildArtifact("a.out")
target = self.dbg.CreateTarget(exe)
self.assertTrue(target and target.IsValid(), "Target is valid")