Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jason Molenda <jmolenda@apple.com>
To: sliwa@euv-frankfurt-o.de
Cc: gdb@sources.redhat.com
Subject: Re: STL containers
Date: Thu, 15 Jul 2004 19:49:00 -0000	[thread overview]
Message-ID: <7B90E592-D696-11D8-BBF3-000A9569836A@apple.com> (raw)
In-Reply-To: <27560.62.255.64.4.1089918318.squirrel@webmail.euv-frankfurt-o.de>


On Jul 15, 2004, at 12:05 PM, Przemyslaw Sliwa wrote:

> Is it possible to display a content of the STL containers by gdb?

In the Apple integrated development environment (Xcode), we handled 
this in two ways.  One, we added a "print for debugger" class to many 
of the standard Objective-C classes, and two, our UI has a "custom data 
formatters" feature.

For objects supporting the "print for debugger" method, we have a 
"print-object" or "po" command in gdb which invokes taht method on a 
given object.  The print for debugger methods prints the object's 
contents to stdout in some human-meaningful way.

For the custom data formatters, our debugger UI comes with a bunch of 
pre-canned formatters.  For a simple structure, like a structure that 
represents the height and width of a rectangle (with structure data 
member names "height" and "width"), you'd write width=%width%, 
height=%height%, and in the UI the variable summary field looks like 
"width=100, height=150".  gdb is just grabbing the children of a varobj 
- very fast.

The custom data formatters also allow you to make inferior function 
calls to extract information from objects that don't have a simple 
representation.  We provide these custom data formatters for the main 
classes in our graphics frameworks.  We don't provide them for STL yet, 
but the point of this feature was that it'll be easy to add them for 
STL classes in the future as well.  (and users can easily write their 
own custom data formatters for STL or their own classes).

Unfortunately I don't think either of these approaches will help you 
much.  The "print for debugger" method requires collaboration with the 
library provider.  The "custom data formatters" method requires a lot 
of work in a debugger UI sitting above gdb.  I don't think it makes 
much sense to try to put these kinds of facilities directly inside gdb, 
but that's just MHO.

(in case anyone is wondering, yes, having lots of custom data 
formatters doing inferior function calls does slow down stepping speed. 
  They are easily disabled in the UI and we encourage people to do so 
when they've got too many locals being formatted at each step.)


J


  reply	other threads:[~2004-07-15 19:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-15 19:38 Przemyslaw Sliwa
2004-07-15 19:49 ` Jason Molenda [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-07-15 19:05 Przemyslaw Sliwa

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=7B90E592-D696-11D8-BBF3-000A9569836A@apple.com \
    --to=jmolenda@apple.com \
    --cc=gdb@sources.redhat.com \
    --cc=sliwa@euv-frankfurt-o.de \
    /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