The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: neoassembler on June 29, 2011, 12:15:17 AM

Title: Unable to link with debug info
Post by: neoassembler on June 29, 2011, 12:15:17 AM
Hi guys,

Newbie here who is teaching himself assembly. I'm trying to learn by stepping through a debugger. I'm using Windbg. I need to generate a pdb file and I've followed a very useful file posted elsewhere on this forum on how to do this. I've used the Masm32 editor to create a makeit.bat file and have edited it so that the key lines are now;

\masm32\bin\ml /c /coff /Zi /Zd "flags.asm"
\masm32\bin\link /SUBSYSTEM:CONSOLE /DEBUG /PDB:flags.pdb "flags.obj"

However, I get the following linker error:
LINK: error : Internal error during ReadSymbolTable.

I do not get this error if I omit the /DEBUG switch.

I'm following a book which I've had on my bookshelf for years but never read and was about to throw away - The Revolutionary Guide to Assembly Language. Basically masm on DOS etc. The first program I'm assembling comes from this book and as the name suggests, it carries out various register operations so you can see the effects on the flags - if you have a debugger to see all of this.

It uses Codeview which I don't know where to get hold of, hence my use of Windbg.

Any help would be much appreciated. I've spent a lot of time working on this and was about to throw in the towel. (I had tried fasm first but the program someone wrote to generate pdb info from a coff output is now broken in the latest version and no one seems to be supporting it.) I'd much prefer having source level debugging but maybe I'll just have to live with machine level debugging :-(.
Title: Re: Unable to link with debug info
Post by: jj2007 on June 29, 2011, 12:26:10 AM
Hi neo,
Welcome to the forum :thumbu

Newer versions of ML.exe may choke with symbols. Try JWasm, and forget WinDbg - use Olly.

Olly (http://www.ollydbg.de/version2.html) likes these here:
OPT_DebugA   /Zi   ; activate symbols
OPT_Assembler   mlv614   ; must be present in \bin
OPT_DebugL   /debug
OPT_Linker   linkv614   ; must be present in \bin
Title: Re: Unable to link with debug info
Post by: hutch-- on June 29, 2011, 01:29:58 AM
Neo,

It sounds like you are trying to mix 16 bit and 32 bit code which does not work. Codeview is the very old DOS debugger which was a great tool back then but is no longer useful as it was designed for 16 bit real mode operation. Olly is popular, the freeware IDA Pro is very useful at looking at disassembly listings but they are 32 bit tools, not 16 bit. If you are going to use debug options, you need to use the correct version of LINK for it to work.
Title: Re: Unable to link with debug info
Post by: neoassembler on June 29, 2011, 07:09:02 AM
Thanks for the replies guys.

@jj - I'll certainly use Olly if i can't get a source level debugger working.

@hutch

Hmm. I don't know enough assembler to spot whether the file I am trying to link contains 16-bit +/- DOS-specific commands but that could be it. I'll try playing around with the source.

Thanks once again guys.
Title: Re: Unable to link with debug info
Post by: neoassembler on June 29, 2011, 08:10:11 AM
Problem solved!  :bg

I needed to add

include \masm\include\masm32rt.inc

to the start of the source code. Now WinDbg is as happy as a pig in mud!

For my education, what's included in this include file? (pun intended)

Thanks once again guys.
Title: Re: Unable to link with debug info
Post by: jj2007 on June 29, 2011, 08:29:06 AM
Quote from: neoassembler on June 29, 2011, 08:10:11 AM
For my education, what's included in this include file? (pun intended)

Just open it in Notepad, it won't bite you: \masm\include\masm32rt.inc  :bg
Title: Re: Unable to link with debug info
Post by: neoassembler on June 29, 2011, 09:14:53 AM
Oh - didn't realize it was a text file.

cool