[Lldb-commits] [lldb] r324222 - Fix upper->lower case for /usr/lib/debug/.build-id/**.debug
Jan Kratochvil via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 5 02:46:56 PST 2018
Author: jankratochvil
Date: Mon Feb 5 02:46:56 2018
New Revision: 324222
URL: http://llvm.org/viewvc/llvm-project?rev=324222&view=rev
Log:
Fix upper->lower case for /usr/lib/debug/.build-id/**.debug
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
Differential revision: https://reviews.llvm.org/D42852
Added:
lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/
lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile
lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py
lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c
Modified:
lldb/trunk/source/Host/common/Symbols.cpp
Added: lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile?rev=324222&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile Mon Feb 5 02:46:56 2018
@@ -0,0 +1,20 @@
+LEVEL = ../../make
+C_SOURCES := main.c
+LD_EXTRAS += -Wl,--build-id=sha1
+
+all: stripped.out
+
+.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
Added: lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py?rev=324222&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py Mon Feb 5 02:46:56 2018
@@ -0,0 +1,21 @@
+""" 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 TestTargetSymbolsBuildidCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @no_debug_info_test # Prevent the genaration of the dwarf version of this test
+ @skipUnlessPlatform(['linux'])
+ def test_target_symbols_buildid_case(self):
+ self.build(clean=True)
+ exe = self.getBuildArtifact("stripped.out")
+
+ lldbutil.run_to_name_breakpoint(self, "main", exe_name = exe)
Added: lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c?rev=324222&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c Mon Feb 5 02:46:56 2018
@@ -0,0 +1,3 @@
+int main() {
+ return 0;
+}
Modified: lldb/trunk/source/Host/common/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Symbols.cpp?rev=324222&r1=324221&r2=324222&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Symbols.cpp (original)
+++ lldb/trunk/source/Host/common/Symbols.cpp Mon Feb 5 02:46:56 2018
@@ -245,6 +245,8 @@ FileSpec Symbols::LocateExecutableSymbol
// 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";
}
More information about the lldb-commits
mailing list