Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LLDB] Support GNU-style compressed debug sections (.zdebug)
Patch by Erik Welander! Differential Revision: https://reviews.llvm.org/D45628 llvm-svn: 332162
- Loading branch information
Showing
4 changed files
with
135 additions
and
135 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
lldb/packages/Python/lldbsuite/test/linux/compressed-debug-info/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
46 changes: 46 additions & 0 deletions
46
lldb/packages/Python/lldbsuite/test/linux/compressed-debug-info/TestCompressedDebugInfo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") |
4 changes: 4 additions & 0 deletions
4
lldb/packages/Python/lldbsuite/test/linux/compressed-debug-info/a.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
int main() { | ||
int z = 2; | ||
return z; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters