[Lldb-commits] [lldb] d8ad018 - [lldb] fix stepping through POSIX trampolines
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 29 02:07:08 PDT 2022
Author: Michael Daniels
Date: 2022-06-29T11:06:29+02:00
New Revision: d8ad018869aeb1ffe40e94ee4d6d377121581083
URL: https://github.com/llvm/llvm-project/commit/d8ad018869aeb1ffe40e94ee4d6d377121581083
DIFF: https://github.com/llvm/llvm-project/commit/d8ad018869aeb1ffe40e94ee4d6d377121581083.diff
LOG: [lldb] fix stepping through POSIX trampolines
The DynamicLoaderPOSIXDYLD::GetStepThroughTrampolinePlan() function was
doing the symbol lookup using the demangled name. This stopped working
with https://reviews.llvm.org/D118814. To get things working again, just
use the mangled name for the lookup instead.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D127999
Added:
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
Modified:
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index b3360dbf6158a..64bc5323fc4e6 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -488,7 +488,7 @@ DynamicLoaderPOSIXDYLD::GetStepThroughTrampolinePlan(Thread &thread,
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;
diff --git a/lldb/test/API/lang/cpp/step-through-trampoline/Makefile b/lldb/test/API/lang/cpp/step-through-trampoline/Makefile
new file mode 100644
index 0000000000000..624021fbe98d6
--- /dev/null
+++ b/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
+
diff --git a/lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py b/lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
new file mode 100644
index 0000000000000..b6384c73306ab
--- /dev/null
+++ b/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)])
diff --git a/lldb/test/API/lang/cpp/step-through-trampoline/foo.cpp b/lldb/test/API/lang/cpp/step-through-trampoline/foo.cpp
new file mode 100644
index 0000000000000..8faa4b65c8068
--- /dev/null
+++ b/lldb/test/API/lang/cpp/step-through-trampoline/foo.cpp
@@ -0,0 +1,4 @@
+#include "foo.h"
+
+void foo() { } // End up here
+
diff --git a/lldb/test/API/lang/cpp/step-through-trampoline/foo.h b/lldb/test/API/lang/cpp/step-through-trampoline/foo.h
new file mode 100644
index 0000000000000..edfeae5a215f3
--- /dev/null
+++ b/lldb/test/API/lang/cpp/step-through-trampoline/foo.h
@@ -0,0 +1,2 @@
+extern void foo();
+
diff --git a/lldb/test/API/lang/cpp/step-through-trampoline/main.cpp b/lldb/test/API/lang/cpp/step-through-trampoline/main.cpp
new file mode 100644
index 0000000000000..3896e71f860a9
--- /dev/null
+++ b/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
+}
+
More information about the lldb-commits
mailing list