News:

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

Stepping through assembler source code using MASM32

Started by slonumber, December 22, 2007, 01:38:14 AM

Previous topic - Next topic

slonumber

I am trying to go through Iczelion' PE tutorials.
I have MASM32 installed and running. Is there a way to step through the assembler source code of his examples (pe-tut02.asm, etc) or any Win32 assembler source code using only tools included in the MASM32 package?
If there is not,  how can it be done? Detailed explanation will be very much appreciated.
Thanks in advance!

dsouza123

MASM32 doesn't come with a source code debugger,
but it does have VKDEBUG which can display the contents
of variables and optionally output to a log file.

Ollydbg is a very good assembly level debugger that can
be configured to show multiple columns containing
machine code, the equivalent assembly using MASM syntax,
and well know api calls some with current parameters.
It also has some support for showing the source code
in another pane, if you search the forums you will find
more details (including how to make a debug build that
produces a .pdb file so the debugger can sync the executable
with the source and have named variables).

Microsoft Visual Studio products have a source level debugger.
There are also other Microsoft debuggers.

BogdanOntanu

Yes, with MASM and Ollydbg you can

build your sample test file like this:


\masm32\bin\ml.exe /nologo /c /coff /Zi sample.asm

\masm32\bin\link.exe /nologo /SUBSYSTEM:CONSOLE /debug  sample.obj

pause


MASM will generate am sample.exe, sample.obj, sample.ilk and sample.pdb (debug info file)

Then open your executable sample.exe in Ollydbg and go to Menu->View->Source
You can now step into your code and you will step into the source file also.

Remember that MASM32 is just a package containing the MASM compiler, a series of includes , macros, tools and samples to help you start-up.

However ASM is for people that already know everything.... or are capable of understanding everything by them self. Never expect that MASM32 or ASM will be baby sitting or spoiling you like most HLL languages do.

You must be capable of understanding and experimenting yourself or you are lost in ASM.


Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

slonumber

Thanks for the great answers! Your help is greatly appreciated!

ToutEnMasm

Hello,
winhelp is abble to made what you want.
1) create a .pdb file using the corrects options with ml and link
Quote
\masm32\bin\ml.exe /c /coff /nologo /Zi /Zd /Zp4 mysource.asm
\masm32\bin\Link /NOLOGO /SUBSYSTEM:WINDOWS /DEBUG /PDB:mysource.pdb mysource.obj mysource.bin
mysource.bin is a resource object.
2)install winhelp and intall the windows symbol

When this is done,you can debug a source file following the source and not Hex uncompiled code.


slonumber


Wannabe

QuoteHello,
winhelp is abble to made what you want.
1) create a .pdb file using the corrects options with ml and link
Quote
\masm32\bin\ml.exe /c /coff /nologo /Zi /Zd /Zp4 mysource.asm
\masm32\bin\Link /NOLOGO /SUBSYSTEM:WINDOWS /DEBUG /PDB:mysource.pdb mysource.obj mysource.bin
mysource.bin is a resource object.
2)install winhelp and intall the windows symbol

When this is done,you can debug a source file following the source and not Hex uncompiled code.
winhelp?  shouldn't it read windbg?


ToutEnMasm