public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "André Pönitz" <andre.poenitz@nokia.com>
To: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: automated cast to different data type possible?
Date: Tue, 24 May 2011 13:48:00 -0000	[thread overview]
Message-ID: <201105241550.00273.andre.poenitz@nokia.com> (raw)
In-Reply-To: <4DD15C6B.6080006@gmx.de>

On Monday 16 May 2011 19:18:35 ext Klaus Rudolph wrote:
> André Pönitz schrieb:
> 
> >> please give me an idea who is calling qdump_KRBase and what is parameter
> >> d? I actually have no idea how to add that to the printer script... or
> >> maybe any other python script to gdb.
> > 
> > The code would be called from a Python script that creates the full
> > display for an local variable including all expanded children in one go. 
> 
> Is there any interface defined for that purpose? Or you think that I
> should create a new gdb command? If I handle that from a new gdb
> command, there is really no problem, but that fits not in the
> integration to ddd without changing sources of it.

The necessary basic interface is gdb's python module, i.e.

  http://sourceware.org/gdb/current/onlinedocs/gdb/Python-API.html#Python-API

The script on top of that would be something similar to

  https://qt.gitorious.org/qt-creator/qt-creator/blobs/master/share/qtcreator/gdbmacros/dumper.py

This also contains definitions of convenience functions that uses that scheme.
Some example pretty-printer implementations using that scheme are in 

  https://qt.gitorious.org/qt-creator/qt-creator/blobs/master/share/qtcreator/gdbmacros/gdbmacros.py

The qdump__KRBase() function I mentioned is currently at the end of that file.

The main script produces gdb/MI-style output. I am not sure whether ddd 
can digest that, if not, producing "human readable" output by "fixing" the 
put*() methods in the Dumper class should be straightforward. 

> > 'd' is an object that accumulates output that's finally 'printed', and
> > takes care of properly closing nested items in case of exceptions.
> 
> Is there any description which can handle such idea? Maybe you already
> have such a solution finsihed?

I have, Qt Creator uses this approach. There are some hints on what it does 
and how it works (I wouldn't call it "documentation", though) at

  http://doc.qt.nokia.com/qtcreator-snapshot/creator-debugging-helpers.html

> Maybe there is also an official one but not known by me?

I don't think so.

Regards,
Andre'

      reply	other threads:[~2011-05-24 13:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-11  9:09 Klaus Rudolph
2011-05-11 21:00 ` Tom Tromey
2011-05-12  6:17   ` Klaus Rudolph
2011-05-12 16:06     ` Tom Tromey
2011-05-12 17:13       ` André Pönitz
2011-05-15 14:17         ` Klaus Rudolph
2011-05-16 11:43           ` André Pönitz
2011-05-16 17:15             ` Klaus Rudolph
2011-05-24 13:48               ` André Pönitz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201105241550.00273.andre.poenitz@nokia.com \
    --to=andre.poenitz@nokia.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).