This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Support for DDWARF-2 debug info? (on Cygwin)


On 16 Jan 2003, Nick Clifton wrote:

> Hi Brian,
>
> > The coff versions of sec_to_styp_flags and styp_to_sec_flag in bfd
> > look to see if the section name begins with .debug and modify the
> > section flags appropriately.  The PE versions do not even look at
> > the section name.
>
> Ahh, yes, you are right.  I guess that no-one has tried to
> incporporate DWARF2 sections into the PE format before.  I guess that,
> for now you are going to have to add similar name-checking code to the
> PE versions.
>
I have and it works fine.

> Ideally what we ought to do is give gcc some way to tell gas that
> "this section is a debug section" and then gas could do the right
> thing.  Perhaps a new pseudo op ".debug_section <name>" ?
>
Agreed.

My current problem is that all previous DWARF2 implementations assign a
VMA of zero to the .debug_* sections in the link script.  This violates
the PE format and makes the executable unusable.

I am making the VMAs adjacent at the end of the image as the PE spec
requires.  The offsets in the DWARF2 information are then parsed
incorrectly in bfd/dwarf2.c and gdb/dwarf2read.c, because they are
no longer section relative offsets, but VMA addresses.

I am still consulting the DWARF2 spec to see if gcc and gas are
correct in generating VMA addresses.  If so, I guess I have to fix the
dwarf parsing code in bfd and gdb to subtract the section base VMA.

As always, hints, tips, and comments are welcome.

Examples:

addr2line 0x401040 -e xyz.exe
BFD: Dwarf Error: Abbrev offset (4251648) greater than or equal to
.debug_abbrev size (512).

gdb xyz.exe
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are welcome to change it and/or distribute copies of it under certain
conditions.  Type "show copying" to see the conditions.  There is
absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...Dwarf Error: bad offset
(0x40e000) in compilation unit header (offset 0x0 + 6).

Thanks.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]