public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-tromey-python: 2008-11-06  Paul Pluzhnikov  <ppluzhnikov@google.com>
@ 2008-11-07  0:28 ppluzhnikov
  0 siblings, 0 replies; 2+ messages in thread
From: ppluzhnikov @ 2008-11-07  0:28 UTC (permalink / raw)
  To: archer-commits

The branch, archer-tromey-python has been updated
       via  aac1baf0b0f00a2c3580248d7532018be33b53d4 (commit)
      from  3c4a12486daf891d58920ad7f97ab6f78b40c11e (commit)

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

- Log -----------------------------------------------------------------
commit aac1baf0b0f00a2c3580248d7532018be33b53d4
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date:   Thu Nov 6 16:27:39 2008 -0800

    2008-11-06  Paul Pluzhnikov  <ppluzhnikov@google.com>
    
    	* python/python-type.c (typy_lookup_type): New fn.
    	Handle const and volatile qualified types, pointers and references.
    	* python/python-type.c (typy_template_argument): Call it.

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

Summary of changes:
 gdb/ChangeLog            |    6 ++++
 gdb/python/python-type.c |   70 +++++++++++++++++++++++++++++-----------------
 2 files changed, 50 insertions(+), 26 deletions(-)

First 500 lines of diff:
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8e34945..013f3a7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2008-11-06  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+	* python/python-type.c (typy_lookup_type): New fn.
+	Handle const and volatile qualified types, pointers and references.
+	* python/python-type.c (typy_template_argument): Call it.
+	
 2008-11-06  Tom Tromey  <tromey@redhat.com>
 
 	* python/python-type.c (pyty_type_object) <owned>: New field.
diff --git a/gdb/python/python-type.c b/gdb/python/python-type.c
index 1d27714..5162986 100644
--- a/gdb/python/python-type.c
+++ b/gdb/python/python-type.c
@@ -128,6 +128,48 @@ typy_lookup_typename (char *type_name, struct block *block)
   return type;
 }
 
+static struct type *
+typy_lookup_type (struct demangle_component *demangled,
+		  struct block *block)
+{
+  struct type *type;
+  char *type_name;
+
+  if (demangled->type == DEMANGLE_COMPONENT_POINTER
+      || demangled->type == DEMANGLE_COMPONENT_REFERENCE
+      || demangled->type == DEMANGLE_COMPONENT_CONST
+      || demangled->type == DEMANGLE_COMPONENT_VOLATILE)
+    {
+      type = typy_lookup_type (demangled->u.s_binary.left, block);
+      if (! type)
+	return NULL;
+    }
+  switch (demangled->type)
+    {
+    case DEMANGLE_COMPONENT_REFERENCE:
+      return lookup_reference_type (type);
+    case DEMANGLE_COMPONENT_POINTER:
+      return lookup_pointer_type (type);
+    case DEMANGLE_COMPONENT_CONST:
+      return make_cv_type (1, 0, type, NULL);
+    case DEMANGLE_COMPONENT_VOLATILE:
+      return make_cv_type (0, 1, type, NULL);
+    }
+
+  type_name = cp_comp_to_string (demangled, 10);
+  type = typy_lookup_typename (type_name, block);
+  if (! type)
+    {
+      PyErr_Format (PyExc_RuntimeError, "no such type named %s",
+		    type_name);
+      xfree (type_name);
+      return NULL;
+    }
+  xfree (type_name);
+
+  return type;
+}
+
 static PyObject *
 typy_template_argument (PyObject *self, PyObject *args)
 {
@@ -135,7 +177,6 @@ typy_template_argument (PyObject *self, PyObject *args)
   struct type *type = ((type_object *) self)->type;
   struct demangle_component *demangled;
   const char *err;
-  char *type_name;
   struct type *argtype;
   struct block *block = NULL;
   PyObject *block_obj = NULL;
@@ -196,32 +237,9 @@ typy_template_argument (PyObject *self, PyObject *args)
       return NULL;
     }
 
-  /* Count pointers and apply later, because lookup_typename does not
-     understand '*'.  FIXME: should handle references as well.  Really
-     we should have a generic cp_comp_to_type.  */
-  demangled = demangled->u.s_binary.left;
-  n_pointers = 0;
-  while (demangled->type == DEMANGLE_COMPONENT_POINTER)
-    {
-      ++n_pointers;
-      demangled = demangled->u.s_binary.left;
-    }
-
-  /* FIXME: if argument is a value, we should DTRT.  */
-  type_name = cp_comp_to_string (demangled, 10);
-
-  argtype = typy_lookup_typename (type_name, block);
+  argtype = typy_lookup_type (demangled->u.s_binary.left, block);
   if (! argtype)
-    {
-      PyErr_Format (PyExc_RuntimeError, "no such type named %s",
-		    type_name);
-      xfree (type_name);
-      return NULL;
-    }
-  xfree (type_name);
-
-  while (n_pointers--)
-    argtype = lookup_pointer_type (argtype);
+    return NULL;
 
   return type_to_type_object (argtype);
 }


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [SCM]  archer-tromey-python: 2008-11-06  Paul Pluzhnikov  <ppluzhnikov@google.com>
@ 2008-11-07 18:05 ppluzhnikov
  0 siblings, 0 replies; 2+ messages in thread
From: ppluzhnikov @ 2008-11-07 18:05 UTC (permalink / raw)
  To: archer-commits

The branch, archer-tromey-python has been updated
       via  01cb0077b3fd57bf730adff7a230d4edd269d4d1 (commit)
      from  fec9620d4ece0e275113b47f9923876acfc7604f (commit)

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

- Log -----------------------------------------------------------------
commit 01cb0077b3fd57bf730adff7a230d4edd269d4d1
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date:   Fri Nov 7 10:04:42 2008 -0800

    2008-11-06  Paul Pluzhnikov  <ppluzhnikov@google.com>
    
    	* gdb.python/python-template.exp,
    	gdb.python/python-template.cc: New test for const, volatile
    	qualified pointer and reference template args.

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

Summary of changes:
 gdb/testsuite/ChangeLog |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

First 500 lines of diff:
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index ca4424a..1fc69d0 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2008-11-07  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+	* gdb.python/python-template.exp,
+	gdb.python/python-template.cc: New test for const, volatile
+	qualified pointer and reference template args.
+	
 2008-11-06  Tom Tromey  <tromey@redhat.com>
 
 	* gdb.python/python-mi.exp: Update.


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-07 18:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-07  0:28 [SCM] archer-tromey-python: 2008-11-06 Paul Pluzhnikov <ppluzhnikov@google.com> ppluzhnikov
2008-11-07 18:05 ppluzhnikov

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).