This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] [python] Allow extraction of function and method arguments, as specified in the documentation.
- From: Zach Riggle <riggle at google dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 12 Jun 2015 15:14:17 -0400
- Subject: [PATCH] [python] Allow extraction of function and method arguments, as specified in the documentation.
- Authentication-results: sourceware.org; auth=none
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