x86/disasm: Rework comment handling
Refactors x86 disassembler to handle comments in the same order as operands, improving annotation consistency.
This patch refactors the x86 disassembler’s comment handling to align it with operand handling, allowing comments to be emitted in the same order as operands. It aims to provide a more consistent approach to annotation. The author discusses the limitations of unifying %rip-relative comments due to the print_address_func() hook and proposes moving the test suite to a more generic location.
In Details
This patch modifies the x86 disassembly code in opcodes/i386-dis.c to improve comment annotation. It moves away from ad-hoc comment insertion towards a model where comments are handled similarly to operands. The patch also touches the testsuite, specifically the binutils-all/x86-64 directory, to add new tests for the improved comment handling.
For Context
The disassembler is a tool that translates machine code back into human-readable assembly code. This patch focuses on improving how the x86 disassembler annotates the generated assembly with comments, aiming for better readability and consistency. The changes involve refactoring the internal logic of the disassembler to handle comments in a more structured way, similar to how operands are processed.