News:

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

Windbg help needed

Started by skywalker, February 19, 2006, 01:27:49 PM

Previous topic - Next topic

skywalker

I recently  installed windbg. I think I need to do this first, but not sure how to.

<You must install the symbol files for the user-mode process that is being debugged. If this is an application you <have written, it should be built with full symbol files.

I want to set some breakpoints and step thru the code to see what going on. I have read the help, but still don't know how to do this.

Thanks.

Mark Jones

Hi Skywalker. Try this:


ml /c /Cp /coff /Fm /Zi /Zf /Zd /I"\masm32\Include" MyFile.asm
link /SUBSYSTEM:WINDOWS /DEBUG /VERSION:4.0 /LIBPATH:"\masm32\lib" /OUT:"MyFile.exe" MyFile.obj


Use the Microsoft linker and it should spit out a large .PDB file. See this link for a full tutorial:
http://www.codeproject.com/debug/windbg_part1.asp?df=100&forumid=33481&exp=0&select=879065
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

skywalker

Quote from: Mark Jones on February 19, 2006, 05:54:58 PM
Hi Skywalker. Try this:


ml /c /Cp /coff /Fm /Zi /Zf /Zd /I"\masm32\Include" MyFile.asm
link /SUBSYSTEM:WINDOWS /DEBUG /VERSION:4.0 /LIBPATH:"\masm32\lib" /OUT:"MyFile.exe" MyFile.obj


Use the Microsoft linker and it should spit out a large .PDB file. See this link for a full tutorial:
http://www.codeproject.com/debug/windbg_part1.asp?df=100&forumid=33481&exp=0&select=879065

This is what I'm getting. It assembles normally using Qeditor.
This is my batch file.

ml /c /Cp /coff /Fm /Zi /Zf /Zd /I"\masm32\Include" end_proc.asm
link /SUBSYSTEM:WINDOWS /DEBUG /VERSION:4.0 /LIBPATH:"\masm32\lib" /OUT:"end_proc.exe" end_proc.obj

C:\masm32\Source>ml /c /Cp /coff /Fm /Zi /Zf /Zd /I"\masm32\Include" end_proc.asm
Assembling: end_proc.asm
end_proc.asm(60) : error A2144: cannot nest procedures
end_proc.asm(62) : error A2012: PROC, MACRO, or macro repeat directive must precede LOCAL
end_proc.asm(63) : error A2012: PROC, MACRO, or macro repeat directive must precede LOCAL
end_proc.asm(66) : error A2006: undefined symbol : @stProcess
end_proc.asm(66) : error A2114: INVOKE argument type mismatch : argument : 2
end_proc.asm(66) : error A2114: INVOKE argument type mismatch : argument : 1
end_proc.asm(70) : error A2006: undefined symbol : @stProcess
end_proc.asm(70) : error A2114: INVOKE argument type mismatch : argument : 2
end_proc.asm(70) : error A2006: undefined symbol : @hSnapShot
end_proc.asm(70) : error A2114: INVOKE argument type mismatch : argument : 1
end_proc.asm(72) : error A2006: undefined symbol : @stProcess
end_proc.asm(72) : error A2114: INVOKE argument type mismatch : argument : 1
end_proc.asm(74) : error A2006: undefined symbol : @stProcess
end_proc.asm(74) : error A2114: INVOKE argument type mismatch : argument : 3
end_proc.asm(81) : error A2006: undefined symbol : @stProcess
end_proc.asm(81) : error A2114: INVOKE argument type mismatch : argument : 2
end_proc.asm(81) : error A2006: undefined symbol : @hSnapShot
end_proc.asm(81) : error A2114: INVOKE argument type mismatch : argument : 1
end_proc.asm(83) : error A2006: undefined symbol : @hSnapShot
end_proc.asm(83) : error A2114: INVOKE argument type mismatch : argument : 1
end_proc.asm(91) : fatal error A1010: unmatched block nesting : KillProcess

P1

This also outputs the list file as well.

Regards,  P1  :8)


Save as BLDALLD.BAT, then add to the QEditor Menu.
@echo off

if not exist rsrc.rc goto over1
\masm32\bin\rc /v rsrc.rc
\masm32\bin\cvtres /machine:ix86 rsrc.res
:over1

if exist "%1.obj" del "%1.obj"
if exist "%1.exe" del "%1.exe"

\masm32\bin\ml /c /coff /Fl"%1.lst" /FR"%1.pdb" /Sa /Zd /Zf /Zi  "%1.asm" > "%1.txt"
if errorlevel 1 goto errasm

