This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: [7.0] PR/9174: gdb can't handle PIE
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: jan dot kratochvil at redhat dot com (Jan Kratochvil)
- Cc: thiago dot bauermann at gmail dot com (Thiago Jung Bauermann), gdb at sourceware dot org
- Date: Wed, 5 Aug 2009 20:30:57 +0200 (CEST)
- Subject: Re: [7.0] PR/9174: gdb can't handle PIE
Jan Kratochvil wrote:
> On Wed, 29 Jul 2009 22:40:54 +0200, Thiago Jung Bauermann wrote:
> > I just removed my name from the task in the subject in the wiki page for
> > GDB 7.0. The task consists of taking one of the two "competing" patches which
> > implement PIE support and herding it upstream, or implementing a third patch.
>
> It is questionable how much clean it should be.
>
> The right way would be to make all the GDB read-in symbols non-relocated and
> relocated by section_offsets/ANOFFSET only on each use.
>
> Currently the (Red Hat) PIE patch
> http://cvs.fedora.redhat.com/viewvc/rpms/gdb/devel/gdb-6.3-pie-20050110.patch?view=co
> does a needless reread of the symbol files when the executable gets its final
> in-memory address from solib_add() as it has been added there to the shared
> library list:
While having the symbols non-relocated might be a good idea in the long run,
even in the current setup it is certainly possible to relocate the main
objfile without rereading its symbols: use objfile_relocate. You might want
to have a look at the new solib-spu.c:spu_current_sos where I check whether
I'm seeing a relocated main executable for the first time, and call both
objfile_relocate and enable_breakpoints_after_startup at this point.
Looking at the current PIE patch, it seems to me that the various changes
related to avoiding calling breakpoint_re_set during startup are no longer
necessary: you're now using my version of bp_startup_disabled breakpoint,
and those can handle breakpoint_re_set properly. All the "mainline" flag
related changes in the PIE patch can probably just go away ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com