diff options
author | Daniel Jacobowitz <drow@false.org> | 2008-04-30 21:19:10 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2008-04-30 21:19:10 +0000 |
commit | 25492ce3f9c588d98d1284c04990491dc5056b15 (patch) | |
tree | e635fb5c3959dca6150e77d34cf4426eedc15fdf | |
parent | 4a4e51493775a8b68df6fe1c1e364aefed060fb9 (diff) | |
download | gdb-25492ce3f9c588d98d1284c04990491dc5056b15.zip gdb-25492ce3f9c588d98d1284c04990491dc5056b15.tar.gz gdb-25492ce3f9c588d98d1284c04990491dc5056b15.tar.bz2 |
* trad-frame.c (struct trad_frame_cache): Rename next_frame to this_frame.
(trad_frame_cache_zalloc, trad_frame_alloc_saved_regs): Expect
this_frame.
(trad_frame_get_prev_register, trad_frame_get_register): Update signature.
* trad-frame.h (trad_frame_cache_zalloc, trad_frame_get_register)
(trad_frame_alloc_saved_regs, trad_frame_get_prev_register): Update
signature.
* tramp-frame.c (tramp_frame_cache, tramp_frame_start): Expect
this_frame.
(tramp_frame_this_id, tramp_frame_prev_register, tramp_frame_sniffer):
Update signature.
* tramp-frame.h (struct tramp_frame): Update signature of init.
* Makefile.in (trad-frame.o): Update.
-rw-r--r-- | gdb/ChangeLog | 16 | ||||
-rw-r--r-- | gdb/Makefile.in | 2 | ||||
-rw-r--r-- | gdb/trad-frame.c | 84 | ||||
-rw-r--r-- | gdb/trad-frame.h | 20 | ||||
-rw-r--r-- | gdb/tramp-frame.c | 37 | ||||
-rw-r--r-- | gdb/tramp-frame.h | 2 |
6 files changed, 69 insertions, 92 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f19244a..1c78f5b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,21 @@ 2008-04-30 Daniel Jacobowitz <dan@codesourcery.com> + * trad-frame.c (struct trad_frame_cache): Rename next_frame to this_frame. + (trad_frame_cache_zalloc, trad_frame_alloc_saved_regs): Expect + this_frame. + (trad_frame_get_prev_register, trad_frame_get_register): Update signature. + * trad-frame.h (trad_frame_cache_zalloc, trad_frame_get_register) + (trad_frame_alloc_saved_regs, trad_frame_get_prev_register): Update + signature. + * tramp-frame.c (tramp_frame_cache, tramp_frame_start): Expect + this_frame. + (tramp_frame_this_id, tramp_frame_prev_register, tramp_frame_sniffer): + Update signature. + * tramp-frame.h (struct tramp_frame): Update signature of init. + * Makefile.in (trad-frame.o): Update. + +2008-04-30 Daniel Jacobowitz <dan@codesourcery.com> + * dwarf2-frame.c (read_reg): Expect this_frame in the baton. (execute_stack_op): Put this_frame in the baton. (execute_cfa_program): Take this_frame. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 98ae558..7a3ce03 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2925,7 +2925,7 @@ tracepoint.o: tracepoint.c $(defs_h) $(symtab_h) $(frame_h) $(gdbtypes_h) \ $(block_h) $(dictionary_h) $(ax_h) $(ax_gdb_h) $(readline_h) \ $(readline_history_h) trad-frame.o: trad-frame.c $(defs_h) $(frame_h) $(trad_frame_h) \ - $(regcache_h) + $(regcache_h) $(frame_unwind_h) $(value_h) tramp-frame.o: tramp-frame.c $(defs_h) $(tramp_frame_h) $(frame_unwind_h) \ $(gdbcore_h) $(symtab_h) $(objfiles_h) $(target_h) $(trad_frame_h) \ $(frame_base_h) $(gdb_assert_h) diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c index 0a27906..b571cd3 100644 --- a/gdb/trad-frame.c +++ b/gdb/trad-frame.c @@ -21,23 +21,25 @@ #include "frame.h" #include "trad-frame.h" #include "regcache.h" +#include "frame-unwind.h" +#include "value.h" struct trad_frame_cache { - struct frame_info *next_frame; + struct frame_info *this_frame; CORE_ADDR this_base; struct trad_frame_saved_reg *prev_regs; struct frame_id this_id; }; struct trad_frame_cache * -trad_frame_cache_zalloc (struct frame_info *next_frame) +trad_frame_cache_zalloc (struct frame_info *this_frame) { struct trad_frame_cache *this_trad_cache; this_trad_cache = FRAME_OBSTACK_ZALLOC (struct trad_frame_cache); - this_trad_cache->prev_regs = trad_frame_alloc_saved_regs (next_frame); - this_trad_cache->next_frame = next_frame; + this_trad_cache->prev_regs = trad_frame_alloc_saved_regs (this_frame); + this_trad_cache->this_frame = this_frame; return this_trad_cache; } @@ -47,10 +49,10 @@ trad_frame_cache_zalloc (struct frame_info *next_frame) for all potential instruction sequences). */ struct trad_frame_saved_reg * -trad_frame_alloc_saved_regs (struct frame_info *next_frame) +trad_frame_alloc_saved_regs (struct frame_info *this_frame) { int regnum; - struct gdbarch *gdbarch = get_frame_arch (next_frame); + struct gdbarch *gdbarch = get_frame_arch (this_frame); int numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch); struct trad_frame_saved_reg *this_saved_regs = FRAME_OBSTACK_CALLOC (numregs, struct trad_frame_saved_reg); @@ -128,66 +130,34 @@ trad_frame_set_unknown (struct trad_frame_saved_reg this_saved_regs[], this_saved_regs[regnum].addr = -1; } -void -trad_frame_get_prev_register (struct frame_info *next_frame, +struct value * +trad_frame_get_prev_register (struct frame_info *this_frame, struct trad_frame_saved_reg this_saved_regs[], - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realregp, gdb_byte *bufferp) + int regnum) { - struct gdbarch *gdbarch = get_frame_arch (next_frame); + struct gdbarch *gdbarch = get_frame_arch (this_frame); if (trad_frame_addr_p (this_saved_regs, regnum)) - { - /* The register was saved in memory. */ - *optimizedp = 0; - *lvalp = lval_memory; - *addrp = this_saved_regs[regnum].addr; - *realregp = -1; - if (bufferp != NULL) - { - /* Read the value in from memory. */ - get_frame_memory (next_frame, this_saved_regs[regnum].addr, bufferp, - register_size (gdbarch, regnum)); - } - } + /* The register was saved in memory. */ + return frame_unwind_got_memory (this_frame, regnum, + this_saved_regs[regnum].addr); else if (trad_frame_realreg_p (this_saved_regs, regnum)) - { - *optimizedp = 0; - *lvalp = lval_register; - *addrp = 0; - *realregp = this_saved_regs[regnum].realreg; - /* Ask the next frame to return the value of the register. */ - if (bufferp) - frame_unwind_register (next_frame, (*realregp), bufferp); - } + return frame_unwind_got_register (this_frame, regnum, + this_saved_regs[regnum].realreg); else if (trad_frame_value_p (this_saved_regs, regnum)) - { - /* The register's value is available. */ - *optimizedp = 0; - *lvalp = not_lval; - *addrp = 0; - *realregp = -1; - if (bufferp != NULL) - store_unsigned_integer (bufferp, register_size (gdbarch, regnum), - this_saved_regs[regnum].addr); - } + /* The register's value is available. */ + return frame_unwind_got_constant (this_frame, regnum, + this_saved_regs[regnum].addr); else - { - error (_("Register %s not available"), - gdbarch_register_name (gdbarch, regnum)); - } + return frame_unwind_got_optimized (this_frame, regnum); } -void +struct value * trad_frame_get_register (struct trad_frame_cache *this_trad_cache, - struct frame_info *next_frame, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realregp, gdb_byte *bufferp) -{ - trad_frame_get_prev_register (next_frame, this_trad_cache->prev_regs, - regnum, optimizedp, lvalp, addrp, realregp, - bufferp); + struct frame_info *this_frame, + int regnum) +{ + return trad_frame_get_prev_register (this_frame, this_trad_cache->prev_regs, + regnum); } void diff --git a/gdb/trad-frame.h b/gdb/trad-frame.h index ce7855b..70c81b3 100644 --- a/gdb/trad-frame.h +++ b/gdb/trad-frame.h @@ -30,7 +30,7 @@ struct trad_frame_cache; The entire cache is populated in a single pass and then generic routines are used to extract the various cache values. */ -struct trad_frame_cache *trad_frame_cache_zalloc (struct frame_info *next_frame); +struct trad_frame_cache *trad_frame_cache_zalloc (struct frame_info *this_frame); /* This frame's ID. */ void trad_frame_set_id (struct trad_frame_cache *this_trad_cache, @@ -50,11 +50,9 @@ void trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache, void trad_frame_set_reg_value (struct trad_frame_cache *this_cache, int regnum, LONGEST val); -void trad_frame_get_register (struct trad_frame_cache *this_trad_cache, - struct frame_info *next_frame, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realregp, gdb_byte *bufferp); +struct value *trad_frame_get_register (struct trad_frame_cache *this_trad_cache, + struct frame_info *this_frame, + int regnum); /* A traditional saved regs table, indexed by REGNUM, encoding where the value of REGNUM for the previous frame can be found in this @@ -107,14 +105,12 @@ int trad_frame_realreg_p (struct trad_frame_saved_reg this_saved_regs[], /* Return a freshly allocated (and initialized) trad_frame array. */ -struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *next_frame); +struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *this_frame); /* Given the trad_frame info, return the location of the specified register. */ -void trad_frame_get_prev_register (struct frame_info *next_frame, - struct trad_frame_saved_reg this_saved_regs[], - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realregp, gdb_byte *bufferp); +struct value *trad_frame_get_prev_register (struct frame_info *this_frame, + struct trad_frame_saved_reg this_saved_regs[], + int regnum); #endif diff --git a/gdb/tramp-frame.c b/gdb/tramp-frame.c index b7c8735..7edcced 100644 --- a/gdb/tramp-frame.c +++ b/gdb/tramp-frame.c @@ -41,16 +41,16 @@ struct tramp_frame_cache }; static struct trad_frame_cache * -tramp_frame_cache (struct frame_info *next_frame, +tramp_frame_cache (struct frame_info *this_frame, void **this_cache) { - CORE_ADDR pc = frame_pc_unwind (next_frame); + CORE_ADDR pc = get_frame_pc (this_frame); struct tramp_frame_cache *tramp_cache = (*this_cache); if (tramp_cache->trad_cache == NULL) { - tramp_cache->trad_cache = trad_frame_cache_zalloc (next_frame); + tramp_cache->trad_cache = trad_frame_cache_zalloc (this_frame); tramp_cache->tramp_frame->init (tramp_cache->tramp_frame, - next_frame, + this_frame, tramp_cache->trad_cache, tramp_cache->func); } @@ -58,33 +58,28 @@ tramp_frame_cache (struct frame_info *next_frame, } static void -tramp_frame_this_id (struct frame_info *next_frame, +tramp_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { struct trad_frame_cache *trad_cache - = tramp_frame_cache (next_frame, this_cache); + = tramp_frame_cache (this_frame, this_cache); trad_frame_get_id (trad_cache, this_id); } -static void -tramp_frame_prev_register (struct frame_info *next_frame, +static struct value * +tramp_frame_prev_register (struct frame_info *this_frame, void **this_cache, - int prev_regnum, - int *optimizedp, - enum lval_type * lvalp, - CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) + int prev_regnum) { struct trad_frame_cache *trad_cache - = tramp_frame_cache (next_frame, this_cache); - trad_frame_get_register (trad_cache, next_frame, prev_regnum, optimizedp, - lvalp, addrp, realnump, valuep); + = tramp_frame_cache (this_frame, this_cache); + return trad_frame_get_register (trad_cache, this_frame, prev_regnum); } static CORE_ADDR tramp_frame_start (const struct tramp_frame *tramp, - struct frame_info *next_frame, CORE_ADDR pc) + struct frame_info *this_frame, CORE_ADDR pc) { int ti; /* Search through the trampoline for one that matches the @@ -99,7 +94,7 @@ tramp_frame_start (const struct tramp_frame *tramp, ULONGEST insn; if (tramp->insn[i].bytes == TRAMP_SENTINEL_INSN) return func; - if (!safe_frame_unwind_memory (next_frame, + if (!safe_frame_unwind_memory (this_frame, func + i * tramp->insn_size, buf, tramp->insn_size)) break; @@ -114,11 +109,11 @@ tramp_frame_start (const struct tramp_frame *tramp, static int tramp_frame_sniffer (const struct frame_unwind *self, - struct frame_info *next_frame, + struct frame_info *this_frame, void **this_cache) { const struct tramp_frame *tramp = self->unwind_data->tramp_frame; - CORE_ADDR pc = frame_pc_unwind (next_frame); + CORE_ADDR pc = get_frame_pc (this_frame); CORE_ADDR func; struct tramp_frame_cache *tramp_cache; @@ -126,7 +121,7 @@ tramp_frame_sniffer (const struct frame_unwind *self, section, then this is not a trampoline. However, this assumption is false on HPUX which has a signal trampoline that has a name; it can also be false when using an alternative signal stack. */ - func = tramp_frame_start (tramp, next_frame, pc); + func = tramp_frame_start (tramp, this_frame, pc); if (func == 0) return 0; tramp_cache = FRAME_OBSTACK_ZALLOC (struct tramp_frame_cache); diff --git a/gdb/tramp-frame.h b/gdb/tramp-frame.h index 07100a5..3f73e85 100644 --- a/gdb/tramp-frame.h +++ b/gdb/tramp-frame.h @@ -66,7 +66,7 @@ struct tramp_frame /* Initialize a trad-frame cache corresponding to the tramp-frame. FUNC is the address of the instruction TRAMP[0] in memory. */ void (*init) (const struct tramp_frame *self, - struct frame_info *next_frame, + struct frame_info *this_frame, struct trad_frame_cache *this_cache, CORE_ADDR func); }; |