From: Nick Roberts <nickrob@snap.net.nz>
To: Vladimir Prus <ghost@cs.msu.su>
Cc: gdb@sources.redhat.com
Subject: Re: Variable objects and STL containers
Date: Sun, 10 Feb 2008 21:02:00 -0000 [thread overview]
Message-ID: <18351.26207.310382.539746@kahikatea.snap.net.nz> (raw)
In-Reply-To: <200802101010.49506.ghost@cs.msu.su>
> > > I anticipate that -var-update will:
> > >
> > > 1. Create new children, and report them.
> > > 2. Report children that are now gone, possibly deleting them.
> >
> > That sounds sensible. Discussion on the gcc mailing list suggested that
> > this should all be done in GDB, i.e., in C. I will explore that
> > possibility.
>
> Please note that I already have proof-of-concept Python integration,
> together with code to use Python for -var-evaluate-expression, together
> with not-yet-working patch to dynamically compute the list of varobj children.
> It might be better to wait till I got the last bit done.
Will the Python integration be self contained or does it require separate
libraries? Will it restrict the number of platforms that GDB builds on?
In any case, there seem to be two projects here: Python integration and the
display of STL containers using variable objects. It's not clear to me that
the former is necessary for the latter.
Below is just a quick sketch of the thoughts I have, which may or may not be
sensible.
In the case of vectors, var->num_children would be computed from n =
v._M_impl._M_finish - v._M_impl._M_start and the children would be created from
*(v._M_impl._M_start+1), *(v._M_impl._M_start+2), ...*(v._M_impl._M_start+n).
I guess a special variable object would need to be created for n and when it
was reported as changed bt -var-update, new/old variable objects could
accordingly be created/deleted.
--
Nick http://www.inet.net.nz/~nickrob
*** mi-cmd-var.c.~1.45.~ 2008-01-30 21:35:45.000000000 +1300
--- mi-cmd-var.c 2008-02-11 09:42:05.000000000 +1300
*************** mi_cmd_var_list_children (char *command,
*** 361,366 ****
--- 361,369 ----
int numchild;
enum print_values print_values;
int ix;
+ struct expression *expr;
+ struct value *value;
+ char* stl_member;
if (argc != 1 && argc != 2)
error (_("mi_cmd_var_list_children: Usage: [PRINT_VALUES] NAME"));
*************** mi_cmd_var_list_children (char *command,
*** 373,379 ****
if (var == NULL)
error (_("Variable object not found"));
! children = varobj_list_children (var);
ui_out_field_int (uiout, "numchild", VEC_length (varobj_p, children));
if (argc == 2)
print_values = mi_parse_values_option (argv[0]);
--- 376,390 ----
if (var == NULL)
error (_("Variable object not found"));
! stl_member = xstrprintf ("%s._M_impl", varobj_get_expression (var));
! expr = parse_expression (stl_member);
! if (gdb_evaluate_expression (expr, &value))
! // TODO: List children according to STL container.
! children = varobj_list_stl_children (var);
! else
! children = varobj_list_children (var);
! xfree (stl_member);
!
ui_out_field_int (uiout, "numchild", VEC_length (varobj_p, children));
if (argc == 2)
print_values = mi_parse_values_option (argv[0]);
next prev parent reply other threads:[~2008-02-10 21:02 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-05 6:01 Nick Roberts
2008-02-05 6:17 ` Vladimir Prus
2008-02-05 6:34 ` Nick Roberts
2008-02-05 6:56 ` Vladimir Prus
2008-02-05 13:16 ` Daniel Jacobowitz
2008-02-15 9:24 ` Nick Roberts
2008-02-17 0:19 ` Nick Roberts
2008-02-17 7:14 ` Vladimir Prus
2008-02-17 19:55 ` Nick Roberts
2008-02-18 8:12 ` Vladimir Prus
2008-02-19 16:31 ` Daniel Jacobowitz
2008-02-05 11:31 ` Mark Kettenis
2008-02-05 12:03 ` Vladimir Prus
2008-02-05 13:18 ` Daniel Jacobowitz
2008-02-08 0:53 ` Nick Roberts
2008-02-08 6:47 ` Vladimir Prus
2008-02-10 4:28 ` Nick Roberts
2008-02-10 7:11 ` Vladimir Prus
2008-02-10 17:52 ` Daniel Jacobowitz
2008-02-10 18:14 ` Vladimir Prus
2008-02-10 19:45 ` Doug Evans
2008-02-10 19:44 ` Doug Evans
2008-02-10 20:05 ` Vladimir Prus
2008-02-10 21:02 ` Nick Roberts [this message]
2008-02-11 9:12 ` Vladimir Prus
2008-02-11 13:07 ` Daniel Jacobowitz
2008-02-11 20:28 ` Nick Roberts
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=18351.26207.310382.539746@kahikatea.snap.net.nz \
--to=nickrob@snap.net.nz \
--cc=gdb@sources.redhat.com \
--cc=ghost@cs.msu.su \
/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