[RFA/Python] Fix int() builtin with range type gdb.Value objects.

Joel Brobecker brobecker@adacore.com
Wed Nov 20 02:52:00 GMT 2013


> >>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
> 
> Joel>         * python/py-value.c (is_intlike): Delete.
> Joel>         (valpy_int): Replace use of CHECK_TYPEDEF and is_intlike
> Joel>         by use of is_integral_type.
> Joel>         (valpy_long): Replace use of CHECK_TYPEDEF and is_intlike
> Joel>         by use of is_integral_type and check for TYPE_CODE_PTR.
> 
> Thanks, Joel.
> 
> Joel>    TRY_CATCH (except, RETURN_MASK_ALL)
> Joel>      {
> Joel> -      CHECK_TYPEDEF (type);
> Joel> -
> Joel> -      if (!is_intlike (type, 1))
> Joel> +      if (!is_integral_type (type)
> Joel> +	  && TYPE_CODE (type) != TYPE_CODE_PTR)
> Joel>  	error (_("Cannot convert value to long."));
> 
> I think the CHECK_TYPEDEF is still needed in this hunk (but not the
> other one), since we examine the TYPE_CODE of the type.

I missed that, you're right! New patch attached.

gdb/ChangeLog:

        * python/py-value.c (is_intlike): Delete.
        (valpy_int): Replace use of CHECK_TYPEDEF and is_intlike
        by use of is_integral_type.
        (valpy_long): Replace use of CHECK_TYPEDEF and is_intlike
        by use of is_integral_type and check for TYPE_CODE_PTR.

Re-tested on x86_64-linux, JIC.

Thanks!
-- 
Joel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-get-rid-of-py-value.c-is_intlike-use-is_integral_typ.patch
Type: text/x-diff
Size: 2259 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20131120/1c6bf01d/attachment.bin>


More information about the Gdb-patches mailing list