Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jim Ingham <jingham@apple.com>
To: gdb@sources.redhat.com
Subject: Re: casting in gdb
Date: Thu, 16 Jan 2003 18:53:00 -0000	[thread overview]
Message-ID: <C503193A-2983-11D7-9053-00039379E320@apple.com> (raw)
In-Reply-To: <1042721692.8268.ezmlm@sources.redhat.com>

David,

For ObjC, where getting to the real data of an object is sometimes 
highly non-trivial, we used method calls in the inferior.  We insert a 
shared library into the inferior process when we launch it.  This 
shared library has functions that produce a user-friendly view of the 
object passed to them and stuff it somewhere in inferior memory.  Then 
a client (PB in our case) can read out this memory and show that to the 
user.

However, for STL classes the job is a little easier, since you can 
mostly get what you want from presenting various members of the class 
(or one of its sub-classes), perhaps with appropriate casts.  For this 
case, we were planning to do something more like what Visual Studio or 
CodeWarrior do.  Both of these allow users to associate some custom 
printing description with a given type.  CW & VS use an XML description 
file giving what members to print - and what cast operation to apply to 
the members - for a given C++ type.  This is faster than the ObjC 
method, since it does not involve inferior function calls, so where it 
is possible to use something like this it is preferable.

We haven't gotten past the investigation of what CW & VC++ do, and I am 
not sure yet whether we will implement this in gdb, or let PB drive. So 
what we end up doing may or may not be interesting to the gdb 
community.  PB already has an XML parser, and the facilities to manage 
this sort of thing, so it is more natural for us to do it there.

Jim


On Thursday, January 16, 2003, at 04:54  AM, 
gdb-digest-help@sources.redhat.com wrote:

> On Sat, 14 Dec 2002 23:47:42 -0600, Michael Elizabeth Chastain 
> <mec@shout.net> said:
>
>> I'm playing with the idea that gdb should know more about the C++
>> standard library types, in the same spirit that gdb knows that a C
>> "char *" usually points to a string terminated with '\0'.  I would
>> like gdb to understood more about std::string, std::vector, std:map,
>> and so on.
>
> I was going through my old messages, and I noticed this one.  For what
> it's worth, Apple has implemented something like this for strings in
> Objective C, where they actually print out the string in question, and
> they say it works pretty well.  Apparently the implementation of
> strings is complicated enough that they really didn't want to tie it
> to the implementation; so GDB prints out Objective C strings by
> actually doing the method call.
>
> Of course, the above message was part of a thread that noted that, in
> C++, the appropriate methods might not be compiled in.  That's a real
> problem; I'm not sure what to do about that.
>
> David Carlton
> carlton@math.stanford.edu
>
--
Jim Ingham                                   jingham@apple.com
Developer Tools
Apple Computer


       reply	other threads:[~2003-01-16 18:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1042721692.8268.ezmlm@sources.redhat.com>
2003-01-16 18:53 ` Jim Ingham [this message]
2002-12-14 21:47 Michael Elizabeth Chastain
2002-12-14 22:48 ` Jacques Le Normand
2002-12-15  8:05 ` Daniel Jacobowitz
2003-01-15 18:47 ` David Carlton
  -- strict thread matches above, loose matches on Subject: below --
2002-12-14 19:49 Jacques Le Normand
2002-12-14 19:59 ` Daniel Jacobowitz
2002-11-20 12:22 dejagnu bemis
2002-11-20 20:37 ` dejagnu Andrew Cagney
2002-12-05 16:26   ` dejagnu Fernando Nasser
2002-12-05 16:58     ` dejagnu bemis
2002-12-05 17:08       ` dejagnu Fernando Nasser
2002-12-12 22:26         ` dejagnu Rob Savoye
2002-12-12 22:29           ` casting in gdb Jacques Le Normand
2002-12-13  7:33             ` *****SPAM***** " Daniel Berlin
2002-12-13  8:46               ` Daniel Jacobowitz
2002-12-13 11:43                 ` Jacques Le Normand
2002-12-13 23:34                   ` Daniel Jacobowitz
2002-12-14 11:55                     ` Daniel Berlin

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=C503193A-2983-11D7-9053-00039379E320@apple.com \
    --to=jingham@apple.com \
    --cc=gdb@sources.redhat.com \
    /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