Sorry you're not finding it to just work. Firstly I've never gotten this to work correctly with symbols unless I have the source and binary at the debugger side; where you run gdb; and then on the target obviously have the binary.
Figuring that to be fair I haven't done this in years, I just gave it a try; albeit all on a local machine. And it worked great. I was able to set a breakpoint and hit that but I also saw different information from what you saw as far as the condition of the remote process; it said it was running so I had to continue. Here's how it went:
The program:
Code:
#include <stdio.h>
void main(void)
{
char *s = "Hello World";
printf("The address of string s is %p\n", s);
}
Compiling:
Code:
gcc -o test -ggdb test.c
Running gdbserver:
Code:
gdbserver host:9876 test
Process test created; pid = 11231
Listening on port 9876
In other window, my remote debugger
Running GDB
Code:
gdb
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) target remote 127.0.0.1:9876
Remote debugging using 127.0.0.1:9876
warning: Could not load vsyscall page because no executable was specified
try using the "file" command first.
0xb77fc850 in ?? ()
Loading the symbols:
Code:
(gdb) symbol-file test
Reading symbols from /home/certus/testcode/test...done.
Setting breakpoint at the printf statement:
Code:
(gdb) b test.c:6
Breakpoint 1 at 0x80483f5: file test.c, line 6.
I tried to run and learned that it didn't support it:
Code:
(gdb) run
The "remote" target does not support "run". Try "help target" or "continue".
So I chose "continue":
Code:
(gdb) c
Continuing.
It hit the breakpoint. That's all I needed to see and so I quit:
Code:
Breakpoint 1, main () at test.c:6
6 printf("The address of string s is %p\n", s);
(gdb) quit
A debugging session is active.
Inferior 1 [Remote target] will be killed.
Quit anyway? (y or n) y
Back at the server
It detects that a remote session has started:
Code:
Remote debugging from host 127.0.0.1
Once the remote session is done, it exits:
Code:
Killing all inferiors
So, try this locally with just your machine you are trying to run debugging from and try it locally on your target in the same fashion. Something is missing or incorrect here, it does work.