This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[python] emit displayhint for -var-create


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);
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]