This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: Can gdb debug win32 native program?
- To: Motohiko dot Nagano at jp dot sony dot com
- Subject: Re: Can gdb debug win32 native program?
- From: DJ Delorie <dj at delorie dot com>
- Date: Thu, 29 Jun 2000 23:37:54 -0400
- CC: cygwin at sourceware dot cygnus dot com, binutils at sourceware dot cygnus dot com
- References: <7840643F05B5D3119B9A0000F807175702BD85E0@SJP01014>
Warning: cross-posted to cygwin and binutils. Remove at least one
when replying!
> bash-2.04$ objdump -p //E/WINNT/SYSTEM32/calc.exe
> objdump: //E/WINNT/SYSTEM32/calc.exe: File format not recognized
OK, I debugged it and I know why it's failing, but I don't have a fix.
To make it short: 99% of all PE programs have the same sized
structures at the beginning of the program file. Some don't. BFD
tries hard to adjust to the varying sizes, but it appears that in your
case it doesn't do it right, and ends up reading a structure from the
wrong place in the file. If you care to debug it, look for
pe_bfd_object_p() in bfd/peicode.h; the test that fails is in
coff_bad_format_hook() in bfd/coffcode.h. However, I suspect I will
be debugging this one myself :-( but not tonight.
I had to scan my whole system32 directory to find a program that
failed this way, too!