From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19355 invoked by alias); 23 Oct 2008 22:27:25 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 19037 invoked by uid 306); 23 Oct 2008 22:27:23 -0000 Date: Thu, 23 Oct 2008 22:27:00 -0000 Message-ID: <20081023222723.18986.qmail@sourceware.org> From: tromey@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-tromey-python: gdb X-Git-Refname: refs/heads/archer-tromey-python X-Git-Reftype: branch X-Git-Oldrev: 830c5c95aa64f4918c81388f19e080063ea24649 X-Git-Newrev: f413e75bd1cbd52ad756f9d3bfb4863714dca5f9 X-SW-Source: 2008-q4/txt/msg00044.txt.bz2 List-Id: The branch, archer-tromey-python has been updated via f413e75bd1cbd52ad756f9d3bfb4863714dca5f9 (commit) from 830c5c95aa64f4918c81388f19e080063ea24649 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit f413e75bd1cbd52ad756f9d3bfb4863714dca5f9 Author: Tom Tromey Date: Thu Oct 23 16:27:05 2008 -0600 gdb * python/python.c (find_pretty_printer): Strip reference types. gdb/doc * gdb.texinfo (Pretty Printing): Update. gdb/testsuite * gdb.python/python-prettyprint.exp (run_lang_tests): Test printing a reference. * gdb.python/python-prettyprint.c (main): Add reference. ----------------------------------------------------------------------- Summary of changes: gdb/ChangeLog | 4 ++++ gdb/doc/ChangeLog | 4 ++++ gdb/doc/gdb.texinfo | 6 ++++-- gdb/python/python.c | 3 +++ gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/gdb.python/python-prettyprint.c | 2 ++ gdb/testsuite/gdb.python/python-prettyprint.exp | 1 + 7 files changed, 24 insertions(+), 2 deletions(-) First 500 lines of diff: diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7eaf2f5..3eddb7c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2008-10-23 Tom Tromey + * python/python.c (find_pretty_printer): Strip reference types. + +2008-10-23 Tom Tromey + * python/python.c (find_pretty_printer): Strip type qualifiers. 2008-10-22 Tom Tromey diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 2d5b8f7..60a9c94 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2008-10-23 Tom Tromey + + * gdb.texinfo (Pretty Printing): Update. + 2008-10-22 Tom Tromey * gdb.texinfo (Pretty Printing): Remove comments. Add missing diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index b41175f..ea1020e 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -17994,8 +17994,10 @@ The Python dictionary @code{gdb.cli_pretty_printers} maps regular expressions (strings) onto pretty-printers. A pretty-printer is either a function or an object. -When printing a value, @value{GDBN} first compares the name of the -value's canonical type (the type after following all typedefs) to each +When printing a value, @value{GDBN} first computes the values' +canonical type by following typedefs, following a reference type to +its referenced type, and removing qualifiers, such as @code{const} or +@code{volatile}. The name of this type is then compared to each regular expression. If a regular expression matches, then the corresponding pretty-printer is invoked with a @code{gdb.Value} representing the value to be printed. diff --git a/gdb/python/python.c b/gdb/python/python.c index c6395fb..6d280d9 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -632,6 +632,9 @@ find_pretty_printer (struct type *type, PyObject **dictp, char *dict_name) /* Get the name of the type. */ TRY_CATCH (except, RETURN_MASK_ALL) { + /* If we have a reference, use the referenced type. */ + if (TYPE_CODE (type) == TYPE_CODE_REF) + type = TYPE_TARGET_TYPE (type); /* Strip off any qualifiers from the type. */ type = make_cv_type (0, 0, type, NULL); type_name = get_type (type); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1047286..911275c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,6 +1,12 @@ 2008-10-23 Tom Tromey * gdb.python/python-prettyprint.exp (run_lang_tests): Test + printing a reference. + * gdb.python/python-prettyprint.c (main): Add reference. + +2008-10-23 Tom Tromey + + * gdb.python/python-prettyprint.exp (run_lang_tests): Test printing 'cstring'. * gdb.python/python-prettyprint.c (main): New local 'cstring'. diff --git a/gdb/testsuite/gdb.python/python-prettyprint.c b/gdb/testsuite/gdb.python/python-prettyprint.c index 1336d91..f99e6f9 100644 --- a/gdb/testsuite/gdb.python/python-prettyprint.c +++ b/gdb/testsuite/gdb.python/python-prettyprint.c @@ -137,6 +137,8 @@ main () init_s(&cpssa[1].s, 14); SSS sss(15, cps); + + SSS& ref (sss); #endif add_item (&c, 23); /* MI breakpoint here */ diff --git a/gdb/testsuite/gdb.python/python-prettyprint.exp b/gdb/testsuite/gdb.python/python-prettyprint.exp index 7c654a4..d07d195 100644 --- a/gdb/testsuite/gdb.python/python-prettyprint.exp +++ b/gdb/testsuite/gdb.python/python-prettyprint.exp @@ -71,6 +71,7 @@ proc run_lang_tests {lang} { gdb_test "print cpssa\[1\]" " = {zss = 13, s = a=<14> b=<$hex>}" gdb_test "print cpssa" " = {{zss = 11, s = a=<12> b=<$hex>}, {zss = 13, s = a=<14> b=<$hex>}}" gdb_test "print sss" "= a=<15> b=< a=<8> b=<$hex>>" + gdb_test "print ref" "= a=<15> b=< a=<8> b=<$hex>>" } gdb_test "print x" " = $hex \"this is x\"" hooks/post-receive -- Repository for Project Archer.