Skip to content

Commit 09c4d04

Browse files
Add high-level comment explaining rich disassembly annotation logic in Instruction::Dump
1 parent 912ba6d commit 09c4d04

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lldb/source/Core/Disassembler.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,22 @@ void Instruction::Dump(lldb_private::Stream *s, uint32_t max_opcode_byte_size,
705705
ss.FillLastLineToColumn(opcode_pos + opcode_column_width, ' ');
706706
ss.PutCString(mnemonics);
707707

708+
// Add rich variable location annotations to the disassembly output.
709+
//
710+
// For each instruction, this block attempts to resolve in-scope variables
711+
// and determine if the current PC falls within their
712+
// DWARF location entry. If so, it prints a simplified annotation using the
713+
// variable name and its resolved location (e.g., "var = reg; " ).
714+
//
715+
// Annotations are only included if the variable has a valid DWARF location
716+
// entry, and the location string is non-empty after filtering. Decoding
717+
// errors and DWARF opcodes are intentionally omitted to keep the output
718+
// concise and user-friendly.
719+
//
720+
// The goal is to give users helpful live variable hints alongside the
721+
// disassembled instruction stream, similar to how debug information
722+
// enhances source-level debugging.
723+
708724
const size_t annotation_column = 150;
709725

710726
if (exe_ctx && exe_ctx->GetFramePtr()) {

0 commit comments

Comments
 (0)