public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-tromey-python:  * python/python.c (_initialize_python) <_format_children>: Handle
@ 2008-10-22 19:47 tromey
  0 siblings, 0 replies; 2+ messages in thread
From: tromey @ 2008-10-22 19:47 UTC (permalink / raw)
  To: archer-commits

The branch, archer-tromey-python has been updated
       via  c235d8da2f38350f6b45d143038a23f4f6a27811 (commit)
      from  be28390bda0775ce506162b7adacf2a4f6fb0c41 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit c235d8da2f38350f6b45d143038a23f4f6a27811
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Oct 22 13:47:19 2008 -0600

    	* python/python.c (_initialize_python) <_format_children>: Handle
    	"print elements" properly.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog       |    5 +++++
 gdb/python/python.c |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

First 500 lines of diff:
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a8cfa41..3a112c4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2008-10-22  Tom Tromey  <tromey@redhat.com>
 
+	* python/python.c (_initialize_python) <_format_children>: Handle
+	"print elements" properly.
+
+2008-10-22  Tom Tromey  <tromey@redhat.com>
+
 	* python/python.c (_initialize_python) <_format_children>: Call
 	to_string, not header.
 	(pretty_print_one_value): Call _format_children if either
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 3541712..83bce4d 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1058,7 +1058,7 @@ def _format_children(obj, val):\n\
     (name, val) = elt\n\
     result.append('%s = %s' % (name, str(val)))\n\
     i = i + 1\n\
-    if max == 0 or i == max:\n\
+    if max != None and i == max:\n\
       break\n\
   return '\\n'.join(result)\n\
 \n\


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [SCM]  archer-tromey-python:  * python/python.c (_initialize_python) <_format_children>: Handle
@ 2008-10-27 19:31 tromey
  0 siblings, 0 replies; 2+ messages in thread
From: tromey @ 2008-10-27 19:31 UTC (permalink / raw)
  To: archer-commits

The branch, archer-tromey-python has been updated
       via  e70b3d9a9b5ac9bcafde2ee9a50dfaac7462c72f (commit)
       via  df95f929b8f1caee928e0d088dbb9ca2c2976138 (commit)
      from  42282d0780bfa532a5452c152a3723443ce18f12 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit e70b3d9a9b5ac9bcafde2ee9a50dfaac7462c72f
Author: Tom Tromey <tromey@redhat.com>
Date:   Mon Oct 27 13:30:59 2008 -0600

    	* python/python.c (_initialize_python) <_format_children>: Handle
    	display_hint.  Stringize result of to_string.

commit df95f929b8f1caee928e0d088dbb9ca2c2976138
Author: Tom Tromey <tromey@redhat.com>
Date:   Mon Oct 27 12:55:47 2008 -0600

    	* gdb.texinfo (Pretty Printing): Reword list of predefined display
    	hints.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog       |    5 +++++
 gdb/doc/ChangeLog   |    5 +++++
 gdb/doc/gdb.texinfo |    8 ++++++--
 gdb/python/python.c |   15 +++++++++++++--
 4 files changed, 29 insertions(+), 4 deletions(-)

First 500 lines of diff:
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 97e7206..8def8d3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-27  Tom Tromey  <tromey@redhat.com>
+
+	* python/python.c (_initialize_python) <_format_children>: Handle
+	display_hint.  Stringize result of to_string.
+
 2008-10-23  Paul Pluzhnikov  <ppluzhnikov@google.com>
 
 	* thread.c (prune_threads): Correctly unlink dead threads.
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 60a9c94..26c9ed2 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-27  Tom Tromey  <tromey@redhat.com>
+
+	* gdb.texinfo (Pretty Printing): Reword list of predefined display
+	hints.
+
 2008-10-23  Tom Tromey  <tromey@redhat.com>
 
 	* gdb.texinfo (Pretty Printing): Update.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index ea1020e..787a438 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -17970,10 +17970,14 @@ This method must return a string.  It will be supplied to the MI
 consumer as a @samp{displayhint} attribute of the variable being
 printed.
 
-Currently only one display hint is defined: @samp{map}.  This
-indicates to the MI consumer that the object being printed is
+Some display hints are predefined by @value{GDBN}:
+
+@table @samp
+@item map
+Indicate to the MI consumer that the object being printed is
 ``map-like'', and that the children of this value can be assumed to
 alternate between keys and values.
+@end table
 @end defop
 
 @defop Operation {pretty printer} to_string (self, val)
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 6d280d9..22f85ba 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1056,12 +1056,23 @@ sys.stdout = GdbOutputFile()\n\
 def _format_children(obj, val):\n\
   result = []\n\
   if hasattr(obj, 'to_string'):\n\
-    result.append(obj.to_string(val))\n\
+    result.append(str(obj.to_string(val)))\n\
+  if hasattr(obj, 'display_hint'):\n\
+    is_map = 'map' == obj.display_hint(val)\n\
+  else:\n\
+    is_map = False\n\
   max = gdb.get_parameter('print elements')\n\
   i = 0\n\
+  previous = None\n\
   for elt in obj.children(val):\n\
     (name, val) = elt\n\
-    result.append('%s = %s' % (name, str(val)))\n\
+    if is_map:\n\
+      if i % 2 == 0:\n\
+        previous = val\n\
+      else:\n\
+        result.append('[%s] = %s' % (str (previous), str (val)))\n\
+    else:\n\
+      result.append('%s = %s' % (name, str(val)))\n\
     i = i + 1\n\
     if max != None and i == max:\n\
       break\n\


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-27 19:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-22 19:47 [SCM] archer-tromey-python: * python/python.c (_initialize_python) <_format_children>: Handle tromey
2008-10-27 19:31 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).