This is the mail archive of the 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: Cross solib support; viable at all?

On Wed, Nov 07, 2001 at 03:24:03PM +0100, Orjan Friberg wrote:
> Sorry for repeating the question, but I thought it might be necessary to
> ask this question on a higher level.  My target is running Linux
> 2.4(.12), with shared libraries (glibc 2.2.3-ish), and debugging is done
> via a gdbserver.  I would like gdb to automatically load so-files when
> they are opened, and whatever else might happen when run in a host
> environment.
> Reading the lengthy comment preceding enable_break in solib-svr4.c, I
> understand that gdb must be able to put a breakpoint in the linker to
> intercept the loading and unloading of shared libraries.  This obviously
> becomes a problem when the linker isn't run native.  Besides that, I
> need to tell gdb where it should fetch the libraries from, since it's
> not from /lib.  And I'm sure there are more issues to be resolved. 
> Question is, is this viable at all?  I'm thinking the remote protocol
> would need extensions to deal with this.

Nope, no extensions needed - for the way I generally do it.  I have a
target filesystem mounted at /opt/hardhat/devkit/mips/fp_le/target, and
I set "solib-absolute-prefix" to that path.  I also set
solib-search-path, although it isn't generally necessary, AFAICT.  Then
gdb can find the dynamic linker, based on the .interp section of the
binary we're opening and that sepecified prefix.

> Is there any target that has this functionality yet?  I was thinking
> mips-linux did, but I can't tell for sure from the code (and I don't
> have a machine to try it on).

(If you can't tell from above, yes, it does work).

> Until now, I've just read in the symbol tables manually in gdb by
> checking /proc/<pid>/maps for where the so-files are loaded and then
> adding the offset for the .text section.  Since I don't get the data
> section, I can't set breakpoints there, or debug a core dump that
> happened in the library.
> If it can't be done automatically for a cross environment, manually will
> do.  Is there a way to manually load so-files the way that they are done
> in a native environment?  The sharedlibrary command doesn't allow me to
> specify a file to load.

You ought to be able to use add-symbol-file for this.  But stick to the
above, if you can make it work.  See my other comment.

Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

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