I am trying to use gdbserver...
I have an application with binary path /user/bin/foo
running with pid 19767
.
Started the gdbserver on remote:
gdbserver --remote-debug --multi 0:12347
Started gdb on client and connected it to remove server
target extended-remote 192.168.1.84:12347
Attached gdb on pid
attach 19767
It shows:
warning: Could not load vsyscall page because no executable was specified
try using the "file" command first.
0x00007f207550043c in ?? ()
Also, current thread information it is showing is incorrect. Like info threads shows 1 thread , but my app has 10 threads-
(gdb) info threads
* 1 Thread 19767.19767 0x00007f207550043c in ?? ()
How can I ask gdb to load symbol from remote file /user/bin/foo
? How to make it show correct info?
] gdbserver is a control program for Unix-like systems, which allows you to connect your program with a remote GDB via target remote ---but without linking in the usual debugging stub. gdbserver is not a complete replacement for the debugging stubs, because it requires essentially the same operating-system facilities that GDB itself does.
The program can be stripped to save space if needed, as GDBserver doesn’t care about symbols. All symbol handling is taken care of by the GDB running on the host system. To use the server, you log on to the target system, and run the ‘gdbserver’ program.
Implementing a remote stub The stub files provided with GDB implement the target side of the communication protocol, and the GDB side is implemented in the GDB source file `remote.c'. Normally, you can simply allow these subroutines to communicate, and ignore the details.
Go to the first, previous, next, lastsection, table of contents. Debugging remote programs Connecting to a remote target On the GDB host machine, you will need an unstripped copy of your program, since GDB needs symobl and debugging information. Start up GDB as usual, using the name of the local copy of your program as the first argument.
How can I ask gdb to load symbol from remote file /user/bin/foo
You can't. Copy remote /usr/bin/foo
locally (or mount the filesystem it's on), and then invoke gdb like this: gdb /path/to/copy/of/foo
, or just use the file
command.
As of gdb 7.10, you can use
set sysroot target:
to make gdb retrieve files from the remote filesystem. See https://sourceware.org/gdb/onlinedocs/gdb/Files.html#Files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With