From ef2b8fcdd80de265ba1c78995be2563f629c2e3c Mon Sep 17 00:00:00 2001 From: Stephane Carrez Date: Sun, 20 Jul 2003 14:18:14 +0000 Subject: [PATCH] * m68hc11-tdep.c (m68hc11_extract_return_value): Use regcache_raw_read and translate to use regcache. (m68hc11_gdbarch_init): Undeprecate extract_return_value. --- gdb/ChangeLog | 6 ++++++ gdb/m68hc11-tdep.c | 33 ++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7d5eedb08f3..f6482eb697d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2003-07-20 Stephane Carrez + + * m68hc11-tdep.c (m68hc11_extract_return_value): Use regcache_raw_read + and translate to use regcache. + (m68hc11_gdbarch_init): Undeprecate extract_return_value. + 2003-07-18 Andrew Cagney * gdbarch.sh (DWARF2_BUILD_FRAME_INFO): Delete method. diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 99903edd228..686fb40d6ba 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1101,34 +1101,37 @@ m68hc11_store_return_value (struct type *type, char *valbuf) } -/* Given a return value in `regbuf' with a type `type', +/* Given a return value in `regcache' with a type `type', extract and copy its value into `valbuf'. */ static void -m68hc11_extract_return_value (struct type *type, - char *regbuf, - char *valbuf) +m68hc11_extract_return_value (struct type *type, struct regcache *regcache, + void *valbuf) { int len = TYPE_LENGTH (type); - + char buf[M68HC11_REG_SIZE]; + + regcache_raw_read (regcache, HARD_D_REGNUM, buf); switch (len) { case 1: - memcpy (valbuf, ®buf[HARD_D_REGNUM * 2 + 1], len); + memcpy (valbuf, buf + 1, 1); break; - + case 2: - memcpy (valbuf, ®buf[HARD_D_REGNUM * 2], len); + memcpy (valbuf, buf, 2); break; - + case 3: - memcpy (&valbuf[0], ®buf[HARD_X_REGNUM * 2 + 1], 1); - memcpy (&valbuf[1], ®buf[HARD_D_REGNUM * 2], 2); + memcpy ((char*) valbuf + 1, buf, 2); + regcache_raw_read (regcache, HARD_X_REGNUM, buf); + memcpy (valbuf, buf + 1, 1); break; - + case 4: - memcpy (&valbuf[0], ®buf[HARD_X_REGNUM * 2], 2); - memcpy (&valbuf[2], ®buf[HARD_D_REGNUM * 2], 2); + memcpy ((char*) valbuf + 2, buf, 2); + regcache_raw_read (regcache, HARD_X_REGNUM, buf); + memcpy (valbuf, buf, 2); break; default: @@ -1369,7 +1372,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_deprecated_call_dummy_words (gdbarch, m68hc11_call_dummy_words); set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, sizeof (m68hc11_call_dummy_words)); set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register); - set_gdbarch_deprecated_extract_return_value (gdbarch, m68hc11_extract_return_value); + set_gdbarch_extract_return_value (gdbarch, m68hc11_extract_return_value); set_gdbarch_deprecated_push_arguments (gdbarch, m68hc11_push_arguments); set_gdbarch_deprecated_push_return_address (gdbarch, m68hc11_push_return_address); set_gdbarch_return_value_on_stack (gdbarch, m68hc11_return_value_on_stack); -- 2.30.2