This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Suppress printing of address when python pretty-printer returns a value instead of string.
- From: ppluzhnikov at google dot com (Paul Pluzhnikov)
- To: gdb-patches at sourceware dot org
- Cc: "Tom Tromey" <tromey at redhat dot com>, ppluzhnikov at google dot com, dje at google dot com
- Date: Tue, 10 Nov 2009 13:45:17 -0800 (PST)
- Subject: [patch] Suppress printing of address when python pretty-printer returns a value instead of string.
Greetings,
This has been OK'd by Tom here:
http://sourceware.org/ml/gdb/2009-11/msg00123.html
I'll check it in by end of the week if there are no objections.
Thanks,
--
Paul Pluzhnikov
ChangeLog:
2009-11-10 Paul Pluzhnikov <ppluzhnikov@google.com>
* python/py-prettyprint.c (print_string_repr): Suppress
address printing.
testsuite/ChangeLog:
2009-11-10 Paul Pluzhnikov <ppluzhnikov@google.com>
* gdb.python/py-prettyprint.exp: Adjust.
Index: python/py-prettyprint.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-prettyprint.c,v
retrieving revision 1.1
diff -u -p -u -r1.1 py-prettyprint.c
--- python/py-prettyprint.c 9 Sep 2009 17:45:40 -0000 1.1
+++ python/py-prettyprint.c 10 Nov 2009 21:38:50 -0000
@@ -209,7 +209,12 @@ print_string_repr (PyObject *printer, co
Py_DECREF (py_str);
}
else if (replacement)
- common_val_print (replacement, stream, recurse, options, language);
+ {
+ struct value_print_options opts = *options;
+
+ opts.addressprint = 0;
+ common_val_print (replacement, stream, recurse, &opts, language);
+ }
else
gdbpy_print_stack ();
}
Index: testsuite/gdb.python/py-prettyprint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.python/py-prettyprint.exp,v
retrieving revision 1.2
diff -u -p -u -r1.2 py-prettyprint.exp
--- testsuite/gdb.python/py-prettyprint.exp 21 Sep 2009 09:39:53 -0000 1.2
+++ testsuite/gdb.python/py-prettyprint.exp 10 Nov 2009 21:38:50 -0000
@@ -97,10 +97,10 @@ proc run_lang_tests {lang} {
gdb_py_test_silent_cmd "set print elements 200" "" 1
}
- gdb_test "print x" " = $hex \"this is x\""
- gdb_test "print cstring" " = $hex \"const string\""
+ gdb_test "print x" " = \"this is x\""
+ gdb_test "print cstring" " = \"const string\""
- gdb_test "print c" " = container $hex \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}"
+ gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}"
gdb_test "continue" "Program exited normally\."
}