UltimateForce21 wrote:

> As high-level comments:
> 
> * I would filter out the entry values, since this feature is meant to help a 
> user understand the disassembly, and the entry values don't really exist in 
> the function.
> * It would help readability if all annotations started at the same column
> * in a follow-up patch it would be great to outline the valid range of each 
> expression
> * is it possible to hide the DW_OP... part and just show the human-readable 
> register name?
> * `DW_OP_consts +0, DW_OP_stack_value` -> I would filter out anything that 
> isn't a pure register. Then we can later recognize certain kinds of 
> expression, for example, this is a constant, so it should just print `= 0`

Thank you for the thoughtful feedback! Here's a breakdown of what has been 
addressed so far and what I’m currently working on:

1. DW_OP_ suppression and human-readable register names
The most recent commit 
https://github.com/llvm/llvm-project/pull/147460/commits/912ba6d5a7a00c9111aae12a89ef84ccf0de00b4
 introduces a new `PrintRegisterOnly `flag in `DIDumpOptions`, along with a 
`DumpLocationWithOptions()` API. This allows us to display clean, 
architecture-specific register names (e.g. `RDI`) without the `DW_OP_` prefix 
or LLVM-internal formatting.

- It also suppresses `<decoding error>` messages when `PrintRegisterOnly `is 
enabled, helping keep output clean for disassembly annotations.


2. Column alignment for annotations
I attempted to align annotations to a fixed column, and this works well in 
non-colored output. However, with color enabled, the byte-length of character 
sequences skews alignment. I'm investigating this, and suspect that the issue 
stems from the color codes affecting character counting without accounting for 
their visual width.

3. Variable invalidation (end of live range)
I'm currently working on modifying `Disassembler::PrintInstructions()` to allow 
tracking of variable live ranges across instructions. The goal is to emit 
annotations like `var = <invalid>` at the exact PC where a variable’s location 
range ends—while ensuring this is printed only once per variable.

4. `DW_OP_consts `filtering
I’ll follow up with a commit to recognize and handle `DW_OP_consts `and similar 
constant expressions more gracefully (e.g. print `var = 0`), while continuing 
to filter out more complex or mixed expressions for now, as suggested.

Thanks again—will continue to iterate on this based on your guidance and on all 
the other comments you have made!

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

Reply via email to