Remote GDB debugging

前端 未结 2 1913
借酒劲吻你
借酒劲吻你 2021-02-05 12:22

I\'ve just spent a whole day trying to find a way to enable GDB debugging from Qt Creator or Eclipse. I learned that there are basically two approaches to launch the target appl

相关标签:
2条回答
  • 2021-02-05 13:11

    So that GDB on your host (the machine you develop and compile on, so where you have Qt Creator) you have to give it access to the "symbol file".

    I usually don't use Qt Creator, but GDB and gdbserver directly for cross-compiled programs remote-debugging. You could maybe give this a try to be sure that this works for you and maybe then find the missing option in Qt Creator (or maybe this will help you find what is missing).

    On the target machine run:

    gdbserver :5000 yourprogram
    

    On the host machine, run gdb and then load the symbol file:

    (gdb) symbol-file yourprogram
    

    On GDB on the host machine, you then have to connect to connect GDB to the remote gdbserver:

    (gdb) target remote target_ip_address:5000
    

    From then you can use GDB on the host controlling the program on the target.

    I hope this helps!

    0 讨论(0)
  • 2021-02-05 13:18

    Due to peculiarities in our makefile build system the file references contained in the debugging symbols look like this:

    ../src/main.cpp
    ../../src/utils/logger.cpp
    

    This is no problem for GDB, but Qt Creator was unable to map these paths to the actual files. I was able to fix this by adding 'dir' statements in the GDB init file:

    dir src
    dir src/utils
    ...
    

    Now it works.

    0 讨论(0)
提交回复
热议问题