Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jason Molenda <jmolenda@apple.com>
To: Michael Elizabeth Chastain <mec@shout.net>
Cc: carlton@math.stanford.edu, drow@mvista.com, gdb@sources.redhat.com
Subject: Re: [rfc] xfailed tests in gdb.c++/classes.exp
Date: Fri, 28 Feb 2003 20:58:00 -0000	[thread overview]
Message-ID: <2CD1C12F-4B5F-11D7-B016-003065BC3540@apple.com> (raw)
In-Reply-To: <200302280351.h1S3p6525237@duracef.shout.net>

I like to pull mail threads utterly off-topic whenever possible:

On Thursday, February 27, 2003, at 07:51  PM, Michael Elizabeth 
Chastain wrote:

> If you look in gnats, you will see users complaining that they can't
> print their string variables (because C++ strings are implemented with
> layers of templates and derived classes).  They are complaining that
> operator overloading doesn't work.  They are complaining that they have
> a std::vector<Foo> and they can't even look inside the damn thing.

We have the same problem here at Apple, introspecting objects.  As a 
convention, many of the standard Cocoa Objective C classes include a 
"NSPrintForDebugger" member function which can print the object in some 
way that is meaningful to the developer.  We have a gdb command, 
"print-object" or "po" which does an inferior function call into this.  
In the GUI, we let users right-click on locals et al and do this 
command.  It's not fancy/seamless/beautiful, but it is enough for users 
to do what they need.  It does depend on support from the class 
libraries, obviously.

That's still not ideal - your Locals window still shows a bunch of 
variables with raw pointers instead of the strings they contain.  Rab 
Hagy added a feature last summer to display these objects as strings 
when using the ProjectBuilder GUI.  He added a solib that is loaded 
into the inferior to provide some object introspection functions in the 
inferior executable, and at a stop he determines if an object is an 
NSString class or inherited from that class, and then gets the 
formatted version of that text.

This approach is very expensive (making an inferior function call for 
each local object for each step) so we'll surely need to refine it in 
the future, but it's a step in the right direction.


Well, Rab could provide better details on what he did and where he sees 
this going (I was utterly uninvolved), but we're looking at these same 
problems here at Apple.  We haven't cracked into the C++ library yet, 
but the problems are of a similar sort.

J


  parent reply	other threads:[~2003-02-28 20:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-28  3:51 Michael Elizabeth Chastain
2003-02-28  3:59 ` Daniel Jacobowitz
2003-02-28 13:40   ` Paul Koning
2003-02-28 20:58 ` Jason Molenda [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-02-28  5:01 Michael Elizabeth Chastain
2003-02-28 15:15 ` Daniel Jacobowitz
2003-02-28 17:58   ` David Carlton
2003-01-03 23:27 Michael Elizabeth Chastain
2003-01-03 22:53 David Carlton
2003-02-28  1:30 ` Daniel Jacobowitz

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=2CD1C12F-4B5F-11D7-B016-003065BC3540@apple.com \
    --to=jmolenda@apple.com \
    --cc=carlton@math.stanford.edu \
    --cc=drow@mvista.com \
    --cc=gdb@sources.redhat.com \
    --cc=mec@shout.net \
    /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