Does gdb understand copy relocation?

H. J. Lu hjl@lucon.org
Sun Aug 7 20:01:00 GMT 2005


On Sun, Aug 07, 2005 at 03:08:59PM -0400, Daniel Jacobowitz wrote:
> On Sun, Aug 07, 2005 at 08:12:16AM -0700, H. J. Lu wrote:
> > On targets with copy relocation, when executable references a data
> > symbol defined in DSO, a copy relocation will be used to copy the
> > definition from DSO to executable and the copy in executable will be
> > used by the process. But gdb I am using insists using the one in DSO.
> > Is there a way to teach gdb about copy relocation?
> 
> GDB does not know anything about symbol resolution at all.  It also
> does not use the relocations for much of anything, just the symbol
> tables.
> 
> I would have expected it to prefer the copy in the executable.  I'm a
> bit surprised if it didn't.

There is no DW_AT_location for copy relocated symbol. But the symbol
tables have

    84: 080ebbd0     4 OBJECT  GLOBAL DEFAULT   24 optarg@GLIBC_2.0
(2)
  2297: 080ebbd0     4 OBJECT  GLOBAL DEFAULT   24 optarg@@GLIBC_2.0

If I strip the binary, gdb seems to know the location of optarg. I
think gdb should consult symbol tables in executable if the debug
info doesn't have DW_AT_location.



H.J.



More information about the Gdb mailing list