The implementation relies on communicating with the default python debugger, pdb, which is shipped with python. It aims to nicely map all of pdb's features to buttons and tooltips / toolviews.
|kdev-python debugger in action
FeaturesKey features include:
- Step through code using the well-known "next", "continue", etc. buttons; KDevelop will automatically open up the source file you're currently stepping through
- Inspect the frame stack and switch between frames (toolview on the right in the above screenshot -- just click a frame to switch there)
- Set and remove breakpoints by clicking the left editor border, even while the application is running (requires extra work in plain pdb)
- A list with all local variables which is automatically updated (left toolview)
- Possibility to add custom expressions, which are automatically re-evaluated, like seen in the screenshot below
- Query the value of any expression in your code while the debugger is paused by moving the mouse over it (the value will be shown in a tooltip)
- Inspect frame stack and variables after your application crashed (i.e. threw an uncaught exception)
|Automatically evaluate custom expressions (top left)
How to use itAs always, this feature is available in the master branch of kdev-python (http://projects.kde.org/kdev-python). To use the debugger, configure a script launch for your application (Run - Configure launches, Add new, then select "Script Application" in the tree view on the left under "type"), then click the "Debug" button in the toolbar.
|Example launch configuration for using the debugger
Remaining issuesThere's a few things left which are currently missing or broken:
- Debugging is only supported for python 2.x applications. I will not support python 3.x before I switch to it completely (probably this summer).
- The display of the children of a variable is not optimal, it would greatly profit from heuristics about which items are important and which ones aren't (you usually don't want to inspect the __get__ method, do you).
- There's probably a few bugs left -- please report anything you find to bugs.kde.org.
- "Run to cursor" is not well written, i.e. will stop at breakpoints
- Breakpoint conditions are not supported, neither is disabling breakpoints (you can just remove them).
|Inspecing the frame stack of a crashed application