public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: Can gdb debug win32 native program?
@ 2000-06-30 14:57 DJ Delorie
  0 siblings, 0 replies; 2+ messages in thread
From: DJ Delorie @ 2000-06-30 14:57 UTC (permalink / raw)
  To: binutils; +Cc: cgf, Motohiko.Nagano

> > 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.

I just checked in a fix.  There was a spot where we assumed that the
PE header was at offset 0x80 in the file, but obviously we can't do
that.  I also commented the structure for the headers to remind people
that the offsets are dynamic.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Can gdb debug win32 native program?
       [not found] <7840643F05B5D3119B9A0000F807175702BD85E0@SJP01014>
@ 2000-06-29 20:38 ` DJ Delorie
  0 siblings, 0 replies; 2+ messages in thread
From: DJ Delorie @ 2000-06-29 20:38 UTC (permalink / raw)
  To: Motohiko.Nagano; +Cc: cygwin, binutils

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!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-06-30 14:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-30 14:57 Can gdb debug win32 native program? DJ Delorie
     [not found] <7840643F05B5D3119B9A0000F807175702BD85E0@SJP01014>
2000-06-29 20:38 ` DJ Delorie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).