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]

Re: [python] more tests and documentation


Tom> On second thought, I understand stripping const (and volatile and
Tom> restrict).

What do you think of this?

Tom

b/gdb/ChangeLog:
2008-10-23  Tom Tromey  <tromey@redhat.com>

	* python/python.c (find_pretty_printer): Strip type qualifiers.

b/gdb/testsuite/ChangeLog:
2008-10-23  Tom Tromey  <tromey@redhat.com>

	* gdb.python/python-prettyprint.exp (run_lang_tests): Test
	printing 'cstring'.
	* gdb.python/python-prettyprint.c (main): New local 'cstring'.

diff --git a/gdb/python/python.c b/gdb/python/python.c
index 83bce4d..c6395fb 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -632,6 +632,8 @@ find_pretty_printer (struct type *type, PyObject **dictp, char *dict_name)
   /* Get the name of the type.  */
   TRY_CATCH (except, RETURN_MASK_ALL)
     {
+      /* Strip off any qualifiers from the type.  */
+      type = make_cv_type (0, 0, type, NULL);
       type_name = get_type (type);
     }
   if (except.reason < 0)
diff --git a/gdb/testsuite/gdb.python/python-prettyprint.c b/gdb/testsuite/gdb.python/python-prettyprint.c
index 8e7473a..1336d91 100644
--- a/gdb/testsuite/gdb.python/python-prettyprint.c
+++ b/gdb/testsuite/gdb.python/python-prettyprint.c
@@ -114,6 +114,7 @@ main ()
   struct ss  ssa[2];
   string x = make_string ("this is x");
   zzz_type c = make_container ("container");
+  const struct string_repr cstring = { { "const string" } };
 
   init_ss(&ss, 1, 2);
   init_ss(ssa+0, 3, 4);
diff --git a/gdb/testsuite/gdb.python/python-prettyprint.exp b/gdb/testsuite/gdb.python/python-prettyprint.exp
index 1deac49..7c654a4 100644
--- a/gdb/testsuite/gdb.python/python-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/python-prettyprint.exp
@@ -74,6 +74,7 @@ proc run_lang_tests {lang} {
     }
 
     gdb_test "print x" " = $hex \"this is x\""
+    gdb_test "print cstring" " = $hex \"const string\""
 
     set nl "\[\r\n\]+"
     gdb_test "print c" " = container $hex \"container\" with 2 elements$nl *.0. = 23$nl *.1. = 72"


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