Debugging Kate with Qt Creator
Let’s have a quick look at how to debug Kate and KWrite with Qt Creator. First, make sure you meet the requirements:
- build Kate according to this tutorial
- install Qt-Creator (in my case this is version 2.0.0)
Setup the Kate project Qt-Creator once like this
- start Qt-Creator like this (important to get all environment variables right):
~/kde/run.sh qtcreator - invoke File > Open File or Project and choose ~/kde/kate/CMakeLists.txt
- Build Location: choose ~/kde/build
- Run CMake arguments: type
../kate -DCMAKE_BUILD_TYPE=debugfull -DCMAKE_INSTALL_PREFIX=~/kde/usr - click the button “Run CMake” and then “Finish”
Start debugging like this
- click the (C) “hammer” icon button on the very bottom left to compile Kate
- click the (B) “computer” icon button and choose “kate” (or “kwrite”) in the Run combo box
- choose the (A) “Debug” icon in the left pane
- invoke “Debug > Start Debugging (F5)”, now Kate starts
- open part/document/katedocument.cpp in the file tree view on the left
- go to the line “KateDocument::insertText” and click “Debug > Toggle Breakpoint (F9)”
- now if you type a character in Kate, Qt-Crator will halt in KateDocument::insertText
- chose “Debug > Step Opver (F10)” (and “Debug > Stip Into (F11)”) to step through the code
- click on “Locals and Watchers” in the debugging pane on the bottom and you see the values of local variables
Happy debugging! :)