News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Debugging Macros

Started by cman, July 08, 2010, 07:25:31 PM

Previous topic - Next topic

cman

Is there a way to set up the assembler to give error messages pertaining to errors within a macro rather than just reporting that an error occurred on the line that the macro is called? The only way I can think of converting macros to functions to debug and then converting the functions back to macros. Is there a better way to do this? Thanks.

jj2007

If something goes wrong, you get the error line also for the macro:
include \masm32\include\masm32rt.inc

Launch MACRO cmd:REQ, showSW:=<SW_NORMAL>, timeout:=<0>
LOCAL ShowMode
  ShowMode equ <showSW>
  ifidn ShowMode, <SW_HIDE>
ShowMode equ <SW_HIDE or 65536>
  endif
  invoke ShellWait, reparg(cmd), ShowMode, timeout
ENDM

.code
start:
Launch "That won't work"
exit
end start


error A2006:undefined symbol : ShellWait
Launch(6): Macro Called From
  tmp_file.asm(16)

You should also check the usage of echo:

tmp$ CATSTR <Myarg=>, <arg>
% echo tmp$

qWord

creating an listing is also very helpfull: /FlList.txt /Sn
Use .listall / .nolist to control the listings output
FPU in a trice: SmplMath
It's that simple!

cman

OK , thanks guys!  :bg I never noticed that the number after the macro name in the error output referred to the line the error occurred at counting from the top of the macro declaration.  :red Thanks for the tips!

KeepingRealBusy

Quote from: cman on July 08, 2010, 08:47:00 PM
OK , thanks guys!  :bg I never noticed that the number after the macro name in the error output referred to the line the error occurred at counting from the top of the macro declaration.  :red Thanks for the tips!

Caution, I have found that jwasm does not count blank lines or normal comment lines (";") in his source numbering. This causes a lot of grief for huge macros where you think the error is on one line, but in reality, the error is somewhere else.

Dave.

jj2007

Dave, please flag it as a bug to Japheth. Normally he'll fix it soon.

KeepingRealBusy

JJ,

I have already got that set up to log a problem on SourceForge. I did have one problem with SF, trying to create an ID. I read the help screen, no help. I tried to click on the "?", right click the fields, everything. I looked into sending a the site a problem report but, Catch 22! You have to log on first! What can you do when you can't log on or create a logon ID? The problem I encountered was that I finished the create user form, I clicked on submit, and nothing happened. I waited for an Email for 24 hours, nothing. I tried again, nothing. 5 days later, in desperation, I actually tried to log on using the ID and password I was trying to create. Then and only then did I get the message that the ID could only contain lower case letters and numbers and I was trying to use my same ID I have here, KeepingRealBusy. Bah! I was so busy with other things that I have not got back to the problem report.

The problem report is not of high priority, coding errors in macros get flagged with a wrong source file line number (actually macro body line number). I was able to use Echo to find out where I was in the (huge) macro and fixed my problems.

I will get back to this, soon.

Dave.

jj2007

Dave,
My account works fine, so I filed the bug "on your behalf". Hope this is fine for you :thumbu

KeepingRealBusy

jj,

Oh, I finally got logged in (in lowercase), but never got back to sending the report. Thank you for reporting it.

Dave.

jj2007

Dave, it's fixed in V 2.03
Thanks Japheth :U

qWord

Quote from: jj2007 on August 20, 2010, 08:02:56 AM
Thanks Japheth :U
Dem Dank möchte ich mich an dieser Stelle einfach mal anschließen  :P
FPU in a trice: SmplMath
It's that simple!