PDA

View Full Version : Debugging with gdb



SteM
8th August 2007, 14:05
Hi all,
i need to setup a remote debug session of a QT application.
Since i have some problems i started with a local debugging using gdb ./app + run. This was ok.
Then i used two shells in which i launched gdbserver in the first one and gdb in the second one.

gdbserver:

[root@centos-sd seashell]# gdbserver :2345 ./seadragonshellapp
Process ./seadragonshellapp created; pid = 7063
Listening on port 2345
Remote debugging from host 127.0.0.1

gdb:

(gdb) target remote :2345
Remote debugging using :2345
0x0097f7c0 in ?? ()
(gdb) list
No symbol table is loaded. Use the "file" command.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) n
Program not restarted.
(gdb) start
No symbol table loaded. Use the "file" command.
(gdb)

I don't understand why since the project is the same :confused:
Any known problem on gdbserver?

Thanks

jacek
9th August 2007, 00:02
Try:
gdb ./seadragonshellapp
(gdb) target remote :2345
(gdb) cont
or use file command as gdb suggests.

SteM
9th August 2007, 11:25
Thanks!
Yes, this works but again i don't have the symbols.

If i type 'file executable' the gdb kills the current session and loads the symbols (but when i will be in remote environment??) but the gdbserver exits :confused:
If i re-run the server gdb shows me the source correctly.
Is there a way to avoid all this operations on them and launch a complete debugging session?

If i should be in a real remote debugging session, the gdb have to see the executable loaded on the target? So, both of them have to see the executable?

Thanks a lot!

SteM
9th August 2007, 11:39
I'm trying to debug using Eclipse environment.
This seems to be good, the environment switch to Debug prespective, i can view the source code but when run the line:
QApplication app(argc, argv);
the application exits with the messages in the console view:


seashell: cannot connect to X server

Child exited with retcode = 1

Child exited with status 1
GDBserver exiting
logout


How can i debug a graphical QT aplication with gdb/gdbserver?
Do i need some extra settings?

Thanks again !!

jacek
9th August 2007, 14:40
Yes, this works but again i don't have the symbols.

If i type 'file executable' the gdb kills the current session and loads the symbols (but when i will be in remote environment??) but the gdbserver exits
Did you pass the path to the executable as a parameter when you started gdb? Like this:
gdb ./seadragonshellapp
(gdb) target remote :2345
(gdb) cont
You can also try:
gdb
(gdb) file ./seadragonshellapp
(gdb) target remote :2345
(gdb) cont



seashell: cannot connect to X server
I've never tried to debug a C++ application in Eclipse, but maybe it's a matter of invoking xhost with proper parameter? Maybe there's something in the logs?