[Lldb-commits] [PATCH] D127999: [lldb] fix stepping through POSIX trampolines

Michael Daniels via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 16 15:50:27 PDT 2022


mdaniels updated this revision to Diff 437741.
mdaniels added a comment.

Added a simple test case that reproduces the issue.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127999/new/

https://reviews.llvm.org/D127999

Files:
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  lldb/test/API/lang/cpp/step-into-namespace/Makefile
  lldb/test/API/lang/cpp/step-into-namespace/TestStepIntoNamespace.py
  lldb/test/API/lang/cpp/step-into-namespace/foo.cpp
  lldb/test/API/lang/cpp/step-into-namespace/foo.h
  lldb/test/API/lang/cpp/step-into-namespace/main.cpp


Index: lldb/test/API/lang/cpp/step-into-namespace/main.cpp
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/step-into-namespace/main.cpp
@@ -0,0 +1,6 @@
+#include "foo.h"
+
+int main(void) {
+    foo::foo(); // Set a breakpoint here
+}
+
Index: lldb/test/API/lang/cpp/step-into-namespace/foo.h
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/step-into-namespace/foo.h
@@ -0,0 +1,4 @@
+namespace foo {
+    extern void foo();
+}
+
Index: lldb/test/API/lang/cpp/step-into-namespace/foo.cpp
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/step-into-namespace/foo.cpp
@@ -0,0 +1,4 @@
+#include "foo.h"
+
+void foo::foo() { } // End up here
+
Index: lldb/test/API/lang/cpp/step-into-namespace/TestStepIntoNamespace.py
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/step-into-namespace/TestStepIntoNamespace.py
@@ -0,0 +1,17 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+class StepIntoNamespace(TestBase):
+    mydir = TestBase.compute_mydir(__file__)
+
+    def test(self):
+        self.build()
+        (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
+                                   "// Set a breakpoint here",
+                                   lldb.SBFileSpec("main.cpp"),
+                                   extra_images=["foo"])
+        thread.StepInto()
+
+        foo_line = line_number("foo.cpp", '// End up here')
+        self.expect("frame info", substrs=["foo.cpp:{}:".format(foo_line)])
Index: lldb/test/API/lang/cpp/step-into-namespace/Makefile
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/step-into-namespace/Makefile
@@ -0,0 +1,6 @@
+DYLIB_NAME := foo
+DYLIB_CXX_SOURCES := foo.cpp
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
+
Index: lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
===================================================================
--- lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -488,7 +488,7 @@
   if (sym == nullptr || !sym->IsTrampoline())
     return thread_plan_sp;
 
-  ConstString sym_name = sym->GetName();
+  ConstString sym_name = sym->GetMangled().GetName(Mangled::ePreferMangled);
   if (!sym_name)
     return thread_plan_sp;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127999.437741.patch
Type: text/x-patch
Size: 2607 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220616/ba6c3312/attachment.bin>


More information about the lldb-commits mailing list