[RFA] Fix crash of convenience vars with typedefs.

Ulrich Weigand uweigand@de.ibm.com
Mon Aug 17 13:11:00 GMT 2009


Doug Evans wrote:

> gdb/value.c:1094: internal-error: bad type
> A problem internal to GDB has been detected,
> further debugging may prove unreliable.

Oops, sorry for the breakage.

> +	  struct type *real_type = check_typedef (var->u.scalar.type);
> +	  switch (TYPE_CODE (check_typedef (real_type)))

That's a duplicate check_typedef ...

> +	    case TYPE_CODE_INT:
> +	      val = value_from_longest (real_type, var->u.scalar.val.l);
> +	      break;
> +	    case TYPE_CODE_PTR:
> +	      val = value_from_pointer (real_type, var->u.scalar.val.a);
> +	      break;

Shouldn't the result of value_of_internalvar still have the original
typedef name instead of the type it resolves to?

I'm wondering about the other places where the type is used, in particular
get_internalvar_integer.   Also, it seems better to avoid calling
check_typedef every time ...

Maybe it would be best to split the INTERNALVAR_SCALAR state into two
distinct states INTERNALVAL_INTEGER and INTERNAL_POINTER; the decision
can be make in set_internalvar, where we already call check_typedef,
and then used subsequentially.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com



More information about the Gdb-patches mailing list