diff options
author | Vincent Belliard <81770341+v-bulle@users.noreply.github.com> | 2024-05-07 05:42:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-07 13:42:16 +0100 |
commit | b22a6f1eba8e27b2a21bf6b96a3bd349230cb80a (patch) | |
tree | 3b512971e64cd383a6347d9b85ea8cc83bab3df3 /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | |
parent | 6f2997cefc1e32c11a891ede2e3a2d73310e6ce1 (diff) | |
download | llvm-b22a6f1eba8e27b2a21bf6b96a3bd349230cb80a.zip llvm-b22a6f1eba8e27b2a21bf6b96a3bd349230cb80a.tar.gz llvm-b22a6f1eba8e27b2a21bf6b96a3bd349230cb80a.tar.bz2 |
[lldb] fix step in AArch64 trampoline (#90783)
Detects AArch64 trampolines in order to be able to step in a function
through a trampoline on AArch64.
---------
Co-authored-by: Vincent Belliard <v-bulle@github.com>
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 16f6d2e..1646ee9 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -2356,13 +2356,30 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, bool symbol_size_valid = symbol.st_size != 0 || symbol.getType() != STT_FUNC; + bool is_trampoline = false; + if (arch.IsValid() && (arch.GetMachine() == llvm::Triple::aarch64)) { + // On AArch64, trampolines are registered as code. + // If we detect a trampoline (which starts with __AArch64ADRPThunk_ or + // __AArch64AbsLongThunk_) we register the symbol as a trampoline. This + // way we will be able to detect the trampoline when we step in a function + // and step through the trampoline. + if (symbol_type == eSymbolTypeCode) { + llvm::StringRef trampoline_name = mangled.GetName().GetStringRef(); + if (trampoline_name.starts_with("__AArch64ADRPThunk_") || + trampoline_name.starts_with("__AArch64AbsLongThunk_")) { + symbol_type = eSymbolTypeTrampoline; + is_trampoline = true; + } + } + } + Symbol dc_symbol( i + start_id, // ID is the original symbol table index. mangled, symbol_type, // Type of this symbol is_global, // Is this globally visible? false, // Is this symbol debug info? - false, // Is this symbol a trampoline? + is_trampoline, // Is this symbol a trampoline? false, // Is this symbol artificial? AddressRange(symbol_section_sp, // Section in which this symbol is // defined or null. |