================ @@ -702,6 +705,78 @@ void Instruction::Dump(lldb_private::Stream *s, uint32_t max_opcode_byte_size, ss.FillLastLineToColumn(opcode_pos + opcode_column_width, ' '); ss.PutCString(mnemonics); + const size_t annotation_column = 150; + + if (exe_ctx && exe_ctx->GetFramePtr()) { + StackFrame *frame = exe_ctx->GetFramePtr(); + TargetSP target_sp = exe_ctx->GetTargetSP(); + if (frame && target_sp) { + addr_t current_pc = m_address.GetLoadAddress(target_sp.get()); + addr_t original_pc = frame->GetFrameCodeAddress().GetLoadAddress(target_sp.get()); + if (frame->ChangePC(current_pc)) { ---------------- UltimateForce21 wrote:
`m_address` here refers to the address of the current instruction being dumped in the disassembler output. Since `Instruction::Dump` is called per-instruction, `m_address` gives us the load address of the instruction currently being printed. I used `frame->ChangePC(current_pc)` to temporarily update the frame's PC to this instruction address. This is necessary because `GetInScopeVariableList(true)` relies on the frame's current PC to determine which variables are in scope and what their locations are at that exact address. Without setting the PC to the instruction being dumped, the variable list might reflect a different point in the function, which could lead to incorrect or missing annotations. That said, I make sure to save the original PC with `frame->GetFrameCodeAddress()` and restore it afterward with `frame->ChangePC(original_pc)` to avoid any persistent side effects on the frame state. If there’s a better way to get the in-scope variables for a given address without mutating the frame, I’m happy to revise the approach. https://github.com/llvm/llvm-project/pull/147460 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits