aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-02-14 11:25:12 +0000
committerPedro Alves <palves@redhat.com>2011-02-14 11:25:12 +0000
commit3158c6ed12f939c10d31152fd3eb48ea0f8b8eaa (patch)
treec1810ccfaf512ad204ce15b72eb104fa94c42381
parent9fbdca0d6697412dee250b11fea99691673cd022 (diff)
downloadgdb-3158c6ed12f939c10d31152fd3eb48ea0f8b8eaa.zip
gdb-3158c6ed12f939c10d31152fd3eb48ea0f8b8eaa.tar.gz
gdb-3158c6ed12f939c10d31152fd3eb48ea0f8b8eaa.tar.bz2
* 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.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/value.c23
2 files changed, 19 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 34200b0..106835a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
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>
+
* value.c (struct internalvar) <enum internalvar_kind>: Remove
INTERNALVAR_POINTER.
<pointer>: Delete.
diff --git a/gdb/value.c b/gdb/value.c
index 92d857f..ee53914 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1675,15 +1675,24 @@ value_of_internalvar (struct gdbarch *gdbarch, struct internalvar *var)
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;
}
static int
@@ -1750,12 +1759,6 @@ set_internalvar (struct internalvar *var, struct value *val)
/* Copies created here are never canonical. */
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:
new_kind = INTERNALVAR_VALUE;
new_data.value = value_copy (val);