[patch] Fixes problem setting breakpoint in dynamic loader

PAUL GILLIAM pgilliam@us.ibm.com
Thu May 25 22:58:00 GMT 2006


On Wed, 2006-05-24 at 22:26 -0400, Daniel Jacobowitz wrote:
> On Wed, May 24, 2006 at 04:26:11PM -0700, PAUL GILLIAM wrote:
> > +	      interp_sect = bfd_get_section_by_name (tmp_bfd, ".plt");
> 
> > +	      interp_sect = bfd_get_section_by_name (tmp_bfd, ".opd");
> 
> Magic names...

These aren't magic: they are common to all 64-bit ELF ABIs.  Well, ok:
maybe they're enchanted.

> 
> > +	  if (interp_sect != 0)
> > +	    {
> > +	      /* Try to convert the function descriptor we found above, into
> > +		 the address we need.  It will be relocated below by adding
> > +		 "load_addr" to it. */
> > +	      char *buf = alloca (sizeof (LONGEST));
> > +	      if (bfd_get_section_contents (tmp_bfd, interp_sect, buf,
> > +					    sym_addr - sect_offset,
> > +					    sizeof (LONGEST)))
> > +		sym_addr = extract_unsigned_integer (buf, sizeof (LONGEST));
> > +	      else
> > +		sym_addr = 0;
> > +	    }
> > +        }
> > +
> 
> ... and a magic load; you have no idea what the format of a function
> descriptor is, at this point.
> 
uffda!  I'm afraid I was just a little bit ppc64-centric.

> Can you make convert_from_func_ptr_addr do what you need?  It needs a
> target_ops; conveniently you've got one (tmp_bfd_target).  Some targets
> use a memory read function which honors the supplied target_ops, others
> don't.  rs6000's doesn't so you'd need to fix that.
> 

Yes! Thank you: "gdbarch_convert_from_func_ptr_addr()" does exactly what
I want.  And while it's true that "rs6000_convert_from_func_ptr_addr()"
does not use the target_ops, "ppc64_linux_convert_from_func_ptr_addr()"
does and that is the version that is invoked on the configuration
reporting the error I am trying to fix.

I went ahead and converted "rs6000_convert_from_func_ptr_addr()" to use
target_ops, but because I have no way to test the change, I thought it
best to make it a separate patch.

So is it OK to commit the solib-svr4.c patch?

Does anyone want to test the rs6000-tdep.c patch and commit it?

-=# Paul #=-

PS:  Uffda is the word a Swed would exclaim when examining the bottom of
their shoe after stepping in a fresh cow-pie or after a similarly
annoying event.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: loader_break.diff
Type: text/x-patch
Size: 3280 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20060525/c4f93575/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rs6000.diff
Type: text/x-patch
Size: 1286 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20060525/c4f93575/attachment-0001.bin>


More information about the Gdb-patches mailing list