Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jim Ingham <jingham@apple.com>
To: Marc Khouzam <marc.khouzam@ericsson.com>
Cc: "André Pönitz" <apoenitz@trolltech.com>, gdb@sourceware.org
Subject: Re: MI varobj artificial fields
Date: Wed, 16 Apr 2008 18:51:00 -0000	[thread overview]
Message-ID: <18AEA6D3-19E5-460A-86FC-8B83FA809474@apple.com> (raw)
In-Reply-To: <6D19CA8D71C89C43A057926FE0D4ADAA04291077@ecamlmw720.eamcs.ericsson.se>

What we did at Apple was that we added a setting "set mi-show- 
protections" that "auto-opened" all public/protected/private  
children.  So if you have a class:

class Foo
{
   public:
     int first;
   protected:
     int second;
   private:
     int third;
}

-var-create - * mine
^ 
done 
,name 
= 
"var2 
",numchild 
= 
"3 
",type 
= 
"Foo 
",typecode 
= 
"STRUCT 
",dynamic_type 
= 
"",in_scope 
="true",block_start_addr="0x00001cfc",block_end_addr="0x00001d70"
(gdb)
-var-list-children var2
^done,numchild="3",children=[child={name="var2.public.first",exp="first",numchild="0",type="int",typecode="INT",dynamic_type=""},child={name="var2.private.third",exp="third",numchild="0",type="int",typecode="INT",dynamic_type=""},child={name="var2.protected.second",exp="second",numchild="0",type="int",typecode="INT",dynamic_type=""}]

So if you want you can still show the protections in the UI, but you  
don't have to add a separate step to open them up.  I don't see why  
the presence of "private" etc. really much matters in varobj child  
names that are after all only for machine consumption.  But it is  
annoying to have to go through two steps to see the contents.

Another thing we did was that if the class ONLY had public members  
then we automatically suppress the protections.  That avoids having  
"public" show up for:

struct foo
{
  ...
};

which was kind of dopey.

Jim

On Apr 16, 2008, at 9:26 AM, Marc Khouzam wrote:
>> Right now, when you're in C++ program and ask for children of a  
>> varobj
>> that has structure type, you don't the the fields. Instead, you get
>> "public", "private" and "protected" as chil dren.
>> [...]
>> So, I suggest to allow MI to optionally suppress those artificial  
>> fields.
>> Comments?
>
> I also think it is a good idea.
> I assume you mean for the private/public children to not be created  
> at all?
>
> That will be also good because children's name are now crowded with  
> those
> intermediate levels e.g., f.public.bar.private.x instead of f.bar.x
>
> As you say, this would be optional, so as to keep things backwards  
> compatible,
> right?
>
>> Should the access be an attribute of the each children, instead of
>> being children themselves?
>
> That seems good too.
> But I'm wondering if someone debugging has use of that knowledge?
> Isn't the visibility of fields only important up to compile time?
>
>
> BTW, Andre had brought this up a little while back:
> http://sourceware.org/ml/gdb-patches/2008-04/msg00004.html
>
>
> Marc


  reply	other threads:[~2008-04-16 18:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-16 16:27 Vladimir Prus
2008-04-16 18:06 ` Pedro Alves
2008-04-16 18:18 ` André Pönitz
2008-04-16 18:22   ` Marc Khouzam
2008-04-16 18:51     ` Jim Ingham [this message]
     [not found] <4806400B.7050905@qnx.com>
2008-04-16 19:16 ` Jim Ingham
2008-04-16 19:22   ` Daniel Jacobowitz
2008-04-16 19:34     ` Jim Ingham
2008-04-16 22:05       ` Pedro Alves
2008-04-18 10:22         ` André Pönitz

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=18AEA6D3-19E5-460A-86FC-8B83FA809474@apple.com \
    --to=jingham@apple.com \
    --cc=apoenitz@trolltech.com \
    --cc=gdb@sourceware.org \
    --cc=marc.khouzam@ericsson.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