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]

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


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


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