diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/d10v-tdep.c | 29 | ||||
-rw-r--r-- | gdb/frame.c | 26 | ||||
-rw-r--r-- | gdb/frame.h | 16 |
4 files changed, 59 insertions, 25 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b819c67..ab8db86 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,18 @@ 2003-02-02 Andrew Cagney <ac131313@redhat.com> + * frame.c (frame_unwind_register): New function. + (frame_unwind_unsigned_register): Use. + (frame_unwind_signed_register): Use. + (frame_read_register): New function. + * frame.h (frame_unwind_register): Declare. + (frame_read_register): Declare. + + * d10v-tdep.c (d10v_frame_pop): Rewrite. Use regcache_cooked_write + and frame_unwind_register instead of read_memory, write_register + and deprecated_write_register_bytes. + +2003-02-02 Andrew Cagney <ac131313@redhat.com> + * frame.h: Note that namelen can be negative. * frame.c (frame_map_name_to_regnum): When LEN is negative, use NAME's length. diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 05bf475..c6b94bd 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -1552,27 +1552,24 @@ d10v_frame_pop (struct frame_info *fi, void **unwind_cache, /* now update the current registers with the old values */ for (regnum = A0_REGNUM; regnum < A0_REGNUM + NR_A_REGS; regnum++) { - if (info->saved_regs[regnum]) - { - read_memory (info->saved_regs[regnum], raw_buffer, REGISTER_RAW_SIZE (regnum)); - deprecated_write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, - REGISTER_RAW_SIZE (regnum)); - } + frame_unwind_register (fi, regnum, raw_buffer); + regcache_cooked_write (regcache, regnum, raw_buffer); } for (regnum = 0; regnum < SP_REGNUM; regnum++) { - if (info->saved_regs[regnum]) - { - write_register (regnum, read_memory_unsigned_integer (info->saved_regs[regnum], REGISTER_RAW_SIZE (regnum))); - } - } - if (info->saved_regs[PSW_REGNUM]) - { - write_register (PSW_REGNUM, read_memory_unsigned_integer (info->saved_regs[PSW_REGNUM], REGISTER_RAW_SIZE (PSW_REGNUM))); + frame_unwind_register (fi, regnum, raw_buffer); + regcache_cooked_write (regcache, regnum, raw_buffer); } + frame_unwind_register (fi, PSW_REGNUM, raw_buffer); + regcache_cooked_write (regcache, PSW_REGNUM, raw_buffer); + + frame_unwind_register (fi, LR_REGNUM, raw_buffer); + regcache_cooked_write (regcache, PC_REGNUM, raw_buffer); + + store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (SP_REGNUM), + fp + info->size); + regcache_cooked_write (regcache, SP_REGNUM, raw_buffer); - write_register (PC_REGNUM, read_register (LR_REGNUM)); - write_register (SP_REGNUM, fp + info->size); target_store_registers (-1); flush_cached_frames (); } diff --git a/gdb/frame.c b/gdb/frame.c index f5d40bd..0c3009c 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -238,16 +238,22 @@ frame_register (struct frame_info *frame, int regnum, } void -frame_unwind_signed_register (struct frame_info *frame, int regnum, - LONGEST *val) +frame_unwind_register (struct frame_info *frame, int regnum, void *buf) { int optimized; CORE_ADDR addr; int realnum; enum lval_type lval; - void *buf = alloca (MAX_REGISTER_RAW_SIZE); frame_register_unwind (frame, regnum, &optimized, &lval, &addr, &realnum, buf); +} + +void +frame_unwind_signed_register (struct frame_info *frame, int regnum, + LONGEST *val) +{ + void *buf = alloca (MAX_REGISTER_RAW_SIZE); + frame_unwind_register (frame, regnum, buf); (*val) = extract_signed_integer (buf, REGISTER_VIRTUAL_SIZE (regnum)); } @@ -255,17 +261,19 @@ void frame_unwind_unsigned_register (struct frame_info *frame, int regnum, ULONGEST *val) { - int optimized; - CORE_ADDR addr; - int realnum; - enum lval_type lval; void *buf = alloca (MAX_REGISTER_RAW_SIZE); - frame_register_unwind (frame, regnum, &optimized, &lval, &addr, - &realnum, buf); + frame_unwind_register (frame, regnum, buf); (*val) = extract_unsigned_integer (buf, REGISTER_VIRTUAL_SIZE (regnum)); } void +frame_read_register (struct frame_info *frame, int regnum, void *buf) +{ + gdb_assert (frame != NULL && frame->next != NULL); + frame_unwind_register (frame->next, regnum, buf); +} + +void frame_read_unsigned_register (struct frame_info *frame, int regnum, ULONGEST *val) { diff --git a/gdb/frame.h b/gdb/frame.h index dc90e0a..8169173 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -263,6 +263,9 @@ extern void frame_register_unwind (struct frame_info *frame, int regnum, /* NOTE: cagney/2002-09-13: Return void as one day these functions may be changed to return an indication that the read succeeded. */ +extern void frame_unwind_register (struct frame_info *frame, + int regnum, void *buf); + extern void frame_unwind_signed_register (struct frame_info *frame, int regnum, LONGEST *val); @@ -283,6 +286,9 @@ extern void frame_register (struct frame_info *frame, int regnum, /* NOTE: cagney/2002-09-13: Return void as one day these functions may be changed to return an indication that the read succeeded. */ +extern void frame_read_register (struct frame_info *frame, int regnum, + void *buf); + extern void frame_read_signed_register (struct frame_info *frame, int regnum, LONGEST *val); @@ -563,6 +569,16 @@ extern void get_saved_register (char *raw_buffer, int *optimized, struct frame_info *frame, int regnum, enum lval_type *lval); +/* FIXME: cagney/2003-02-02: Should be deprecated or replaced with a + function called frame_read_register_p(). This slightly weird (and + older) variant of frame_read_register() returns zero (indicating + the register is unavailable) if either: the register isn't cached; + or the register has been optimized out. Problem is, neither check + is exactly correct. A register can't be optimized out (it may not + have been saved as part of a function call); The fact that a + register isn't in the register cache doesn't mean that the register + isn't available (it could have been fetched from memory). */ + extern int frame_register_read (struct frame_info *frame, int regnum, void *buf); |