[Qt-creator] GDB Macros helper.
Andre Poenitz
andre.poenitz at mathematik.tu-chemnitz.de
Wed Nov 25 23:52:35 CET 2009
On Thu, Nov 26, 2009 at 01:35:09AM +0300, Rudenko Eugene wrote:
> > It loads a library into the address space of the debugged
> > applications using either LD_PRELOAD or dlopen/LoadLibraryA
> > and uses gdb's 'call' function to execute code in that
> > library. Communication is done via two buffer areas in the
> > injected library, with gdb being used to write to and
> > read from these buffers.
> >
> > Note that this approach is pretty fragile and I intend to
> > replace it rather sooner than later by using gdb's new
> > python based scripting, at least on Linux and Windows.
> > Mac and Symbian will probably stay as they are as long as
> > there is no python-enabled gdb available for them.
> >
> > You could start coding the helpers for your custom types
> > in the currently existing scheme, the python code needed
> > for the new approach will look pretty similar, so the
> > porting effort will be minimal.
>
> Thank you a lot for your answer.
> And Is there any inpormation about QDumper's API?
> At least I'm interesting about putItem, putHash, beginChildren methods
> and it's arguments format. Especially for "numchild", "exp" and all
> dumping mechanisms at all.
There is no documentation other than the code in gdbmacros.cpp
and gdbengine.cpp and the comments therein.
QT_NAMESPACE=xxx
name="NAME"
value="VALUE"
beginHash();
putItem("name", name);
putItem("value", value);
putItem("type", NS"QFoo");
putItem("numchild", "1");
endHash();
basically puts
{name="NAME",value="VALUE",type="xxx::QFoo",numchild="1"}
in the output buffer which will yield an entry like
[+] NAME VALUE TYPE
in the Locals and Watchers view. So basically each 'Hash' corresponds
to one tree row in L&W.
'numchild' could be considered a bool. If '0', the tree row won't be
expandible. 'exp' is for the really hard cases where you cannot give
a proper 'value' but only an expression how to get 'value'. This will
be evaluated by another rounbd trip through gdb's expression parser
(and therefore sometime need some funny quoting or dirty tricks).
> Also as was thinking before about dumping custom classes, It will be
> grade feature to build gdbmacroshelper not for every Qt build, but
> make opportunity to set project specific gdbhelper build with setting
> some defines to it to make specific dependence for every project.
That will be much easier once the python scripting is up and running.
Andre'
More information about the Qt-creator-old
mailing list