Skip to content

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:

  1. build Kate according to this tutorial
  2. install Qt-Creator (in my case this is version 2.0.0)

Setup the Kate project Qt-Creator once like this

  1. start Qt-Creator like this (important to get all environment variables right):
    ~/kde/run.sh qtcreator
  2. invoke File > Open File or Project and choose ~/kde/kate/CMakeLists.txt
  3. Build Location: choose ~/kde/build
  4. Run CMake arguments: type
    ../kate -DCMAKE_BUILD_TYPE=debugfull -DCMAKE_INSTALL_PREFIX=~/kde/usr
  5. click the button “Run CMake” and then “Finish”

Start debugging like this

  1. click the (C) “hammer” icon button on the very bottom left to compile Kate
  2. click the (B) “computer” icon button and choose “kate” (or “kwrite”) in the Run combo box
  3. choose the (A) “Debug” icon in the left pane
  4. invoke “Debug > Start Debugging (F5)”, now Kate starts
  5. open part/document/katedocument.cpp in the file tree view on the left
  6. go to the line “KateDocument::insertText” and click “Debug > Toggle Breakpoint (F9)”
  7. now if you type a character in Kate, Qt-Crator will halt in KateDocument::insertText
  8. chose “Debug > Step Opver (F10)” (and “Debug > Stip Into (F11)”) to step through the code
  9. click on “Locals and Watchers” in the debugging pane on the bottom and you see the values of local variables

Happy debugging! :)