public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [python] Allow extraction of function and method arguments, as specified in the documentation.
@ 2015-06-12 19:14 Zach Riggle
  2015-06-15 13:16 ` Joel Brobecker
  0 siblings, 1 reply; 2+ messages in thread
From: Zach Riggle @ 2015-06-12 19:14 UTC (permalink / raw)
  To: gdb-patches

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

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

* Re: [PATCH] [python] Allow extraction of function and method arguments, as specified in the documentation.
  2015-06-12 19:14 [PATCH] [python] Allow extraction of function and method arguments, as specified in the documentation Zach Riggle
@ 2015-06-15 13:16 ` Joel Brobecker
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Brobecker @ 2015-06-15 13:16 UTC (permalink / raw)
  To: Zach Riggle; +Cc: gdb-patches

Zach,

> 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 ***']

As explained privately, I think Doug Evans would be a better reviewer
than me, but I glanced at the patch anyway, and can provide the
following feedback.

First of all, thank you for sending in a patch! :-)

Second, I'm afraid the description is a little too terse. I would
be better, in my opinion, to be a little more verbose in what
you are trying to say. In particular, what the problem is that
you are trying to fix, and how you're fixing it. Usually, a copy/paste
of the output before and after your patch, explaining what's wrong
in it, goes a long way.

Patch submissions also require a ChangeLog entry. We actually
have a contribution Checklist:
https://sourceware.org/gdb/wiki/ContributionChecklist

I think this change deserves a regression test.

Speaking of which, did you validate this change against the GDB
testsuite? If yes, it's customary to say so, and specific which
platform this was tested on.

Thank you.

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

-- 
Joel

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

end of thread, other threads:[~2015-06-15 13:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-12 19:14 [PATCH] [python] Allow extraction of function and method arguments, as specified in the documentation Zach Riggle
2015-06-15 13:16 ` Joel Brobecker

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