[Qt-creator] Writing a Debugging Helper

André Pönitz apoenitz at t-online.de
Sun Jan 24 22:31:37 CET 2021


On Sun, Jan 24, 2021 at 09:49:51PM +0100, Björn Schäpers wrote:
> Hi,
> 
> I've tried to create a debugging helper, I've looked into
> https://doc.qt.io/qtcreator/creator-debugging-helpers.html but I have a
> problem.
> 
> I've basically:
> def qdump__Std__Vector(d, value):
>     d.putItem(value.members(True)[0])
> 
> this goes through two other helpers until it lands on std::vector. But when
> I debug the helpers seem not to be used, although the file is loaded
> (verified in the debugger log). But when I reload all the helpers from the
> context menu of the log it is used.
> 
> Two side notes:
> 1. Before the reload a std::vector states its size and capacity in the
> value, afterwards not anymore.

If that is something like 

  "std::vector of length 3, capacity 4 = {0, 1, 2}"

then you see the result of gdb's (or libstdc++'s...) pretty printers,
not the result of Qt Creator's.

This is not the default setup.

> 2. Directly calling qdump__std__vector(d, value) does not seem to work, but
> shouldn't it? My Std::Vector is a fancy wrapper around a std::vector, it has
> some additional base classes to add some methods, but no additional data.
 
Putting 

 def qdump__Std__Vector(d, value):
     qdump__std__vector(d, value)

in stdtypes.py should work if qdump__std__vector works (i.e. in the default
setup)

You can try putting your function in there for starters. For other locations,
it depends on your exact setup.

> Do I do something wrong? Is this a bug, and I should file a report? I can
> provide a full debugger log.

Feel free to.

Andre'


More information about the Qt-creator mailing list