[Lldb-commits] [PATCH] D42852: Fix upper->lower case for /usr/lib/debug/.build-id/**.debug

2018-02-05 Thread Jan Kratochvil via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL324222: Fix upper->lower case for 
/usr/lib/debug/.build-id/**.debug (authored by jankratochvil, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D42852?vs=132668&id=132797#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42852

Files:
  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
  lldb/trunk/source/Host/common/Symbols.cpp


Index: lldb/trunk/source/Host/common/Symbols.cpp
===
--- lldb/trunk/source/Host/common/Symbols.cpp
+++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c
===
--- lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c
+++ lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c
@@ -0,0 +1,3 @@
+int main() {
+  return 0;
+}
Index: 
lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py
@@ -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)
Index: lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile
===
--- lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile
@@ -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 Index: lldb/trunk/source/Host/common/Symbols.cpp
===
--- lldb/trunk/source/Host/common/Symbols.cpp
+++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c
===
--- lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c
+++ lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c
@@ -0,0 +1,3 @@
+int main() {
+  return 0;
+}
Index: lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py
+++ lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py
@@ -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'])
+

[Lldb-commits] [PATCH] D42852: Fix upper->lower case for /usr/lib/debug/.build-id/**.debug

2018-02-02 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 132668.
jankratochvil added a comment.

Simplify the testcase using: lldbutil.run_to_name_breakpoint


https://reviews.llvm.org/D42852

Files:
  packages/Python/lldbsuite/test/linux/buildidcase/Makefile
  
packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.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/TestTargetSymbolsBuildidCase.py
===
--- /dev/null
+++ 
packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py
@@ -0,0 +1,25 @@
+""" 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__)
+
+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_symbols_buildid_case(self):
+self.build(clean=True)
+exe = self.getBuildArtifact("stripped.out")
+
+lldbutil.run_to_name_breakpoint(self, "main", exe_name = exe)
Index: packages/Python/lldbsuite/test/linux/buildidcase/Makefile
===
--- /dev/null
+++ packages/Python/lldbsuite/test/linux/buildidcase/Makefile
@@ -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 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/TestTargetSymbolsBuildidCase.py
===
--- /dev/null
+++ packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py
@@ -0,0 +1,25 @@
+""" 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__)
+
+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_symbols_buildid_case(self):
+self.build(clean=True)
+exe = self.getBuildArtifact("stripped.out")
+
+lldbutil.run_to_name_breakpoint(self, "main", exe_name = exe)
Index: packages/Python/lldbsuite/test/linux/buildidcase/Makefile
===
--- /dev/null
+++ packages/Python/lldbsuite/test/linux/buildidcase/Makefile
@@ -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 .n

[Lldb-commits] [PATCH] D42852: Fix upper->lower case for /usr/lib/debug/.build-id/**.debug

2018-02-02 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Many file systems are case insensitive so that is probably why it works on some 
computers.


https://reviews.llvm.org/D42852



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D42852: Fix upper->lower case for /usr/lib/debug/.build-id/**.debug

2018-02-02 Thread Jan Kratochvil via Phabricator via lldb-commits
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 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
+