How to load shared library symbols for remote source level debugging using gdb and gdbserver?

I have installed gdb and gdbserver on an ARM angstrom linux board (with external access) and I am trying to get source level debugging for a shared library running from my local machine. Currently, if I ssh into a device, I can run gdb and I can get everything including setting a breakpoint, hitting it, and doing a backtrace.

My problem occurs when I try to do the same with gdbserver and run gdb on my host machine to accomplish the same thing (after all, I want this to work in eclipse, but in gdb it is good enough for moment).

I notice that when I just use gdb on the server and run "info shared", it loads the symbol files correctly (syms read: yes for all), which I can then debug. I have been unable to do this remotely using a "symbol file" or "directory" or "shared". Obviously it sees the files, but I can't get it to load any symbols even when I specify the remote files directly. Any advice on what I can try next?

+3


source to share


2 answers


There are several different ways to do this, but it is typical for gdb to collect local files, not files from the server.

There are also several different ways to fix this, but the simplest is to do it before calling target remote

:

(gdb) set sysroot remote:

      



This tells gdb to fetch files from the remote system. If you have debug information in there (which I am gathering from your post that you are doing) then everything will work fine.

A common problem with this approach is that it requires copying data from the remote. It can be painful if you have a bad connection. In this case, you can save a copy of the data locally and specify sysroot in the copy. However, this requires some attention to event timing.

+2


source


First run before main

and then set solib-search-path .

Otherwise, gdbserver

stops in dynamic loader before libraries can be loaded. Read more: Debugging Shared Libraries with gdbserver



0


source







All Articles