This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


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

Re: GDB and shared libraries




Andrew Cagney wrote:

> > Ok,  what do I need to add (commands, data, etc.) to my gdb server to trace into these libraries?  Is the spec written
> > down?
>
> Just FYI.
>
> Most shared library implementations can, in theory, be debugged remotely
> without any modifications to the GDB remote protocol.  This is because
> the SHLIBs are handled using only memory read/writes and breakpoints.
>
> The ``exercise left to the reader'' is getting what was native-only
> SHLIB code re-written in a way that is host independant.

>From what I have been told and from looking at the spec it appears that I may have what I need already implemented as far as
the remote protocol is concerned (unless I missed something).  BTW, thanks kevin for your help.

Now here is an example that will go along with my question that hopefully will explain why I am so confused.  Remember I am
running
on target=powerpc-motorola-elf   and host = i686-cygwin-pe (this means that gdb is the insight version 5.0).

On the target I have the application testapp.exe and the library libtestlib.so.  When the OS loads testapp.exe and
libtestlib.so it does the fixups and (since we wrote the OS and the gdbserver) we can see the elf headers for both files.
We also currently can debug testapp.exe itself.

Now, the function main() has a call to lib1Func()  which is defined inside of libtestlib.so.  I would like to trace into
that function.

Questions:
     1)  In the protocol   http://sources.redhat.com/gdb/onlinedocs/gdb_14.html#SEC120  I don't see a way to pass back the
fixup results that the loader performed.
          Don't I need to do that?

     2) When I step into the function, lib1Func(), how does the gdbserver tell gdb that it needs to load the symbol table
from the file libtestlib.so?

sps




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