The MASM Forum

General => The Campus => Topic started by: flipflop1 on March 26, 2013, 05:49:39 AM

Title: noob with windbg not working could be masm settings
Post by: flipflop1 on March 26, 2013, 05:49:39 AM
hi im new to the forums but here goes

ive been programming for 20 years and programming in asm for a while but ive desided I would like to have a debugger that can step through my source. I downloaded olly and couldn't really get on with it so I thought id try windbg but ive had problems now its turning into a mission to solve this problem

I have a standard masm32 setup and a standard windbg setup but Im having problems with my symbols ive downloaded all the needed symbols from Microsoft but it seems as though this is not the problem link does not seem to create a pdb file for windbg to find

this is the command ive been using

\masm32\bin\Link /SUBSYSTEM:WINDOWS /VERBOSE /DEBUG /DEBUGTYPE:COFF  /PDB:prime.pdb prime.obj

it compiles fine but no pdb file is found anywhere on my harddrive

please help
Title: Re: noob with windbg not working could be masm settings
Post by: ragdog on March 26, 2013, 05:59:46 AM
Hi

Have you set in ML settings the Zi switch?

ml /c /coff /Cp /Zi /Zd "source.asm"
link /SUBSYSTEM:WINDOWS /DEBUG /VERSION:4.0 /OUT:"source.exe" "source.obj"  "rsrc.res"
Title: Re: noob with windbg not working could be masm settings
Post by: Magnum on March 26, 2013, 06:01:44 AM
Try this.



\masm32\bin\ml /c /coff /Zi %1.asm

\masm32\bin\Link /RELEASE /DEBUG /SUBSYSTEM:WINDOWS /OPT:NOREF %1.obj rsrc.obj

Title: Re: noob with windbg not working could be masm settings
Post by: rsala on March 26, 2013, 06:11:17 AM
Hi flipflop1,

I use the command line options below and I get the .pdb file.

\masm32\bin\ml  /X /nologo /c /coff /Cp /Zp4 /Zi /Zd

\masm32\bin\Link  /nologo /subsystem:windows /debug /nodefaultlib:libc
Title: Re: noob with windbg not working could be masm settings
Post by: flipflop1 on March 26, 2013, 06:20:07 AM
thanks ragdog and magnum

ragdog your settings worked

I will play for a bit to see which setting that was different seemed to work I think it may have been the rsrc.obj

but my problems continue do I post a new thread or continue in this thread


cheers to rsala as well
Title: Re: noob with windbg not working could be masm settings
Post by: Gunther on March 26, 2013, 06:26:00 AM
Hi flipflop 1,

welcome to the forum. Have fun.  :t

Gunther
Title: Re: noob with windbg not working could be masm settings
Post by: jj2007 on March 26, 2013, 09:15:23 AM
/Zi for the assembler, /debug for the linker. The /zd switch is not needed.

Note this works for ML 6.14 or 6.15 and JWasm. Higher Masm versions may throw fatal error LNK1103: debugging information corrupt.

