[Lldb-commits] [lldb] [lldb] fix step in AArch64 trampoline (PR #90783)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu May 2 06:00:14 PDT 2024


================
@@ -506,9 +506,29 @@ DynamicLoaderPOSIXDYLD::GetStepThroughTrampolinePlan(Thread &thread,
   Target &target = thread.GetProcess()->GetTarget();
   const ModuleList &images = target.GetImages();
 
-  images.FindSymbolsWithNameAndType(sym_name, eSymbolTypeCode, target_symbols);
-  if (!target_symbols.GetSize())
-    return thread_plan_sp;
+  llvm::StringRef target_name = sym_name.GetStringRef();
+  // On AArch64, the trampoline name has a prefix (__AArch64ADRPThunk_ or
+  // __AArch64AbsLongThunk_) added to the function name. If we detect a
+  // trampoline with the prefix, we need to remove the prefix to find the
+  // function symbol.
+  if (target_name.consume_front("__AArch64ADRPThunk_")) {
----------------
DavidSpickett wrote:

You could also assign back to `symname` if `target_name` is not empty, then only have one call to `FindSymbolsWithNameAndType` at the end.

```
if ((target_name.consume_front("__AArch64ADRPThunk_") || target_name.consume_front("__AArch64AbsLongThunk_"))) && !target_name.empty())
   sym_name = ConstString(target_name);
images.FindSymbolsWithNameAndType(sym_name...
```

https://github.com/llvm/llvm-project/pull/90783


More information about the lldb-commits mailing list