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: [unavailable values part 1, 08/17] unavailable integer internalvars


On Mon, 07 Feb 2011 15:31:47 +0100, Pedro Alves wrote:
> --- src.orig/gdb/value.c	2011-01-31 19:57:59.424645004 +0000
> +++ src/gdb/value.c	2011-01-31 19:58:02.114645000 +0000
> @@ -1536,15 +1536,24 @@ value_of_internalvar (struct gdbarch *gd
>  int
>  get_internalvar_integer (struct internalvar *var, LONGEST *result)
>  {
> -  switch (var->kind)
> +  if (var->kind == INTERNALVAR_INTEGER)
>      {
> -    case INTERNALVAR_INTEGER:
>        *result = var->u.integer.val;
>        return 1;
> +    }
>  
> -    default:
> -      return 0;
> +  if (var->kind == INTERNALVAR_VALUE)
> +    {
> +      struct type *type = check_typedef (value_type (var->u.value));
> +
> +      if (TYPE_CODE (type) == TYPE_CODE_INT)
> +	{
> +	  *result = value_as_long (var->u.value);
> +	  return 1;
> +	}
>      }
> +
> +  return 0;
>  }

[nitpick]  That switch would be finally appropriate there now.


Thanks,
Jan


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