Re: [ARM] dlopen and remote debugging

Matthew Gretton-Dann
2010-06-25T12:47:59Z

Karthik,

On Thu, 2010-06-24 at 23:42 +0530, karthikeyan.s wrote:
> Hi,
> We recently encountered an issue with gdb wherein it does not get the
> symbols from a shared library when loaded with dlopen. The following
> steps does not give us the shared library's symbols. The binary is
> Xorg.
>
> 1)
> <target> gdbserver :10000 /usr/bin/X -ac
> <host gdb> set sysroot <targetfs_path>
> <host gdb> target remote 10.0.0.3:10000
> <host gdb> continue
> <host> cntrl-C
> We do not get the library's symbols here. But with cat
> /proc/{x_pid}/maps we can see the library is loaded in memory.
>
> 2) But with the following steps, the libraries get loaded
> <target> /usr/bin/X -ac &
> <target> gdbserver :10000 --attach <X_pid>
> <host gdb> set sysroot <targetfs_path>
> <host gdb> target remote 10.0.0.3:10000
>
> We can see the library's symbols and hit breakpoint, debug etc. etc.
>

Section 20.3.2 of the gdb manual says that you need to load the symbols
for your application using the file command before you connect (see
http://sourceware.org/gdb/download/onlinedocs/gdb/Server.html#Server).
Can you try this, and report back if you are still having problems?

I would imagine the commands to your host gdb would be something like:
(gdb) set sysroot <targetfs_path>
(gdb) file <program_being_debugged>
(gdb) target remote 10.0.0.3:10000
(gdb) continue

Thanks,

Matt

--
Matthew Gretton-Dann
Principal Engineer - PDSW Tools
ARM Ltd