if not exist rsrc.obj goto nores

rem \masm32\bin\Link /SUBSYSTEM:WINDOWS /DEBUG /OPT:REF /DEBUGTYPE:CV /PDB:"%1" "%1.obj" rsrc.obj
\masm32\bin\Link /SUBSYSTEM:WINDOWS /DEBUG /DEBUGTYPE:CV /PDB:"%1" "%1.obj" rsrc.obj
if errorlevel 1 goto errlink

dir "%1.*"
goto TheEnd

:nores
rem \masm32\bin\Link /SUBSYSTEM:WINDOWS /DEBUG /DEBUGTYPE:CV /PDB:"%1" "%1.obj"
\masm32\bin\Link /SUBSYSTEM:WINDOWS /DEBUG /OPT:REF /DEBUGTYPE:CV /PDB:"%1" "%1.obj"
if errorlevel 1 goto errlink
dir "%1.*"
goto TheEnd

:errlink
echo _
echo Link error
goto TheEnd

:errasm
echo _
echo Assembly Error
goto TheEnd

:TheEnd

pause

skywalker

Quote from: P1 on February 20, 2006, 04:13:58 PM
This also outputs the list file as well.

Regards,  P1  :8)


Save as BLDALLD.BAT, then add to the QEditor Menu.
@echo off

[/quote]

Thanks.
I went to edit menus but can't figure out what to do next.


P1

skywalker,

Be sure to copy BldallD.bat to \MASM32\BIN\.

In QEditor:
Under Edit is 'Edit Menu'
Add this line under the regular 'Build' option.
Build All &Debug,\MASM32\BIN\BldallD.bat {b}

Then Save and Exit.

This works for using Visual Studio to do your debugging with too.  You see your source execute line by line, while stepping through the execution.

Regards,  P1  :8)

skywalker

Quote from: P1 on February 20, 2006, 05:30:10 PM
skywalker,

Be sure to copy BldallD.bat to \MASM32\BIN\.

In QEditor:
Under Edit is 'Edit Menu'
Add this line under the regular 'Build' option.
Build All &Debug,\MASM32\BIN\BldallD.bat {b}

Then Save and Exit.

This works for using Visual Studio to do your debugging with too.  You see your source execute line by line, while stepping through the execution.

Regards,  P1  :8)

This is what I put in the menu. It makes the .pdb file OK.
Only thing is it isn't under the project pick, it's part of the larger menu.
This automation stuff is pretty neat.


[&Project]
Compile &Resource File,\MASM32\BIN\Bres.bat {b}
&Assemble ASM file,\MASM32\BIN\Assmbl.bat {b}
-
&Link OBJ File,\MASM32\BIN\Lnk.bat {b}
Assemble && Link,\MASM32\BIN\Build.bat {b}
&Build All,\MASM32\BIN\Bldall.bat {b}
Run &Makeit.bat,makeit.bat
-
Console Link &OBJ File,\MASM32\BIN\Lnkc.bat {b}
&Console Assemble && Link,\MASM32\BIN\Buildc.bat {b}
Console Build &All,\MASM32\BIN\Bldallc.bat {b}
-
&Run Program,{b}.exe
-
[Build All and Debug]
Build All &Debug,\MASM32\BIN\BLDALLD.bat {b}

P1

skywalker,

Please make noted changes and you should do well.

Regards,  P1  :8)

[&Project]
Compile &Resource File,\MASM32\BIN\Bres.bat {b}
&Assemble ASM file,\MASM32\BIN\Assmbl.bat {b}
-
&Link OBJ File,\MASM32\BIN\Lnk.bat {b}
Assemble && Link,\MASM32\BIN\Build.bat {b}
&Build All,\MASM32\BIN\Bldall.bat {b}
Build All &Debug,\MASM32\BIN\BLDALLD.bat {b}
Run &Makeit.bat,makeit.bat
-
Console Link &OBJ File,\MASM32\BIN\Lnkc.bat {b}
&Console Assemble && Link,\MASM32\BIN\Buildc.bat {b}
Console Build &All,\MASM32\BIN\Bldallc.bat {b}
-
&Run Program,{b}.exe
-
[Build All and Debug]   <--- Remove this line.  This starts another menu group and you do not want to do that or do you?
Build All &Debug,\MASM32\BIN\BLDALLD.bat {b}   <--- Move this to where I have it above..