Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Mo DeJong <supermo@bayarea.net>
Cc: gdb <gdb@sources.redhat.com>
Subject: Re: Problem with MI -var-evaluate-expression command
Date: Wed, 10 Jul 2002 17:31:00 -0000	[thread overview]
Message-ID: <Pine.GSO.4.33.0207101722060.12727-100000@makita.cygnus.com> (raw)
In-Reply-To: <20020710171957.5e657753.supermo@bayarea.net>

On Wed, 10 Jul 2002, Mo DeJong wrote:

> % cat S.c
> struct S {
>     int v1;
>     int v2;
> };
>
> -var-create svar * "(struct S *) 0x8049560"
> ^done,name="svar",numchild="2",type="struct S *"
> (gdb)
> -var-evaluate-expression svar
> ^done,value="0x8049560"
> (gdb)
> -var-evaluate-expression svar.v1
> &"Variable object not found\n"
> ^error,msg="Variable object not found"

How is a UI to know what the children of svar are? You do, because you're
a human, but a UI reacting programmatically could not automatically know
that svar has a child named "v1" _until_ it asks svar for its children
(thus creating the varobjs).

Remember, we're dealing with VARiable OBJects here. You cannot do anything
without a varobj.

Insight is the major client for this code right now. (In fact varobj was
originally written for Insight, but it appeared to be useful to someone
else, and it was added to MI.) Here's what Insight does:

Given the expression "svar" which is perhaps supplied by "info
locals", "-stack-list-locals", or from the user inputting it as a watch, a
UI would:

1) Create varobj for (the expression) "svar"
2) Ask the varobj for a display name and stuff this into a column of the
   display
3) Ask the varobj for its type and stuff that into a column
4) Ask the varobj for its value and stuff that into a column
5) Ask the varobj if it has any children. If it does, it puts a little "+"
   next to the name, so that the user can expand it.

Now, when the user hits the "+", Insight will ask the varobj for its
children. It gets back a list of varobjs. It then repeats steps 2-5 for
each of these new varobjs.

In practice, I think it works quite well, but I may be a little biased,
since I originally wrote varobj for Insight. ;-)

Keith



  reply	other threads:[~2002-07-11  0:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-10 17:15 Mo DeJong
2002-07-10 17:31 ` Keith Seitz [this message]
2002-07-11 12:13   ` Mo DeJong
2002-07-11 12:43     ` Keith Seitz
     [not found] <1026487389.32493.ezmlm@sources.redhat.com>
2002-07-12 11:30 ` Jim Ingham

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=Pine.GSO.4.33.0207101722060.12727-100000@makita.cygnus.com \
    --to=keiths@redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=supermo@bayarea.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