From b2fb46766e90d9753db4f8db3138f69be34f8e3b Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Fri, 3 Jan 2003 23:53:48 +0000 Subject: [PATCH] 2003-01-03 Andrew Cagney * alpha-tdep.c: Use get_frame_saved_regs. * arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto. * h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto. * m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Ditto. * ns32k-tdep.c, s390-tdep.c, sh-tdep.c, v850-tdep.c: Ditto. * vax-tdep.c, xstormy16-tdep.c: Ditto. --- gdb/ChangeLog | 9 ++++++ gdb/alpha-tdep.c | 43 ++++++++++++------------- gdb/arm-tdep.c | 47 ++++++++++++++-------------- gdb/avr-tdep.c | 34 ++++++++++---------- gdb/cris-tdep.c | 36 ++++++++++----------- gdb/d10v-tdep.c | 58 +++++++++++++++++----------------- gdb/h8300-tdep.c | 12 +++---- gdb/i386-tdep.c | 12 +++---- gdb/ia64-tdep.c | 74 ++++++++++++++++++++++---------------------- gdb/m68hc11-tdep.c | 30 +++++++++--------- gdb/m68k-tdep.c | 38 +++++++++++------------ gdb/mcore-tdep.c | 16 +++++----- gdb/mips-tdep.c | 34 ++++++++++---------- gdb/mn10300-tdep.c | 60 +++++++++++++++++------------------ gdb/ns32k-tdep.c | 18 +++++------ gdb/s390-tdep.c | 26 ++++++++-------- gdb/sh-tdep.c | 66 +++++++++++++++++++-------------------- gdb/v850-tdep.c | 14 ++++----- gdb/vax-tdep.c | 16 +++++----- gdb/xstormy16-tdep.c | 26 ++++++++-------- 20 files changed, 339 insertions(+), 330 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3bff968eb0e..0ce24407fd1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2003-01-03 Andrew Cagney + + * alpha-tdep.c: Use get_frame_saved_regs. + * arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto. + * h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto. + * m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Ditto. + * ns32k-tdep.c, s390-tdep.c, sh-tdep.c, v850-tdep.c: Ditto. + * vax-tdep.c, xstormy16-tdep.c: Ditto. + 2003-01-03 Mark Kettenis * configure.in: Remove all use of the SUBDIRS variable; add diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 14595055bb2..ea68302b930 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -389,14 +389,14 @@ alpha_find_saved_regs (struct frame_info *frame) for (ireg = 0; ireg < 32; ireg++) { reg_position = sigcontext_addr + SIGFRAME_REGSAVE_OFF + ireg * 8; - frame->saved_regs[ireg] = reg_position; + get_frame_saved_regs (frame)[ireg] = reg_position; } for (ireg = 0; ireg < 32; ireg++) { reg_position = sigcontext_addr + SIGFRAME_FPREGSAVE_OFF + ireg * 8; - frame->saved_regs[FP0_REGNUM + ireg] = reg_position; + get_frame_saved_regs (frame)[FP0_REGNUM + ireg] = reg_position; } - frame->saved_regs[PC_REGNUM] = sigcontext_addr + SIGFRAME_PC_OFF; + get_frame_saved_regs (frame)[PC_REGNUM] = sigcontext_addr + SIGFRAME_PC_OFF; return; } @@ -419,7 +419,7 @@ alpha_find_saved_regs (struct frame_info *frame) register number. */ if (mask & (1 << returnreg)) { - frame->saved_regs[returnreg] = reg_position; + get_frame_saved_regs (frame)[returnreg] = reg_position; reg_position += 8; mask &= ~(1 << returnreg); /* Clear bit for RA so we don't save again later. */ @@ -428,7 +428,7 @@ alpha_find_saved_regs (struct frame_info *frame) for (ireg = 0; ireg <= 31; ++ireg) if (mask & (1 << ireg)) { - frame->saved_regs[ireg] = reg_position; + get_frame_saved_regs (frame)[ireg] = reg_position; reg_position += 8; } @@ -441,19 +441,19 @@ alpha_find_saved_regs (struct frame_info *frame) for (ireg = 0; ireg <= 31; ++ireg) if (mask & (1 << ireg)) { - frame->saved_regs[FP0_REGNUM + ireg] = reg_position; + get_frame_saved_regs (frame)[FP0_REGNUM + ireg] = reg_position; reg_position += 8; } - frame->saved_regs[PC_REGNUM] = frame->saved_regs[returnreg]; + get_frame_saved_regs (frame)[PC_REGNUM] = get_frame_saved_regs (frame)[returnreg]; } static void alpha_frame_init_saved_regs (struct frame_info *fi) { - if (fi->saved_regs == NULL) + if (get_frame_saved_regs (fi) == NULL) alpha_find_saved_regs (fi); - fi->saved_regs[SP_REGNUM] = fi->frame; + get_frame_saved_regs (fi)[SP_REGNUM] = fi->frame; } static CORE_ADDR @@ -475,10 +475,10 @@ read_next_frame_reg (struct frame_info *fi, int regno) return fi->frame; else { - if (fi->saved_regs == NULL) + if (get_frame_saved_regs (fi) == NULL) alpha_find_saved_regs (fi); - if (fi->saved_regs[regno]) - return read_memory_integer (fi->saved_regs[regno], 8); + if (get_frame_saved_regs (fi)[regno]) + return read_memory_integer (get_frame_saved_regs (fi)[regno], 8); } } return read_register (regno); @@ -984,7 +984,9 @@ alpha_init_extra_frame_info (int fromleaf, struct frame_info *frame) frame->extra_info = (struct frame_extra_info *) frame_obstack_alloc (sizeof (struct frame_extra_info)); - frame->saved_regs = NULL; + /* NOTE: cagney/2003-01-03: No need to set saved_regs to NULL, + always NULL by default. */ + /* frame->saved_regs = NULL; */ frame->extra_info->localoff = 0; frame->extra_info->pc_reg = ALPHA_RA_REGNUM; frame->extra_info->proc_desc = proc_desc == &temp_proc_desc ? 0 : proc_desc; @@ -1028,12 +1030,11 @@ alpha_init_extra_frame_info (int fromleaf, struct frame_info *frame) (CORE_ADDR *) NULL, (CORE_ADDR *) NULL); if (!PC_IN_SIGTRAMP (get_frame_pc (frame), name)) { - frame->saved_regs = (CORE_ADDR *) - frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS); - memcpy (frame->saved_regs, temp_saved_regs, + frame_saved_regs_zalloc (frame); + memcpy (get_frame_saved_regs (frame), temp_saved_regs, SIZEOF_FRAME_SAVED_REGS); - frame->saved_regs[PC_REGNUM] - = frame->saved_regs[ALPHA_RA_REGNUM]; + get_frame_saved_regs (frame)[PC_REGNUM] + = get_frame_saved_regs (frame)[ALPHA_RA_REGNUM]; } } } @@ -1302,19 +1303,19 @@ alpha_pop_frame (void) For now, we don't save a copy... */ write_register (PC_REGNUM, FRAME_SAVED_PC (frame)); - if (frame->saved_regs == NULL) + if (get_frame_saved_regs (frame) == NULL) alpha_find_saved_regs (frame); if (proc_desc) { for (regnum = 32; --regnum >= 0;) if (PROC_REG_MASK (proc_desc) & (1 << regnum)) write_register (regnum, - read_memory_integer (frame->saved_regs[regnum], + read_memory_integer (get_frame_saved_regs (frame)[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[regnum + FP0_REGNUM], 8)); + read_memory_integer (get_frame_saved_regs (frame)[regnum + FP0_REGNUM], 8)); } write_register (SP_REGNUM, new_sp); flush_cached_frames (); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 75c18240115..b82f9e7ce88 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -591,7 +591,7 @@ thumb_scan_prologue (struct frame_info *fi) if (mask & (1 << regno)) { fi->extra_info->framesize += 4; - fi->saved_regs[saved_reg[regno]] = + get_frame_saved_regs (fi)[saved_reg[regno]] = -(fi->extra_info->framesize); /* Reset saved register map. */ saved_reg[regno] = regno; @@ -670,7 +670,7 @@ check_prologue_cache (struct frame_info *fi) fi->extra_info->framesize = prologue_cache.extra_info->framesize; fi->extra_info->frameoffset = prologue_cache.extra_info->frameoffset; for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++) - fi->saved_regs[i] = prologue_cache.saved_regs[i]; + get_frame_saved_regs (fi)[i] = get_frame_saved_regs (&prologue_cache)[i]; return 1; } else @@ -691,7 +691,7 @@ save_prologue_cache (struct frame_info *fi) prologue_cache.extra_info->frameoffset = fi->extra_info->frameoffset; for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++) - prologue_cache.saved_regs[i] = fi->saved_regs[i]; + get_frame_saved_regs (&prologue_cache)[i] = get_frame_saved_regs (fi)[i]; } @@ -890,7 +890,7 @@ arm_scan_prologue (struct frame_info *fi) if (mask & (1 << regno)) { sp_offset -= 4; - fi->saved_regs[regno] = sp_offset; + get_frame_saved_regs (fi)[regno] = sp_offset; } } else if ((insn & 0xffffc000) == 0xe54b0000 || /* strb rx,[r11,#-n] */ @@ -926,7 +926,7 @@ arm_scan_prologue (struct frame_info *fi) { sp_offset -= 12; regno = ARM_F0_REGNUM + ((insn >> 12) & 0x07); - fi->saved_regs[regno] = sp_offset; + get_frame_saved_regs (fi)[regno] = sp_offset; } else if ((insn & 0xffbf0fff) == 0xec2d0200) /* sfmfd f0, 4, [sp!] */ { @@ -953,7 +953,7 @@ arm_scan_prologue (struct frame_info *fi) for (; fp_start_reg < fp_bound_reg; fp_start_reg++) { sp_offset -= 12; - fi->saved_regs[fp_start_reg++] = sp_offset; + get_frame_saved_regs (fi)[fp_start_reg++] = sp_offset; } } else if ((insn & 0xf0000000) != 0xe0000000) @@ -997,14 +997,14 @@ arm_find_callers_reg (struct frame_info *fi, int regnum) { return deprecated_read_register_dummy (get_frame_pc (fi), fi->frame, regnum); } - else if (fi->saved_regs[regnum] != 0) + else if (get_frame_saved_regs (fi)[regnum] != 0) { /* NOTE: cagney/2002-05-03: This would normally need to handle ARM_SP_REGNUM as a special case as, according to the frame.h comments, saved_regs[SP_REGNUM] contains the SP value not its address. It appears that the ARM isn't doing this though. */ - return read_memory_integer (fi->saved_regs[regnum], + return read_memory_integer (get_frame_saved_regs (fi)[regnum], REGISTER_RAW_SIZE (regnum)); } } @@ -1086,7 +1086,7 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi) int reg; CORE_ADDR sp; - if (fi->saved_regs == NULL) + if (get_frame_saved_regs (fi) == NULL) frame_saved_regs_zalloc (fi); fi->extra_info = (struct frame_extra_info *) @@ -1099,7 +1099,7 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi) if (fi->next) deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (fi->next)); - memset (fi->saved_regs, '\000', sizeof fi->saved_regs); + memset (get_frame_saved_regs (fi), '\000', sizeof get_frame_saved_regs (fi)); /* Compute stack pointer for this frame. We use this value for both the sigtramp and call dummy cases. */ @@ -1135,12 +1135,12 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi) && ((get_frame_type (fi) == SIGTRAMP_FRAME) || PC_IN_SIGTRAMP (get_frame_pc (fi), (char *)0))) { for (reg = 0; reg < NUM_REGS; reg++) - fi->saved_regs[reg] = SIGCONTEXT_REGISTER_ADDRESS (sp, get_frame_pc (fi), reg); + get_frame_saved_regs (fi)[reg] = SIGCONTEXT_REGISTER_ADDRESS (sp, get_frame_pc (fi), reg); /* FIXME: What about thumb mode? */ fi->extra_info->framereg = ARM_SP_REGNUM; fi->frame = - read_memory_integer (fi->saved_regs[fi->extra_info->framereg], + read_memory_integer (get_frame_saved_regs (fi)[fi->extra_info->framereg], REGISTER_RAW_SIZE (fi->extra_info->framereg)); fi->extra_info->framesize = 0; fi->extra_info->frameoffset = 0; @@ -1162,10 +1162,9 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi) { /* not the innermost frame */ /* If we have an FP, the callee saved it. */ - if (fi->next->saved_regs[fi->extra_info->framereg] != 0) + if (get_frame_saved_regs (get_next_frame (fi))[fi->extra_info->framereg] != 0) fi->frame = - read_memory_integer (fi->next - ->saved_regs[fi->extra_info->framereg], 4); + read_memory_integer (get_frame_saved_regs (get_next_frame (fi))[fi->extra_info->framereg], 4); else if (fromleaf) /* If we were called by a frameless fn. then our frame is still in the frame pointer register on the board... */ @@ -1175,9 +1174,9 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi) /* Calculate actual addresses of saved registers using offsets determined by arm_scan_prologue. */ for (reg = 0; reg < NUM_REGS; reg++) - if (fi->saved_regs[reg] != 0) - fi->saved_regs[reg] += (fi->frame + fi->extra_info->framesize - - fi->extra_info->frameoffset); + if (get_frame_saved_regs (fi)[reg] != 0) + get_frame_saved_regs (fi)[reg] += (fi->frame + fi->extra_info->framesize + - fi->extra_info->frameoffset); } } @@ -1200,7 +1199,7 @@ arm_frame_saved_pc (struct frame_info *fi) if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), fi->frame - fi->extra_info->frameoffset, fi->frame)) { - return read_memory_integer (fi->saved_regs[ARM_PC_REGNUM], + return read_memory_integer (get_frame_saved_regs (fi)[ARM_PC_REGNUM], REGISTER_RAW_SIZE (ARM_PC_REGNUM)); } else @@ -1232,7 +1231,7 @@ static void arm_frame_init_saved_regs (struct frame_info *fip) { - if (fip->saved_regs) + if (get_frame_saved_regs (fip)) return; arm_init_extra_frame_info (0, fip); @@ -1531,9 +1530,9 @@ arm_pop_frame (void) } for (regnum = 0; regnum < NUM_REGS; regnum++) - if (frame->saved_regs[regnum] != 0) + if (get_frame_saved_regs (frame)[regnum] != 0) write_register (regnum, - read_memory_integer (frame->saved_regs[regnum], + read_memory_integer (get_frame_saved_regs (frame)[regnum], REGISTER_RAW_SIZE (regnum))); write_register (ARM_PC_REGNUM, FRAME_SAVED_PC (frame)); @@ -3039,8 +3038,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* We can't use SIZEOF_FRAME_SAVED_REGS here, since that still references the old architecture vector, not the one we are building here. */ - if (prologue_cache.saved_regs != NULL) - xfree (prologue_cache.saved_regs); + if (get_frame_saved_regs (&prologue_cache) != NULL) + xfree (get_frame_saved_regs (&prologue_cache)); /* We can't use NUM_REGS nor NUM_PSEUDO_REGS here, since that still references the old architecture vector, not the one we are diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 16488f5b8b2..d1b14165db0 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -593,13 +593,13 @@ avr_scan_prologue (struct frame_info *fi) if (num_pushes) { int from; - fi->saved_regs[AVR_FP_REGNUM + 1] = num_pushes; + get_frame_saved_regs (fi)[AVR_FP_REGNUM + 1] = num_pushes; if (num_pushes >= 2) - fi->saved_regs[AVR_FP_REGNUM] = num_pushes - 1; + get_frame_saved_regs (fi)[AVR_FP_REGNUM] = num_pushes - 1; i = 0; for (from = AVR_LAST_PUSHED_REGNUM + 1 - (num_pushes - 2); from <= AVR_LAST_PUSHED_REGNUM; ++from) - fi->saved_regs[from] = ++i; + get_frame_saved_regs (fi)[from] = ++i; } fi->extra_info->locals_size = loc_size; fi->extra_info->framesize = loc_size + num_pushes; @@ -622,15 +622,15 @@ avr_scan_prologue (struct frame_info *fi) if (memcmp (prologue, img, sizeof (img)) == 0) { vpc += sizeof (img); - fi->saved_regs[0] = 2; - fi->saved_regs[1] = 1; + get_frame_saved_regs (fi)[0] = 2; + get_frame_saved_regs (fi)[1] = 1; fi->extra_info->framesize += 3; } else if (memcmp (img + 1, prologue, sizeof (img) - 1) == 0) { vpc += sizeof (img) - 1; - fi->saved_regs[0] = 2; - fi->saved_regs[1] = 1; + get_frame_saved_regs (fi)[0] = 2; + get_frame_saved_regs (fi)[1] = 1; fi->extra_info->framesize += 3; } } @@ -646,7 +646,7 @@ avr_scan_prologue (struct frame_info *fi) /* Bits 4-9 contain a mask for registers R0-R32. */ regno = (insn & 0x1f0) >> 4; ++fi->extra_info->framesize; - fi->saved_regs[regno] = fi->extra_info->framesize; + get_frame_saved_regs (fi)[regno] = fi->extra_info->framesize; scan_stage = 1; } else @@ -776,11 +776,11 @@ avr_init_extra_frame_info (int fromleaf, struct frame_info *fi) for (; next_fi; next_fi = next_fi->next) { /* look for saved AVR_FP_REGNUM */ - if (next_fi->saved_regs[AVR_FP_REGNUM] && !fp) - fp = next_fi->saved_regs[AVR_FP_REGNUM]; + if (get_frame_saved_regs (next_fi)[AVR_FP_REGNUM] && !fp) + fp = get_frame_saved_regs (next_fi)[AVR_FP_REGNUM]; /* look for saved AVR_FP_REGNUM + 1 */ - if (next_fi->saved_regs[AVR_FP_REGNUM + 1] && !fp1) - fp1 = next_fi->saved_regs[AVR_FP_REGNUM + 1]; + if (get_frame_saved_regs (next_fi)[AVR_FP_REGNUM + 1] && !fp1) + fp1 = get_frame_saved_regs (next_fi)[AVR_FP_REGNUM + 1]; } fp_low = (fp ? read_memory_unsigned_integer (avr_make_saddr (fp), 1) : read_register (AVR_FP_REGNUM)) & 0xff; @@ -815,8 +815,8 @@ avr_init_extra_frame_info (int fromleaf, struct frame_info *fi) /* Resolve a pushed registers addresses */ for (i = 0; i < NUM_REGS; i++) { - if (fi->saved_regs[i]) - fi->saved_regs[i] = addr - fi->saved_regs[i]; + if (get_frame_saved_regs (fi)[i]) + get_frame_saved_regs (fi)[i] = addr - get_frame_saved_regs (fi)[i]; } } } @@ -844,13 +844,13 @@ avr_pop_frame (void) { /* Don't forget AVR_SP_REGNUM in a frame_saved_regs struct is the actual value we want, not the address of the value we want. */ - if (frame->saved_regs[regnum] && regnum != AVR_SP_REGNUM) + if (get_frame_saved_regs (frame)[regnum] && regnum != AVR_SP_REGNUM) { - saddr = avr_make_saddr (frame->saved_regs[regnum]); + saddr = avr_make_saddr (get_frame_saved_regs (frame)[regnum]); write_register (regnum, read_memory_unsigned_integer (saddr, 1)); } - else if (frame->saved_regs[regnum] && regnum == AVR_SP_REGNUM) + else if (get_frame_saved_regs (frame)[regnum] && regnum == AVR_SP_REGNUM) write_register (regnum, frame->frame + 2); } diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 52f20bb57f6..53013558505 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -501,10 +501,10 @@ cris_examine (CORE_ADDR ip, CORE_ADDR limit, struct frame_info *fi, /* We only want to know the end of the prologue when fi->saved_regs == 0. When the saved registers are allocated full information is required. */ - if (fi->saved_regs) + if (get_frame_saved_regs (fi)) { for (regno = 0; regno < NUM_REGS; regno++) - fi->saved_regs[regno] = 0; + get_frame_saved_regs (fi)[regno] = 0; } /* Find the prologue instructions. */ @@ -676,34 +676,34 @@ cris_examine (CORE_ADDR ip, CORE_ADDR limit, struct frame_info *fi, /* We only want to know the end of the prologue when fi->saved_regs == 0. */ - if (!fi->saved_regs) + if (!get_frame_saved_regs (fi)) return ip; if (have_fp) { - fi->saved_regs[FP_REGNUM] = get_frame_base (fi); + get_frame_saved_regs (fi)[FP_REGNUM] = get_frame_base (fi); /* Calculate the addresses. */ for (regno = regsave; regno >= 0; regno--) { - fi->saved_regs[regno] = get_frame_base (fi) - val; + get_frame_saved_regs (fi)[regno] = get_frame_base (fi) - val; val -= 4; } if (fi->extra_info->leaf_function) { /* Set the register SP to contain the stack pointer of the caller. */ - fi->saved_regs[SP_REGNUM] = get_frame_base (fi) + 4; + get_frame_saved_regs (fi)[SP_REGNUM] = get_frame_base (fi) + 4; } else { /* Set the register SP to contain the stack pointer of the caller. */ - fi->saved_regs[SP_REGNUM] = get_frame_base (fi) + 8; + get_frame_saved_regs (fi)[SP_REGNUM] = get_frame_base (fi) + 8; /* Set the register SRP to contain the return address of the caller. */ - fi->saved_regs[SRP_REGNUM] = get_frame_base (fi) + 4; + get_frame_saved_regs (fi)[SRP_REGNUM] = get_frame_base (fi) + 4; } } return ip; @@ -743,7 +743,7 @@ cris_skip_prologue_main (CORE_ADDR pc, int frameless_p) /* frame_info now contains dynamic memory. Since fi is a dummy here, I use static memory for extra_info, and don't bother allocating memory for saved_regs. */ - fi.saved_regs = 0; + memset (&fi, 0, sizeof (fi)); fi.extra_info = &fei; /* If there is no symbol information then sal.end == 0, and we end up @@ -1164,7 +1164,7 @@ cris_frame_init_saved_regs (struct frame_info *fi) register int frameless_p = 0; /* Has this frame's registers already been initialized? */ - if (fi->saved_regs) + if (get_frame_saved_regs (fi)) return; frame_saved_regs_zalloc (fi); @@ -1231,11 +1231,11 @@ cris_init_extra_frame_info (int fromleaf, struct frame_info *fi) /* Check fromleaf/frameless_function_invocation. (FIXME) */ - if (fi->saved_regs[SRP_REGNUM] != 0) + if (get_frame_saved_regs (fi)[SRP_REGNUM] != 0) { /* SRP was saved on the stack; non-leaf function. */ fi->extra_info->return_pc = - read_memory_integer (fi->saved_regs[SRP_REGNUM], + read_memory_integer (get_frame_saved_regs (fi)[SRP_REGNUM], REGISTER_RAW_SIZE (SRP_REGNUM)); } else @@ -1533,30 +1533,30 @@ cris_pop_frame (void) after SP was saved. */ for (regno = 0; regno < FP_REGNUM; regno++) { - if (fi->saved_regs[regno]) + if (get_frame_saved_regs (fi)[regno]) { write_register (regno, - read_memory_integer (fi->saved_regs[regno], 4)); + read_memory_integer (get_frame_saved_regs (fi)[regno], 4)); } } - if (fi->saved_regs[FP_REGNUM]) + if (get_frame_saved_regs (fi)[FP_REGNUM]) { /* Pop the frame pointer (R8). It was pushed before SP was saved. */ write_register (FP_REGNUM, - read_memory_integer (fi->saved_regs[FP_REGNUM], 4)); + read_memory_integer (get_frame_saved_regs (fi)[FP_REGNUM], 4)); stack_offset += 4; /* Not a leaf function. */ - if (fi->saved_regs[SRP_REGNUM]) + if (get_frame_saved_regs (fi)[SRP_REGNUM]) { /* SRP was pushed before SP was saved. */ stack_offset += 4; } /* Restore the SP and adjust for R8 and (possibly) SRP. */ - write_register (SP_REGNUM, fi->saved_regs[FP_REGNUM] + stack_offset); + write_register (SP_REGNUM, get_frame_saved_regs (fi)[FP_REGNUM] + stack_offset); } else { diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 24bb14a73c7..2012cead22d 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -555,23 +555,23 @@ do_d10v_pop_frame (struct frame_info *fi) /* now update the current registers with the old values */ for (regnum = A0_REGNUM; regnum < A0_REGNUM + NR_A_REGS; regnum++) { - if (fi->saved_regs[regnum]) + if (get_frame_saved_regs (fi)[regnum]) { - read_memory (fi->saved_regs[regnum], raw_buffer, REGISTER_RAW_SIZE (regnum)); + read_memory (get_frame_saved_regs (fi)[regnum], raw_buffer, REGISTER_RAW_SIZE (regnum)); deprecated_write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, REGISTER_RAW_SIZE (regnum)); } } for (regnum = 0; regnum < SP_REGNUM; regnum++) { - if (fi->saved_regs[regnum]) + if (get_frame_saved_regs (fi)[regnum]) { - write_register (regnum, read_memory_unsigned_integer (fi->saved_regs[regnum], REGISTER_RAW_SIZE (regnum))); + write_register (regnum, read_memory_unsigned_integer (get_frame_saved_regs (fi)[regnum], REGISTER_RAW_SIZE (regnum))); } } - if (fi->saved_regs[PSW_REGNUM]) + if (get_frame_saved_regs (fi)[PSW_REGNUM]) { - write_register (PSW_REGNUM, read_memory_unsigned_integer (fi->saved_regs[PSW_REGNUM], REGISTER_RAW_SIZE (PSW_REGNUM))); + write_register (PSW_REGNUM, read_memory_unsigned_integer (get_frame_saved_regs (fi)[PSW_REGNUM], REGISTER_RAW_SIZE (PSW_REGNUM))); } write_register (PC_REGNUM, read_register (LR_REGNUM)); @@ -703,16 +703,16 @@ d10v_frame_chain (struct frame_info *fi) return (CORE_ADDR) 0; } - if (!fi->saved_regs[FP_REGNUM]) + if (!get_frame_saved_regs (fi)[FP_REGNUM]) { - if (!fi->saved_regs[SP_REGNUM] - || fi->saved_regs[SP_REGNUM] == STACK_START) + if (!get_frame_saved_regs (fi)[SP_REGNUM] + || get_frame_saved_regs (fi)[SP_REGNUM] == STACK_START) return (CORE_ADDR) 0; - return fi->saved_regs[SP_REGNUM]; + return get_frame_saved_regs (fi)[SP_REGNUM]; } - addr = read_memory_unsigned_integer (fi->saved_regs[FP_REGNUM], + addr = read_memory_unsigned_integer (get_frame_saved_regs (fi)[FP_REGNUM], REGISTER_RAW_SIZE (FP_REGNUM)); if (addr == 0) return (CORE_ADDR) 0; @@ -732,7 +732,7 @@ prologue_find_regs (unsigned short op, struct frame_info *fi, CORE_ADDR addr) { n = (op & 0x1E0) >> 5; next_addr -= 2; - fi->saved_regs[n] = next_addr; + get_frame_saved_regs (fi)[n] = next_addr; return 1; } @@ -741,8 +741,8 @@ prologue_find_regs (unsigned short op, struct frame_info *fi, CORE_ADDR addr) { n = (op & 0x1E0) >> 5; next_addr -= 4; - fi->saved_regs[n] = next_addr; - fi->saved_regs[n + 1] = next_addr + 2; + get_frame_saved_regs (fi)[n] = next_addr; + get_frame_saved_regs (fi)[n + 1] = next_addr + 2; return 1; } @@ -771,7 +771,7 @@ prologue_find_regs (unsigned short op, struct frame_info *fi, CORE_ADDR addr) if ((op & 0x7E1F) == 0x681E) { n = (op & 0x1E0) >> 5; - fi->saved_regs[n] = next_addr; + get_frame_saved_regs (fi)[n] = next_addr; return 1; } @@ -779,8 +779,8 @@ prologue_find_regs (unsigned short op, struct frame_info *fi, CORE_ADDR addr) if ((op & 0x7E3F) == 0x3A1E) { n = (op & 0x1E0) >> 5; - fi->saved_regs[n] = next_addr; - fi->saved_regs[n + 1] = next_addr + 2; + get_frame_saved_regs (fi)[n] = next_addr; + get_frame_saved_regs (fi)[n + 1] = next_addr + 2; return 1; } @@ -802,7 +802,7 @@ d10v_frame_init_saved_regs (struct frame_info *fi) int i; fp = fi->frame; - memset (fi->saved_regs, 0, SIZEOF_FRAME_SAVED_REGS); + memset (get_frame_saved_regs (fi), 0, SIZEOF_FRAME_SAVED_REGS); next_addr = 0; pc = get_pc_function_start (get_frame_pc (fi)); @@ -825,15 +825,15 @@ d10v_frame_init_saved_regs (struct frame_info *fi) /* st rn, @(offset,sp) */ short offset = op & 0xFFFF; short n = (op >> 20) & 0xF; - fi->saved_regs[n] = next_addr + offset; + get_frame_saved_regs (fi)[n] = next_addr + offset; } else if ((op & 0x3F1F0000) == 0x350F0000) { /* st2w rn, @(offset,sp) */ short offset = op & 0xFFFF; short n = (op >> 20) & 0xF; - fi->saved_regs[n] = next_addr + offset; - fi->saved_regs[n + 1] = next_addr + offset + 2; + get_frame_saved_regs (fi)[n] = next_addr + offset; + get_frame_saved_regs (fi)[n + 1] = next_addr + offset + 2; } else break; @@ -864,15 +864,15 @@ d10v_frame_init_saved_regs (struct frame_info *fi) fp = d10v_read_sp (); for (i = 0; i < NUM_REGS - 1; i++) - if (fi->saved_regs[i]) + if (get_frame_saved_regs (fi)[i]) { - fi->saved_regs[i] = fp - (next_addr - fi->saved_regs[i]); + get_frame_saved_regs (fi)[i] = fp - (next_addr - get_frame_saved_regs (fi)[i]); } - if (fi->saved_regs[LR_REGNUM]) + if (get_frame_saved_regs (fi)[LR_REGNUM]) { CORE_ADDR return_pc - = read_memory_unsigned_integer (fi->saved_regs[LR_REGNUM], + = read_memory_unsigned_integer (get_frame_saved_regs (fi)[LR_REGNUM], REGISTER_RAW_SIZE (LR_REGNUM)); fi->extra_info->return_pc = d10v_make_iaddr (return_pc); } @@ -882,18 +882,18 @@ d10v_frame_init_saved_regs (struct frame_info *fi) } /* The SP is not normally (ever?) saved, but check anyway */ - if (!fi->saved_regs[SP_REGNUM]) + if (!get_frame_saved_regs (fi)[SP_REGNUM]) { /* if the FP was saved, that means the current FP is valid, */ /* otherwise, it isn't being used, so we use the SP instead */ if (uses_frame) - fi->saved_regs[SP_REGNUM] + get_frame_saved_regs (fi)[SP_REGNUM] = d10v_read_fp () + fi->extra_info->size; else { - fi->saved_regs[SP_REGNUM] = fp + fi->extra_info->size; + get_frame_saved_regs (fi)[SP_REGNUM] = fp + fi->extra_info->size; fi->extra_info->frameless = 1; - fi->saved_regs[FP_REGNUM] = 0; + get_frame_saved_regs (fi)[FP_REGNUM] = 0; } } } diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index da500c667ad..471909549e8 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -464,7 +464,7 @@ h8300_frame_init_saved_regs (struct frame_info *fi) { CORE_ADDR func_addr, func_end; - if (!fi->saved_regs) + if (!get_frame_saved_regs (fi)) { frame_saved_regs_zalloc (fi); @@ -475,7 +475,7 @@ h8300_frame_init_saved_regs (struct frame_info *fi) struct symtab_and_line sal = find_pc_line (func_addr, 0); CORE_ADDR limit = (sal.end && sal.end < get_frame_pc (fi)) ? sal.end : get_frame_pc (fi); /* This will fill in fields in fi. */ - h8300_examine_prologue (func_addr, limit, fi->frame, fi->saved_regs, fi); + h8300_examine_prologue (func_addr, limit, fi->frame, get_frame_saved_regs (fi), fi); } /* Else we're out of luck (can't debug completely stripped code). FIXME. */ @@ -500,7 +500,7 @@ h8300_frame_chain (struct frame_info *thisframe) E_PC_REGNUM); return thisframe->frame; } - return thisframe->saved_regs[E_SP_REGNUM]; + return get_frame_saved_regs (thisframe)[E_SP_REGNUM]; } /* Return the saved PC from this frame. @@ -757,11 +757,11 @@ h8300_pop_frame (void) { /* Don't forget E_SP_REGNUM is a frame_saved_regs struct is the actual value we want, not the address of the value we want. */ - if (frame->saved_regs[regno] && regno != E_SP_REGNUM) + if (get_frame_saved_regs (frame)[regno] && regno != E_SP_REGNUM) write_register (regno, - read_memory_integer (frame->saved_regs[regno], + read_memory_integer (get_frame_saved_regs (frame)[regno], BINWORD)); - else if (frame->saved_regs[regno] && regno == E_SP_REGNUM) + else if (get_frame_saved_regs (frame)[regno] && regno == E_SP_REGNUM) write_register (regno, frame->frame + 2 * BINWORD); } diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index e7b166f412e..26543960deb 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -707,7 +707,7 @@ i386_frame_init_saved_regs (struct frame_info *fip) CORE_ADDR pc; int i; - if (fip->saved_regs) + if (get_frame_saved_regs (fip)) return; frame_saved_regs_zalloc (fip); @@ -726,16 +726,16 @@ i386_frame_init_saved_regs (struct frame_info *fip) break; #ifdef I386_REGNO_TO_SYMMETRY /* Dynix uses different internal numbering. Ick. */ - fip->saved_regs[I386_REGNO_TO_SYMMETRY (op - 0x50)] = addr; + get_frame_saved_regs (fip)[I386_REGNO_TO_SYMMETRY (op - 0x50)] = addr; #else - fip->saved_regs[op - 0x50] = addr; + get_frame_saved_regs (fip)[op - 0x50] = addr; #endif addr -= 4; } } - fip->saved_regs[PC_REGNUM] = fip->frame + 4; - fip->saved_regs[FP_REGNUM] = fip->frame; + get_frame_saved_regs (fip)[PC_REGNUM] = fip->frame + 4; + get_frame_saved_regs (fip)[FP_REGNUM] = fip->frame; } /* Return PC of first real instruction. */ @@ -867,7 +867,7 @@ i386_do_pop_frame (struct frame_info *frame) for (regnum = 0; regnum < NUM_REGS; regnum++) { CORE_ADDR addr; - addr = frame->saved_regs[regnum]; + addr = get_frame_saved_regs (frame)[regnum]; if (addr) { read_memory (addr, regbuf, REGISTER_RAW_SIZE (regnum)); diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 454fd2d8232..d8f7db0a3f4 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -710,8 +710,8 @@ ia64_frame_chain (struct frame_info *frame) else { FRAME_INIT_SAVED_REGS (frame); - if (frame->saved_regs[IA64_VFP_REGNUM]) - return read_memory_integer (frame->saved_regs[IA64_VFP_REGNUM], 8); + if (get_frame_saved_regs (frame)[IA64_VFP_REGNUM]) + return read_memory_integer (get_frame_saved_regs (frame)[IA64_VFP_REGNUM], 8); else return frame->frame + frame->extra_info->mem_stack_frame_size; } @@ -728,8 +728,8 @@ ia64_frame_saved_pc (struct frame_info *frame) { FRAME_INIT_SAVED_REGS (frame); - if (frame->saved_regs[IA64_VRAP_REGNUM]) - return read_memory_integer (frame->saved_regs[IA64_VRAP_REGNUM], 8); + if (get_frame_saved_regs (frame)[IA64_VRAP_REGNUM]) + return read_memory_integer (get_frame_saved_regs (frame)[IA64_VRAP_REGNUM], 8); else if (frame->next && (get_frame_type (frame->next) == SIGTRAMP_FRAME)) return read_sigcontext_register (frame->next, IA64_BR0_REGNUM); else /* either frameless, or not far enough along in the prologue... */ @@ -832,7 +832,7 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame) memset (instores, 0, sizeof instores); memset (infpstores, 0, sizeof infpstores); - if (frame && !frame->saved_regs) + if (frame && !get_frame_saved_regs (frame)) { frame_saved_regs_zalloc (frame); do_fsr_stuff = 1; @@ -960,7 +960,7 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame) && ((2 <= fM && fM <= 5) || (16 <= fM && fM <= 31))) { if (do_fsr_stuff) - frame->saved_regs[IA64_FR0_REGNUM + fM] = spill_addr; + get_frame_saved_regs (frame)[IA64_FR0_REGNUM + fM] = spill_addr; if ((instr & 0x1efc0000000) == 0x0eec0000000) spill_addr += imm; @@ -1019,14 +1019,14 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame) { /* Track UNAT register */ if (do_fsr_stuff) - frame->saved_regs[IA64_UNAT_REGNUM] = spill_addr; + get_frame_saved_regs (frame)[IA64_UNAT_REGNUM] = spill_addr; unat_save_reg = 0; } else { /* Track PR register */ if (do_fsr_stuff) - frame->saved_regs[IA64_PR_REGNUM] = spill_addr; + get_frame_saved_regs (frame)[IA64_PR_REGNUM] = spill_addr; pr_save_reg = 0; } if ((instr & 0x1efc0000000LL) == 0x0acc0000000LL) @@ -1095,7 +1095,7 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame) regs. Record the spill address and advance the spill register if appropriate. */ if (do_fsr_stuff) - frame->saved_regs[IA64_GR0_REGNUM + rM] = spill_addr; + get_frame_saved_regs (frame)[IA64_GR0_REGNUM + rM] = spill_addr; if ((instr & 0x1efc0000000LL) == 0x0aec0000000LL) /* st8.spill [rN] = rM, imm9 */ spill_addr += imm9(instr); @@ -1128,17 +1128,17 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame) addr += 8; } if (i < sor) - frame->saved_regs[IA64_GR32_REGNUM + ((i + (sor - rrb_gr)) % sor)] + get_frame_saved_regs (frame)[IA64_GR32_REGNUM + ((i + (sor - rrb_gr)) % sor)] = addr; else - frame->saved_regs[IA64_GR32_REGNUM + i] = addr; + get_frame_saved_regs (frame)[IA64_GR32_REGNUM + i] = addr; if (i+32 == cfm_reg) - frame->saved_regs[IA64_CFM_REGNUM] = addr; + get_frame_saved_regs (frame)[IA64_CFM_REGNUM] = addr; if (i+32 == ret_reg) - frame->saved_regs[IA64_VRAP_REGNUM] = addr; + get_frame_saved_regs (frame)[IA64_VRAP_REGNUM] = addr; if (i+32 == fp_reg) - frame->saved_regs[IA64_VFP_REGNUM] = addr; + get_frame_saved_regs (frame)[IA64_VFP_REGNUM] = addr; } } @@ -1160,7 +1160,7 @@ ia64_skip_prologue (CORE_ADDR pc) void ia64_frame_init_saved_regs (struct frame_info *frame) { - if (frame->saved_regs) + if (get_frame_saved_regs (frame)) return; if ((get_frame_type (frame) == SIGTRAMP_FRAME) && SIGCONTEXT_REGISTER_ADDRESS) @@ -1169,37 +1169,37 @@ ia64_frame_init_saved_regs (struct frame_info *frame) frame_saved_regs_zalloc (frame); - frame->saved_regs[IA64_VRAP_REGNUM] = + get_frame_saved_regs (frame)[IA64_VRAP_REGNUM] = SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_IP_REGNUM); - frame->saved_regs[IA64_CFM_REGNUM] = + get_frame_saved_regs (frame)[IA64_CFM_REGNUM] = SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_CFM_REGNUM); - frame->saved_regs[IA64_PSR_REGNUM] = + get_frame_saved_regs (frame)[IA64_PSR_REGNUM] = SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_PSR_REGNUM); #if 0 - frame->saved_regs[IA64_BSP_REGNUM] = + get_frame_saved_regs (frame)[IA64_BSP_REGNUM] = SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_BSP_REGNUM); #endif - frame->saved_regs[IA64_RNAT_REGNUM] = + get_frame_saved_regs (frame)[IA64_RNAT_REGNUM] = SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_RNAT_REGNUM); - frame->saved_regs[IA64_CCV_REGNUM] = + get_frame_saved_regs (frame)[IA64_CCV_REGNUM] = SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_CCV_REGNUM); - frame->saved_regs[IA64_UNAT_REGNUM] = + get_frame_saved_regs (frame)[IA64_UNAT_REGNUM] = SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_UNAT_REGNUM); - frame->saved_regs[IA64_FPSR_REGNUM] = + get_frame_saved_regs (frame)[IA64_FPSR_REGNUM] = SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_FPSR_REGNUM); - frame->saved_regs[IA64_PFS_REGNUM] = + get_frame_saved_regs (frame)[IA64_PFS_REGNUM] = SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_PFS_REGNUM); - frame->saved_regs[IA64_LC_REGNUM] = + get_frame_saved_regs (frame)[IA64_LC_REGNUM] = SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_LC_REGNUM); for (regno = IA64_GR1_REGNUM; regno <= IA64_GR31_REGNUM; regno++) if (regno != sp_regnum) - frame->saved_regs[regno] = + get_frame_saved_regs (frame)[regno] = SIGCONTEXT_REGISTER_ADDRESS (frame->frame, regno); for (regno = IA64_BR0_REGNUM; regno <= IA64_BR7_REGNUM; regno++) - frame->saved_regs[regno] = + get_frame_saved_regs (frame)[regno] = SIGCONTEXT_REGISTER_ADDRESS (frame->frame, regno); for (regno = IA64_FR2_REGNUM; regno <= IA64_BR7_REGNUM; regno++) - frame->saved_regs[regno] = + get_frame_saved_regs (frame)[regno] = SIGCONTEXT_REGISTER_ADDRESS (frame->frame, regno); } else @@ -1301,8 +1301,8 @@ ia64_get_saved_register (char *raw_buffer, if (!is_dummy_frame) { FRAME_INIT_SAVED_REGS (frame); - gr_addr = frame->saved_regs[ regnum - IA64_NAT0_REGNUM - + IA64_GR0_REGNUM]; + gr_addr = get_frame_saved_regs (frame)[ regnum - IA64_NAT0_REGNUM + + IA64_GR0_REGNUM]; } if (gr_addr) { @@ -1343,7 +1343,7 @@ ia64_get_saved_register (char *raw_buffer, if (!is_dummy_frame) { FRAME_INIT_SAVED_REGS (frame); - addr = frame->saved_regs[regnum]; + addr = get_frame_saved_regs (frame)[regnum]; } if (addr != 0) @@ -1513,8 +1513,8 @@ ia64_init_extra_frame_info (int fromleaf, struct frame_info *frame) FRAME_INIT_SAVED_REGS (frn); - if (frn->saved_regs[IA64_CFM_REGNUM] != 0) - cfm = read_memory_integer (frn->saved_regs[IA64_CFM_REGNUM], 8); + if (get_frame_saved_regs (frn)[IA64_CFM_REGNUM] != 0) + cfm = read_memory_integer (get_frame_saved_regs (frn)[IA64_CFM_REGNUM], 8); else if (frn->next && (get_frame_type (frn->next) == SIGTRAMP_FRAME)) cfm = read_sigcontext_register (frn->next, IA64_PFS_REGNUM); else if (frn->next @@ -1978,7 +1978,7 @@ ia64_pop_frame_regular (struct frame_info *frame) for (regno = 0; regno < ia64_num_regs; regno++) { - if (frame->saved_regs[regno] + if (get_frame_saved_regs (frame)[regno] && (!(IA64_GR32_REGNUM <= regno && regno <= IA64_GR127_REGNUM)) && regno != pc_regnum && regno != sp_regnum @@ -1988,7 +1988,7 @@ ia64_pop_frame_regular (struct frame_info *frame) && regno != IA64_BSPSTORE_REGNUM) { write_register (regno, - read_memory_integer (frame->saved_regs[regno], + read_memory_integer (get_frame_saved_regs (frame)[regno], REGISTER_RAW_SIZE (regno))); } } @@ -1998,9 +1998,9 @@ ia64_pop_frame_regular (struct frame_info *frame) cfm = read_register (IA64_CFM_REGNUM); - if (frame->saved_regs[IA64_PFS_REGNUM]) + if (get_frame_saved_regs (frame)[IA64_PFS_REGNUM]) { - pfs = read_memory_integer (frame->saved_regs[IA64_PFS_REGNUM], + pfs = read_memory_integer (get_frame_saved_regs (frame)[IA64_PFS_REGNUM], REGISTER_RAW_SIZE (IA64_PFS_REGNUM)); } else diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 267951e3e93..eda411c3b4a 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -443,9 +443,9 @@ m68hc11_pop_frame (void) /* Copy regs from where they were saved in the frame. */ for (regnum = 0; regnum < M68HC11_ALL_REGS; regnum++) - if (frame->saved_regs[regnum]) + if (get_frame_saved_regs (frame)[regnum]) write_register (regnum, - read_memory_integer (frame->saved_regs[regnum], 2)); + read_memory_integer (get_frame_saved_regs (frame)[regnum], 2)); write_register (HARD_PC_REGNUM, frame->extra_info->return_pc); sp = (fp + frame->extra_info->size + 2) & 0x0ffff; @@ -840,36 +840,36 @@ m68hc11_frame_init_saved_regs (struct frame_info *fi) CORE_ADDR pc; CORE_ADDR addr; - if (fi->saved_regs == NULL) + if (get_frame_saved_regs (fi) == NULL) frame_saved_regs_zalloc (fi); else - memset (fi->saved_regs, 0, sizeof (fi->saved_regs)); + memset (get_frame_saved_regs (fi), 0, SIZEOF_FRAME_SAVED_REGS); pc = get_frame_pc (fi); fi->extra_info->return_kind = m68hc11_get_return_insn (pc); m68hc11_guess_from_prologue (pc, fi->frame, &pc, &fi->extra_info->size, - fi->saved_regs); + get_frame_saved_regs (fi)); addr = fi->frame + fi->extra_info->size + STACK_CORRECTION; if (soft_regs[SOFT_FP_REGNUM].name) - fi->saved_regs[SOFT_FP_REGNUM] = addr - 2; + get_frame_saved_regs (fi)[SOFT_FP_REGNUM] = addr - 2; /* Take into account how the function was called/returns. */ if (fi->extra_info->return_kind == RETURN_RTC) { - fi->saved_regs[HARD_PAGE_REGNUM] = addr; + get_frame_saved_regs (fi)[HARD_PAGE_REGNUM] = addr; addr++; } else if (fi->extra_info->return_kind == RETURN_RTI) { - fi->saved_regs[HARD_CCR_REGNUM] = addr; - fi->saved_regs[HARD_D_REGNUM] = addr + 1; - fi->saved_regs[HARD_X_REGNUM] = addr + 3; - fi->saved_regs[HARD_Y_REGNUM] = addr + 5; + get_frame_saved_regs (fi)[HARD_CCR_REGNUM] = addr; + get_frame_saved_regs (fi)[HARD_D_REGNUM] = addr + 1; + get_frame_saved_regs (fi)[HARD_X_REGNUM] = addr + 3; + get_frame_saved_regs (fi)[HARD_Y_REGNUM] = addr + 5; addr += 7; } - fi->saved_regs[HARD_SP_REGNUM] = addr; - fi->saved_regs[HARD_PC_REGNUM] = fi->saved_regs[HARD_SP_REGNUM]; + get_frame_saved_regs (fi)[HARD_SP_REGNUM] = addr; + get_frame_saved_regs (fi)[HARD_PC_REGNUM] = get_frame_saved_regs (fi)[HARD_SP_REGNUM]; } static void @@ -892,7 +892,7 @@ m68hc11_init_extra_frame_info (int fromleaf, struct frame_info *fi) } else { - addr = fi->saved_regs[HARD_PC_REGNUM]; + addr = get_frame_saved_regs (fi)[HARD_PC_REGNUM]; addr = read_memory_unsigned_integer (addr, 2) & 0x0ffff; /* Take into account the 68HC12 specific call (PC + page). */ @@ -900,7 +900,7 @@ m68hc11_init_extra_frame_info (int fromleaf, struct frame_info *fi) && addr >= 0x08000 && addr < 0x0c000 && USE_PAGE_REGISTER) { - CORE_ADDR page_addr = fi->saved_regs[HARD_PAGE_REGNUM]; + CORE_ADDR page_addr = get_frame_saved_regs (fi)[HARD_PAGE_REGNUM]; unsigned page = read_memory_unsigned_integer (page_addr, 1); addr -= 0x08000; diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index c25a825667a..34cc0eb6386 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -478,25 +478,25 @@ m68k_pop_frame (void) m68k_frame_init_saved_regs (frame); for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--) { - if (frame->saved_regs[regnum]) + if (get_frame_saved_regs (frame)[regnum]) { - read_memory (frame->saved_regs[regnum], raw_buffer, 12); + read_memory (get_frame_saved_regs (frame)[regnum], raw_buffer, 12); deprecated_write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12); } } for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) { - if (frame->saved_regs[regnum]) + if (get_frame_saved_regs (frame)[regnum]) { write_register (regnum, - read_memory_integer (frame->saved_regs[regnum], 4)); + read_memory_integer (get_frame_saved_regs (frame)[regnum], 4)); } } - if (frame->saved_regs[PS_REGNUM]) + if (get_frame_saved_regs (frame)[PS_REGNUM]) { write_register (PS_REGNUM, - read_memory_integer (frame->saved_regs[PS_REGNUM], 4)); + read_memory_integer (get_frame_saved_regs (frame)[PS_REGNUM], 4)); } write_register (FP_REGNUM, read_memory_integer (fp, 4)); write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); @@ -592,12 +592,12 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info) int nextinsn; - if (frame_info->saved_regs) + if (get_frame_saved_regs (frame_info)) return; frame_saved_regs_zalloc (frame_info); - memset (frame_info->saved_regs, 0, SIZEOF_FRAME_SAVED_REGS); + memset (get_frame_saved_regs (frame_info), 0, SIZEOF_FRAME_SAVED_REGS); if (get_frame_pc (frame_info) >= possible_call_dummy_start && get_frame_pc (frame_info) <= frame_info->frame) @@ -658,7 +658,7 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info) /* Regmask's low bit is for register fp7, the first pushed */ for (regnum = FP0_REGNUM + 8; --regnum >= FP0_REGNUM; regmask >>= 1) if (regmask & 1) - frame_info->saved_regs[regnum] = (next_addr -= 12); + get_frame_saved_regs (frame_info)[regnum] = (next_addr -= 12); pc += 4; } /* fmovemx to (fp + displacement) */ @@ -671,7 +671,7 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info) for (regnum = FP0_REGNUM + 8; --regnum >= FP0_REGNUM; regmask >>= 1) if (regmask & 1) { - frame_info->saved_regs[regnum] = addr; + get_frame_saved_regs (frame_info)[regnum] = addr; addr += 12; } pc += 6; @@ -683,7 +683,7 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info) for (regnum = 0; regnum < 16; regnum++, regmask >>= 1) if (regmask & 1) { - frame_info->saved_regs[regnum] = next_addr; + get_frame_saved_regs (frame_info)[regnum] = next_addr; next_addr += 4; } pc += 4; @@ -698,7 +698,7 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info) for (regnum = 0; regnum < 16; regnum++, regmask >>= 1) if (regmask & 1) { - frame_info->saved_regs[regnum] = addr; + get_frame_saved_regs (frame_info)[regnum] = addr; addr += 4; } pc += 6; @@ -709,14 +709,14 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info) /* Regmask's low bit is for register 15, the first pushed */ for (regnum = 16; --regnum >= 0; regmask >>= 1) if (regmask & 1) - frame_info->saved_regs[regnum] = (next_addr -= 4); + get_frame_saved_regs (frame_info)[regnum] = (next_addr -= 4); pc += 4; } /* movl r,-(sp) */ else if (0x2f00 == (0xfff0 & nextinsn)) { regnum = 0xf & nextinsn; - frame_info->saved_regs[regnum] = (next_addr -= 4); + get_frame_saved_regs (frame_info)[regnum] = (next_addr -= 4); pc += 2; } /* fmovemx to index of sp */ @@ -726,7 +726,7 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info) for (regnum = FP0_REGNUM + 8; --regnum >= FP0_REGNUM; regmask >>= 1) if (regmask & 1) { - frame_info->saved_regs[regnum] = next_addr; + get_frame_saved_regs (frame_info)[regnum] = next_addr; next_addr += 12; } pc += 10; @@ -734,16 +734,16 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info) /* clrw -(sp); movw ccr,-(sp) */ else if (0x4267 == nextinsn && 0x42e7 == regmask) { - frame_info->saved_regs[PS_REGNUM] = (next_addr -= 4); + get_frame_saved_regs (frame_info)[PS_REGNUM] = (next_addr -= 4); pc += 4; } else break; } lose:; - frame_info->saved_regs[SP_REGNUM] = (frame_info)->frame + 8; - frame_info->saved_regs[FP_REGNUM] = (frame_info)->frame; - frame_info->saved_regs[PC_REGNUM] = (frame_info)->frame + 4; + get_frame_saved_regs (frame_info)[SP_REGNUM] = (frame_info)->frame + 8; + get_frame_saved_regs (frame_info)[FP_REGNUM] = (frame_info)->frame; + get_frame_saved_regs (frame_info)[PC_REGNUM] = (frame_info)->frame + 4; #ifdef SIG_SP_FP_OFFSET /* Adjust saved SP_REGNUM for fake _sigtramp frames. */ if ((get_frame_type (frame_info) == SIGTRAMP_FRAME) && frame_info->next) diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index d0cd3020d5a..708cf4c0cba 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -301,7 +301,7 @@ analyze_dummy_frame (CORE_ADDR pc, CORE_ADDR frame) deprecated_update_frame_base_hack (dummy, frame); dummy->extra_info->status = 0; dummy->extra_info->framesize = 0; - memset (dummy->saved_regs, '\000', SIZEOF_FRAME_SAVED_REGS); + memset (get_frame_saved_regs (dummy), '\000', SIZEOF_FRAME_SAVED_REGS); mcore_analyze_prologue (dummy, 0, 0); return dummy; } @@ -626,7 +626,7 @@ mcore_analyze_prologue (struct frame_info *fi, CORE_ADDR pc, int skip_prologue) { if (register_offsets[rn] >= 0) { - fi->saved_regs[rn] = fi->frame - register_offsets[rn]; + get_frame_saved_regs (fi)[rn] = fi->frame - register_offsets[rn]; mcore_insn_debug (("Saved register %s stored at 0x%08x, value=0x%08x\n", mcore_register_names[rn], fi->saved_regs[rn], read_memory_integer (fi->saved_regs[rn], 4))); @@ -675,11 +675,11 @@ mcore_frame_chain (struct frame_info * fi) int fp = dummy->extra_info->fp_regnum; /* Our caller has a frame pointer. */ - if (fi->saved_regs[fp] != 0) + if (get_frame_saved_regs (fi)[fp] != 0) { /* The "FP" was saved on the stack. Don't forget to adjust the "FP" with the framesize to get a real FP. */ - callers_addr = read_memory_integer (fi->saved_regs[fp], REGISTER_SIZE) + callers_addr = read_memory_integer (get_frame_saved_regs (fi)[fp], REGISTER_SIZE) + dummy->extra_info->framesize; } else @@ -759,8 +759,8 @@ mcore_find_callers_reg (struct frame_info *fi, int regnum) { if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), fi->frame, fi->frame)) return deprecated_read_register_dummy (get_frame_pc (fi), fi->frame, regnum); - else if (fi->saved_regs[regnum] != 0) - return read_memory_integer (fi->saved_regs[regnum], + else if (get_frame_saved_regs (fi)[regnum] != 0) + return read_memory_integer (get_frame_saved_regs (fi)[regnum], REGISTER_SIZE); } @@ -800,11 +800,11 @@ mcore_pop_frame (void) /* Restore any saved registers. */ for (rn = 0; rn < NUM_REGS; rn++) { - if (fi->saved_regs[rn] != 0) + if (get_frame_saved_regs (fi)[rn] != 0) { ULONGEST value; - value = read_memory_unsigned_integer (fi->saved_regs[rn], + value = read_memory_unsigned_integer (get_frame_saved_regs (fi)[rn], REGISTER_SIZE); write_register (rn, value); } diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 1aa369666b2..e8bce383185 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -1424,15 +1424,15 @@ mips_find_saved_regs (struct frame_info *fci) { reg_position = fci->frame + SIGFRAME_REGSAVE_OFF + ireg * SIGFRAME_REG_SIZE; - fci->saved_regs[ireg] = reg_position; + get_frame_saved_regs (fci)[ireg] = reg_position; } for (ireg = 0; ireg < MIPS_NUMREGS; ireg++) { reg_position = fci->frame + SIGFRAME_FPREGSAVE_OFF + ireg * SIGFRAME_REG_SIZE; - fci->saved_regs[FP0_REGNUM + ireg] = reg_position; + get_frame_saved_regs (fci)[FP0_REGNUM + ireg] = reg_position; } - fci->saved_regs[PC_REGNUM] = fci->frame + SIGFRAME_PC_OFF; + get_frame_saved_regs (fci)[PC_REGNUM] = fci->frame + SIGFRAME_PC_OFF; return; } @@ -1502,7 +1502,7 @@ mips_find_saved_regs (struct frame_info *fci) for (ireg = MIPS_NUMREGS - 1; gen_mask; --ireg, gen_mask <<= 1) if (gen_mask & 0x80000000) { - fci->saved_regs[ireg] = reg_position; + get_frame_saved_regs (fci)[ireg] = reg_position; reg_position -= MIPS_SAVED_REGSIZE; } @@ -1526,7 +1526,7 @@ mips_find_saved_regs (struct frame_info *fci) /* Check if the s0 and s1 registers were pushed on the stack. */ for (reg = 16; reg < sreg_count + 16; reg++) { - fci->saved_regs[reg] = reg_position; + get_frame_saved_regs (fci)[reg] = reg_position; reg_position -= MIPS_SAVED_REGSIZE; } } @@ -1557,11 +1557,11 @@ mips_find_saved_regs (struct frame_info *fci) for (ireg = MIPS_NUMREGS - 1; float_mask; --ireg, float_mask <<= 1) if (float_mask & 0x80000000) { - fci->saved_regs[FP0_REGNUM + ireg] = reg_position; + get_frame_saved_regs (fci)[FP0_REGNUM + ireg] = reg_position; reg_position -= MIPS_SAVED_REGSIZE; } - fci->saved_regs[PC_REGNUM] = fci->saved_regs[RA_REGNUM]; + get_frame_saved_regs (fci)[PC_REGNUM] = get_frame_saved_regs (fci)[RA_REGNUM]; } /* Set up the 'saved_regs' array. This is a data structure containing @@ -1574,11 +1574,11 @@ mips_find_saved_regs (struct frame_info *fci) static void mips_frame_init_saved_regs (struct frame_info *frame) { - if (frame->saved_regs == NULL) + if (get_frame_saved_regs (frame) == NULL) { mips_find_saved_regs (frame); } - frame->saved_regs[SP_REGNUM] = frame->frame; + get_frame_saved_regs (frame)[SP_REGNUM] = frame->frame; } static CORE_ADDR @@ -2512,15 +2512,15 @@ mips_init_extra_frame_info (int fromleaf, struct frame_info *fci) if (!PC_IN_SIGTRAMP (get_frame_pc (fci), name)) { frame_saved_regs_zalloc (fci); - memcpy (fci->saved_regs, temp_saved_regs, SIZEOF_FRAME_SAVED_REGS); - fci->saved_regs[PC_REGNUM] - = fci->saved_regs[RA_REGNUM]; + memcpy (get_frame_saved_regs (fci), temp_saved_regs, SIZEOF_FRAME_SAVED_REGS); + get_frame_saved_regs (fci)[PC_REGNUM] + = get_frame_saved_regs (fci)[RA_REGNUM]; /* Set value of previous frame's stack pointer. Remember that saved_regs[SP_REGNUM] is special in that it contains the value of the stack pointer register. The other saved_regs values are addresses (in the inferior) at which a given register's value may be found. */ - fci->saved_regs[SP_REGNUM] = fci->frame; + get_frame_saved_regs (fci)[SP_REGNUM] = fci->frame; } } @@ -3823,22 +3823,22 @@ mips_pop_frame (void) } write_register (PC_REGNUM, FRAME_SAVED_PC (frame)); - if (frame->saved_regs == NULL) + if (get_frame_saved_regs (frame) == NULL) FRAME_INIT_SAVED_REGS (frame); for (regnum = 0; regnum < NUM_REGS; regnum++) if (regnum != SP_REGNUM && regnum != PC_REGNUM - && frame->saved_regs[regnum]) + && get_frame_saved_regs (frame)[regnum]) { /* Floating point registers must not be sign extended, in case MIPS_SAVED_REGSIZE = 4 but sizeof (FP0_REGNUM) == 8. */ if (FP0_REGNUM <= regnum && regnum < FP0_REGNUM + 32) write_register (regnum, - read_memory_unsigned_integer (frame->saved_regs[regnum], + read_memory_unsigned_integer (get_frame_saved_regs (frame)[regnum], MIPS_SAVED_REGSIZE)); else write_register (regnum, - read_memory_integer (frame->saved_regs[regnum], + read_memory_integer (get_frame_saved_regs (frame)[regnum], MIPS_SAVED_REGSIZE)); } diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 75b7932a0f2..582e965bb0f 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -163,7 +163,7 @@ analyze_dummy_frame (CORE_ADDR pc, CORE_ADDR frame) dummy->frame = frame; dummy->extra_info->status = 0; dummy->extra_info->stack_size = 0; - memset (dummy->saved_regs, '\000', SIZEOF_FRAME_SAVED_REGS); + memset (get_frame_saved_regs (dummy), '\000', SIZEOF_FRAME_SAVED_REGS); mn10300_analyze_prologue (dummy, 0); return dummy; } @@ -231,59 +231,59 @@ set_movm_offsets (struct frame_info *fi, int movm_args) /* The `other' bit leaves a blank area of four bytes at the beginning of its block of saved registers, making it 32 bytes long in total. */ - fi->saved_regs[LAR_REGNUM] = fi->frame + offset + 4; - fi->saved_regs[LIR_REGNUM] = fi->frame + offset + 8; - fi->saved_regs[MDR_REGNUM] = fi->frame + offset + 12; - fi->saved_regs[A0_REGNUM + 1] = fi->frame + offset + 16; - fi->saved_regs[A0_REGNUM] = fi->frame + offset + 20; - fi->saved_regs[D0_REGNUM + 1] = fi->frame + offset + 24; - fi->saved_regs[D0_REGNUM] = fi->frame + offset + 28; + get_frame_saved_regs (fi)[LAR_REGNUM] = fi->frame + offset + 4; + get_frame_saved_regs (fi)[LIR_REGNUM] = fi->frame + offset + 8; + get_frame_saved_regs (fi)[MDR_REGNUM] = fi->frame + offset + 12; + get_frame_saved_regs (fi)[A0_REGNUM + 1] = fi->frame + offset + 16; + get_frame_saved_regs (fi)[A0_REGNUM] = fi->frame + offset + 20; + get_frame_saved_regs (fi)[D0_REGNUM + 1] = fi->frame + offset + 24; + get_frame_saved_regs (fi)[D0_REGNUM] = fi->frame + offset + 28; offset += 32; } if (movm_args & movm_a3_bit) { - fi->saved_regs[A3_REGNUM] = fi->frame + offset; + get_frame_saved_regs (fi)[A3_REGNUM] = fi->frame + offset; offset += 4; } if (movm_args & movm_a2_bit) { - fi->saved_regs[A2_REGNUM] = fi->frame + offset; + get_frame_saved_regs (fi)[A2_REGNUM] = fi->frame + offset; offset += 4; } if (movm_args & movm_d3_bit) { - fi->saved_regs[D3_REGNUM] = fi->frame + offset; + get_frame_saved_regs (fi)[D3_REGNUM] = fi->frame + offset; offset += 4; } if (movm_args & movm_d2_bit) { - fi->saved_regs[D2_REGNUM] = fi->frame + offset; + get_frame_saved_regs (fi)[D2_REGNUM] = fi->frame + offset; offset += 4; } if (AM33_MODE) { if (movm_args & movm_exother_bit) { - fi->saved_regs[MCVF_REGNUM] = fi->frame + offset; - fi->saved_regs[MCRL_REGNUM] = fi->frame + offset + 4; - fi->saved_regs[MCRH_REGNUM] = fi->frame + offset + 8; - fi->saved_regs[MDRQ_REGNUM] = fi->frame + offset + 12; - fi->saved_regs[E0_REGNUM + 1] = fi->frame + offset + 16; - fi->saved_regs[E0_REGNUM + 0] = fi->frame + offset + 20; + get_frame_saved_regs (fi)[MCVF_REGNUM] = fi->frame + offset; + get_frame_saved_regs (fi)[MCRL_REGNUM] = fi->frame + offset + 4; + get_frame_saved_regs (fi)[MCRH_REGNUM] = fi->frame + offset + 8; + get_frame_saved_regs (fi)[MDRQ_REGNUM] = fi->frame + offset + 12; + get_frame_saved_regs (fi)[E0_REGNUM + 1] = fi->frame + offset + 16; + get_frame_saved_regs (fi)[E0_REGNUM + 0] = fi->frame + offset + 20; offset += 24; } if (movm_args & movm_exreg1_bit) { - fi->saved_regs[E0_REGNUM + 7] = fi->frame + offset; - fi->saved_regs[E0_REGNUM + 6] = fi->frame + offset + 4; - fi->saved_regs[E0_REGNUM + 5] = fi->frame + offset + 8; - fi->saved_regs[E0_REGNUM + 4] = fi->frame + offset + 12; + get_frame_saved_regs (fi)[E0_REGNUM + 7] = fi->frame + offset; + get_frame_saved_regs (fi)[E0_REGNUM + 6] = fi->frame + offset + 4; + get_frame_saved_regs (fi)[E0_REGNUM + 5] = fi->frame + offset + 8; + get_frame_saved_regs (fi)[E0_REGNUM + 4] = fi->frame + offset + 12; offset += 16; } if (movm_args & movm_exreg0_bit) { - fi->saved_regs[E0_REGNUM + 3] = fi->frame + offset; - fi->saved_regs[E0_REGNUM + 2] = fi->frame + offset + 4; + get_frame_saved_regs (fi)[E0_REGNUM + 3] = fi->frame + offset; + get_frame_saved_regs (fi)[E0_REGNUM + 2] = fi->frame + offset + 4; offset += 8; } } @@ -633,14 +633,14 @@ saved_regs_size (struct frame_info *fi) /* Reserve four bytes for every register saved. */ for (i = 0; i < NUM_REGS; i++) - if (fi->saved_regs[i]) + if (get_frame_saved_regs (fi)[i]) adjust += 4; /* If we saved LIR, then it's most likely we used a `movm' instruction with the `other' bit set, in which case the SP is decremented by an extra four bytes, "to simplify calculation of the transfer area", according to the processor manual. */ - if (fi->saved_regs[LIR_REGNUM]) + if (get_frame_saved_regs (fi)[LIR_REGNUM]) adjust += 4; return adjust; @@ -690,8 +690,8 @@ mn10300_frame_chain (struct frame_info *fi) { /* Our caller has a frame pointer. So find the frame in $a3 or in the stack. */ - if (fi->saved_regs[A3_REGNUM]) - return (read_memory_integer (fi->saved_regs[A3_REGNUM], REGISTER_SIZE)); + if (get_frame_saved_regs (fi)[A3_REGNUM]) + return (read_memory_integer (get_frame_saved_regs (fi)[A3_REGNUM], REGISTER_SIZE)); else return read_register (A3_REGNUM); } @@ -728,11 +728,11 @@ mn10300_pop_frame_regular (struct frame_info *frame) /* Restore any saved registers. */ for (regnum = 0; regnum < NUM_REGS; regnum++) - if (frame->saved_regs[regnum] != 0) + if (get_frame_saved_regs (frame)[regnum] != 0) { ULONGEST value; - value = read_memory_unsigned_integer (frame->saved_regs[regnum], + value = read_memory_unsigned_integer (get_frame_saved_regs (frame)[regnum], REGISTER_RAW_SIZE (regnum)); write_register (regnum, value); } diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index f1d084f1eea..8c2db2e7477 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -375,7 +375,7 @@ ns32k_frame_init_saved_regs (struct frame_info *frame) int localcount; CORE_ADDR enter_addr, next_addr; - if (frame->saved_regs) + if (get_frame_saved_regs (frame)) return; frame_saved_regs_zalloc (frame); @@ -390,18 +390,18 @@ ns32k_frame_init_saved_regs (struct frame_info *frame) for (regnum = 0; regnum < 8; regnum++) { if (regmask & (1 << regnum)) - frame->saved_regs[regnum] = next_addr -= 4; + get_frame_saved_regs (frame)[regnum] = next_addr -= 4; } - frame->saved_regs[SP_REGNUM] = frame->frame + 4; - frame->saved_regs[PC_REGNUM] = frame->frame + 4; - frame->saved_regs[FP_REGNUM] = read_memory_integer (frame->frame, 4); + get_frame_saved_regs (frame)[SP_REGNUM] = frame->frame + 4; + get_frame_saved_regs (frame)[PC_REGNUM] = frame->frame + 4; + get_frame_saved_regs (frame)[FP_REGNUM] = read_memory_integer (frame->frame, 4); } else if (enter_addr == 1) { CORE_ADDR sp = read_register (SP_REGNUM); - frame->saved_regs[PC_REGNUM] = sp; - frame->saved_regs[SP_REGNUM] = sp + 4; + get_frame_saved_regs (frame)[PC_REGNUM] = sp; + get_frame_saved_regs (frame)[SP_REGNUM] = sp + 4; } } @@ -432,9 +432,9 @@ ns32k_pop_frame (void) FRAME_INIT_SAVED_REGS (frame); for (regnum = 0; regnum < 8; regnum++) - if (frame->saved_regs[regnum]) + if (get_frame_saved_regs (frame)[regnum]) write_register (regnum, - read_memory_integer (frame->saved_regs[regnum], 4)); + read_memory_integer (get_frame_saved_regs (frame)[regnum], 4)); write_register (FP_REGNUM, read_memory_integer (fp, 4)); write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 572b30b0da2..6f48b3251bb 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -290,7 +290,7 @@ s390_get_frame_info (CORE_ADDR pc, struct frame_extra_info *fextra_info, orig_sp = fi->frame; if (! init_extra_info && fextra_info->initialised) orig_sp += fextra_info->stack_bought; - saved_regs = fi->saved_regs; + saved_regs = get_frame_saved_regs (fi); } if (init_extra_info || !fextra_info->initialised) { @@ -922,7 +922,7 @@ s390_frame_init_saved_regs (struct frame_info *fi) int quick; - if (fi->saved_regs == NULL) + if (get_frame_saved_regs (fi) == NULL) { /* zalloc memsets the saved regs */ frame_saved_regs_zalloc (fi); @@ -962,10 +962,10 @@ s390_frame_saved_pc_nofix (struct frame_info *fi) { fi->extra_info->saved_pc_valid = 1; if (fi->extra_info->good_prologue - && fi->saved_regs[S390_RETADDR_REGNUM]) + && get_frame_saved_regs (fi)[S390_RETADDR_REGNUM]) fi->extra_info->saved_pc = ADDR_BITS_REMOVE (read_memory_integer - (fi->saved_regs[S390_RETADDR_REGNUM], + (get_frame_saved_regs (fi)[S390_RETADDR_REGNUM], S390_GPR_SIZE)); else fi->extra_info->saved_pc @@ -1046,24 +1046,24 @@ s390_frame_chain (struct frame_info *thisframe) } else { - if (thisframe->saved_regs) + if (get_frame_saved_regs (thisframe)) { int regno; if (prev_fextra_info.frame_pointer_saved_pc - && thisframe->saved_regs[S390_FRAME_REGNUM]) + && get_frame_saved_regs (thisframe)[S390_FRAME_REGNUM]) regno = S390_FRAME_REGNUM; else regno = S390_SP_REGNUM; - if (thisframe->saved_regs[regno]) + if (get_frame_saved_regs (thisframe)[regno]) { /* The SP's entry of `saved_regs' is special. */ if (regno == S390_SP_REGNUM) - prev_fp = thisframe->saved_regs[regno]; + prev_fp = get_frame_saved_regs (thisframe)[regno]; else prev_fp = - read_memory_integer (thisframe->saved_regs[regno], + read_memory_integer (get_frame_saved_regs (thisframe)[regno], S390_GPR_SIZE); } } @@ -1217,14 +1217,14 @@ s390_pop_frame_regular (struct frame_info *frame) write_register (S390_PC_REGNUM, FRAME_SAVED_PC (frame)); /* Restore any saved registers. */ - if (frame->saved_regs) + if (get_frame_saved_regs (frame)) { for (regnum = 0; regnum < NUM_REGS; regnum++) - if (frame->saved_regs[regnum] != 0) + if (get_frame_saved_regs (frame)[regnum] != 0) { ULONGEST value; - value = read_memory_unsigned_integer (frame->saved_regs[regnum], + value = read_memory_unsigned_integer (get_frame_saved_regs (frame)[regnum], REGISTER_RAW_SIZE (regnum)); write_register (regnum, value); } @@ -1232,7 +1232,7 @@ s390_pop_frame_regular (struct frame_info *frame) /* Actually cut back the stack. Remember that the SP's element of saved_regs is the old SP itself, not the address at which it is saved. */ - write_register (S390_SP_REGNUM, frame->saved_regs[S390_SP_REGNUM]); + write_register (S390_SP_REGNUM, get_frame_saved_regs (frame)[S390_SP_REGNUM]); } /* Throw away any cached frame information. */ diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 3b715a841bf..41c609e208c 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1000,8 +1000,8 @@ sh_find_callers_reg (struct frame_info *fi, int regnum) FRAME_INIT_SAVED_REGS (fi); if (!get_frame_pc (fi)) return 0; - if (fi->saved_regs[regnum] != 0) - return read_memory_integer (fi->saved_regs[regnum], + if (get_frame_saved_regs (fi)[regnum] != 0) + return read_memory_integer (get_frame_saved_regs (fi)[regnum], REGISTER_RAW_SIZE (regnum)); } return read_register (regnum); @@ -1025,13 +1025,13 @@ sh64_get_saved_pr (struct frame_info *fi, int pr_regnum) media_mode = pc_is_isa32 (get_frame_pc (fi)); - if (fi->saved_regs[pr_regnum] != 0) + if (get_frame_saved_regs (fi)[pr_regnum] != 0) { int gdb_reg_num = translate_insn_rn (pr_regnum, media_mode); int size = ((gdbarch_tdep (current_gdbarch)->sh_abi == SH_ABI_32) ? 4 : REGISTER_RAW_SIZE (gdb_reg_num)); - return read_memory_integer (fi->saved_regs[pr_regnum], size); + return read_memory_integer (get_frame_saved_regs (fi)[pr_regnum], size); } } return read_register (pr_regnum); @@ -1055,10 +1055,10 @@ sh_nofp_frame_init_saved_regs (struct frame_info *fi) int r3_val = 0; char *dummy_regs = deprecated_generic_find_dummy_frame (get_frame_pc (fi), fi->frame); - if (fi->saved_regs == NULL) + if (get_frame_saved_regs (fi) == NULL) frame_saved_regs_zalloc (fi); else - memset (fi->saved_regs, 0, SIZEOF_FRAME_SAVED_REGS); + memset (get_frame_saved_regs (fi), 0, SIZEOF_FRAME_SAVED_REGS); if (dummy_regs) { @@ -1140,21 +1140,21 @@ sh_nofp_frame_init_saved_regs (struct frame_info *fi) if (rn == FP_REGNUM) have_fp = 1; - fi->saved_regs[rn] = fi->frame - where[rn] + depth - 4; + get_frame_saved_regs (fi)[rn] = fi->frame - where[rn] + depth - 4; } else { - fi->saved_regs[rn] = 0; + get_frame_saved_regs (fi)[rn] = 0; } } if (have_fp) { - fi->saved_regs[SP_REGNUM] = read_memory_integer (fi->saved_regs[FP_REGNUM], 4); + get_frame_saved_regs (fi)[SP_REGNUM] = read_memory_integer (get_frame_saved_regs (fi)[FP_REGNUM], 4); } else { - fi->saved_regs[SP_REGNUM] = fi->frame - 4; + get_frame_saved_regs (fi)[SP_REGNUM] = fi->frame - 4; } fi->extra_info->f_offset = depth - where[FP_REGNUM] - 4; @@ -1395,10 +1395,10 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) char *dummy_regs = deprecated_generic_find_dummy_frame (get_frame_pc (fi), fi->frame); struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - if (fi->saved_regs == NULL) + if (get_frame_saved_regs (fi) == NULL) frame_saved_regs_zalloc (fi); else - memset (fi->saved_regs, 0, SIZEOF_FRAME_SAVED_REGS); + memset (get_frame_saved_regs (fi), 0, SIZEOF_FRAME_SAVED_REGS); if (dummy_regs) { @@ -1553,11 +1553,11 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) /* Watch out! saved_regs is only for the real registers, and doesn't include space for the pseudo registers. */ - fi->saved_regs[register_number]= fi->frame - where[rn] + depth; + get_frame_saved_regs (fi)[register_number]= fi->frame - where[rn] + depth; } else - fi->saved_regs[register_number] = 0; + get_frame_saved_regs (fi)[register_number] = 0; } if (have_fp) @@ -1574,10 +1574,10 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) size = 4; else size = REGISTER_RAW_SIZE (fp_regnum); - fi->saved_regs[sp_regnum] = read_memory_integer (fi->saved_regs[fp_regnum], size); + get_frame_saved_regs (fi)[sp_regnum] = read_memory_integer (get_frame_saved_regs (fi)[fp_regnum], size); } else - fi->saved_regs[sp_regnum] = fi->frame; + get_frame_saved_regs (fi)[sp_regnum] = fi->frame; fi->extra_info->f_offset = depth - where[fp_regnum]; } @@ -1596,10 +1596,10 @@ sh_fp_frame_init_saved_regs (struct frame_info *fi) char *dummy_regs = deprecated_generic_find_dummy_frame (get_frame_pc (fi), fi->frame); struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - if (fi->saved_regs == NULL) + if (get_frame_saved_regs (fi) == NULL) frame_saved_regs_zalloc (fi); else - memset (fi->saved_regs, 0, SIZEOF_FRAME_SAVED_REGS); + memset (get_frame_saved_regs (fi), 0, SIZEOF_FRAME_SAVED_REGS); if (dummy_regs) { @@ -1692,22 +1692,22 @@ sh_fp_frame_init_saved_regs (struct frame_info *fi) if (rn == FP_REGNUM) have_fp = 1; - fi->saved_regs[rn] = fi->frame - where[rn] + depth - 4; + get_frame_saved_regs (fi)[rn] = fi->frame - where[rn] + depth - 4; } else { - fi->saved_regs[rn] = 0; + get_frame_saved_regs (fi)[rn] = 0; } } if (have_fp) { - fi->saved_regs[SP_REGNUM] = - read_memory_integer (fi->saved_regs[FP_REGNUM], 4); + get_frame_saved_regs (fi)[SP_REGNUM] = + read_memory_integer (get_frame_saved_regs (fi)[FP_REGNUM], 4); } else { - fi->saved_regs[SP_REGNUM] = fi->frame - 4; + get_frame_saved_regs (fi)[SP_REGNUM] = fi->frame - 4; } fi->extra_info->f_offset = depth - where[FP_REGNUM] - 4; @@ -1828,8 +1828,8 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, } FRAME_INIT_SAVED_REGS (frame); - if (frame->saved_regs != NULL - && frame->saved_regs[regnum] != 0) + if (get_frame_saved_regs (frame) != NULL + && get_frame_saved_regs (frame)[regnum] != 0) { if (lval) /* found it saved on the stack */ *lval = lval_memory; @@ -1837,13 +1837,13 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, { if (raw_buffer) /* SP register treated specially */ store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), - frame->saved_regs[regnum]); + get_frame_saved_regs (frame)[regnum]); } else { /* any other register */ if (addrp) - *addrp = frame->saved_regs[regnum]; + *addrp = get_frame_saved_regs (frame)[regnum]; if (raw_buffer) { int size; @@ -1854,9 +1854,9 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, else size = REGISTER_RAW_SIZE (live_regnum); if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) - read_memory (frame->saved_regs[regnum], raw_buffer, size); + read_memory (get_frame_saved_regs (frame)[regnum], raw_buffer, size); else - read_memory (frame->saved_regs[regnum], + read_memory (get_frame_saved_regs (frame)[regnum], raw_buffer + REGISTER_RAW_SIZE (live_regnum) - size, @@ -1918,9 +1918,9 @@ sh_pop_frame (void) /* Copy regs from where they were saved in the frame */ for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++) - if (frame->saved_regs[regnum]) + if (get_frame_saved_regs (frame)[regnum]) write_register (regnum, - read_memory_integer (frame->saved_regs[regnum], 4)); + read_memory_integer (get_frame_saved_regs (frame)[regnum], 4)); write_register (PC_REGNUM, frame->extra_info->return_pc); write_register (SP_REGNUM, fp + 4); @@ -1948,7 +1948,7 @@ sh64_pop_frame (void) /* Copy regs from where they were saved in the frame */ for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++) - if (frame->saved_regs[regnum]) + if (get_frame_saved_regs (frame)[regnum]) { int size; if (tdep->sh_abi == SH_ABI_32 @@ -1959,7 +1959,7 @@ sh64_pop_frame (void) size = REGISTER_RAW_SIZE (translate_insn_rn (regnum, media_mode)); write_register (regnum, - read_memory_integer (frame->saved_regs[regnum], + read_memory_integer (get_frame_saved_regs (frame)[regnum], size)); } diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 13952d5789b..44b3a3086c5 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -802,8 +802,8 @@ v850_find_callers_reg (struct frame_info *fi, int regnum) for (; fi; fi = fi->next) if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), fi->frame, fi->frame)) return deprecated_read_register_dummy (get_frame_pc (fi), fi->frame, regnum); - else if (fi->saved_regs[regnum] != 0) - return read_memory_unsigned_integer (fi->saved_regs[regnum], + else if (get_frame_saved_regs (fi)[regnum] != 0) + return read_memory_unsigned_integer (get_frame_saved_regs (fi)[regnum], v850_register_raw_size (regnum)); return read_register (regnum); @@ -890,9 +890,9 @@ v850_pop_frame (void) write_register (E_PC_REGNUM, FRAME_SAVED_PC (frame)); for (regnum = 0; regnum < E_NUM_REGS; regnum++) - if (frame->saved_regs[regnum] != 0) + if (get_frame_saved_regs (frame)[regnum] != 0) write_register (regnum, - read_memory_unsigned_integer (frame->saved_regs[regnum], + read_memory_unsigned_integer (get_frame_saved_regs (frame)[regnum], v850_register_raw_size (regnum))); write_register (E_SP_REGNUM, get_frame_base (frame)); @@ -1105,7 +1105,7 @@ v850_frame_init_saved_regs (struct frame_info *fi) struct pifsr pifsrs[E_NUM_REGS + 1], *pifsr; CORE_ADDR func_addr, func_end; - if (!fi->saved_regs) + if (!get_frame_saved_regs (fi)) { frame_saved_regs_zalloc (fi); @@ -1127,10 +1127,10 @@ v850_frame_init_saved_regs (struct frame_info *fi) for (pifsr = pifsrs; pifsr->framereg; pifsr++) { - fi->saved_regs[pifsr->reg] = pifsr->offset + fi->frame; + get_frame_saved_regs (fi)[pifsr->reg] = pifsr->offset + fi->frame; if (pifsr->framereg == E_SP_REGNUM) - fi->saved_regs[pifsr->reg] += pi.frameoffset; + get_frame_saved_regs (fi)[pifsr->reg] += pi.frameoffset; } } /* Else we're out of luck (can't debug completely stripped code). diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index d3deda6a73d..c467e135f06 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -129,7 +129,7 @@ vax_frame_init_saved_regs (struct frame_info *frame) int regnum, regmask; CORE_ADDR next_addr; - if (frame->saved_regs) + if (get_frame_saved_regs (frame)) return; frame_saved_regs_zalloc (frame); @@ -143,18 +143,18 @@ vax_frame_init_saved_regs (struct frame_info *frame) for (regnum = 0; regnum < VAX_AP_REGNUM; regnum++) { if (regmask & (1 << regnum)) - frame->saved_regs[regnum] = next_addr += 4; + get_frame_saved_regs (frame)[regnum] = next_addr += 4; } - frame->saved_regs[SP_REGNUM] = next_addr + 4; + get_frame_saved_regs (frame)[SP_REGNUM] = next_addr + 4; if (regmask & (1 << FP_REGNUM)) - frame->saved_regs[SP_REGNUM] += + get_frame_saved_regs (frame)[SP_REGNUM] += 4 + (4 * read_memory_integer (next_addr + 4, 4)); - frame->saved_regs[PC_REGNUM] = frame->frame + 16; - frame->saved_regs[FP_REGNUM] = frame->frame + 12; - frame->saved_regs[VAX_AP_REGNUM] = frame->frame + 8; - frame->saved_regs[PS_REGNUM] = frame->frame + 4; + get_frame_saved_regs (frame)[PC_REGNUM] = frame->frame + 16; + get_frame_saved_regs (frame)[FP_REGNUM] = frame->frame + 12; + get_frame_saved_regs (frame)[VAX_AP_REGNUM] = frame->frame + 8; + get_frame_saved_regs (frame)[PS_REGNUM] = frame->frame + 4; } /* Get saved user PC for sigtramp from sigcontext for BSD style sigtramp. */ diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 580c0fe3879..4cf9794b66c 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -341,15 +341,15 @@ xstormy16_pop_frame (void) { /* Restore the saved regs. */ for (i = 0; i < NUM_REGS; i++) - if (fi->saved_regs[i]) + if (get_frame_saved_regs (fi)[i]) { if (i == SP_REGNUM) - write_register (i, fi->saved_regs[i]); + write_register (i, get_frame_saved_regs (fi)[i]); else if (i == E_PC_REGNUM) - write_register (i, read_memory_integer (fi->saved_regs[i], + write_register (i, read_memory_integer (get_frame_saved_regs (fi)[i], xstormy16_pc_size)); else - write_register (i, read_memory_integer (fi->saved_regs[i], + write_register (i, read_memory_integer (get_frame_saved_regs (fi)[i], xstormy16_reg_size)); } /* Restore the PC */ @@ -490,7 +490,7 @@ xstormy16_scan_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr, if (fi) { regnum = inst & 0x000f; - fi->saved_regs[regnum] = fi->extra_info->framesize; + get_frame_saved_regs (fi)[regnum] = fi->extra_info->framesize; fi->extra_info->framesize += xstormy16_reg_size; } } @@ -546,7 +546,7 @@ xstormy16_scan_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr, if (offset & 0x0800) offset -= 0x1000; - fi->saved_regs[regnum] = fi->extra_info->framesize + offset; + get_frame_saved_regs (fi)[regnum] = fi->extra_info->framesize + offset; } next_addr += xstormy16_inst_size; } @@ -593,12 +593,12 @@ xstormy16_scan_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr, previous value would have been pushed). */ if (fi->extra_info->frameless_p) { - fi->saved_regs[E_SP_REGNUM] = sp - fi->extra_info->framesize; + get_frame_saved_regs (fi)[E_SP_REGNUM] = sp - fi->extra_info->framesize; fi->frame = sp; } else { - fi->saved_regs[E_SP_REGNUM] = fp - fi->extra_info->framesize; + get_frame_saved_regs (fi)[E_SP_REGNUM] = fp - fi->extra_info->framesize; fi->frame = fp; } @@ -607,11 +607,11 @@ xstormy16_scan_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr, sp, fp and framesize. We know the beginning of the frame so we can translate the register offsets to real addresses. */ for (regnum = 0; regnum < E_SP_REGNUM; ++regnum) - if (fi->saved_regs[regnum]) - fi->saved_regs[regnum] += fi->saved_regs[E_SP_REGNUM]; + if (get_frame_saved_regs (fi)[regnum]) + get_frame_saved_regs (fi)[regnum] += get_frame_saved_regs (fi)[E_SP_REGNUM]; /* Save address of PC on stack. */ - fi->saved_regs[E_PC_REGNUM] = fi->saved_regs[E_SP_REGNUM]; + get_frame_saved_regs (fi)[E_PC_REGNUM] = get_frame_saved_regs (fi)[E_SP_REGNUM]; } return next_addr; @@ -732,7 +732,7 @@ xstormy16_frame_init_saved_regs (struct frame_info *fi) { CORE_ADDR func_addr, func_end; - if (!fi->saved_regs) + if (!get_frame_saved_regs (fi)) { frame_saved_regs_zalloc (fi); @@ -763,7 +763,7 @@ xstormy16_frame_saved_pc (struct frame_info *fi) } else { - saved_pc = read_memory_unsigned_integer (fi->saved_regs[E_PC_REGNUM], + saved_pc = read_memory_unsigned_integer (get_frame_saved_regs (fi)[E_PC_REGNUM], xstormy16_pc_size); } -- 2.30.2