This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[PATCH] [python] Allow extraction of function and method arguments, as specified in the documentation.


Example usage:

    >>> func = gdb.lookup_symbol('expandargv')[0]
    >>> str(func), str(func.type)
    ('expandargv', 'void (int *, char ***)')
    >>> [str(field.type) for field in func.type.fields()]
    ['int *', 'char ***']
---
 gdb/python/py-type.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 648d8c8..bf42ff4 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -495,7 +495,9 @@ typy_get_composite (struct type *type)
      exception.  */
   if (TYPE_CODE (type) != TYPE_CODE_STRUCT
       && TYPE_CODE (type) != TYPE_CODE_UNION
-      && TYPE_CODE (type) != TYPE_CODE_ENUM)
+      && TYPE_CODE (type) != TYPE_CODE_ENUM
+      && TYPE_CODE (type) != TYPE_CODE_FUNC
+      && TYPE_CODE (type) != TYPE_CODE_METHOD)
     {
       PyErr_SetString (PyExc_TypeError,
        "Type is not a structure, union, or enum type.");
-- 
2.2.0.rc0.207.ga3a616c


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