[Nasm-bugs] [Bug 3392679] [Feature request] Macros whose content is listed verbatim (including comments) to listing file

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Mon Jun 8 14:33:45 PDT 2020


--- Comment #3 from C. Masloch <pushbx at ulukai.org> ---
I invented a little dance to work around this issue. To create the listing that
is more useful for debugging, we can wrap an %include directive into the macro,
instead of the code. The included file's listing is full comments plus the
emitted opcodes. Here's a little test I did to check that this is true:

$ cat test.asm
%imacro testhandler 0
; comment in macro
%include "test.tmp"

$ cat test.tmp
; comment in include file
$ nasm test.asm -l /dev/stderr
     1                                  %imacro testhandler 0
     2                                  ; comment in macro
     3                                  %include "test.tmp"
     4                                  %endmacro
     6                                  testhandler
     2                              <1>
     3                              <1> %include "test.tmp"
     1 00000000 90                  <2> nop
     2                              <2> ; comment in include file

For source control purposes the authoritative copy of the code can still be
included in the macro, just disabled if the %include method is used. And then a
to-be-written script can automatically extract the code from the macro
definition point and place it into the temporary include file. Then we can
compare the output binaries to be the same whether the code is directly
included in the macro or indirectly in the include file.

You are receiving this mail because:
You are watching all bug changes.
You are on the CC list for the bug.

More information about the Nasm-bugs mailing list