How to trouble shoot qt application on commad line using GDB
-
wrote on 29 Jan 2024, 10:42 last edited by
gdb programName
When i single step the application, control comes and stop it at a.exec().
After a.exec, i'm not able to run any GDB command's as GDB stopped at a.exec().I don't want to use Qt creator.
-
gdb programName
When i single step the application, control comes and stop it at a.exec().
After a.exec, i'm not able to run any GDB command's as GDB stopped at a.exec().I don't want to use Qt creator.
wrote on 29 Jan 2024, 11:33 last edited by JonB@Rajashekara-V
Yes, what else do you expect? It is not "stopped" ata.exec()
, rather it is running inside whatever that calls. And will continue to do so until you exit the Qt program. In the same way as it would if it were not a Qt program.You have two choices if you want to then "break into" the gdb debugger:
-
Put breakpoint(s) wherever. When they are hit execution should stop, you return to the gdb command prompt, and do whatever you like.
continue
, I think, is the command to issue when you want it to carry on running from where it got to. (Note: if you expect to step intoa.exec()
--- not a good idea --- you would need (a) Qt itself compiled for debug and (b) gdb to see Qt's source files.) -
Press the keyboard interrupt character at the gdb command prompt in the terminal, e.g. Ctrl+C. That should break into gdb. You might have to set something in gdb to allow it, and to allow it to continue without raising the interrupt signal when you are done, but again should be same as for non-Qt program. Be aware you will break somewhere deep inside the Qt event loop.
-
1/2