This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[python] add "dynamic" attribute
- From: Tom Tromey <tromey at redhat dot com>
- To: Project Archer <archer at sourceware dot org>
- Date: Thu, 10 Sep 2009 13:00:27 -0600
- Subject: [python] add "dynamic" attribute
- Reply-to: tromey at redhat dot com
I'm checking this in on the python branch.
This adds a "dynamic" attribute to varobj output.
Vladimir asked for this on the gdb list.
After this I plan to package up the varobj changes for upstreaming.
Tom
2009-09-10 Tom Tromey <tromey@redhat.com>
* mi/mi-cmd-var.c (print_varobj): Emit "dynamic" field.
(varobj_update_one): Likewise.
2009-09-10 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (GDB/MI Variable Objects): Mention 'dynamic'
attribute.
2009-09-10 Tom Tromey <tromey@redhat.com>
* gdb.python/python-mi.exp: Update.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 374d113..2adf43a 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -23860,6 +23860,11 @@ the thread's identifier.
@item has_more
For a dynamic varobj, this indicates whether there appear to be any
children available. For a non-dynamic varobj, this will be 0.
+
+@item dynamic
+This attribute will be present and have the value @samp{1} if the
+varobj is a dynamic varobj. If the varobj is not a dynamic varobj,
+then this attribute will not be present.
@end table
Typical output will look like this:
@@ -24270,6 +24275,11 @@ The display hint, if any.
This is an integer value, which will be 1 if there are more children
available outside the varobj's update range.
+@item dynamic
+This attribute will be present and have the value @samp{1} if the
+varobj is a dynamic varobj. If the varobj is not a dynamic varobj,
+then this attribute will not be present.
+
@item new_children
If new children were added to a dynamic varobj within the selected
update range (as set by @code{-var-set-update-range}), then they will
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 81d7e02..ede928c 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -79,6 +79,9 @@ print_varobj (struct varobj *var, enum print_values print_values,
if (varobj_get_frozen (var))
ui_out_field_int (uiout, "frozen", 1);
+
+ if (varobj_pretty_printed_p (var))
+ ui_out_field_int (uiout, "dynamic", 1);
}
/* VAROBJ operations */
@@ -759,6 +762,9 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
xfree (display_hint);
}
+ if (varobj_pretty_printed_p (var))
+ ui_out_field_int (uiout, "dynamic", 1);
+
varobj_get_child_range (r->varobj, &from, &to);
ui_out_field_int (uiout, "has_more",
varobj_has_more (r->varobj, to));
diff --git a/gdb/testsuite/gdb.python/python-mi.exp b/gdb/testsuite/gdb.python/python-mi.exp
index 0178270..bfdb595 100644
--- a/gdb/testsuite/gdb.python/python-mi.exp
+++ b/gdb/testsuite/gdb.python/python-mi.exp
@@ -69,7 +69,7 @@ mi_gdb_test "-data-evaluate-expression \"string_1 = string_2\"" ".*" \
"assign string_1 from string_2"
mi_gdb_test "-var-update string" \
- "\\^done,changelist=\\\[{name=\"string\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"}\\\]" \
+ "\\^done,changelist=\\\[{name=\"string\",in_scope=\"true\",type_changed=\"false\",dynamic=\"1\",has_more=\"0\"}\\\]" \
"update string varobj after assignment"
mi_create_dynamic_varobj container c \
@@ -81,7 +81,7 @@ mi_list_varobj_children container {
mi_next "next over update 1"
mi_varobj_update_dynamic container "varobj update 1" {
- type_changed false new_num_children 1 has_more 0
+ type_changed false new_num_children 1 dynamic 1 has_more 0
} {
} {
{ name {container.\[0\]} exp {\[0\]} numchild 0 type int thread-id 1 }
@@ -90,7 +90,7 @@ mi_varobj_update_dynamic container "varobj update 1" {
mi_next "next over update 2"
mi_varobj_update_dynamic container "varobj update 2" {
- type_changed false new_num_children 2 has_more 0
+ type_changed false new_num_children 2 dynamic 1 has_more 0
} {
} {
{ name {container.\[1\]} exp {\[1\]} numchild 0 type int thread-id 1 }
@@ -109,7 +109,7 @@ mi_gdb_test "-var-set-visualizer container gdb.default_visualizer" \
"choose default visualizer"
mi_varobj_update_dynamic container "varobj update after choosing default" {
- type_changed false new_num_children 2 has_more 0
+ type_changed false new_num_children 2 dynamic 1 has_more 0
} {
} {
{ name {container.\[0\]} exp {\[0\]} numchild 0 type int thread-id 1 }
@@ -122,7 +122,7 @@ mi_gdb_test "-var-set-visualizer container ContainerPrinter" \
mi_varobj_update_dynamic container \
"varobj update after choosing via expression" {
- type_changed false new_num_children 2 has_more 0
+ type_changed false new_num_children 2 dynamic 1 has_more 0
} {
} {
{ name {container.\[0\]} exp {\[0\]} numchild 0 type int thread-id 1 }
@@ -178,16 +178,16 @@ mi_next "next over update 5"
# should not actually see them.
mi_varobj_update_dynamic container2 \
"update varobj 2, no children requested" {
- type_changed false has_more 1
+ type_changed false dynamic 1 has_more 1
} {} {}
# This should only show the first child, because the update range has
# been set.
mi_varobj_update_dynamic container \
"update after next with restricted range" {
- type_changed false new_num_children 1 has_more 1
+ type_changed false new_num_children 1 dynamic 1 has_more 1
} {
- { name {container.\[0\]} in_scope true type_changed false has_more 0 }
+ { name {container.\[0\]} in_scope true type_changed false dynamic 1 has_more 0 }
} {
}
@@ -211,7 +211,7 @@ mi_list_varobj_children outer.s {
mi_next "next over outer update"
mi_gdb_test "-var-update outer" \
- ".done,changelist=.{name=\"outer.s.a\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"}." \
+ ".done,changelist=.{name=\"outer.s.a\",in_scope=\"true\",type_changed=\"false\",dynamic=\"1\",has_more=\"0\"}." \
"update after updating element of outer"
mi_continue_to_line \