[Lldb-commits] [PATCH] D42852: Fix upper->lower case for /usr/lib/debug/.build-id/**.debug
Jan Kratochvil via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 2 10:07:59 PST 2018
jankratochvil created this revision.
jankratochvil added reviewers: labath, clayborg.
I have found the lookup by build-id (when lookup by /usr/lib/debug/path/name/exec.debug failed) does not work as LLDB tries the build-id hex string in uppercase but Fedora uses lowercase.
xubuntu-16.10 also uses lowercase during my test:
/usr/lib/debug/.build-id/6c/61f3566329f43d03f812ae7057e9e7391b5ff6.debug
So I do not see when it could work, I haven't found any such regression-looking change in GIT history.
https://reviews.llvm.org/D42852
Files:
packages/Python/lldbsuite/test/linux/buildidcase/Makefile
packages/Python/lldbsuite/test/linux/buildidcase/TargetSymbolsBuildidCase.py
packages/Python/lldbsuite/test/linux/buildidcase/main.c
source/Host/common/Symbols.cpp
Index: source/Host/common/Symbols.cpp
===================================================================
--- source/Host/common/Symbols.cpp
+++ source/Host/common/Symbols.cpp
@@ -245,6 +245,8 @@
// Some debug files are stored in the .build-id directory like this:
// /usr/lib/debug/.build-id/ff/e7fe727889ad82bb153de2ad065b2189693315.debug
uuid_str = module_uuid.GetAsString("");
+ std::transform(uuid_str.begin(), uuid_str.end(), uuid_str.begin(),
+ ::tolower);
uuid_str.insert(2, 1, '/');
uuid_str = uuid_str + ".debug";
}
Index: packages/Python/lldbsuite/test/linux/buildidcase/main.c
===================================================================
--- /dev/null
+++ packages/Python/lldbsuite/test/linux/buildidcase/main.c
@@ -0,0 +1,3 @@
+int main() {
+ return 0;
+}
Index: packages/Python/lldbsuite/test/linux/buildidcase/TargetSymbolsBuildidCase.py
===================================================================
--- /dev/null
+++ packages/Python/lldbsuite/test/linux/buildidcase/TargetSymbolsBuildidCase.py
@@ -0,0 +1,42 @@
+""" Testing separate debug info loading by its .build-id. """
+import os
+import time
+import lldb
+import sys
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TargetSymbolsBuildidCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ TestBase.setUp(self)
+ self.source = 'main.c'
+
+ @no_debug_info_test # Prevent the genaration of the dwarf version of this test
+ @skipUnlessPlatform(['linux'])
+ def test_target_buildid_case(self):
+ self.build(clean=True)
+ exe = self.getBuildArtifact("stripped.out")
+
+ self.target = self.dbg.CreateTarget(exe)
+ self.assertTrue(self.target, VALID_TARGET)
+
+ main_bp = self.target.BreakpointCreateByName("main", "stripped.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)
+
+ exe_module = self.target.GetModuleAtIndex(0)
+
+ # Check that symbols are now loaded and main.c is in the output.
+ self.expect("frame select", substrs=['main.c'])
Index: packages/Python/lldbsuite/test/linux/buildidcase/Makefile
===================================================================
--- /dev/null
+++ packages/Python/lldbsuite/test/linux/buildidcase/Makefile
@@ -0,0 +1,20 @@
+LEVEL = ../../make
+CXX_SOURCES := main.cpp
+LD_EXTRAS += -Wl,--build-id=sha1
+
+localall: stripped.out .build-id
+
+.PHONY: .build-id
+stripped.out .build-id: a.out
+ $(OBJCOPY) -j .note.gnu.build-id -O binary $< tmp
+ rm -rf .build-id
+ fn=`od -An -tx1 <tmp|tr -d ' \n'|sed -e 's/^.\{32\}//' -e 's#^..#.build-id/&/#' -e 's#$$#.debug#'` && \
+ mkdir -p `dirname $$fn` && \
+ $(OBJCOPY) --only-keep-debug $< $$fn && \
+ $(OBJCOPY) --strip-all --add-gnu-debuglink=$$fn $< stripped.out
+ $(RM) tmp
+
+clean::
+ $(RM) -r stripped.out .build-id
+
+include $(LEVEL)/Makefile.rules
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42852.132618.patch
Type: text/x-patch
Size: 3345 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180202/896d721e/attachment.bin>
More information about the lldb-commits
mailing list