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

Michael Daniels via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 20 05:25:21 PDT 2022


mdaniels updated this revision to Diff 438347.

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-through-trampoline/Makefile
  lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
  lldb/test/API/lang/cpp/step-through-trampoline/foo.cpp
  lldb/test/API/lang/cpp/step-through-trampoline/foo.h
  lldb/test/API/lang/cpp/step-through-trampoline/main.cpp


Index: lldb/test/API/lang/cpp/step-through-trampoline/main.cpp
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/step-through-trampoline/main.cpp
@@ -0,0 +1,6 @@
+#include "foo.h"
+
+int main(void) {
+    foo(); // Set a breakpoint here
+}
+
Index: lldb/test/API/lang/cpp/step-through-trampoline/foo.h
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/step-through-trampoline/foo.h
@@ -0,0 +1,2 @@
+extern void foo();
+
Index: lldb/test/API/lang/cpp/step-through-trampoline/foo.cpp
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/step-through-trampoline/foo.cpp
@@ -0,0 +1,4 @@
+#include "foo.h"
+
+void foo() { } // End up here
+
Index: lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
@@ -0,0 +1,17 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+class StepThroughTrampoline(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-through-trampoline/Makefile
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/step-through-trampoline/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.438347.patch
Type: text/x-patch
Size: 2625 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220620/e81ce708/attachment-0001.bin>


More information about the lldb-commits mailing list