Google グループは Usenet の新規の投稿と購読のサポートを終了しました。過去のコンテンツは引き続き閲覧できます。
Dismiss

Can NASM generate debug information?

閲覧: 477 回
最初の未読メッセージにスキップ

Yi Wang

未読、
2003/03/26 22:13:382003/03/26
To:
I have three versions of NASM on my win2000 machine:
1. nasm comes from Cygwin
2. nasmw.exe downloaded from
ftp://ftp.kernel.org/pub/software/devel/nasm/source/
3. nasm.exe build from the source

But all these three versions generate the fowlloing output
valid debug formats for 'win32' output format are ('*' denotes default):
* null Null debug format

when command line parameters are given as :
nasm -f win32 -y

In my Cygwin + DJGPP environment, I can not use 'nasm -g -f coff' to
generate debug information that GDB can use.

In my Visual C++ project settings, I try to use 'nasm -g -f win32 ...'
to assemble my source file. It seems that no debug information can be
used by Visual C++ debugger.

I am wondering whether nasm can generate debug information for COFF or
WIN32 object file format?


Frank Kotler

未読、
2003/03/27 0:04:192003/03/27
To:
Yi Wang wrote:

> I am wondering whether nasm can generate debug information for COFF or
> WIN32 object file format?

No. Nasm generates debug info *only* in "-f obj" format. Otherwise, the
"-g" switch is silently ignored. I'm aware of some "experimental" Nasm
code that generates "stabs" debug info in "-f elf" format. (and a Perl
script that does the same) Unless I'm mistaken, there's *some* symbolic
information in a coff/win32 object file anyway, but apparently not
enough for a debugger to use. If someone gets "around to it", it "might
happen someday"... Better debug info *is* on the "todo" list...

Best,
Frank

Matt Taylor

未読、
2003/03/27 0:39:232003/03/27
To:
"Yi Wang" <cxwa...@ieee.org> wrote in message
news:b5tq9g$1qo2$1...@mail.cn99.com...

The "Win32" or PE format uses the proprietary CodeView format. Nasm does not
support this format. I don't know of any tool that does. There are a couple
other less-complicated formats that PE uses, too. (Observe VC's debug format
options.) I don't know whether Nasm can generate them or not.

If you're trying to debug assembly, debug info shouldn't be too important.
Debug information usually has data regarding type information and location
of variables. That means nothing in Nasm-style assembly.

The VC debugger will disassemble code for you at runtime. You should be able
to see addresses for any global symbol in the asm file. What you really want
is to get the assembler to make everything global for you. I don't know of
any way to do that either. Perhaps you could have Nasm generate a listfile?
It would be a start.

-Matt


wicked...@trioptimum.com

未読、
2003/03/27 14:49:342003/03/27
To:

"Frank Kotler" <fbko...@attbi.com> wrote in message
news:3E829CEA...@attbi.com...

http://ls7-www.cs.uni-dortmund.de/~wawro/nasmstabs.html

Again, this is only for stabs type information (Linux, BSD, etc.).

Frank Kotler

未読、
2003/03/27 20:42:362003/03/27
To:
wicked...@trioptimum.com wrote:

> http://ls7-www.cs.uni-dortmund.de/~wawro/nasmstabs.html
>
> Again, this is only for stabs type information (Linux, BSD, etc.).

Thanks, wickedchicken! As it happens, this is the "experimental" code I
was referring to. Martin Wawro's code wants "ELFSTABS" (or something)
defined on the command line when you compile Nasm. I was fooling with
making it "always there", and enabled with the "-g" switch - it was
going pretty well - gdb gets lots friendlier - I just got distracted and
haven't got back to it...

Now what we need is a similar link - where someone has already done most
of the work - for... however many formats PE and/or coff uses. Matt's
mention of making a listfile reminds me that the Perl script that does
elf stabs debug info makes a listfile... invokes Nasm twice, I think...
then "patches" the .o file. Possibly a similar script could be used to
"fake up" some debug info for "-f win32", at least until the real thing
comes along.

And Matt's mention of VC reminds me that there *is* a new feature in
Nasm - using the "-X vc" switch will cause Nasm to emit its error
messages in a format that VC is happier with (parentheses around the
line number, IIRC). Something VC users might want to know about -
although not exactly debug related.

Best,
Frank

Matt Taylor

未読、
2003/03/28 3:49:202003/03/28
To:
"Frank Kotler" <fbko...@attbi.com> wrote in message
news:3E83A88C...@attbi.com...

> wicked...@trioptimum.com wrote:
>
> > http://ls7-www.cs.uni-dortmund.de/~wawro/nasmstabs.html
> >
> > Again, this is only for stabs type information (Linux, BSD, etc.).
>
> Thanks, wickedchicken! As it happens, this is the "experimental" code I
> was referring to. Martin Wawro's code wants "ELFSTABS" (or something)
> defined on the command line when you compile Nasm. I was fooling with
> making it "always there", and enabled with the "-g" switch - it was
> going pretty well - gdb gets lots friendlier - I just got distracted and
> haven't got back to it...
>
> Now what we need is a similar link - where someone has already done most
> of the work - for... however many formats PE and/or coff uses. Matt's
> mention of making a listfile reminds me that the Perl script that does
> elf stabs debug info makes a listfile... invokes Nasm twice, I think...
> then "patches" the .o file. Possibly a similar script could be used to
> "fake up" some debug info for "-f win32", at least until the real thing
> comes along.

The format VC generally uses is proprietary. Supposedly the book on my desk
at work has the format documented. I was interested in the format until I
discovered the symbol APIs (which, IMO, are poorly designed). Anyway, I got
the general impression 8 months ago that -nobody- really knew how the format
worked. I have my doubts that Nasm will ever support it.

COFF is different, obviously, and the PE format supports it. There are other
formats as well, but I don't know anything about them. All that's really
useful from an asm file is line numbers, and I think COFF debug information
is sufficient for this. (When I read the PE docs describing that format, it
did not look terribly inviting to implement.)

> And Matt's mention of VC reminds me that there *is* a new feature in
> Nasm - using the "-X vc" switch will cause Nasm to emit its error
> messages in a format that VC is happier with (parentheses around the
> line number, IIRC). Something VC users might want to know about -
> although not exactly debug related.

Excellent!

-Matt


Yi Wang

未読、
2003/03/28 1:02:292003/03/28
To:
Thank you all very much.


新着メール 0 件