diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 64 | ||||
-rw-r--r-- | gdb/alpha-tdep.c | 41 | ||||
-rw-r--r-- | gdb/config/a29k/tm-a29k.h | 2 | ||||
-rw-r--r-- | gdb/config/mips/tm-mips.h | 8 | ||||
-rw-r--r-- | gdb/config/mn10300/tm-mn10300.h | 7 | ||||
-rw-r--r-- | gdb/config/rs6000/tm-rs6000.h | 91 | ||||
-rw-r--r-- | gdb/config/sparc/tm-sparc.h | 2 | ||||
-rw-r--r-- | gdb/config/z8k/tm-z8k.h | 5 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/doc/gdbint.texinfo | 21 | ||||
-rw-r--r-- | gdb/h8300-tdep.c | 8 | ||||
-rw-r--r-- | gdb/i960-tdep.c | 8 | ||||
-rw-r--r-- | gdb/m88k-tdep.c | 8 | ||||
-rw-r--r-- | gdb/mips-tdep.c | 40 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 160 | ||||
-rw-r--r-- | gdb/z8k-tdep.c | 37 |
16 files changed, 269 insertions, 237 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1265a38..3201f14 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,61 @@ +Sat Dec 12 09:28:13 1998 Andrew Cagney <cagney@b1.cygnus.com> + + * frame.h (struct frame_info): Add CORE_ADDR *saved_regs and + struct frame_extra_info *extra_info. + (frame_obstack_alloc, frame_saved_regs_zalloc): Prototype. + (SIZEOF_FRAME_SAVED_REGS): Provide default. + (FRAME_INIT_SAVED_REGS): Provide default. + (struct frame_saved_regs): Deprecate. + (EXTRA_FRAME_INFO): Deprecate. + + * blockframe.c (frame_obstack_alloc, frame_saved_regs_zalloc): New + function. + (generic_get_saved_register): Use FRAME_INIT_SAVED_REGS and + frame->saved_regs. + (frame_cache_obstack): Make static. + (get_frame_saved_regs): Deprecate. Copy the saved regs into the + frame buffer. + + * stack.c (frame_info): Rewrite using frame->saved_regs and + FRAME_INIT_SAVED_REGS. + * findvar.c (find_saved_register): Ditto. + + * config/mn10300/tm-mn10300.h (EXTRA_FRAME_INFO): Delete. + (FRAME_FIND_SAVED_REGS): Replace with FRAME_INIT_SAVED_REGS. No-op. + * mn10300-tdep.c: Update. + (analyze_dummy_frame): New function. + (struct frame_extra_info): Define. + (mn10300_init_extra_frame_info): Update. + + * config/rs6000/tm-rs6000.h: (EXTRA_FRAME_INFO): Delete. + (FRAME_FIND_SAVED_REGS): Replace with FRAME_INIT_SAVED_REGS. + (FRAME_ARGS_ADDRESS): Replace with function. + + * rs6000-tdep.c (frame_get_saved_regs): Rename from + frame_get_cache_fsr. + (rs6000_init_extra_frame_info): New function. + (rs6000_frame_init_saved_regs): Call frame_get_saved_regs. + (FUNCTION_START_OFFSET): Delete references, was ZERO. + (rs6000_frame_args_address): New function. + (frame_initial_stack_address): Update + + * config/mips/tm-mips.h (EXTRA_FRAME_INFO): Remove saved_regs. + (FRAME_INIT_SAVED_REGS): Rename FRAME_FIND_SAVED_REGS, update. + * mips-tdep.c (mips_find_saved_regs, read_next_frame_reg, + init_extra_frame_info, mips_pop_frame): Update. + * config/alpha/tm-alpha.h (FRAME_INIT_SAVED_REGS, + EXTRA_FRAME_INFO), alpha-tdep.c (alpha_find_saved_regs, + alpha_pop_frame, init_extra_frame_info): Ditto. + + * i960-tdep.c, m88k-tdep.c, h8300-tdep.c: Update. + * config/sparc/tm-sparc.h, config/a29k/tm-a29k.h: Define + FRAME_INIT_SAVED_REGS as no-op. + + * z8k-tdep.c (z8k_init_frame_saved_regs): Rename + get_frame_saved_regs. + (examine_frame, z8k_skip_prologue): Update. + * config/z8k/tm-z8k.h (FRAME_INIT_SAVED_REGS): Define. + 1998-12-11 Fernando Nasser <fnasser@totem.to.cygnus.com> From J.T. Conklin <jtc@redbacknetworks.com>: @@ -32,8 +90,8 @@ Fri Dec 11 09:52:04 1998 Andrew Cagney <cagney@chook> * gdbtk-cmds.c, mipsm3-nat.c, hppah-nat.c, infptrace.c, i386gnu-nat.c, hppab-nat.c, core-aout.c, arm-xdep.c, alpha-nat.c, altos-xdep.c, pyr-xdep.c, remote-st.c, remote-os9k.c, - tahoe-tdep.c, pyr-tdep.c, v850ice.c, vax-tdep.c: Replace reg_name - with REGISTER_NAME. + tahoe-tdep.c, pyr-tdep.c, vax-tdep.c: Replace reg_name with + REGISTER_NAME. Thu Dec 10 15:19:40 1998 David Taylor <taylor@texas.cygnus.com> @@ -322,8 +380,8 @@ Fri Nov 27 11:00:25 1998 Andrew Cagney <cagney@chook> start-sanitize-sky * config/mips/tm-txvu.h (STEP_SKIPS_DELAY), txvu-tdep.c (txvu_step_skips_delay): Change macro to function. -end-sanitize-sky +end-sanitize-sky Thu Nov 26 11:19:15 1998 Andrew Cagney <cagney@amy.cygnus.com> * config/alpha/tm-alpha.h (ABOUT_TO_RETURN): Replace macro. diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 2382be1..0201016 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -31,10 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* FIXME: Some of this code should perhaps be merged with mips-tdep.c. */ -/* FIXME: Put this declaration in frame.h. */ -extern struct obstack frame_cache_obstack; - - /* Prototypes for local functions. */ static alpha_extra_func_info_t push_sigtramp_desc PARAMS ((CORE_ADDR low_addr)); @@ -254,9 +250,7 @@ alpha_find_saved_regs (frame) alpha_extra_func_info_t proc_desc; int returnreg; - frame->saved_regs = (struct frame_saved_regs *) - obstack_alloc (&frame_cache_obstack, sizeof(struct frame_saved_regs)); - memset (frame->saved_regs, 0, sizeof (struct frame_saved_regs)); + frame_saved_regs_zalloc (frame); /* If it is the frame for __sigtramp, the saved registers are located in a sigcontext structure somewhere on the stack. __sigtramp @@ -276,14 +270,14 @@ alpha_find_saved_regs (frame) for (ireg = 0; ireg < 32; ireg++) { reg_position = sigcontext_addr + SIGFRAME_REGSAVE_OFF + ireg * 8; - frame->saved_regs->regs[ireg] = reg_position; + frame->saved_regs[ireg] = reg_position; } for (ireg = 0; ireg < 32; ireg++) { reg_position = sigcontext_addr + SIGFRAME_FPREGSAVE_OFF + ireg * 8; - frame->saved_regs->regs[FP0_REGNUM + ireg] = reg_position; + frame->saved_regs[FP0_REGNUM + ireg] = reg_position; } - frame->saved_regs->regs[PC_REGNUM] = sigcontext_addr + SIGFRAME_PC_OFF; + frame->saved_regs[PC_REGNUM] = sigcontext_addr + SIGFRAME_PC_OFF; return; } @@ -306,7 +300,7 @@ alpha_find_saved_regs (frame) register number. */ if (mask & (1 << returnreg)) { - frame->saved_regs->regs[returnreg] = reg_position; + frame->saved_regs[returnreg] = reg_position; reg_position += 8; mask &= ~(1 << returnreg); /* Clear bit for RA so we don't save again later. */ @@ -315,7 +309,7 @@ alpha_find_saved_regs (frame) for (ireg = 0; ireg <= 31 ; ++ireg) if (mask & (1 << ireg)) { - frame->saved_regs->regs[ireg] = reg_position; + frame->saved_regs[ireg] = reg_position; reg_position += 8; } @@ -328,11 +322,11 @@ alpha_find_saved_regs (frame) for (ireg = 0; ireg <= 31 ; ++ireg) if (mask & (1 << ireg)) { - frame->saved_regs->regs[FP0_REGNUM+ireg] = reg_position; + frame->saved_regs[FP0_REGNUM+ireg] = reg_position; reg_position += 8; } - frame->saved_regs->regs[PC_REGNUM] = frame->saved_regs->regs[returnreg]; + frame->saved_regs[PC_REGNUM] = frame->saved_regs[returnreg]; } static CORE_ADDR @@ -350,8 +344,8 @@ read_next_frame_reg(fi, regno) { if (fi->saved_regs == NULL) alpha_find_saved_regs (fi); - if (fi->saved_regs->regs[regno]) - return read_memory_integer(fi->saved_regs->regs[regno], 8); + if (fi->saved_regs[regno]) + return read_memory_integer(fi->saved_regs[regno], 8); } } return read_register(regno); @@ -855,12 +849,11 @@ init_extra_frame_info (frame) (CORE_ADDR *)NULL,(CORE_ADDR *)NULL); if (!IN_SIGTRAMP (frame->pc, name)) { - frame->saved_regs = (struct frame_saved_regs*) - obstack_alloc (&frame_cache_obstack, - sizeof (struct frame_saved_regs)); - *frame->saved_regs = temp_saved_regs; - frame->saved_regs->regs[PC_REGNUM] - = frame->saved_regs->regs[RA_REGNUM]; + frame->saved_regs = (CORE_ADDR*) + frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS); + memcpy (frame->saved_regs, temp_saved_regs.regs, SIZEOF_FRAME_SAVED_REGS); + frame->saved_regs[PC_REGNUM] + = frame->saved_regs[RA_REGNUM]; } } } @@ -1116,12 +1109,12 @@ alpha_pop_frame() for (regnum = 32; --regnum >= 0; ) if (PROC_REG_MASK(proc_desc) & (1 << regnum)) write_register (regnum, - read_memory_integer (frame->saved_regs->regs[regnum], + read_memory_integer (frame->saved_regs[regnum], 8)); for (regnum = 32; --regnum >= 0; ) if (PROC_FREG_MASK(proc_desc) & (1 << regnum)) write_register (regnum + FP0_REGNUM, - read_memory_integer (frame->saved_regs->regs[regnum + FP0_REGNUM], 8)); + read_memory_integer (frame->saved_regs[regnum + FP0_REGNUM], 8)); } write_register (SP_REGNUM, new_sp); flush_cached_frames (); diff --git a/gdb/config/a29k/tm-a29k.h b/gdb/config/a29k/tm-a29k.h index 8d451d8..4892ec5 100644 --- a/gdb/config/a29k/tm-a29k.h +++ b/gdb/config/a29k/tm-a29k.h @@ -415,6 +415,8 @@ extern use_struct_convention_fn a29k_use_struct_convention; void read_register_stack (); long read_register_stack_integer (); +#define FRAME_INIT_SAVED_REGS(fi) /*no-op*/ + #define EXTRA_FRAME_INFO \ CORE_ADDR saved_msp; \ unsigned int rsize; \ diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index fac4e14..bbc4e2b 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -380,12 +380,11 @@ extern int mips_frame_num_args PARAMS ((struct frame_info *)); ways in the stack frame. sp is even more special: the address we return for it IS the sp for the next frame. */ -#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ +#define FRAME_INIT_SAVED_REGS(frame_info) \ do { \ if ((frame_info)->saved_regs == NULL) \ mips_find_saved_regs (frame_info); \ - (frame_saved_regs) = *(frame_info)->saved_regs; \ - (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame; \ + (frame_info)->saved_regs[SP_REGNUM] = (frame_info)->frame; \ } while (0) extern void mips_find_saved_regs PARAMS ((struct frame_info *)); @@ -455,8 +454,7 @@ typedef struct mips_extra_func_info { #define EXTRA_FRAME_INFO \ mips_extra_func_info_t proc_desc; \ - int num_args;\ - struct frame_saved_regs *saved_regs; + int num_args; #define INIT_EXTRA_FRAME_INFO(fromleaf, fci) init_extra_frame_info(fci) extern void init_extra_frame_info PARAMS ((struct frame_info *)); diff --git a/gdb/config/mn10300/tm-mn10300.h b/gdb/config/mn10300/tm-mn10300.h index 94582ba..769924c 100644 --- a/gdb/config/mn10300/tm-mn10300.h +++ b/gdb/config/mn10300/tm-mn10300.h @@ -73,20 +73,15 @@ extern breakpoint_from_pc_fn mn10300_breakpoint_from_pc; #ifdef __STDC__ struct frame_info; -struct frame_saved_regs; struct type; struct value; #endif -#define EXTRA_FRAME_INFO struct frame_saved_regs fsr; int status; int stack_size; - extern void mn10300_init_extra_frame_info PARAMS ((struct frame_info *)); #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) mn10300_init_extra_frame_info (fi) #define INIT_FRAME_PC /* Not necessary */ -extern void mn10300_frame_find_saved_regs PARAMS ((struct frame_info *, - struct frame_saved_regs *)); -#define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr +#define FRAME_INIT_SAVED_REGS(fi) /* handled by init_extra_frame_info */ extern CORE_ADDR mn10300_frame_chain PARAMS ((struct frame_info *)); #define FRAME_CHAIN(fi) mn10300_frame_chain (fi) diff --git a/gdb/config/rs6000/tm-rs6000.h b/gdb/config/rs6000/tm-rs6000.h index 0ea9bf6..10562f2 100644 --- a/gdb/config/rs6000/tm-rs6000.h +++ b/gdb/config/rs6000/tm-rs6000.h @@ -388,31 +388,12 @@ CORE_ADDR rs6000_frame_chain PARAMS ((struct frame_info *)); extern int frameless_function_invocation PARAMS((struct frame_info *)); -/* Functions calling alloca() change the value of the stack pointer. We - need to use initial stack pointer (which is saved in r31 by gcc) in - such cases. If a compiler emits traceback table, then we should use the - alloca register specified in traceback table. FIXME. */ -/* Also, it is a good idea to cache information about frame's saved registers - in the frame structure to speed things up. See tm-m88k.h. FIXME. */ - -#define EXTRA_FRAME_INFO \ - CORE_ADDR initial_sp; /* initial stack pointer. */ \ - struct frame_saved_regs *cache_fsr; /* saved registers */ - #define INIT_FRAME_PC_FIRST(fromleaf, prev) \ prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \ prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ()); #define INIT_FRAME_PC(fromleaf, prev) /* nothing */ -#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \ - fi->initial_sp = 0; \ - fi->cache_fsr = 0; \ - if (fi->next != (CORE_ADDR)0 \ - && fi->pc < TEXT_SEGMENT_BASE) \ - /* We're in get_prev_frame_info */ \ - /* and this is a special signal frame. */ \ - /* (fi->pc will be some low address in the kernel, */ \ - /* to which the signal handler returns). */ \ - fi->signal_handler_caller = 1; +extern void rs6000_init_extra_frame_info (int fromleaf, struct frame_info *); +#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) rs6000_init_extra_frame_info (fromleaf, fi) /* If the kernel has to deliver a signal, it pushes a sigcontext structure on the stack and then calls the signal handler, passing @@ -433,11 +414,8 @@ extern int frameless_function_invocation PARAMS((struct frame_info *)); extern unsigned long frame_saved_pc PARAMS ((struct frame_info *)); -#define FRAME_ARGS_ADDRESS(FI) \ - (((struct frame_info*)(FI))->initial_sp ? \ - ((struct frame_info*)(FI))->initial_sp : \ - frame_initial_stack_address (FI)) -extern CORE_ADDR frame_initial_stack_address PARAMS ((struct frame_info *)); +extern CORE_ADDR rs6000_frame_args_address PARAMS ((struct frame_info *)); +#define FRAME_ARGS_ADDRESS(FI) rs6000_frame_args_address (FI) #define FRAME_LOCALS_ADDRESS(FI) FRAME_ARGS_ADDRESS(FI) @@ -463,66 +441,9 @@ extern CORE_ADDR frame_initial_stack_address PARAMS ((struct frame_info *)); not sure if it will be needed. The following macro takes care of gpr's and fpr's only. */ -#define FRAME_FIND_SAVED_REGS(FRAME_INFO, FRAME_SAVED_REGS) \ -{ \ - int ii; \ - CORE_ADDR frame_addr, func_start; \ - struct rs6000_framedata fdata; \ - \ - /* find the start of the function and collect info about its frame. */ \ - \ - func_start = get_pc_function_start ((FRAME_INFO)->pc) + FUNCTION_START_OFFSET; \ - (void) skip_prologue (func_start, &fdata); \ - memset (&(FRAME_SAVED_REGS), '\0', sizeof (FRAME_SAVED_REGS)); \ - \ - /* if there were any saved registers, figure out parent's stack pointer. */ \ - /* the following is true only if the frame doesn't have a call to alloca(), \ - FIXME. */ \ - if (fdata.saved_fpr == 0 && fdata.saved_gpr == 0 && \ - fdata.lr_offset == 0 && fdata.cr_offset == 0) { \ - frame_addr = 0; \ - \ - } else if ((FRAME_INFO)->prev && (FRAME_INFO)->prev->frame) { \ - frame_addr = (FRAME_INFO)->prev->frame; \ - \ - } else { \ - frame_addr = read_memory_integer ((FRAME_INFO)->frame, 4); \ - } \ - \ - /* if != -1, fdata.saved_fpr is the smallest number of saved_fpr. All \ - fpr's from saved_fpr to f31 are saved. */ \ - if (fdata.saved_fpr >= 0) { \ - int fpr_offset = frame_addr + fdata.fpr_offset; \ - for (ii = fdata.saved_fpr; ii < 32; ii++) { \ - (FRAME_SAVED_REGS).regs [FP0_REGNUM + ii] = fpr_offset; \ - fpr_offset += 8; \ - } \ - } \ - \ - /* if != -1, fdata.saved_gpr is the smallest number of saved_gpr. All \ - gpr's from saved_gpr to r31 are saved. */ \ - if (fdata.saved_gpr >= 0) { \ - int gpr_offset = frame_addr + fdata.gpr_offset; \ - for (ii = fdata.saved_gpr; ii < 32; ii++) { \ - (FRAME_SAVED_REGS).regs [ii] = gpr_offset; \ - gpr_offset += 4; \ - } \ - } \ - \ - /* If != 0, fdata.cr_offset is the offset from the frame that holds \ - the CR */ \ - if (fdata.cr_offset != 0) { \ - (FRAME_SAVED_REGS).regs [CR_REGNUM] = frame_addr + fdata.cr_offset; \ - } \ - \ - /* If != 0, fdata.cr_offset is the offset from the frame that holds \ - the LR */ \ - if (fdata.lr_offset != 0) { \ - (FRAME_SAVED_REGS).regs [LR_REGNUM] = frame_addr + fdata.lr_offset; \ - } \ -} +extern void rs6000_frame_init_saved_regs PARAMS ((struct frame_info *)); +#define FRAME_INIT_SAVED_REGS(FI) rs6000_frame_init_saved_regs (FI) - /* Things needed for making the inferior call functions. */ /* Push an empty stack frame, to record the current PC, etc. */ diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index e3165ce..ecbe9e2 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -330,6 +330,8 @@ sparc_extract_struct_value_address PARAMS ((char [REGISTER_BYTES])); /* time of the register saves. */ \ int sp_offset; +#define FRAME_INIT_SAVED_REGS(fp) /*no-op*/ + #define INIT_EXTRA_FRAME_INFO(fromleaf, fci) \ sparc_init_extra_frame_info (fromleaf, fci) extern void sparc_init_extra_frame_info PARAMS((int, struct frame_info *)); diff --git a/gdb/config/z8k/tm-z8k.h b/gdb/config/z8k/tm-z8k.h index 8ec1356..babde90 100644 --- a/gdb/config/z8k/tm-z8k.h +++ b/gdb/config/z8k/tm-z8k.h @@ -197,6 +197,11 @@ extern CORE_ADDR mz8k_skip_prologue PARAMS ((CORE_ADDR ip)); #define FRAME_ARGS_SKIP 8 +#ifdef __STDC__ +struct frame_info; +#endif +extern void z8k_frame_init_saved_regs PARAMS ((struct frame_info *)); +#define FRAME_INIT_SAVED_REGS(fi) z8k_frame_init_saved_regs (fi) /* Things needed for making the inferior call functions. diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index f86edac..922a7e0 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +Thu Dec 10 16:07:09 1998 Andrew Cagney <cagney@b1.cygnus.com> + + * gdbint.texinfo (FRAME_FIND_SAVED_REGS): Document. + Wed Dec 9 21:13:57 1998 Andrew Cagney <cagney@chook> * gdbint.texinfo (REGISTER_NAME): Replace REGISTER_NAMES. diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index c5fc4b7..b64620e 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -1288,10 +1288,6 @@ register state, the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). -@item EXTRA_FRAME_INFO -If defined, this must be a list of slots that may be inserted into the -@code{frame_info} structure defined in @code{frame.h}. - @item FLOAT_INFO If defined, then the `info float' command will print information about the processor's floating point unit. @@ -1326,8 +1322,14 @@ is not inside the startup file (such as @file{crt0.o}). nonzero and the given frame's PC is not in @code{main()} or a known entry point function (such as @code{_start()}). -@item FRAME_FIND_SAVED_REGS -stack.c +@item FRAME_INIT_SAVED_REGS(frame) +See @file{frame.h}. Determines the address of all registers in the +current stack frame storing each in @code{frame->saved_regs}. Space for +@code{frame->saved_regs} shall be allocated by +@code{FRAME_INIT_SAVED_REGS} using either +@code{frame_saved_regs_zalloc} or @code{frame_obstack_alloc}. + +@var{FRAME_FIND_SAVED_REGS} and @var{EXTRA_FRAME_INFO} are deprecated. @item FRAME_NUM_ARGS (val, fi) For the frame described by @var{fi}, set @var{val} to the number of arguments @@ -1390,9 +1392,10 @@ repenting at leisure. @item IEEE_FLOAT Define this if the target system uses IEEE-format floating point numbers. -@item INIT_EXTRA_FRAME_INFO (fromleaf, fci) -If defined, this should be a C expression or statement that fills in the -@code{EXTRA_FRAME_INFO} slots of the given frame @var{fci}. +@item INIT_EXTRA_FRAME_INFO (fromleaf, frame) +If additional information about the frame is required this should be +stored in @code{frame->extra_info}. Space for @code{frame->extra_info} +is allocated using @code{frame_obstack_alloc}. @item INIT_FRAME_PC (fromleaf, prev) This is a C statement that sets the pc of the frame pointed to by diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index 7c340b1..984f6c4 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -169,8 +169,8 @@ h8300_frame_chain (thisframe) ways in the stack frame. sp is even more special: the address we return for it IS the sp for the next frame. - We cache the result of doing this in the frame_cache_obstack, since - it is fairly expensive. */ + We cache the result of doing this in the frame_obstack, since it is + fairly expensive. */ void h8300_frame_find_saved_regs (fi, fsr) @@ -178,7 +178,6 @@ h8300_frame_find_saved_regs (fi, fsr) struct frame_saved_regs *fsr; { register struct frame_saved_regs *cache_fsr; - extern struct obstack frame_cache_obstack; CORE_ADDR ip; struct symtab_and_line sal; CORE_ADDR limit; @@ -186,8 +185,7 @@ h8300_frame_find_saved_regs (fi, fsr) if (!fi->fsr) { cache_fsr = (struct frame_saved_regs *) - obstack_alloc (&frame_cache_obstack, - sizeof (struct frame_saved_regs)); + frame_obstack_alloc (sizeof (struct frame_saved_regs)); memset (cache_fsr, '\0', sizeof (struct frame_saved_regs)); fi->fsr = cache_fsr; diff --git a/gdb/i960-tdep.c b/gdb/i960-tdep.c index 0452b95..e33415d 100644 --- a/gdb/i960-tdep.c +++ b/gdb/i960-tdep.c @@ -331,8 +331,8 @@ skip_prologue (ip) ways in the stack frame. sp is even more special: the address we return for it IS the sp for the next frame. - We cache the result of doing this in the frame_cache_obstack, since - it is fairly expensive. */ + We cache the result of doing this in the frame_obstack, since it is + fairly expensive. */ void frame_find_saved_regs (fi, fsr) @@ -343,7 +343,6 @@ frame_find_saved_regs (fi, fsr) register CORE_ADDR *saved_regs; register int regnum; register struct frame_saved_regs *cache_fsr; - extern struct obstack frame_cache_obstack; CORE_ADDR ip; struct symtab_and_line sal; CORE_ADDR limit; @@ -351,8 +350,7 @@ frame_find_saved_regs (fi, fsr) if (!fi->fsr) { cache_fsr = (struct frame_saved_regs *) - obstack_alloc (&frame_cache_obstack, - sizeof (struct frame_saved_regs)); + frame_obstack_alloc (sizeof (struct frame_saved_regs)); memset (cache_fsr, '\0', sizeof (struct frame_saved_regs)); fi->fsr = cache_fsr; diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c index 7a75508..f82cb76 100644 --- a/gdb/m88k-tdep.c +++ b/gdb/m88k-tdep.c @@ -421,8 +421,8 @@ skip_prologue (ip) ways in the stack frame. sp is even more special: the address we return for it IS the sp for the next frame. - We cache the result of doing this in the frame_cache_obstack, since - it is fairly expensive. */ + We cache the result of doing this in the frame_obstack, since it is + fairly expensive. */ void frame_find_saved_regs (fi, fsr) @@ -430,7 +430,6 @@ frame_find_saved_regs (fi, fsr) struct frame_saved_regs *fsr; { register struct frame_saved_regs *cache_fsr; - extern struct obstack frame_cache_obstack; CORE_ADDR ip; struct symtab_and_line sal; CORE_ADDR limit; @@ -438,8 +437,7 @@ frame_find_saved_regs (fi, fsr) if (!fi->fsr) { cache_fsr = (struct frame_saved_regs *) - obstack_alloc (&frame_cache_obstack, - sizeof (struct frame_saved_regs)); + frame_obstack_alloc (sizeof (struct frame_saved_regs)); memset (cache_fsr, '\0', sizeof (struct frame_saved_regs)); fi->fsr = cache_fsr; diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 6280f2c..73cba33 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -41,9 +41,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Do not use "TARGET_IS_MIPS64" to test the size of floating point registers */ #define FP_REGISTER_DOUBLE (REGISTER_VIRTUAL_SIZE(FP0_REGNUM) == 8) -/* FIXME: Put this declaration in frame.h. */ -extern struct obstack frame_cache_obstack; - #if 0 static int mips_in_lenient_prologue PARAMS ((CORE_ADDR, CORE_ADDR)); #endif @@ -829,9 +826,7 @@ mips_find_saved_regs (fci) mips_extra_func_info_t proc_desc; t_inst inst; - fci->saved_regs = (struct frame_saved_regs *) - obstack_alloc (&frame_cache_obstack, sizeof(struct frame_saved_regs)); - memset (fci->saved_regs, 0, sizeof (struct frame_saved_regs)); + frame_saved_regs_zalloc (fci); /* If it is the frame for sigtramp, the saved registers are located in a sigcontext structure somewhere on the stack. @@ -857,15 +852,15 @@ mips_find_saved_regs (fci) { reg_position = fci->frame + SIGFRAME_REGSAVE_OFF + ireg * SIGFRAME_REG_SIZE; - fci->saved_regs->regs[ireg] = reg_position; + fci->saved_regs[ireg] = reg_position; } for (ireg = 0; ireg < MIPS_NUMREGS; ireg++) { reg_position = fci->frame + SIGFRAME_FPREGSAVE_OFF + ireg * SIGFRAME_REG_SIZE; - fci->saved_regs->regs[FP0_REGNUM + ireg] = reg_position; + fci->saved_regs[FP0_REGNUM + ireg] = reg_position; } - fci->saved_regs->regs[PC_REGNUM] = fci->frame + SIGFRAME_PC_OFF; + fci->saved_regs[PC_REGNUM] = fci->frame + SIGFRAME_PC_OFF; return; } @@ -935,7 +930,7 @@ mips_find_saved_regs (fci) for (ireg= MIPS_NUMREGS-1; gen_mask; --ireg, gen_mask <<= 1) if (gen_mask & 0x80000000) { - fci->saved_regs->regs[ireg] = reg_position; + fci->saved_regs[ireg] = reg_position; reg_position -= MIPS_REGSIZE; /* start-sanitize-r5900 */ #ifdef R5900_128BIT_GPR_HACK @@ -968,7 +963,7 @@ mips_find_saved_regs (fci) /* Check if the s0 and s1 registers were pushed on the stack. */ for (reg = 16; reg < sreg_count+16; reg++) { - fci->saved_regs->regs[reg] = reg_position; + fci->saved_regs[reg] = reg_position; reg_position -= MIPS_REGSIZE; } } @@ -988,11 +983,11 @@ mips_find_saved_regs (fci) for (ireg = MIPS_NUMREGS-1; float_mask; --ireg, float_mask <<= 1) if (float_mask & 0x80000000) { - fci->saved_regs->regs[FP0_REGNUM+ireg] = reg_position; + fci->saved_regs[FP0_REGNUM+ireg] = reg_position; reg_position -= MIPS_REGSIZE; } - fci->saved_regs->regs[PC_REGNUM] = fci->saved_regs->regs[RA_REGNUM]; + fci->saved_regs[PC_REGNUM] = fci->saved_regs[RA_REGNUM]; } static CORE_ADDR @@ -1010,8 +1005,8 @@ read_next_frame_reg(fi, regno) { if (fi->saved_regs == NULL) mips_find_saved_regs (fi); - if (fi->saved_regs->regs[regno]) - return read_memory_integer(fi->saved_regs->regs[regno], MIPS_REGSIZE); + if (fi->saved_regs[regno]) + return read_memory_integer(fi->saved_regs[regno], MIPS_REGSIZE); } } return read_register (regno); @@ -1716,12 +1711,11 @@ init_extra_frame_info(fci) (CORE_ADDR *)NULL,(CORE_ADDR *)NULL); if (!IN_SIGTRAMP (fci->pc, name)) { - fci->saved_regs = (struct frame_saved_regs*) - obstack_alloc (&frame_cache_obstack, - sizeof (struct frame_saved_regs)); - *fci->saved_regs = temp_saved_regs; - fci->saved_regs->regs[PC_REGNUM] - = fci->saved_regs->regs[RA_REGNUM]; + fci->saved_regs = (CORE_ADDR*) + frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS); + memcpy (fci->saved_regs, temp_saved_regs.regs, SIZEOF_FRAME_SAVED_REGS); + fci->saved_regs[PC_REGNUM] + = fci->saved_regs[RA_REGNUM]; } } @@ -2107,9 +2101,9 @@ mips_pop_frame() for (regnum = 0; regnum < NUM_REGS; regnum++) { if (regnum != SP_REGNUM && regnum != PC_REGNUM - && frame->saved_regs->regs[regnum]) + && frame->saved_regs[regnum]) write_register (regnum, - read_memory_integer (frame->saved_regs->regs[regnum], + read_memory_integer (frame->saved_regs[regnum], MIPS_REGSIZE)); } write_register (SP_REGNUM, new_sp); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index e25ffdf..d851c77 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -28,8 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "objfiles.h" #include "xcoffsolib.h" -extern struct obstack frame_cache_obstack; - extern int errno; /* Breakpoint shadows for the single step instructions will be kept here. */ @@ -52,11 +50,61 @@ CORE_ADDR (*find_toc_address_hook) PARAMS ((CORE_ADDR)) = NULL; static CORE_ADDR branch_dest PARAMS ((int opcode, int instr, CORE_ADDR pc, CORE_ADDR safety)); -static void frame_get_cache_fsr PARAMS ((struct frame_info *fi, - struct rs6000_framedata *fdatap)); +static void frame_get_saved_regs PARAMS ((struct frame_info *fi, + struct rs6000_framedata *fdatap)); static void pop_dummy_frame PARAMS ((void)); +static CORE_ADDR frame_initial_stack_address PARAMS ((struct frame_info *)); + +/* Fill in fi->saved_regs */ + +struct frame_extra_info +{ + /* Functions calling alloca() change the value of the stack + pointer. We need to use initial stack pointer (which is saved in + r31 by gcc) in such cases. If a compiler emits traceback table, + then we should use the alloca register specified in traceback + table. FIXME. */ + CORE_ADDR initial_sp; /* initial stack pointer. */ \ +}; + +void +rs6000_init_extra_frame_info (fromleaf, fi) + int fromleaf; + struct frame_info *fi; +{ + fi->extra_info = (struct frame_extra_info*) + frame_obstack_alloc (sizeof (struct frame_extra_info)); + fi->extra_info->initial_sp = 0; + if (fi->next != (CORE_ADDR) 0 + && fi->pc < TEXT_SEGMENT_BASE) + /* We're in get_prev_frame_info */ + /* and this is a special signal frame. */ + /* (fi->pc will be some low address in the kernel, */ + /* to which the signal handler returns). */ + fi->signal_handler_caller = 1; +} + + +void +rs6000_frame_init_saved_regs (fi) + struct frame_info *fi; +{ + frame_get_saved_regs (fi, NULL); +} + +CORE_ADDR +rs6000_frame_args_address (fi) + struct frame_info *fi; +{ + if (fi->extra_info->initial_sp != 0) + return fi->extra_info->initial_sp; + else + return frame_initial_stack_address (fi); +} + + /* Calculate the destination of a branch/jump. Return -1 if not a branch. */ static CORE_ADDR @@ -509,7 +557,7 @@ push_dummy_frame () pc = read_register(PC_REGNUM); store_address (pc_targ, 4, pc); - skip_prologue (get_pc_function_start (pc) + FUNCTION_START_OFFSET, &fdata); + skip_prologue (get_pc_function_start (pc), &fdata); dummy_frame_addr [dummy_frame_count++] = sp; @@ -653,7 +701,7 @@ pop_frame () still in the link register, otherwise walk the frames and retrieve the saved %pc value in the previous frame. */ - addr = get_pc_function_start (frame->pc) + FUNCTION_START_OFFSET; + addr = get_pc_function_start (frame->pc); (void) skip_prologue (addr, &fdata); if (fdata.frameless) @@ -1081,7 +1129,6 @@ frameless_function_invocation (fi) return 0; } - func_start += FUNCTION_START_OFFSET; (void) skip_prologue (func_start, &fdata); return fdata.frameless; } @@ -1103,7 +1150,7 @@ frame_saved_pc (fi) return generic_read_register_dummy(fi->pc, fi->frame, PC_REGNUM); #endif /* GENERIC_DUMMY_FRAMES */ - func_start = get_pc_function_start (fi->pc) + FUNCTION_START_OFFSET; + func_start = get_pc_function_start (fi->pc); /* If we failed to find the start of the function, it is a mistake to inspect the instructions. */ @@ -1132,7 +1179,7 @@ frame_saved_pc (fi) in which case the framedata are read. */ static void -frame_get_cache_fsr (fi, fdatap) +frame_get_saved_regs (fi, fdatap) struct frame_info *fi; struct rs6000_framedata *fdatap; { @@ -1140,19 +1187,26 @@ frame_get_cache_fsr (fi, fdatap) CORE_ADDR frame_addr; struct rs6000_framedata work_fdata; - if (fi->cache_fsr) + if (fi->saved_regs) return; - if (fdatap == NULL) { - fdatap = &work_fdata; - (void) skip_prologue (get_pc_function_start (fi->pc), fdatap); - } + if (fdatap == NULL) + { + fdatap = &work_fdata; + (void) skip_prologue (get_pc_function_start (fi->pc), fdatap); + } + + frame_saved_regs_zalloc (fi); - fi->cache_fsr = (struct frame_saved_regs *) - obstack_alloc (&frame_cache_obstack, sizeof (struct frame_saved_regs)); - memset (fi->cache_fsr, '\0', sizeof (struct frame_saved_regs)); + /* If there were any saved registers, figure out parent's stack + pointer. */ + /* The following is true only if the frame doesn't have a call to + alloca(), FIXME. */ - if (fi->prev && fi->prev->frame) + if (fdatap->saved_fpr == 0 && fdatap->saved_gpr == 0 + && fdatap->lr_offset == 0 && fdatap->cr_offset == 0) + frame_addr = 0; + else if (fi->prev && fi->prev->frame) frame_addr = fi->prev->frame; else frame_addr = read_memory_integer (fi->frame, 4); @@ -1160,41 +1214,47 @@ frame_get_cache_fsr (fi, fdatap) /* if != -1, fdatap->saved_fpr is the smallest number of saved_fpr. All fpr's from saved_fpr to fp31 are saved. */ - if (fdatap->saved_fpr >= 0) { - int fpr_offset = frame_addr + fdatap->fpr_offset; - for (ii = fdatap->saved_fpr; ii < 32; ii++) { - fi->cache_fsr->regs [FP0_REGNUM + ii] = fpr_offset; - fpr_offset += 8; + if (fdatap->saved_fpr >= 0) + { + int i; + int fpr_offset = frame_addr + fdatap->fpr_offset; + for (i = fdatap->saved_fpr; i < 32; i++) + { + fi->saved_regs [FP0_REGNUM + i] = fpr_offset; + fpr_offset += 8; + } } - } /* if != -1, fdatap->saved_gpr is the smallest number of saved_gpr. All gpr's from saved_gpr to gpr31 are saved. */ - - if (fdatap->saved_gpr >= 0) { - int gpr_offset = frame_addr + fdatap->gpr_offset; - for (ii = fdatap->saved_gpr; ii < 32; ii++) { - fi->cache_fsr->regs [ii] = gpr_offset; - gpr_offset += 4; + + if (fdatap->saved_gpr >= 0) + { + int i; + int gpr_offset = frame_addr + fdatap->gpr_offset; + for (i = fdatap->saved_gpr; i < 32; i++) + { + fi->saved_regs [i] = gpr_offset; + gpr_offset += 4; + } } - } /* If != 0, fdatap->cr_offset is the offset from the frame that holds the CR. */ if (fdatap->cr_offset != 0) - fi->cache_fsr->regs [CR_REGNUM] = frame_addr + fdatap->cr_offset; + fi->saved_regs [CR_REGNUM] = frame_addr + fdatap->cr_offset; /* If != 0, fdatap->lr_offset is the offset from the frame that holds the LR. */ if (fdatap->lr_offset != 0) - fi->cache_fsr->regs [LR_REGNUM] = frame_addr + fdatap->lr_offset; + fi->saved_regs [LR_REGNUM] = frame_addr + fdatap->lr_offset; } /* Return the address of a frame. This is the inital %sp value when the frame was first allocated. For functions calling alloca(), it might be saved in an alloca register. */ -CORE_ADDR +static CORE_ADDR frame_initial_stack_address (fi) struct frame_info *fi; { @@ -1205,8 +1265,8 @@ frame_initial_stack_address (fi) /* if the initial stack pointer (frame address) of this frame is known, just return it. */ - if (fi->initial_sp) - return fi->initial_sp; + if (fi->extra_info->initial_sp) + return fi->extra_info->initial_sp; /* find out if this function is using an alloca register.. */ @@ -1214,22 +1274,23 @@ frame_initial_stack_address (fi) /* if saved registers of this frame are not known yet, read and cache them. */ - if (!fi->cache_fsr) - frame_get_cache_fsr (fi, &fdata); + if (!fi->saved_regs) + frame_get_saved_regs (fi, &fdata); /* If no alloca register used, then fi->frame is the value of the %sp for this frame, and it is good enough. */ - if (fdata.alloca_reg < 0) { - fi->initial_sp = fi->frame; - return fi->initial_sp; - } + if (fdata.alloca_reg < 0) + { + fi->extra_info->initial_sp = fi->frame; + return fi->extra_info->initial_sp; + } /* This function has an alloca register. If this is the top-most frame (with the lowest address), the value in alloca register is good. */ if (!fi->next) - return fi->initial_sp = read_register (fdata.alloca_reg); + return fi->extra_info->initial_sp = read_register (fdata.alloca_reg); /* Otherwise, this is a caller frame. Callee has usually already saved registers, but there are exceptions (such as when the callee @@ -1238,15 +1299,15 @@ frame_initial_stack_address (fi) for (callee_fi = fi->next; callee_fi; callee_fi = callee_fi->next) { - if (!callee_fi->cache_fsr) - frame_get_cache_fsr (callee_fi, NULL); + if (!callee_fi->saved_regs) + frame_get_saved_regs (callee_fi, NULL); /* this is the address in which alloca register is saved. */ - tmpaddr = callee_fi->cache_fsr->regs [fdata.alloca_reg]; + tmpaddr = callee_fi->saved_regs [fdata.alloca_reg]; if (tmpaddr) { - fi->initial_sp = read_memory_integer (tmpaddr, 4); - return fi->initial_sp; + fi->extra_info->initial_sp = read_memory_integer (tmpaddr, 4); + return fi->extra_info->initial_sp; } /* Go look into deeper levels of the frame chain to see if any one of @@ -1256,7 +1317,8 @@ frame_initial_stack_address (fi) /* If alloca register was not saved, by the callee (or any of its callees) then the value in the register is still good. */ - return fi->initial_sp = read_register (fdata.alloca_reg); + fi->extra_info->initial_sp = read_register (fdata.alloca_reg); + return fi->extra_info->initial_sp; } CORE_ADDR diff --git a/gdb/z8k-tdep.c b/gdb/z8k-tdep.c index 2afacf2..0b5c1c2 100644 --- a/gdb/z8k-tdep.c +++ b/gdb/z8k-tdep.c @@ -80,10 +80,11 @@ skip_adjust (pc, size) return pc; } -int +static CORE_ADDR examine_frame PARAMS ((CORE_ADDR, CORE_ADDR *regs, CORE_ADDR)); +static CORE_ADDR examine_frame (pc, regs, sp) CORE_ADDR pc; - struct frame_saved_regs *regs; + CORE_ADDR *regs; CORE_ADDR sp; { int w = read_memory_short (pc); @@ -91,20 +92,20 @@ examine_frame (pc, regs, sp) int regno; for (regno = 0; regno < NUM_REGS; regno++) - regs->regs[regno] = 0; + regs[regno] = 0; while (IS_PUSHW (w) || IS_PUSHL (w)) { /* work out which register is being pushed to where */ if (IS_PUSHL (w)) { - regs->regs[w & 0xf] = offset; - regs->regs[(w & 0xf) + 1] = offset + 2; + regs[w & 0xf] = offset; + regs[(w & 0xf) + 1] = offset + 2; offset += 4; } else { - regs->regs[w & 0xf] = offset; + regs[w & 0xf] = offset; offset += 2; } pc += 2; @@ -121,16 +122,16 @@ examine_frame (pc, regs, sp) /* Subtracting a value from the sp, so were in a function which needs stack space for locals, but has no fp. We fake up the values as if we had an fp */ - regs->regs[FP_REGNUM] = sp; + regs[FP_REGNUM] = sp; } else { /* This one didn't have an fp, we'll fake it up */ - regs->regs[SP_REGNUM] = sp; + regs[SP_REGNUM] = sp; } /* stack pointer contains address of next frame */ - /* regs->regs[fp_regnum()] = fp;*/ - regs->regs[SP_REGNUM] = sp; + /* regs[fp_regnum()] = fp;*/ + regs[SP_REGNUM] = sp; return pc; } @@ -138,9 +139,9 @@ CORE_ADDR z8k_skip_prologue (start_pc) CORE_ADDR start_pc; { - struct frame_saved_regs dummy; + CORE_ADDR dummy[NUM_REGS]; - return examine_frame (start_pc, &dummy, 0); + return examine_frame (start_pc, dummy, 0); } CORE_ADDR @@ -185,19 +186,17 @@ init_frame_pc () the address we return for it IS the sp for the next frame. */ void -get_frame_saved_regs (frame_info, frame_saved_regs) +z8k_frame_init_saved_regs (frame_info) struct frame_info *frame_info; - struct frame_saved_regs *frame_saved_regs; - { CORE_ADDR pc; int w; - memset (frame_saved_regs, '\0', sizeof (*frame_saved_regs)); + frame_saved_regs_zalloc (frame_info); pc = get_pc_function_start (frame_info->pc); -/* wander down the instruction stream */ - examine_frame (pc, frame_saved_regs, frame_info->frame); + /* wander down the instruction stream */ + examine_frame (pc, frame_info->saved_regs, frame_info->frame); } @@ -240,6 +239,7 @@ NEXT_PROLOGUE_INSN (addr, lim, pword1) return 0; } +#if 0 /* Put here the code to store, into a struct frame_saved_regs, the addresses of the saved registers of frame described by FRAME_INFO. This includes special registers such as pc and fp saved in special @@ -291,6 +291,7 @@ frame_find_saved_regs (fip, fsrp) fsrp->regs[FP_REGNUM] = fip->frame; } +#endif int saved_pc_after_call () |