[Qt-creator] Question about debugger

André Pönitz andre.poenitz at mathematik.tu-chemnitz.de
Wed May 16 02:08:05 CEST 2012

On Tue, May 15, 2012 at 11:46:29AM -0700, Mohammad Mirzadeh wrote:
> On Tue, May 15, 2012 at 2:08 AM, <andre.poenitz at nokia.com> wrote:
>     Mohammad Mirzadeh [mirzadeh at gmail.com]:
>     > 1) Is it possible to catch exceptions of specific type and leave the
>     rest?
>     Not directly. But you could probably tinker around with breaking on all
>     exception and installing a hook that issues a "continue" on exceptions
>     you are not interested in.
> thanks; um but how do I install that "hook" ?

One can use "define hook-stop ..." to install a "canned sequence" that is
called whenenve gdb stops. This could be a single command implemented in
python which examines the enviroment. 

I haven't tried myself yet, but I could have a look if you _really_ need it.

>     > 2) Is it possible to interact with the gdb session through a console or
>     something?
>     The "Debugger Log" view can handle some command. Either by using
>     the lineedit there, or typing/editing anywhere on the left ("input") pane
>     and sending the command using Ctrl-Return.
>     What kind of commands do you want to send?
> mainly calling functions. I have several objects that I like to view.

You can add "foo()" in the Expressions part of "Locals and Expressions"
(see context menu there, second item, or just double click in an empty
place in that view. The evaluates the function and puts the result in
the view, where it can be expanded etc as usual.

> example, is a simple container and right now I can only see the pointers.
> like to have functions inside a debug object that I can directly call
> and view the objects with.

This is usually better done with "data dumpers" for your class, see

Calling a function is comparatively slow, may modify the state of
the debugged program, and does not work on core files. It's sometimes
the last line of defense, but should be avoided if possible.

Displaying a container with pointer dereferenced should not even
need any special activity beyond checking the "Dereference Pointers
Automatically" action in the context menu of the "Locals and Expressions"


More information about the Qt-creator mailing list