Hi. I'm still a newbie :grin: and would appreciate someone critiquing my command line settings. I'd like to make sure I'm not missing anything or using an option I shouldn't.

Environment setup: I'm using the MASM32 7.0 (MASM 6.14) package with ML and Link replaced by the ones provided in the VC++ 6 Processor Pack (MASM 6.15). I'm able to use Codeview to debug 16-bit programs and use Visual C++ 6 to debug 32-bit (specifically Win32) programs. I use the shareware editor EditPlus 2 as my IDE as ASMEdit and RadASM are a little overwhelming in their features right now, plus I have EditPlus setup for C/C++ development and other command line tools like exe2bin.

1. These are my debug command lines for Win32 and 16-bit assembly.

For Win32 (Iczelion's tutorials compile with these.)
ML /c /coff /Cp /Zi /nologo (FileName)
Link /DEBUG /DEBUGTYPE:CV /PDB:NONE /SUBSYSTEM:WINDOWS /LIBPATH:d:\masm32\lib /nologo (FileNameNoExt).obj; or
Link /DEBUG /DEBUGTYPE:COFF /PDB:NONE /SUBSYSTEM:WINDOWS /LIBPATH:d:\masm32\lib /nologo (FileNameNoExt).obj;

(I found Codeview output easier to follow then COFF under the VC++ 6 debugger.)

For 16-bit
ML /c /Zi /Zd /Zm /Fl /nologo (FileName)
Link16 /CODEVIEW /nologo (FileNameNoExt).obj; (Renamed the link.exe that comes with Masm 6.11d to link16.exe)

2. Also (if you're still reading thank you), would the optimal release command line switches be

For Win32
ML /c /coff /Cp (FileName)
Link /release /SUBSYSTEM:WINDOWS /LIBPATH:d:\masm32\lib /nologo (FileNameNoExt).obj;

For 16-bit
ML /c /Zm /nologo (FileName)
Link16 /nologo (FileNameNoExt).obj;

3. PS: Does anyone know if there's a command line that can automatically invoke VC++ 6's debugger? Is there a freeware Win32 debugger (like OllyDbg?) that can take a command line argument and symbolically debug codeview/coff?
Posted on 2003-01-19 10:32:57 by Masmer
for the vs debugger u should be able to do this...

"%vsinstalldir%\devenv.exe" mycode.asm /debugexe mycode.exe

where mycode.asm is the path and/or filename of your source code file(s) and mycode.exe is the path and/or filename of the compiled executable
Posted on 2003-01-19 12:57:43 by BubbaFate
I had to change devenv.exe to msdev.exe and it works. Thank you!
Posted on 2003-01-20 02:33:39 by Masmer
Masmer,

I advice you to use the Olly Debugger.This tool provides also souce-level debugging.

http://home.t-online.de/home/Ollydbg

Regards,

Vortex
Posted on 2003-01-20 03:01:13 by Vortex
I've been trying it out the last hour. Can't seem to get the source level debugging working, but then I haven't had time to read all the FAQ. Olly Debugger appears to be rather complex, which is good. :tongue: Thanks for the recommendation.
Posted on 2003-01-20 03:11:55 by Masmer
Masmer,

Olly Debugger is not so difficult to use.

Parameters for OllyDbg:

c:\masm32\bin\ml /c /coff /Cp /Zi /Zd file.asm
c:\masm32\bin\link /DEBUG /DEBUGTYPE:CV /SUBSYSTEM:WINDOWS /LIBPATH:c:\masm32\lib file.obj

Source-level debugging:
Posted on 2003-01-20 03:27:50 by Vortex
My source window was blank on two different PCs. But now I see you have to select View => Source Files and double-click on the source file (I was just clicking on View => Source).
Posted on 2003-01-20 04:04:03 by Masmer
Masmer, That's O.K. :alright:

Regards,

Vortex
Posted on 2003-01-20 04:16:27 by Vortex
Someone want to tell me how to get this to happen.. or am i suppose to have the up-to-date version of Olldbg (My Ver is: 1.06)

It has a SourceFiles window and A View->Source option. But no matter how many ways i try, i dont get it to show me anything more than the blank window mentioned above :confused:

Here is the bat file im using:
@echo off

rem DEBUG.BAT
rem @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
if exist %1.pdb del %1.pdb
if exist %1.ilk del %1.ilk

\masm32\bin\ml /c /coff /Cp /Zi /Zd %1.asm
if errorlevel 1 goto errasm

if not exist rsrc.obj goto nores

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

dir %1.*
goto TheEnd

:nores
\masm32\bin\Link /DEBUG /DEBUGTYPE:CV /SUBSYSTEM:WINDOWS %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


Its simply an edit from Hutch's builda.bat...

It works, it builds me a directory with a .pdb, and .ilk file.. As well, manually looking at the generated exe file, there is the debug path to the pdb in the file:
NB10 +?,> D:\masm32\_ACTIVE\elec\elec.pdb


And with all this, ollydbg just looks back at me with its empty window when i open the file??
Posted on 2003-01-20 20:21:09 by NaN
I'm guessing as a newbie here: I *was* using the /PDB:NONE switch to include the Program Database inside the exe file, while Vortex's command line creates the PDB in the same directory as the executable. So perhaps OllyDbg (1.0.6 or currently) needs local access to the program database, not recognizing the path to the PDB file inside the executable? I'd be astonished if I'm correct. :grin:

Edit: Or it could be this new feature in 1.0.8b: "Perharps the most important new feature in OllyDbg 1.08 is its ability to read debugging information in numerous Microsoft formats, including CodeView, COFF, PDB and SYM, as implemented in dbghelp.dll. This redistributable file is included into .zip archive."
Posted on 2003-01-21 03:35:25 by Masmer