* [python] emit displayhint for -var-create
@ 2009-09-15 18:36 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2009-09-15 18:36 UTC (permalink / raw)
To: Project Archer
I'm checking this in on the python branch.
Nick suggested that -var-create ought to emit a display hint, if any.
This patch implements that.
Tom
2009-09-15 Tom Tromey <tromey@redhat.com>
* mi/mi-cmd-var.c (print_varobj): Emit displayhint attribute.
2009-09-15 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (GDB/MI Variable Objects): Update.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 96c8e5c..18ffb09 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -23920,6 +23920,11 @@ children available. For a non-dynamic varobj, this will be 0.
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 displayhint
+A dynamic varobj can supply a display hint to the front end. The
+value comes directly from the Python pretty-printer object's
+@code{display_hint} method. @xref{Pretty Printing}.
@end table
Typical output will look like this:
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index ede928c..0baaa83 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -53,6 +53,7 @@ print_varobj (struct varobj *var, enum print_values print_values,
struct type *gdb_type;
char *type;
int thread_id;
+ char *display_hint;
ui_out_field_string (uiout, "name", varobj_get_objname (var));
if (print_expression)
@@ -80,6 +81,13 @@ print_varobj (struct varobj *var, enum print_values print_values,
if (varobj_get_frozen (var))
ui_out_field_int (uiout, "frozen", 1);
+ display_hint = varobj_get_display_hint (var);
+ if (display_hint)
+ {
+ ui_out_field_string (uiout, "displayhint", display_hint);
+ xfree (display_hint);
+ }
+
if (varobj_pretty_printed_p (var))
ui_out_field_int (uiout, "dynamic", 1);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-09-15 18:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-15 18:36 [python] emit displayhint for -var-create Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).