* value.c (get_internalvar_integer): Also return the int value of

TYPE_CODE_INT INTERNALVAR_VALUE values.
	(set_internalvar): Don't special case TYPE_CODE_INT.
This commit is contained in:
Pedro Alves 2011-02-14 11:25:12 +00:00
parent 9fbdca0d66
commit 3158c6ed12
2 changed files with 20 additions and 11 deletions

View File

@ -1,3 +1,9 @@
2011-02-14 Pedro Alves <pedro@codesourcery.com>
* value.c (get_internalvar_integer): Also return the int value of
TYPE_CODE_INT INTERNALVAR_VALUE values.
(set_internalvar): Don't special case TYPE_CODE_INT.
2011-02-14 Pedro Alves <pedro@codesourcery.com> 2011-02-14 Pedro Alves <pedro@codesourcery.com>
* value.c (struct internalvar) <enum internalvar_kind>: Remove * value.c (struct internalvar) <enum internalvar_kind>: Remove

View File

@ -1675,15 +1675,24 @@ value_of_internalvar (struct gdbarch *gdbarch, struct internalvar *var)
int int
get_internalvar_integer (struct internalvar *var, LONGEST *result) get_internalvar_integer (struct internalvar *var, LONGEST *result)
{ {
switch (var->kind) if (var->kind == INTERNALVAR_INTEGER)
{ {
case INTERNALVAR_INTEGER:
*result = var->u.integer.val; *result = var->u.integer.val;
return 1; 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;
} }
static int static int
@ -1750,12 +1759,6 @@ set_internalvar (struct internalvar *var, struct value *val)
/* Copies created here are never canonical. */ /* Copies created here are never canonical. */
break; break;
case TYPE_CODE_INT:
new_kind = INTERNALVAR_INTEGER;
new_data.integer.type = value_type (val);
new_data.integer.val = value_as_long (val);
break;
default: default:
new_kind = INTERNALVAR_VALUE; new_kind = INTERNALVAR_VALUE;
new_data.value = value_copy (val); new_data.value = value_copy (val);