This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: Powerpc disassembly and gdb breakpoints


On Tue, May 13, 2008 at 10:44:03PM -0400, Daniel Jacobowitz wrote:
> On Wed, May 14, 2008 at 11:50:43AM +0930, Alan Modra wrote:
> > +	     Solving (a) could be done by code scanning, but older
> > +	     ppc64 binaries used different stubs to current code.
> > +	     (b) is the tricky one since you need to known the toc
> > +	     pointer for at least one function that uses a pic stub to
> > +	     be able to calculate the plt address referenced.
> > +	     (c) means gdb would need to set multiple breakpoints (or
> > +	     find the glink branch itself) when setting breakpoints
> > +	     for pending shared library loads.  */
> 
> FYI, (c) is already solved.  The others I can't help you with :-)

Oh well, at least that is one problem I don't need to worry about.  :)

The best idea I've had to solve the others is to insert stub symbols
into the disassembler on the fly.  A stub call typically looks like:

    1000a148:   4b ff 7c d1     bl      10001e18 <._init+0x30>
    1000a14c:   e8 41 00 28     ld      r2,40(r1)

ie. you have a call to some previous symbol plus an offset.  The
non-zero offset is a clue that a stub might be involved, so the
disassembler would match the call destination against known plt call
stubs, and find the .opd entry for the current function being
disassembled.  The .opd entry specifies r2 for the current function,
so you can then look up the plt entry relocation, and hence the real
function being called.

-- 
Alan Modra
Australia Development Lab, IBM


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