Results 1 to 5 of 5

Thread: Debugging with gdb

  1. #1
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Debugging with gdb

    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:
    Qt Code:
    1. [root@centos-sd seashell]# gdbserver :2345 ./seadragonshellapp
    2. Process ./seadragonshellapp created; pid = 7063
    3. Listening on port 2345
    4. Remote debugging from host 127.0.0.1
    To copy to clipboard, switch view to plain text mode 

    gdb:
    Qt Code:
    1. (gdb) target remote :2345
    2. Remote debugging using :2345
    3. 0x0097f7c0 in ?? ()
    4. (gdb) list
    5. No symbol table is loaded. Use the "file" command.
    6. (gdb) run
    7. The program being debugged has been started already.
    8. Start it from the beginning? (y or n) n
    9. Program not restarted.
    10. (gdb) start
    11. No symbol table loaded. Use the "file" command.
    12. (gdb)
    To copy to clipboard, switch view to plain text mode 

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

    Thanks
    SteM

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Debugging with gdb

    Try:
    gdb ./seadragonshellapp
    (gdb) target remote :2345
    (gdb) cont
    or use file command as gdb suggests.

  3. The following user says thank you to jacek for this useful post:

    SteM (9th August 2007)

  4. #3
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Debugging with gdb

    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
    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

  5. #4
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Debugging with gdb

    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:

    Qt Code:
    1. seashell: cannot connect to X server
    2.  
    3. Child exited with retcode = 1
    4.  
    5. Child exited with status 1
    6. GDBserver exiting
    7. logout
    To copy to clipboard, switch view to plain text mode 


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

    Thanks again !!
    SteM

  6. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Debugging with gdb

    Quote Originally Posted by SteM View Post
    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

    Quote Originally Posted by SteM View Post
    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?

  7. The following user says thank you to jacek for this useful post:

    SteM (23rd August 2007)

Similar Threads

  1. Problem with SqLite and Qt
    By ad5xj in forum Newbie
    Replies: 26
    Last Post: 5th June 2007, 01:53
  2. Previous frame inner to this frame(corrupt stack?)
    By coralbird in forum Qt Programming
    Replies: 1
    Last Post: 28th May 2007, 01:35
  3. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  4. Debugging on Mac
    By rickbsgu in forum Qt Programming
    Replies: 3
    Last Post: 13th October 2006, 13:12
  5. problem with gdb debugging
    By bruce1007 in forum General Discussion
    Replies: 1
    Last Post: 3rd August 2006, 13:37

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.