Remote debugging problems [SOLVED]
Hi guys!
I am trying to remote debug applications on a server in my local network. Server: Code:
#uname -a Code:
#uname -a Code:
#gdbserver localhost:2345 CrossTest Code:
#gdb CrossTest But when I run gdbserver on the server and gdb on the workstation I get: Code:
Reading symbols from /home/john/dev/broaty/CrossTest/Debug/CrossTest...done. Any ideas? |
Set a breakpoint see if you hit that after you run. I think it is valid what it is telling you; which is that when you attach the process is running and that you have to reset it and run again.
I've done gdb to gdbserver and the sole reason for that is the server did not have an accessible console; the point being I never worried about printf() because whatever I was debugging on the server would write to a log file. I invoked gdbserver via ssh to my target. After all, if I have a keyboard and screen, then I don't need remote debugging; although I get that you're testing it to validate that it's working. Your case may be working, just that printf() is going somewhere else or stdout/stderr handles are not being shown on the default system console because you're not running that program from the system console, specifically. This is all why I suggest you set a breakpoint and see if you hit it. There were other arguments I used because my architecture had the target program running, so I had to specify a PID to attach too in my gdbserver line, much like one attaches to an already running process with a normal gdb session. |
I actually tried DDD before posting this. Setting a breakpoint and calling run does nothing.
Allso tried with eclipse (that is the end goal). It is as if the debugger goes to some inaccessible memory and gets itself lost. |
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> Code:
gcc -o test -ggdb test.c Code:
gdbserver host:9876 test Running GDB Code:
gdb Code:
(gdb) symbol-file test Code:
(gdb) b test.c:6 Code:
(gdb) run Code:
(gdb) c Code:
Breakpoint 1, main () at test.c:6 It detects that a remote session has started: Code:
Remote debugging from host 127.0.0.1 Code:
Killing all inferiors |
That works. Even compiled with g++ and -std=c++11.
I have tried both target remote (instead of extended-remot) and compiling with -ggdb. But not both at the same time. That is awesome. Thanks! |
All times are GMT -5. The time now is 11:47 PM. |