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.0rc1)
Setup the Kate project Qt-Creator once like this
- start Qt-Creator: ~/kde/run.sh /path/to/qtcreator/bin/qtcreator
- invoke File > Open File or Project and choose ~/kde/kate/CMakeLists.txt
- Build Location: choose ~/kde/build
- Run CMake arguments: choose ../kate -DCMAKE_BUILD_TYPE=debugfull -DCMAKE_INSTALL_PREFIX=~/kde/usr
- click the button "Run CMake" and then "Finish"
Start debugging like this
- click the "hammer" icon button on the very bottom left to compile Kate
- click the "computer" icon button (3 icons above the hammer icon) and choose "kate" (or "kwrite") in the Run combo box
- choose the "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 :)
4 comments:
with qtcreator 1.3.1 and an a system installed kate it's a bit more complex than this.
you need to tell qtcreator the right paths for it not to use /usr/lib64/libkparts.so.4.4.0
I've just no idea how to do that though :p
git compiled kate is started from command line the with the following bash script:
export KATE_DIR=~/usr
export PATH=$KATE_DIR/bin:$PATH
export LD_LIBRARY_PATH=$KATE_DIR/lib:$LD_LIBRARY_PATH
export KDEDIR=$KATE_DIR
export KDEDIRS=$KDEDIR
export XDG_DATA_DIRS=$XDG_DATA_DIRS:$KATE_DIR/share
# update KDE's system configuration cache
kbuildsycoca4
# start app
kate $@
but you can start kate as an aeternal application and then attach to it later from Debug->Start Debugging->Attach to running exernal application
@vivo: if i undestand correctly, that's why you simply should start qt-crator already with the run.sh script:
~/kde/run.sh /path/to/qtcreator/bin/qtcreator
Now, qt-creator has automatically all paths set correctly out of the box.
@dhaumann oops
Post a Comment