diff options
| author | Felipe de Azevedo Piovezan <fpiovezan@apple.com> | 2025-08-11 08:27:25 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-11 08:27:25 -0700 |
| commit | 9c8e71644227e2a30403dbfe075f96374ba9739c (patch) | |
| tree | 6d68d12442fd4e5108710a22ba985f1b54f925c3 /lldb/source/Target/StackID.cpp | |
| parent | 26a0962ce297da443ed556fdd547a11fc6a55f0a (diff) | |
[lldb] Make StackID call Fix{Code,Data} pointers (#152796)
In architectures where pointers may contain metadata, such as arm64e, it
is important to ignore those bits when comparing two different StackIDs,
as the metadata may not be the same even if the pointers are.
This patch is a step towards allowing consumers of pointers to decide
whether they want to keep or remove metadata, as opposed to discarding
metadata at the moment pointers are created. See
https://github.com/llvm/llvm-project/pull/150537.
This was tested running the LLDB test suite on arm64e.
Diffstat (limited to 'lldb/source/Target/StackID.cpp')
| -rw-r--r-- | lldb/source/Target/StackID.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lldb/source/Target/StackID.cpp b/lldb/source/Target/StackID.cpp index 410d5b7e820a..b1795970802a 100644 --- a/lldb/source/Target/StackID.cpp +++ b/lldb/source/Target/StackID.cpp @@ -10,10 +10,28 @@ #include "lldb/Symbol/Block.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Target/Process.h" #include "lldb/Utility/Stream.h" using namespace lldb_private; +StackID::StackID(lldb::addr_t pc, lldb::addr_t cfa, + SymbolContextScope *symbol_scope, Process *process) + : m_pc(pc), m_cfa(cfa), m_symbol_scope(symbol_scope) { + if (process) { + m_pc = process->FixCodeAddress(m_pc); + m_cfa = process->FixDataAddress(m_cfa); + } +} + +void StackID::SetPC(lldb::addr_t pc, Process *process) { + m_pc = process ? process->FixCodeAddress(pc) : pc; +} + +void StackID::SetCFA(lldb::addr_t cfa, Process *process) { + m_cfa = process ? process->FixDataAddress(cfa) : cfa; +} + void StackID::Dump(Stream *s) { s->Printf("StackID (pc = 0x%16.16" PRIx64 ", cfa = 0x%16.16" PRIx64 ", symbol_scope = %p", |
