RFC: Annotate immediates in x86 disassembly

Nick Clifton nickc@redhat.com
Thu Apr 23 09:13:45 GMT 2026


Hi Michael,

>>        400419:	bf 18 30 40 00       	mov    $0x403018 [func1],%edi

> I think it's helpful, but may I use the bike-shed opportunity here?

Of course...

> I
> would prefer if the disassembler output (even with the option, but with
> --no-addresses --show-raw-insn) would be roughly copy-n-pastable to the
> assembler.  That would mean putting any annotations (and there may be more
> in the future?) after a comment-introducer.  Like:
> 
>    400419: bf 18 30 40 00          mov    $0x403018,%edi   # [func1]

Ah - yes I did think about this.  But as far as I can see the current code
in i386-dis.c does not have any way to queue up comments to be displayed at
the end of the line.  So that would mean either adding the framework to do
so, or adding yet another walk over all of the operands, once the disassembly
proper has been displayed.  Since the feature is gated by the -Mannotate option
it seemed to me that doing either of these things would needlessly complicate
the code.

But ... I agree that it would be nice, and if, as you suggest, there might be
more annotations to come in the future then it would make sense to code the
framework for them now.  Let me have a little investigation...

Cheers
   Nick



More information about the Binutils mailing list