Author Topic: how to debug in nasm  (Read 21526 times)

nobody

  • Guest
how to debug in nasm
« on: October 03, 2008, 12:38:53 PM »
hi all,
  i am a beginner for nasm. how can i debug the file output by nasm, etc .obj, .bin, .com. i link the .obj file and creat .exe file, and then debug with turbo debugger, but it says "no symbol table". what can i do now. thank you.

nobody

  • Guest
Re: how to debug in nasm
« Reply #1 on: October 03, 2008, 03:49:53 PM »
Create a symbol table!

Use the "-g" option on the command line to Nasm. (this works *only* in "-f obj" and "-f elf" output formats - there's no use doing "-f win32 -g", although people do it...)

Then... I suppose you're linking with Tlink? AFAIK, other linkers won't work. I think it's the "/v" switch... or is it "/t"?... that you need to use on the Tlink command line - RTFM. Then TD will be happier. (although you should be able to debug it even without a symbol table, as I recall)

Unfortunately, the "borland" debugging info that Nasm emits is known to be buggy itself! It semi-works, as I recall... better than nothing, but it isn't quite "right".

I'm supposed to be helping Alexei Frounze fix this, but I've been lazy - I owe him a reply at the moment. You've already helped by returning my wandering attention to the issue. Perhaps you can help more by sharing your observations of what works and what doesn't. Perhaps you're not too sure how it's "supposed" to work. No problem - I'm in the same situation! The halt leading the blind! :)

I mentioned that this will only work in "-f obj" output format. For a .com file, Tasm/Tlink create a freestanding .sym file, IIRC. Nasm's "-f bin" mode won't create that, but it *will* create a .map file ("[map all myfile.map]" in the source code). I'm pretty sure a "third party utility" could be created that would parse the information in the .map file into a .sym file that TD would accept... if we knew what TD wanted. I don't, but maybe we can figure it out.

Besides TD, David Lindauer's GRDB will accept Borland-style debugging information - in the .exe or a .sym file for .com files... I think (haven't really used it much since that feature was added). And *that* we have source code for! So there's hope!

I'm somewhat "handicapped" in this project, since I'm running Linux. I *can* boot dos still, but I mostly don't. Trying to "move on" from that. (I hope you know you're running obsolete tools on an obsolete OS. I've got nothing against obsolete - I'm kinda obsolete myself!) I can *look* at Nasm's output without having to reboot. I'll do that. Thanks for the encouragement!

Keep in touch!

Best,
Frank
fbkotler
verizon.net

or

users.sf.net