[PATCH/BUGFIX] GDB needs long PE section names enabled.

Dave Korn dave.korn.cygwin@googlemail.com
Tue Mar 3 02:28:00 GMT 2009


    Dear all, I messed up, sorry.

  Graydon here was sharp enough to spot something I overlooked[*] in my patch
to regularize the behaviour of BFD and ld w.r.t. PE/COFF long section names:
when using DW-2 debug info, GDB needs to be able to look it up via the long
section names.  Thus although it's technically wrong to use long section names
in PE executable images, it's vital for debuggability on GNU platforms.

  The abbreviated debug info section names are almost but not *quite* unique
in their leading parts, and I considered writing some code to mung the section
names down to short unique names instead of simply truncating them, but then
we'd be doing something non-standard anyway.  So I decided that the second
simplest fix (the first simplest being just to unconditionally re-enable long
section names in executables and leave it to the people who really want
technical compliance to override with a command-line option) would be that, if
we haven't been given an explicit command-line option, and any debug sections
are present, we re-enable long section names in the output.  That's what the
attached patch does.

  Tested that this patch works on i686-pc-cygwin both by looking at the
section names with objdump and by debugging a linked exe with gdb and
observing whether or not it reported debug info present - see attached.  Now
running crossbuilds and regtests from i686-pc-linux-gnu to {arm-epoc-pe,
arm-wince-pe, i386-pc-netbsdpe, i386-pc-pe, i586-pc-interix,
i586-unknown-beospe, i686-pc-cygwin, i686-pc-mingw32, mcore-unknown-pe,
powerpcle-unknown-pe, sh-unknown-pe, thumb-epoc-pe, x86_64-pc-freebsd,
x86_64-pc-linux-gnu, x86_64-pc-mingw32}.

  If testing passes, OK for trunk?

    cheers,
      DaveK
-- 
[*] - Cygwin's old compiler still defaults to .stabs, and the new ones that
use dw2 debug by default are still in unstable status, so I wasn't using them
when I tested the original patch, and didn't see any problem in GDB.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: before-after.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20090303/3b654e15/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: long-section-debug-info-patch.diff
URL: <https://sourceware.org/pipermail/binutils/attachments/20090303/3b654e15/attachment.ksh>


More information about the Binutils mailing list