News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Cleaner Macro Expanded Labels

Started by maxirdax, May 25, 2025, 07:46:30 PM

Previous topic - Next topic

maxirdax

Hello, I have been programming with masm64 and I ran into a problem with some code where I successfully made a macro to process some data and reused it successfully but when I view the disassembly to step through the expanded macro the labels are mangeled and hard to read (using local labels in macro).
Is there a way I can force masm to keep my label names as designated in the original macro in the disassembly? even the /EP preprocessing result is mangled.

maxirdax

I like working with macros but its nice to still be able to debug them. What is the clean workflow?

sinsi

If you mean that local vars in a macro show as e.g. ??0001 then the only way to see the actual var name is not declaring them local. This, of course, can cause more problems if the type changes.

maxirdax

cool, I'm not necessarily talking about var names, mainly labels, they do get translated to ??0166 in the disassembly.
I don't know if making a custom preprocessor that emits clean asm files with already expanded macros is the way to go this way I'll be able to step thru the code cleanly in the debugger

maxirdax


SSS: macro(i) {
  mov rax, <i>
  label_<i>:
  jmp label_<i>
}
for(i: count) {
  SSS(i)
}
; output
mov rax, 0
label_0:
jmp label_0

mov rax, 1
label_1:
jmp label_1

mov rax, 2
label_2:
jmp label_2

it'll just export an asm file which i can simply include and the debugger will show everything cleanly. overkill?

maxirdax

i can just include asmgen.asm and the debugger will gladly oblige me  :biggrin: