aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-03-21 16:29:14 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-03-26 18:25:10 +0000
commit9f9aa85206ab31d2c583e7fef568700d31eb577e (patch)
tree2a45f4e501f37c94af2520e9227287f80f3de7c4 /gdb/doc
parent3714a195e08a5cc7713b27def7a3c3b534da53e8 (diff)
downloadgdb-9f9aa85206ab31d2c583e7fef568700d31eb577e.zip
gdb-9f9aa85206ab31d2c583e7fef568700d31eb577e.tar.gz
gdb-9f9aa85206ab31d2c583e7fef568700d31eb577e.tar.bz2
gdb: Make python display_hint None handling defined behaviour
The documentation say that the display_hint method must return a string to serve as a display hint, and then goes on to list some acceptable strings. However, if we don't supply the display_hint method then we get a default display style behaviour and there's currently no way (in the python api) to force this default behaviour. The guile api allows #f to be used in order to force the default display style behaviour, and this is documented. Currently, using None in the python api also forces the default display behaviour. This commit extends the documentation to make returning None from the display_hint method an official mechanism by which the user can get the default display style. I've extended one of the existing tests to cover this case. gdb/doc/ChangeLog: * python.texi (Pretty Printing API): Document use of None for the display_hint. gdb/testsuite/ChangeLog: * gdb.python/py-prettyprint.c (struct container) <is_map_p>: New field. (make_container): Initialise new field. * gdb.python/py-prettyprint.exp: Add new tests. * gdb.python/py-prettyprint.py (class ContainerPrinter) <display_hint>: New method.
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/python.texi5
2 files changed, 9 insertions, 1 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 1f41498..87e20d3 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2019-03-26 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * python.texi (Pretty Printing API): Document use of None for the
+ display_hint.
+
2019-03-22 Alan Hayward <alan.hayward@arm.com>
Jiong Wang <jiong.wang@arm.com>
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index 6fadaff..56c925d 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -1294,7 +1294,7 @@ consumer as a @samp{displayhint} attribute of the variable being
printed.
This method is optional. If it does exist, this method must return a
-string.
+string or the special value @code{None}.
Some display hints are predefined by @value{GDBN}:
@@ -1317,6 +1317,9 @@ string-printing function to format the string. For the CLI this means
adding quotation marks, possibly escaping some characters, respecting
@code{set print elements}, and the like.
@end table
+
+The special value @code{None} causes @value{GDBN} to apply the default
+display rules.
@end defun
@defun pretty_printer.to_string (self)