[lldb] [llvm] Annotate disassembly with register‐resident variable locations (PR #147460)
Abdullah Mohammad Amin via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 20 12:42:00 PDT 2025
================
@@ -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)) {
+ VariableListSP var_list_sp = frame->GetInScopeVariableList(true);
+ SymbolContext sc = frame->GetSymbolContext(eSymbolContextFunction);
+ addr_t func_load_addr = LLDB_INVALID_ADDRESS;
+ if (sc.function)
+ func_load_addr = sc.function->GetAddress().GetLoadAddress(target_sp.get());
+
+
+ if(ss.GetSizeOfLastLine() < annotation_column) {
----------------
UltimateForce21 wrote:
Yes, exactly. I have now added the comment in commit: [6e17f77c4300654c7664b52efc045983bb59721d](https://github.com/llvm/llvm-project/pull/147460/commits/6e17f77c4300654c7664b52efc045983bb59721d)
https://github.com/llvm/llvm-project/pull/147460
More information about the llvm-commits
mailing list