summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/linux
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2018-05-12 00:29:25 +0000
committerDavide Italiano <davide@freebsd.org>2018-05-12 00:29:25 +0000
commit56ab68f3233d24e07343de937dfb58b4f932072f (patch)
tree1f26cd43a171549cd69250aa5c408d6ed3a7de67 /lldb/packages/Python/lldbsuite/test/linux
parentf616804903d2784b079845d6619c15099eec1dc8 (diff)
downloadbcm5719-llvm-56ab68f3233d24e07343de937dfb58b4f932072f.tar.gz
bcm5719-llvm-56ab68f3233d24e07343de937dfb58b4f932072f.zip
[LLDB] Support GNU-style compressed debug sections (.zdebug)
Patch by Erik Welander! Differential Revision: https://reviews.llvm.org/D45628 llvm-svn: 332162
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/linux')
-rw-r--r--lldb/packages/Python/lldbsuite/test/linux/compressed-debug-info/Makefile16
-rw-r--r--lldb/packages/Python/lldbsuite/test/linux/compressed-debug-info/TestCompressedDebugInfo.py46
-rw-r--r--lldb/packages/Python/lldbsuite/test/linux/compressed-debug-info/a.c4
3 files changed, 66 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/linux/compressed-debug-info/Makefile b/lldb/packages/Python/lldbsuite/test/linux/compressed-debug-info/Makefile
new file mode 100644
index 00000000000..dc7c06fddfe
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/linux/compressed-debug-info/Makefile
@@ -0,0 +1,16 @@
+LEVEL := ../../make
+
+C_SOURCES := a.c
+
+all: compressed.out compressed.gnu.out
+
+compressed.out: a.out
+ $(OBJCOPY) --compress-debug-sections=zlib $< $@
+
+compressed.gnu.out: a.out
+ $(OBJCOPY) --compress-debug-sections=zlib-gnu $< $@
+
+include $(LEVEL)/Makefile.rules
+
+clean::
+ $(RM) -f a.o main compressed.out compressed.gnu.out
diff --git a/lldb/packages/Python/lldbsuite/test/linux/compressed-debug-info/TestCompressedDebugInfo.py b/lldb/packages/Python/lldbsuite/test/linux/compressed-debug-info/TestCompressedDebugInfo.py
new file mode 100644
index 00000000000..f82a2e290a2
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/linux/compressed-debug-info/TestCompressedDebugInfo.py
@@ -0,0 +1,46 @@
+""" Tests that compressed debug info sections are used. """
+import os
+import lldb
+import sys
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCompressedDebugInfo(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
+ @skipUnlessPlatform(["linux"])
+ def test_compressed_debug_info(self):
+ """Tests that the 'frame variable' works with compressed debug info."""
+
+ self.build()
+ process = lldbutil.run_to_source_breakpoint(
+ self, "main", lldb.SBFileSpec("a.c"), exe_name="compressed.out")[1]
+
+ # The process should be stopped at a breakpoint, and the z variable should
+ # be in the top frame.
+ self.assertTrue(process.GetState() == lldb.eStateStopped,
+ STOPPED_DUE_TO_BREAKPOINT)
+ frame = process.GetThreadAtIndex(0).GetFrameAtIndex(0)
+ self.assertTrue(frame.FindVariable("z").IsValid(), "z is not valid")
+
+ @no_debug_info_test # Prevent the genaration of the dwarf version of this test
+ @skipUnlessPlatform(["linux"])
+ def test_compressed_debug_info_gnu(self):
+ """Tests that the 'frame variable' works with gnu-style compressed debug info."""
+
+ self.build()
+ process = lldbutil.run_to_source_breakpoint(
+ self, "main", lldb.SBFileSpec("a.c"), exe_name="compressed.gnu.out")[1]
+
+ # The process should be stopped at a breakpoint, and the z variable should
+ # be in the top frame.
+ self.assertTrue(process.GetState() == lldb.eStateStopped,
+ STOPPED_DUE_TO_BREAKPOINT)
+ frame = process.GetThreadAtIndex(0).GetFrameAtIndex(0)
+ self.assertTrue(frame.FindVariable("z").IsValid(), "z is not valid")
diff --git a/lldb/packages/Python/lldbsuite/test/linux/compressed-debug-info/a.c b/lldb/packages/Python/lldbsuite/test/linux/compressed-debug-info/a.c
new file mode 100644
index 00000000000..9c9dd9f55a9
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/linux/compressed-debug-info/a.c
@@ -0,0 +1,4 @@
+int main() {
+ int z = 2;
+ return z;
+}
OpenPOWER on IntegriCloud