public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
From: tromey@sourceware.org
To: archer-commits@sourceware.org
Subject: [SCM]  archer-tromey-python: gdb
Date: Wed, 17 Dec 2008 23:10:00 -0000	[thread overview]
Message-ID: <20081217231007.1616.qmail@sourceware.org> (raw)

The branch, archer-tromey-python has been updated
       via  dd619449eafdf274e2ec10002e15c0bcf912e16c (commit)
      from  61d61d47d50decc0d8193195026415a9e246777f (commit)

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

- Log -----------------------------------------------------------------
commit dd619449eafdf274e2ec10002e15c0bcf912e16c
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Dec 17 16:09:51 2008 -0700

    gdb
    	* python/lib/gdb/libstdcxx/v6/printers.py
    	(StdMapPrinter.children): Use type's const method.
    	* python/python-type.c (typy_const): New function.
    	(typy_volatile): Likewise.
    	(typy_unqualified): Likewise.
    	(type_object_methods): Add const, volatile, unqualified.
    gdb/doc
    	* gdb.texinfo (Types From Inferior): Document const, volatile,
    	and unqualified methods.

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

Summary of changes:
 gdb/ChangeLog                               |    9 +++++
 gdb/doc/ChangeLog                           |    5 +++
 gdb/doc/gdb.texinfo                         |   22 ++++++++++--
 gdb/python/lib/gdb/libstdcxx/v6/printers.py |    4 +-
 gdb/python/python-type.c                    |   53 +++++++++++++++++++++++++++
 5 files changed, 88 insertions(+), 5 deletions(-)

First 500 lines of diff:
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7b48435..63ac2b4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2008-12-17  Tom Tromey  <tromey@redhat.com>
+
+	* python/lib/gdb/libstdcxx/v6/printers.py
+	(StdMapPrinter.children): Use type's const method.
+	* python/python-type.c (typy_const): New function.
+	(typy_volatile): Likewise.
+	(typy_unqualified): Likewise.
+	(type_object_methods): Add const, volatile, unqualified.
+
 2008-12-16  Tom Tromey  <tromey@redhat.com>
 
 	* python/python-frame.c (FRAPY_REQUIRE_VALID): Use error, not
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 5a29986..56cf330 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2008-12-17  Tom Tromey  <tromey@redhat.com>
+
+	* gdb.texinfo (Types From Inferior): Document const, volatile,
+	and unqualified methods.
+
 2008-12-16  Thiago Jung Bauermann  <bauerman@br.ibm.com>
 
 	* gdb.texinfo (Commands in Python): Mention need of importing the gdb
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 6257660..13137ab 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18377,9 +18377,25 @@ The type of the field.
 @end table
 @end defmethod
 
-@defmethod Type pointer
-Return a new @code{gdb.Type} object which represents a pointer to this
-type.
+@defmethod Type const
+Return a new @code{gdb.Type} object which represents a @code{const}
+qualified variant of this type.
+@end defmethod
+
+@defmethod Type const
+Return a new @code{gdb.Type} object which represents a
+@code{const}-qualified variant of this type.
+@end defmethod
+
+@defmethod Type volatile
+Return a new @code{gdb.Type} object which represents a
+@code{volatile}-qualified variant of this type.
+@end defmethod
+
+@defmethod Type unqualified
+Return a new @code{gdb.Type} object which represents an unqualified
+variant of this type.  That is, the result is neither @code{const} nor
+@code{volatile}.
 @end defmethod
 
 @defmethod Type reference
diff --git a/gdb/python/lib/gdb/libstdcxx/v6/printers.py b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
index c03c682..4390553 100644
--- a/gdb/python/lib/gdb/libstdcxx/v6/printers.py
+++ b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
@@ -232,9 +232,9 @@ class StdMapPrinter:
         return '%s with %d elements' % (self.typename, len (self.iter))
 
     def children (self):
-        keytype = self.val.type().template_argument(0)
+        keytype = self.val.type().template_argument(0).const()
         valuetype = self.val.type().template_argument(1)
