[RFC] Wrong register numbers in .dwarf_frame on Linux/PowerPC
Mark Kettenis
mark.kettenis@xs4all.nl
Tue Nov 27 19:13:00 GMT 2012
> Date: Tue, 27 Nov 2012 19:43:40 +0100 (CET)
> From: "Ulrich Weigand" <uweigand@de.ibm.com>
>
> Mark Kettenis wrote:
> > > Date: Mon, 26 Nov 2012 20:10:06 +0100 (CET)
> > > From: "Ulrich Weigand" <uweigand@de.ibm.com>
> > >
> > > Hello,
> > >
> > > I noticed what appears to be a long-standing bug in generating .dwarf_frame
> > > sections with GCC on Linux on PowerPC.
> > >
> > > ...
> > >
> > > So I'm wondering where to go from here. I guess we could:
> > >
> > > 1. Bring GCC (and gas) behaviour in compliance with the documented ABI
> > > by removing the #undef DBX_REGISTER_NUMBER and changing gas's
> > > md_reg_eh_frame_to_debug_frame to the original implementation from
> > > Jakub's patch. That would make GDB work well on new files, but
> > > there are a large number of binaries out there where we continue
> > > to have the same behaviour as today ...
> > >
> > > 2. Leave GCC and gas as-is and modify GDB to expect GCC numbering in
> > > .dwarf_frame, except for the condition code register. This would
> > > break debugging of files built with GCC 4.0 and 4.1 unless we
> > > want to add a special hack for that.
> > >
> > > 3. Like 2., but remove the condition code hack: simply use identical
> > > numbers in .eh_frame and .dwarf_frame. This would make PowerPC
> > > like other Linux platforms in that respect.
> > >
> > > Thoughts?
> >
> > What do other compilers (in particular XLC) do? From a GDB standpoint
> > it would be a major PITA if different compilers would use different
> > encodings for .dwarf_frame.
>
> In my tests XLC (version 12.1 on Linux) seems to consistently use the
> GCC register numbering in both .eh_frame and .dwarf_frame. LLVM also
> consistently uses the GCC register numbering. Looks like this would
> be another argument for variant 3 ...
Probably. Certainly the most practical solution. Although I'd say
that the fact that people have been able to live with the non-matching
register numbering schemes for so many years means that variant 1
wouldn't hurt people too badly. It's a bit of a shame that on one of
the few architectures that bothered to provide a definition of the
DWARF register numbers we wouldn't use it :(.
More information about the Gdb-patches
mailing list