The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: madhur_ahuja on December 03, 2010, 08:47:58 AM

Title: Source debug MASM32 exe with latest Windbg
Post by: madhur_ahuja on December 03, 2010, 08:47:58 AM
Has anyone been able to source debug .exe generated with Ml.exe and link.exe with Windbg. I am not able to do it.

And yes I have compiled with /Zi and linked with /DEBUGTYPE:CV and /DEBUG option.
Title: Re: Source debug MASM32 exe with latest Windbg
Post by: japheth on December 03, 2010, 09:10:15 AM
Quote from: madhur_ahuja on December 03, 2010, 08:47:58 AM
Has anyone been able to source debug .exe generated with Ml.exe and link.exe with Windbg. I am not able to do it.

Yes.

See:
(http://www.japheth.de/JWasm/Image9.png)

(color depth was reduced to 16)

Quote
And yes I have compiled with /Zi and linked with /DEBUGTYPE:CV and /DEBUG option.

That's ok. /DEBUGTYPE:CV probably isn't needed.
Title: Re: Source debug MASM32 exe with latest Windbg
Post by: madhur_ahuja on December 03, 2010, 09:13:54 AM
Thanks, DEBUGTYPE by default is CV, so thats not a culprit.

Did you do something else ? I even set the symbol path and source file path to the location containing my source, pdb files and executables.

Does it matter if you ave x86 or x64 version of WinDbg ? I am running Win 2008 x64 but assembling against 32 bit ml.exe and link.exe
Title: Re: Source debug MASM32 exe with latest Windbg
Post by: ToutEnMasm on December 03, 2010, 09:18:01 AM

You must have also the windows symbols in C:\WINDOWS\Symbols
They can be downloaded from msdn
http://www.microsoft.com/whdc/devtools/debugging/default.mspx
Title: Re: Source debug MASM32 exe with latest Windbg
Post by: madhur_ahuja on December 03, 2010, 09:19:45 AM
Are the windows symbols really necessary ? Can I point to the symbol server instead of downloading ?
Title: Re: Source debug MASM32 exe with latest Windbg
Post by: japheth on December 03, 2010, 09:23:31 AM
Quote from: madhur_ahuja on December 03, 2010, 09:19:45 AM
Are the windows symbols really necessary ? Can I point to the symbol server instead of downloading ?

No (the windows symbols aren't necessary) and Yes (point to the symbol server instead of downloading).

However, when starting WinDbg, it will stop somewhere inside kernel. This is a very early point of execution, where dll entry points  ("LibMain") aren't executed yet.

To reach the source of your program, you'll have to enter a "G <startsymbol>" in WinDbg's command line. <startsymbol> is the name of the symbol behind the END directive.
Title: Re: Source debug MASM32 exe with latest Windbg
Post by: ToutEnMasm on December 03, 2010, 09:32:43 AM
Quote
Access to Windows symbol files. If you have access to the Internet while debugging, you can set your debugger's symbol path to point to the Windows symbol server. If you do not have access to the Internet while debugging, you can download symbols in advance from the Microsoft website.
If you choose the internet line you have to add one option to the command line
Quote
-c ".sympath+ SRV*C:\WINDOWS\Symbols*http://msdl.microsoft.com/download/symbols"

It is needed you have them with one or the two soluces


Title: Re: Source debug MASM32 exe with latest Windbg
Post by: sinsi on December 03, 2010, 09:45:40 AM
For the Windows symbols, set an environment variable like:

_NT_SYMBOL_PATH=srv*c:\asm\symbols*http://msdl.microsoft.com/download/symbols;cache*c:\asm\symbols

Of course, change c:\asm\symbols to wherever you want them to go.
This lets you keep copies instead of downloading all the time.
Title: Re: Source debug MASM32 exe with latest Windbg
Post by: madhur_ahuja on December 03, 2010, 09:46:48 AM
Thanks guys, let me try that   :U