-        nodetype = gdb.Type('std::_Rb_tree_node< std::pair< const %s, %s > >' % (keytype, valuetype))
+        nodetype = gdb.Type('std::_Rb_tree_node< std::pair< %s, %s > >' % (keytype, valuetype))
         nodetype = nodetype.pointer()
         return self._iter (self.iter, nodetype)
 
diff --git a/gdb/python/python-type.c b/gdb/python/python-type.c
index b2d3654..5aa82f6 100644
--- a/gdb/python/python-type.c
+++ b/gdb/python/python-type.c
@@ -280,6 +280,54 @@ typy_target (PyObject *self, PyObject *args)
   return type_to_type_object (TYPE_TARGET_TYPE (type));
 }
 
+/* Return a const-qualified type variant.  */
+static PyObject *
+typy_const (PyObject *self, PyObject *args)
+{
+  struct type *type = ((type_object *) self)->type;
+  volatile struct gdb_exception except;
+
+  TRY_CATCH (except, RETURN_MASK_ALL)
+    {
+      type = make_cv_type (1, 0, type, NULL);
+    }
+  GDB_PY_HANDLE_EXCEPTION (except);
+
+  return type_to_type_object (type);
+}
+
+/* Return a volatile-qualified type variant.  */
+static PyObject *
+typy_volatile (PyObject *self, PyObject *args)
+{
+  struct type *type = ((type_object *) self)->type;
+  volatile struct gdb_exception except;
+
+  TRY_CATCH (except, RETURN_MASK_ALL)
+    {
+      type = make_cv_type (0, 1, type, NULL);
+    }
+  GDB_PY_HANDLE_EXCEPTION (except);
+
+  return type_to_type_object (type);
+}
+
+/* Return an unqualified type variant.  */
+static PyObject *
+typy_unqualified (PyObject *self, PyObject *args)
+{
+  struct type *type = ((type_object *) self)->type;
+  volatile struct gdb_exception except;
+
+  TRY_CATCH (except, RETURN_MASK_ALL)
+    {
+      type = make_cv_type (0, 0, type, NULL);
+    }
+  GDB_PY_HANDLE_EXCEPTION (except);
+
+  return type_to_type_object (type);
+}
+
 /* Return the size of the type represented by SELF, in bytes.  */
 static PyObject *
 typy_sizeof (PyObject *self, PyObject *args)
@@ -652,6 +700,7 @@ gdbpy_initialize_types (void)
 static PyMethodDef type_object_methods[] =
 {
   { "code", typy_code, METH_NOARGS, "Return the code for this type" },
+  { "const", typy_const, METH_NOARGS, "Return a const variant of this type" },
   { "fields", typy_fields, METH_NOARGS,
     "Return a sequence holding all the fields of this type.\n\
 Each field is a dictionary." },
@@ -665,6 +714,10 @@ Each field is a dictionary." },
     "Return the target type of this type" },
   { "template_argument", typy_template_argument, METH_VARARGS,
     "Return a single template argument type" },
+  { "unqualified", typy_unqualified, METH_NOARGS,
+    "Return a variant of this type without const or volatile attributes" },
+  { "volatile", typy_volatile, METH_NOARGS,
+    "Return a volatile variant of this type" },
   { NULL }
 };
 


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


             reply	other threads:[~2008-12-17 23:10 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-17 23:10 tromey [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-04-07 20:28 tromey
2009-03-24 17:27 tromey
2009-02-05 19:56 tromey
2008-12-15 22:38 tromey
2008-12-13  0:37 tromey
2008-12-12 23:54 tromey
2008-12-10 15:28 tromey
2008-12-09  0:33 tromey
2008-12-02 21:29 tromey
2008-12-01 19:10 tromey
2008-11-25 21:17 tromey
2008-11-21 18:25 tromey
2008-11-18 18:52 tromey
2008-11-18 15:54 tromey
2008-11-17 15:45 tromey
2008-11-16 22:18 tromey
2008-11-16 16:56 tromey
2008-11-12  1:54 tromey
2008-11-10 14:15 tromey
2008-11-06 21:11 tromey
2008-11-06 19:58 tromey
2008-10-23 22:27 tromey
2008-10-23 21:28 tromey
2008-10-22 18:18 tromey
2008-10-21 18:32 tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081217231007.1616.qmail@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=archer-commits@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).