aboutsummaryrefslogtreecommitdiff
path: root/gdb/findvar.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/findvar.c')
-rw-r--r--gdb/findvar.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 163e9f7..4a5a3a0 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -1454,6 +1454,10 @@ value_from_register (type, regnum, frame)
CHECK_TYPEDEF (type);
len = TYPE_LENGTH (type);
+ /* Pointers on D10V are really only 16 bits, but we lie to gdb elsewhere... */
+ if (GDB_TARGET_IS_D10V && TYPE_CODE (type) == TYPE_CODE_PTR)
+ len = 2;
+
VALUE_REGNO (v) = regnum;
num_storage_locs = (len > REGISTER_VIRTUAL_SIZE (regnum) ?
@@ -1652,6 +1656,29 @@ value_from_register (type, regnum, frame)
memcpy (VALUE_CONTENTS_RAW (v), raw_buffer + VALUE_OFFSET (v), len);
}
+ if (GDB_TARGET_IS_D10V
+ && TYPE_CODE (type) == TYPE_CODE_PTR
+ && TYPE_TARGET_TYPE (type)
+ && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC))
+ {
+ /* pointer to function */
+ unsigned long num;
+ unsigned short snum;
+ snum = (unsigned short) extract_unsigned_integer (VALUE_CONTENTS_RAW (v), 2);
+ num = D10V_MAKE_IADDR (snum);
+ store_address (VALUE_CONTENTS_RAW (v), 4, num);
+ }
+ else if (GDB_TARGET_IS_D10V
+ && TYPE_CODE (type) == TYPE_CODE_PTR)
+ {
+ /* pointer to data */
+ unsigned long num;
+ unsigned short snum;
+ snum = (unsigned short) extract_unsigned_integer (VALUE_CONTENTS_RAW (v), 2);
+ num = D10V_MAKE_DADDR (snum);
+ store_address (VALUE_CONTENTS_RAW (v), 4, num);
+ }
+
return v;
}