New thread only if you have a really new theme. Nothing gets lost, most of us have this link (http://www.masm32.com/board/index.php?action=unread;all;start=0) bookmarked ;-)

Welcome to the forum :icon14:
Title: Re: noob with windbg not working could be masm settings
Post by: TouEnMasm on March 26, 2013, 08:06:14 PM

The binary of the masm32  package need an update to be used with windbg (\masm32\bin).
Replace link.exe and all the mspdb*.dll with a more recent version,c++ express.
Title: Re: noob with windbg not working could be masm settings
Post by: japheth on March 26, 2013, 08:32:24 PM
Quote from: jj2007 on March 26, 2013, 09:15:23 AM
Note this works for ML 6.14 or 6.15 and JWasm. Higher Masm versions may throw fatal error LNK1103: debugging information corrupt.

I guess that the linker and not Masm is throwing the fatal error.

The reason is simple: Masm v8 and above use a newer codeview format ( v8 instead of v4 ). The problem is: if an old linker is fed with this new debugging format, it may decide to keep silent and not emit any warning - or emit a warning that is misleading. Hence: if you use Masm v8 or newer and want debug info, you must use a MS linker from at least 2005 ( i.e. VC EE 2005 ); Polink is NOT a good replacement if WinDbg is to be used.

Title: Re: noob with windbg not working could be masm settings
Post by: jj2007 on March 26, 2013, 11:38:55 PM
Quote from: japheth on March 26, 2013, 08:32:24 PM
Quote from: jj2007 on March 26, 2013, 09:15:23 AM
Note this works for ML 6.14 or 6.15 and JWasm. Higher Masm versions may throw fatal error LNK1103: debugging information corrupt.

I guess that the linker and not Masm is throwing the fatal error.

Yes, sloppy wording, sorry. Unfortunately, using higher linker versions entails new problems:
fatal error LNK1101: incorrect MSPDB???.DLL version

The best option to get debug info is imho JWasm plus MS link 6.14. Olly 1.0 shows even local variables, Olly 2.0 only the global ones.
Title: Re: noob with windbg not working could be masm settings
Post by: Magnum on March 26, 2013, 11:54:55 PM
You can get those dlls from VB package.

I have them if anyone needs them.

Andy
Title: Re: noob with windbg not working could be masm settings
Post by: jj2007 on March 27, 2013, 01:42:38 AM
I have these dlls. The linker complains about incorrect installation.
Title: Re: noob with windbg not working could be masm settings
Post by: dedndave on March 27, 2013, 01:47:47 AM
i am able to make all but masm version 11 work under XP (32-bit)
the linkers that come with masm versions 9 and 10 work fine
Title: Re: noob with windbg not working could be masm settings
Post by: japheth on March 27, 2013, 02:06:45 AM
Quote from: jj2007 on March 27, 2013, 01:42:38 AM
I have these dlls. The linker complains about incorrect installation.

For VC 2008 link, you'll need these files:

link.exe
mspdb80.dll
mspdbcore..dll
msobj80.dll
mspdbsrv.exe ( !!! )

There's no need for registry entries.
Title: Re: noob with windbg not working could be masm settings
Post by: dedndave on March 27, 2013, 02:10:16 AM
i think they should be in the same folder as the linker
and - that folder should be in the PATH
otherwise, you may get the error message

mspdbsrv ?
i didn't need that one, but i didn't test all cases (link errors, etc)
is that for masm version 9 ?
Title: Re: noob with windbg not working could be masm settings
Post by: jj2007 on March 27, 2013, 02:48:44 AM
Quote from: dedndave on March 27, 2013, 02:10:16 AM
mspdbsrv ?
i didn't need that one, but i didn't test all cases (link errors, etc)

Works without that one, apparently ;-)
Thanks to Japheth my version 10 assembler & linker pair works now, with and without mspdbsrv.exe. Only that Olly 1 can't use it :(
So back to square one: (ML 6.15 or JWasm) + link 5.12 (the one supplied with Masm32).
Title: Re: noob with windbg not working could be masm settings
Post by: GoneFishing on March 27, 2013, 03:47:21 AM
QuoteThe binary of the masm32  package need an update to be used with windbg (\masm32\bin).

I'm using standard MASM32v11 with WinDbg without any problems. Though I'm debugging only simple examples and my own excercises.
Title: Re: noob with windbg not working could be masm settings
Post by: ragdog on March 27, 2013, 04:27:11 AM
I use Ollydbg to debug all my Coded apps
with masm32 v10 or v11 and use Radasm standart debug settings build

Quoteml /c /coff /Cp /Zi /Zd "source.asm"
link /SUBSYSTEM:WINDOWS /DEBUG /VERSION:4.0 /OUT:"source.exe" "source.obj"  "rsrc.res"

I have not any update my masm32bin folder to newer versions of ml or link

And i can see all Debug information in Ollydbg
Windbg have i never try
Title: Re: noob with windbg not working could be masm settings
Post by: Magnum on March 27, 2013, 08:14:33 AM
My version 10 of link works with only mspdb100.dll.

As long as it's in the same dir.

Andy