[Lldb-commits] [lldb] [lldb] Strip metadata bits on function pointer in IndirectCallEdge::GetCallee (PR #196204)
Alex Langford via lldb-commits
lldb-commits at lists.llvm.org
Thu May 7 11:00:01 PDT 2026
https://github.com/bulbazord updated https://github.com/llvm/llvm-project/pull/196204
>From e94bfb296fab7675db572cf5824344c71c870ce5 Mon Sep 17 00:00:00 2001
From: Alex Langford <alangford at apple.com>
Date: Wed, 6 May 2026 15:51:54 -0700
Subject: [PATCH 1/2] [lldb] Strip metadata bits on function pointer in
IndirectCallEdge::GetCallee
IndirectCallEdge::GetCallee calculates the raw address of a function
pointer and tries to resolve a load address for it. If the function
pointer has metadata bits in it (e.g. a signed pointer in arm64e) then
the resolution will fail.
---
lldb/source/Symbol/Function.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp
index cc8347fd5c510..e3cb42f248e73 100644
--- a/lldb/source/Symbol/Function.cpp
+++ b/lldb/source/Symbol/Function.cpp
@@ -235,6 +235,12 @@ Function *IndirectCallEdge::GetCallee(ModuleList &images,
return nullptr;
}
+ if (auto *process = exe_ctx.GetProcessPtr())
+ raw_addr = process->FixCodeAddress(raw_addr);
+ else
+ LLDB_LOG(log, "IndirectCallEdge: No Process available, unable to call "
+ "FixCodeAddress on function pointer");
+
Address callee_addr;
if (!exe_ctx.GetTargetPtr()->ResolveLoadAddress(raw_addr, callee_addr)) {
LLDB_LOG(log, "IndirectCallEdge: Could not resolve callee's load address");
>From cc85091ac03568b3017b81852be51e04ad32c5b6 Mon Sep 17 00:00:00 2001
From: Alex Langford <nirvashtzero at gmail.com>
Date: Thu, 7 May 2026 10:59:51 -0700
Subject: [PATCH 2/2] Update lldb/source/Symbol/Function.cpp
Co-authored-by: Jonas Devlieghere <jonas at devlieghere.com>
---
lldb/source/Symbol/Function.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp
index e3cb42f248e73..23ec058ae9c82 100644
--- a/lldb/source/Symbol/Function.cpp
+++ b/lldb/source/Symbol/Function.cpp
@@ -235,11 +235,12 @@ Function *IndirectCallEdge::GetCallee(ModuleList &images,
return nullptr;
}
- if (auto *process = exe_ctx.GetProcessPtr())
+ if (auto *process = exe_ctx.GetProcessPtr()) {
raw_addr = process->FixCodeAddress(raw_addr);
- else
+ } else {
LLDB_LOG(log, "IndirectCallEdge: No Process available, unable to call "
"FixCodeAddress on function pointer");
+ }
Address callee_addr;
if (!exe_ctx.GetTargetPtr()->ResolveLoadAddress(raw_addr, callee_addr)) {
More information about the lldb-commits
mailing list