LKBEN11143: Howto send debug commands to gdb when you are debugging with Qt creator
LKB | Created: 02/04/2020 | Version: 0 | Language: EN | Rating: 0 | Outdated: False | Marked for deletion: False
Author: Wim Peeters - Keskon GmbH & Co. KG
Symptom
You would like to send a direct command to the gdb debugger
Cause
none
Solution
Qt Creator is a nice IDE for writing c++ application with Qt. It has integrated debugging features and works as a front end for gdb. Although you have nice views and can see your variables, there are times where you would like to fall back to the gdb command line. One possibility is to use gdb from the command line although it is not needed.
The integrated view of Qt Creator can send gdb commands directly to the debugger! The left pane of the debugger can be used to send these commands by using Ctrl-Enter. So you can just type in your gdb command line command
e.g.
backtrace
to view your stack. When you type in Ctrl-Enter, the right pane will show you the gdb result. This is a very nice (almost unknown) feature of Qt Creator which can make life easier. Especially when you are dealing with a program which has been killed by the OS because of an access violation.
If there our commands that need to be executed each time the debugger is started, you can use a text file and enter it under Tools -> Options -> Debugger. Here you can configure the Gdb startup script.
About the Author
Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux in different European countries and different European languages. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform where he is one of the most important contributors and the main developer.