[Lldb-commits] [lldb] [lldb] Call FixUpPointer in WritePointerToMemory (try 2) (PR #153585)
Felipe de Azevedo Piovezan via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 2 09:47:02 PDT 2025
felipepiovezan wrote:
Your guess is right. Enabling `log enable lldb expr`, we can see the IR generated for `expr get_high_bits(&myglobal_json)`
```
@"_ZGVZ12$__lldb_exprPvE19$__lldb_expr_result" = internal global i8 0, align 1
; Function Attrs: convergent noinline nounwind optnone
define void @"_Z12$__lldb_exprPv"(ptr %"$__lldb_arg") #0 {
entry:
%0 = getelementptr i8, ptr %"$__lldb_arg", i32 8
%1 = getelementptr i8, ptr %"$__lldb_arg", i32 0
%2 = load ptr, ptr %1, align 8
%"$__lldb_arg.addr" = alloca ptr, align 8, !clang.decl.ptr !8
store ptr %"$__lldb_arg", ptr %"$__lldb_arg.addr", align 8
%guard.uninitialized = icmp eq i8 0, 0
br i1 %guard.uninitialized, label %init.check, label %init.end, !prof !9
init.check: ; preds = %entry
%3 = load ptr, ptr %0, align 8, !nonnull !10, !align !11
%call = call i64 @get_high_bits(ptr %3) #2
store i64 %call, ptr %2, align 8
br label %init.end
init.end: ; preds = %init.check, %entry
ret void
}
```
`%"$__lldb_arg` is the memory region allocated by `IRMemoryMap`.
`%0` is the offset where there address of `myglobal_json`'s address was stored by `WritePointerToMemory` (after going through `FixAddress`). We load `%0` into `%3` and pass the result directly to `get_high_bits`
https://github.com/llvm/llvm-project/pull/153585
More information about the lldb-commits
mailing list