diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7329b29661..14d09fb874 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,47 @@ +2002-09-17 Andrew Cagney + + * blockframe.c (deprecated_read_register_dummy): Rename + generic_read_register_dummy. + * frame.c (frame_unwind_signed_register): New function. + (frame_unwind_unsigned_register): New function. + * frame.h (frame_unwind_signed_register): Declare. + (frame_unwind_unsigned_register): Declare. + (deprecated_read_register_dummy): Rename + generic_read_register_dummy. + + * h8300-tdep.c (h8300_frame_chain): Update. + (h8300_frame_saved_pc): Update. + * xstormy16-tdep.c (xstormy16_frame_saved_pc): Update. + * rs6000-tdep.c (rs6000_frame_saved_pc): Update. + * s390-tdep.c (s390_frame_saved_pc_nofix): Update. + (s390_frame_chain): Update. + * v850-tdep.c (v850_find_callers_reg): Update. + (v850_frame_saved_pc): Update. + * m32r-tdep.c (m32r_init_extra_frame_info): Update. + (m32r_find_callers_reg): Update. + (m32r_frame_saved_pc): Update. + * sh-tdep.c (sh_find_callers_reg): Update. + (sh64_get_saved_pr): Update. + (sh_init_extra_frame_info): Update. + (sh_init_extra_frame_info): Update. + (sh64_init_extra_frame_info): Update. + (sh64_init_extra_frame_info): Update. + * mcore-tdep.c (mcore_find_callers_reg): Update. + (mcore_frame_saved_pc): Update. + (mcore_init_extra_frame_info): Update. + * i386-tdep.c (i386_frame_saved_pc): Update. + * ia64-tdep.c (ia64_frame_saved_pc): Update. + (ia64_init_extra_frame_info): Update. + (ia64_init_extra_frame_info): Update. + * d10v-tdep.c (d10v_frame_saved_pc): Update. + * cris-tdep.c (cris_init_extra_frame_info): Update. + * avr-tdep.c (avr_frame_chain): Update. + (avr_init_extra_frame_info): Update. + (avr_frame_saved_pc): Update. + * arm-tdep.c (arm_find_callers_reg): Update. + (arm_init_extra_frame_info): Update. + (arm_frame_saved_pc): Update. + 2002-09-17 Tom Tromey * c-lang.c (c_emit_char): Don't treat \0 specially unless quoter diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index e61c5938ef..82444d1c59 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -995,7 +995,7 @@ arm_find_callers_reg (struct frame_info *fi, int regnum) if (USE_GENERIC_DUMMY_FRAMES && PC_IN_CALL_DUMMY (fi->pc, 0, 0)) { - return generic_read_register_dummy (fi->pc, fi->frame, regnum); + return deprecated_read_register_dummy (fi->pc, fi->frame, regnum); } else if (fi->saved_regs[regnum] != 0) { @@ -1110,8 +1110,8 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi) && PC_IN_CALL_DUMMY (fi->next->pc, 0, 0)) /* For generic dummy frames, pull the value direct from the frame. Having an unwind function to do this would be nice. */ - sp = generic_read_register_dummy (fi->next->pc, fi->next->frame, - ARM_SP_REGNUM); + sp = deprecated_read_register_dummy (fi->next->pc, fi->next->frame, + ARM_SP_REGNUM); else sp = (fi->next->frame - fi->next->extra_info->frameoffset + fi->next->extra_info->framesize); @@ -1221,7 +1221,7 @@ arm_frame_saved_pc (struct frame_info *fi) /* If a dummy frame, pull the PC out of the frame's register buffer. */ if (USE_GENERIC_DUMMY_FRAMES && PC_IN_CALL_DUMMY (fi->pc, 0, 0)) - return generic_read_register_dummy (fi->pc, fi->frame, ARM_PC_REGNUM); + return deprecated_read_register_dummy (fi->pc, fi->frame, ARM_PC_REGNUM); if (PC_IN_CALL_DUMMY (fi->pc, fi->frame - fi->extra_info->frameoffset, fi->frame)) diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index e38f13d2a6..bcd78e11db 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -755,7 +755,11 @@ avr_init_extra_frame_info (int fromleaf, struct frame_info *fi) { /* We need to setup fi->frame here because run_stack_dummy gets it wrong by assuming it's always FP. */ - fi->frame = generic_read_register_dummy (fi->pc, fi->frame, fi->frame); + /* FIXME: cagney/2002-09-13: This is wrong. The third parameter + to deprecated_read_register_dummy() is REGNUM and not a frame + address. */ + fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame, + fi->frame); } else if (!fi->next) /* this is the innermost frame? */ fi->frame = read_register (fi->extra_info->framereg); @@ -867,8 +871,8 @@ static CORE_ADDR avr_frame_saved_pc (struct frame_info *frame) { if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) - return generic_read_register_dummy (frame->pc, frame->frame, - AVR_PC_REGNUM); + return deprecated_read_register_dummy (frame->pc, frame->frame, + AVR_PC_REGNUM); else return frame->extra_info->return_pc; } @@ -1033,10 +1037,9 @@ avr_frame_chain (struct frame_info *frame) if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) { /* initialize the return_pc now */ - frame->extra_info->return_pc = generic_read_register_dummy (frame->pc, - frame-> - frame, - AVR_PC_REGNUM); + frame->extra_info->return_pc + = deprecated_read_register_dummy (frame->pc, frame->frame, + AVR_PC_REGNUM); return frame->frame; } return (frame->extra_info->is_main ? 0 diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 3ff725b726..674285d707 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -1208,7 +1208,7 @@ generic_pc_in_call_dummy (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR fp) Find a saved register from before GDB calls a function in the inferior */ CORE_ADDR -generic_read_register_dummy (CORE_ADDR pc, CORE_ADDR fp, int regno) +deprecated_read_register_dummy (CORE_ADDR pc, CORE_ADDR fp, int regno) { struct regcache *dummy_regs = generic_find_dummy_frame (pc, fp); diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index c53c7ea87a..0bfb5b32f6 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -1214,9 +1214,10 @@ cris_init_extra_frame_info (int fromleaf, struct frame_info *fi) { /* We need to setup fi->frame here because run_stack_dummy gets it wrong by assuming it's always FP. */ - fi->frame = generic_read_register_dummy (fi->pc, fi->frame, SP_REGNUM); + fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame, + SP_REGNUM); fi->extra_info->return_pc = - generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); + deprecated_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); /* FIXME: Is this necessarily true? */ fi->extra_info->leaf_function = 0; diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 4e02106960..d338ff4781 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -513,9 +513,9 @@ static CORE_ADDR d10v_frame_saved_pc (struct frame_info *frame) { if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) - return d10v_make_iaddr (generic_read_register_dummy (frame->pc, - frame->frame, - PC_REGNUM)); + return d10v_make_iaddr (deprecated_read_register_dummy (frame->pc, + frame->frame, + PC_REGNUM)); else return ((frame)->extra_info->return_pc); } diff --git a/gdb/frame.c b/gdb/frame.c index 2da0305938..82754ef1ce 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -122,6 +122,33 @@ frame_register_unwind (struct frame_info *frame, int regnum, optimizedp, lvalp, addrp, realnump, bufferp); } +void +frame_unwind_signed_register (struct frame_info *frame, int regnum, + LONGEST *val) +{ + int optimized; + CORE_ADDR addr; + int realnum; + enum lval_type lval; + void *buf = alloca (MAX_REGISTER_RAW_SIZE); + frame_register_unwind (frame, regnum, &optimized, &lval, &addr, + &realnum, buf); + (*val) = extract_signed_integer (buf, REGISTER_VIRTUAL_SIZE (regnum)); +} + +void +frame_unwind_unsigned_register (struct frame_info *frame, int regnum, + ULONGEST *val) +{ + int optimized; + CORE_ADDR addr; + int realnum; + enum lval_type lval; + void *buf = alloca (MAX_REGISTER_RAW_SIZE); + frame_register_unwind (frame, regnum, &optimized, &lval, &addr, + &realnum, buf); + (*val) = extract_unsigned_integer (buf, REGISTER_VIRTUAL_SIZE (regnum)); +} void generic_unwind_get_saved_register (char *raw_buffer, diff --git a/gdb/frame.h b/gdb/frame.h index b1fd93cf06..df2a0215f1 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -302,8 +302,11 @@ extern struct frame_info *find_frame_addr_in_frame_chain (CORE_ADDR); extern CORE_ADDR sigtramp_saved_pc (struct frame_info *); -extern CORE_ADDR generic_read_register_dummy (CORE_ADDR pc, - CORE_ADDR fp, int); +/* NOTE: cagney/2002-09-13: There is no need for this function. + Instead either of frame_unwind_signed_register() or + frame_unwind_unsigned_register() can be used. */ +extern CORE_ADDR deprecated_read_register_dummy (CORE_ADDR pc, + CORE_ADDR fp, int); extern void generic_push_dummy_frame (void); extern void generic_pop_current_frame (void (*)(struct frame_info *)); extern void generic_pop_dummy_frame (void); @@ -342,6 +345,15 @@ extern void frame_register_unwind (struct frame_info *frame, int regnum, CORE_ADDR *addrp, int *realnump, void *valuep); +/* Unwind FRAME so that the value of register REGNUM, in the previous + frame is returned. Simplified versions of frame_register_unwind. */ +/* NOTE: cagney/2002-09-13: Return void as one day these functions may + be changed to return an indication that the read succeeded. */ +extern void frame_unwind_signed_register (struct frame_info *frame, + int regnum, LONGEST *val); +extern void frame_unwind_unsigned_register (struct frame_info *frame, + int regnum, ULONGEST *val); + extern void generic_save_call_dummy_addr (CORE_ADDR lo, CORE_ADDR hi); extern void get_saved_register (char *raw_buffer, int *optimized, diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index be55327aba..087084c88e 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -493,10 +493,9 @@ h8300_frame_chain (struct frame_info *thisframe) { if (PC_IN_CALL_DUMMY (thisframe->pc, thisframe->frame, thisframe->frame)) { /* initialize the from_pc now */ - thisframe->extra_info->from_pc = generic_read_register_dummy ( - thisframe->pc, - thisframe->frame, - E_PC_REGNUM); + thisframe->extra_info->from_pc = + deprecated_read_register_dummy (thisframe->pc, thisframe->frame, + E_PC_REGNUM); return thisframe->frame; } return thisframe->saved_regs[E_SP_REGNUM]; @@ -511,7 +510,8 @@ static CORE_ADDR h8300_frame_saved_pc (struct frame_info *frame) { if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) - return generic_read_register_dummy (frame->pc, frame->frame, E_PC_REGNUM); + return deprecated_read_register_dummy (frame->pc, frame->frame, + E_PC_REGNUM); else return frame->extra_info->from_pc; } diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 3a90bc05fe..5a19308294 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -535,8 +535,8 @@ static CORE_ADDR i386_frame_saved_pc (struct frame_info *frame) { if (PC_IN_CALL_DUMMY (frame->pc, 0, 0)) - return generic_read_register_dummy (frame->pc, frame->frame, - PC_REGNUM); + return deprecated_read_register_dummy (frame->pc, frame->frame, + PC_REGNUM); if (frame->signal_handler_caller) return i386_sigtramp_saved_pc (frame); diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 18741944a5..53f21a46b1 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -723,7 +723,7 @@ ia64_frame_saved_pc (struct frame_info *frame) if (frame->signal_handler_caller) return read_sigcontext_register (frame, pc_regnum); else if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) - return generic_read_register_dummy (frame->pc, frame->frame, pc_regnum); + return deprecated_read_register_dummy (frame->pc, frame->frame, pc_regnum); else { FRAME_INIT_SAVED_REGS (frame); @@ -1500,10 +1500,12 @@ ia64_init_extra_frame_info (int fromleaf, struct frame_info *frame) } else if (next_frame_is_call_dummy) { - bsp = generic_read_register_dummy (frame->next->pc, frame->next->frame, - IA64_BSP_REGNUM); - cfm = generic_read_register_dummy (frame->next->pc, frame->next->frame, - IA64_CFM_REGNUM); + bsp = deprecated_read_register_dummy (frame->next->pc, + frame->next->frame, + IA64_BSP_REGNUM); + cfm = deprecated_read_register_dummy (frame->next->pc, + frame->next->frame, + IA64_CFM_REGNUM); } else { @@ -1518,8 +1520,8 @@ ia64_init_extra_frame_info (int fromleaf, struct frame_info *frame) else if (frn->next && PC_IN_CALL_DUMMY (frn->next->pc, frn->next->frame, frn->next->frame)) - cfm = generic_read_register_dummy (frn->next->pc, frn->next->frame, - IA64_PFS_REGNUM); + cfm = deprecated_read_register_dummy (frn->next->pc, frn->next->frame, + IA64_PFS_REGNUM); else cfm = read_register (IA64_PFS_REGNUM); diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index b4ee7775b7..b1bc3ed037 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -390,7 +390,8 @@ m32r_init_extra_frame_info (struct frame_info *fi) { /* We need to setup fi->frame here because run_stack_dummy gets it wrong by assuming it's always FP. */ - fi->frame = generic_read_register_dummy (fi->pc, fi->frame, SP_REGNUM); + fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame, + SP_REGNUM); fi->framesize = 0; return; } @@ -462,7 +463,7 @@ m32r_find_callers_reg (struct frame_info *fi, int regnum) { for (; fi; fi = fi->next) if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, regnum); + return deprecated_read_register_dummy (fi->pc, fi->frame, regnum); else if (fi->fsr.regs[regnum] != 0) return read_memory_integer (fi->fsr.regs[regnum], REGISTER_RAW_SIZE (regnum)); @@ -554,7 +555,7 @@ CORE_ADDR m32r_frame_saved_pc (struct frame_info *fi) { if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); + return deprecated_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); else return m32r_find_callers_reg (fi, RP_REGNUM); } diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index a53aaa00c9..395bb44f8a 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -756,7 +756,7 @@ mcore_find_callers_reg (struct frame_info *fi, int regnum) for (; fi != NULL; fi = fi->next) { if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, regnum); + return deprecated_read_register_dummy (fi->pc, fi->frame, regnum); else if (fi->saved_regs[regnum] != 0) return read_memory_integer (fi->saved_regs[regnum], REGISTER_SIZE); @@ -772,7 +772,7 @@ mcore_frame_saved_pc (struct frame_info * fi) { if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); + return deprecated_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); else return mcore_find_callers_reg (fi, PR_REGNUM); } @@ -1049,7 +1049,7 @@ mcore_init_extra_frame_info (int fromleaf, struct frame_info *fi) { /* We need to setup fi->frame here because run_stack_dummy gets it wrong by assuming it's always FP. */ - fi->frame = generic_read_register_dummy (fi->pc, fi->frame, SP_REGNUM); + fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame, SP_REGNUM); } else mcore_analyze_prologue (fi, 0, 0); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index f661861827..2df49e136f 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1511,7 +1511,7 @@ rs6000_frame_saved_pc (struct frame_info *fi) return read_memory_addr (fi->frame + SIG_FRAME_PC_OFFSET, wordsize); if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); + return deprecated_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); func_start = get_pc_function_start (fi->pc); diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 49a15a2f46..f19e4ddfdd 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -956,7 +956,7 @@ s390_frame_saved_pc_nofix (struct frame_info *fi) return fi->extra_info->saved_pc; if (deprecated_generic_find_dummy_frame (fi->pc, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, S390_PC_REGNUM); + return deprecated_read_register_dummy (fi->pc, fi->frame, S390_PC_REGNUM); s390_frame_init_saved_regs (fi); if (fi->extra_info) @@ -1010,8 +1010,8 @@ s390_frame_chain (struct frame_info *thisframe) CORE_ADDR prev_fp = 0; if (deprecated_generic_find_dummy_frame (thisframe->pc, thisframe->frame)) - return generic_read_register_dummy (thisframe->pc, thisframe->frame, - S390_SP_REGNUM); + return deprecated_read_register_dummy (thisframe->pc, thisframe->frame, + S390_SP_REGNUM); else { int sigreturn = 0; diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index b133b035f6..7ac5b9ef57 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -986,7 +986,7 @@ sh_find_callers_reg (struct frame_info *fi, int regnum) if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) /* When the caller requests PR from the dummy frame, we return PC because that's where the previous routine appears to have done a call from. */ - return generic_read_register_dummy (fi->pc, fi->frame, regnum); + return deprecated_read_register_dummy (fi->pc, fi->frame, regnum); else { FRAME_INIT_SAVED_REGS (fi); @@ -1008,7 +1008,7 @@ sh64_get_saved_pr (struct frame_info *fi, int pr_regnum) if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) /* When the caller requests PR from the dummy frame, we return PC because that's where the previous routine appears to have done a call from. */ - return generic_read_register_dummy (fi->pc, fi->frame, pr_regnum); + return deprecated_read_register_dummy (fi->pc, fi->frame, pr_regnum); else { FRAME_INIT_SAVED_REGS (fi); @@ -1722,11 +1722,11 @@ sh_init_extra_frame_info (int fromleaf, struct frame_info *fi) { /* We need to setup fi->frame here because run_stack_dummy gets it wrong by assuming it's always FP. */ - fi->frame = generic_read_register_dummy (fi->pc, fi->frame, - SP_REGNUM); - fi->extra_info->return_pc = generic_read_register_dummy (fi->pc, - fi->frame, - PC_REGNUM); + fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame, + SP_REGNUM); + fi->extra_info->return_pc = deprecated_read_register_dummy (fi->pc, + fi->frame, + PC_REGNUM); fi->extra_info->f_offset = -(CALL_DUMMY_LENGTH + 4); fi->extra_info->leaf_function = 0; return; @@ -1754,10 +1754,10 @@ sh64_init_extra_frame_info (int fromleaf, struct frame_info *fi) { /* We need to setup fi->frame here because run_stack_dummy gets it wrong by assuming it's always FP. */ - fi->frame = generic_read_register_dummy (fi->pc, fi->frame, - SP_REGNUM); + fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame, + SP_REGNUM); fi->extra_info->return_pc = - generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); + deprecated_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); fi->extra_info->f_offset = -(CALL_DUMMY_LENGTH + 4); fi->extra_info->leaf_function = 0; return; diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 3752dced66..03ae1618d3 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -805,7 +805,7 @@ v850_find_callers_reg (struct frame_info *fi, int regnum) { for (; fi; fi = fi->next) if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, regnum); + return deprecated_read_register_dummy (fi->pc, fi->frame, regnum); else if (fi->saved_regs[regnum] != 0) return read_memory_unsigned_integer (fi->saved_regs[regnum], v850_register_raw_size (regnum)); @@ -1014,7 +1014,7 @@ CORE_ADDR v850_frame_saved_pc (struct frame_info *fi) { if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, E_PC_REGNUM); + return deprecated_read_register_dummy (fi->pc, fi->frame, E_PC_REGNUM); else return v850_find_callers_reg (fi, E_RP_REGNUM); } diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index d3583139c6..b08808563f 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -758,7 +758,8 @@ xstormy16_frame_saved_pc (struct frame_info *fi) if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) { - saved_pc = generic_read_register_dummy (fi->pc, fi->frame, E_PC_REGNUM); + saved_pc = deprecated_read_register_dummy (fi->pc, fi->frame, + E_PC_REGNUM); } else {