diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-04-05 18:54:38 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-04-05 18:54:38 +0000 |
commit | be41e9f456f8eb05e1aa2eae0532d0ea5e97a662 (patch) | |
tree | 055243a66f382d80493ca48da5b0dbf91a0521b9 /gdb | |
parent | a01dd7cc8d585aa836a74523790343e52fcad23d (diff) | |
download | gdb-be41e9f456f8eb05e1aa2eae0532d0ea5e97a662.zip gdb-be41e9f456f8eb05e1aa2eae0532d0ea5e97a662.tar.gz gdb-be41e9f456f8eb05e1aa2eae0532d0ea5e97a662.tar.bz2 |
2003-04-05 Andrew Cagney <cagney@redhat.com>
* frame.c (frame_func_unwind, get_frame_func): New functions.
* frame.h (get_frame_func, frame_func_unwind): Declare.
(struct frame_info): Add field "prev_func" for caching the
previous frame's function address.
* arm-tdep.c (arm_frameless_function_invocation): Combine
get_pc_function_start and get_frame_pc into get_frame_func.
* sh-tdep.c (sh_nofp_frame_init_saved_regs): Ditto.
(sh64_nofp_frame_init_saved_regs): Ditto.
* s390-tdep.c (s390_function_start): Ditto.
* rs6000-tdep.c (rs6000_pop_frame): Ditto.
(rs6000_frameless_function_invocation): Ditto.
(rs6000_frame_saved_pc): Ditto.
* m68k-tdep.c (m68k_frame_init_saved_regs): Ditto.
* ia64-tdep.c (ia64_frame_init_saved_regs): Ditto.
* i386-tdep.c (i386_frameless_signal_p): Ditto.
(i386_frame_init_saved_regs): Ditto.
* hppa-tdep.c (hppa_frame_find_saved_regs): Ditto.
* d10v-tdep.c (d10v_frame_unwind_cache): Combine
get_pc_function_start and frame_pc_unwind into frame_func_unwind.
* cris-tdep.c (cris_frame_init_saved_regs): Ditto.
* blockframe.c (frameless_look_for_prologue): Ditto.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 24 | ||||
-rw-r--r-- | gdb/arm-tdep.c | 2 | ||||
-rw-r--r-- | gdb/blockframe.c | 2 | ||||
-rw-r--r-- | gdb/cris-tdep.c | 2 | ||||
-rw-r--r-- | gdb/d10v-tdep.c | 2 | ||||
-rw-r--r-- | gdb/frame.c | 17 | ||||
-rw-r--r-- | gdb/frame.h | 13 | ||||
-rw-r--r-- | gdb/hppa-tdep.c | 2 | ||||
-rw-r--r-- | gdb/i386-tdep.c | 4 | ||||
-rw-r--r-- | gdb/ia64-tdep.c | 2 | ||||
-rw-r--r-- | gdb/m68k-tdep.c | 2 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 12 | ||||
-rw-r--r-- | gdb/s390-tdep.c | 2 | ||||
-rw-r--r-- | gdb/sh-tdep.c | 6 |
14 files changed, 72 insertions, 20 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8bb0240..b45380c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,29 @@ 2003-04-05 Andrew Cagney <cagney@redhat.com> + * frame.c (frame_func_unwind, get_frame_func): New functions. + * frame.h (get_frame_func, frame_func_unwind): Declare. + (struct frame_info): Add field "prev_func" for caching the + previous frame's function address. + * arm-tdep.c (arm_frameless_function_invocation): Combine + get_pc_function_start and get_frame_pc into get_frame_func. + * sh-tdep.c (sh_nofp_frame_init_saved_regs): Ditto. + (sh64_nofp_frame_init_saved_regs): Ditto. + * s390-tdep.c (s390_function_start): Ditto. + * rs6000-tdep.c (rs6000_pop_frame): Ditto. + (rs6000_frameless_function_invocation): Ditto. + (rs6000_frame_saved_pc): Ditto. + * m68k-tdep.c (m68k_frame_init_saved_regs): Ditto. + * ia64-tdep.c (ia64_frame_init_saved_regs): Ditto. + * i386-tdep.c (i386_frameless_signal_p): Ditto. + (i386_frame_init_saved_regs): Ditto. + * hppa-tdep.c (hppa_frame_find_saved_regs): Ditto. + * d10v-tdep.c (d10v_frame_unwind_cache): Combine + get_pc_function_start and frame_pc_unwind into frame_func_unwind. + * cris-tdep.c (cris_frame_init_saved_regs): Ditto. + * blockframe.c (frameless_look_for_prologue): Ditto. + +2003-04-05 Andrew Cagney <cagney@redhat.com> + * frame.c (legacy_get_prev_frame): Link prev to next at the function start. Update comments. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 3968592..5d8c538 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -295,7 +295,7 @@ arm_frameless_function_invocation (struct frame_info *fi) stmdb sp!, {} sub sp, ip, #4. */ - func_start = (get_pc_function_start (get_frame_pc (fi)) + FUNCTION_START_OFFSET); + func_start = (get_frame_func (fi)) + FUNCTION_START_OFFSET); after_prologue = SKIP_PROLOGUE (func_start); /* There are some frameless functions whose first two instructions diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 364be9e..cf691a3 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -146,7 +146,7 @@ frameless_look_for_prologue (struct frame_info *frame) { CORE_ADDR func_start, after_prologue; - func_start = get_pc_function_start (get_frame_pc (frame)); + func_start = get_frame_func (frame); if (func_start) { func_start += FUNCTION_START_OFFSET; diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 4f9ee9b..2258a17 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -1178,7 +1178,7 @@ cris_frame_init_saved_regs (struct frame_info *fi) } else { - ip = get_pc_function_start (get_frame_pc (fi)); + ip = get_frame_func (fi); sal = find_pc_line (ip, 0); /* If there is no symbol information then sal.end == 0, and we end up diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 6c234cc..5e94de4 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -720,7 +720,7 @@ d10v_frame_unwind_cache (struct frame_info *next_frame, info->sp_offset = 0; info->uses_frame = 0; - for (pc = get_pc_function_start (frame_pc_unwind (next_frame)); + for (pc = frame_func_unwind (next_frame); pc < frame_pc_unwind (next_frame); pc += 4) { diff --git a/gdb/frame.c b/gdb/frame.c index 161ff60..b58900b 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -190,6 +190,23 @@ frame_pc_unwind (struct frame_info *this_frame) return this_frame->pc_unwind_cache; } +CORE_ADDR +frame_func_unwind (struct frame_info *fi) +{ + if (!fi->prev_func.p) + { + fi->prev_func.p = 1; + fi->prev_func.addr = get_pc_function_start (frame_pc_unwind (fi)); + } + return fi->prev_func.addr; +} + +CORE_ADDR +get_frame_func (struct frame_info *fi) +{ + return frame_func_unwind (fi->next); +} + static int do_frame_unwind_register (void *src, int regnum, void *buf) { diff --git a/gdb/frame.h b/gdb/frame.h index ad81bd9..1d26209 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -149,6 +149,12 @@ extern struct frame_info *frame_find_by_id (struct frame_id id); this frame. */ extern CORE_ADDR get_frame_pc (struct frame_info *); +/* Following on from the `resume' address. Return the entry point + address of the function containing that resume address, or zero if + that function isn't known. */ +extern CORE_ADDR frame_func_unwind (struct frame_info *fi); +extern CORE_ADDR get_frame_func (struct frame_info *fi); + /* Closely related to the resume address, various symbol table attributes that are determined by the PC. Note that for a normal frame, the PC refers to the resume address after the return, and @@ -410,6 +416,13 @@ struct frame_info int pc_unwind_cache_p; CORE_ADDR pc_unwind_cache; + /* Cached copy of the previous frame's function address. */ + struct + { + CORE_ADDR addr; + int p; + } prev_func; + /* This frame's ID. Note that the frame's ID, base and PC contain redundant information. */ int id_p; diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 2e0c192..c9826e0 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -3912,7 +3912,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* Get the starting address of the function referred to by the PC saved in frame. */ - pc = get_pc_function_start (frame_info->pc); + pc = get_frame_func (frame_info); /* Yow! */ u = find_unwind_entry (pc); diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 7ef1f6e..317d726 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -502,7 +502,7 @@ i386_frameless_signal_p (struct frame_info *frame) return (get_next_frame (frame) && get_frame_type (get_next_frame (frame)) == SIGTRAMP_FRAME && (frameless_look_for_prologue (frame) - || get_frame_pc (frame) == get_pc_function_start (get_frame_pc (frame)))); + || get_frame_pc (frame) == get_frame_func (frame))); } /* Return the chain-pointer for FRAME. In the case of the i386, the @@ -714,7 +714,7 @@ i386_frame_init_saved_regs (struct frame_info *fip) frame_saved_regs_zalloc (fip); - pc = get_pc_function_start (get_frame_pc (fip)); + pc = get_frame_func (fip); if (pc != 0) locals = i386_get_frame_setup (pc); diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index ecb4919..5e46d6b 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -1205,7 +1205,7 @@ ia64_frame_init_saved_regs (struct frame_info *frame) { CORE_ADDR func_start; - func_start = get_pc_function_start (get_frame_pc (frame)); + func_start = get_frame_func (frame); examine_prologue (func_start, get_frame_pc (frame), frame); } } diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 7a9886b..a93a156 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -614,7 +614,7 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info) } else { - pc = get_pc_function_start (get_frame_pc (frame_info)); + pc = get_frame_func (frame_info); nextinsn = read_memory_unsigned_integer (pc, 2); if (P_PEA_FP == nextinsn diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 5b48846..08394de 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -990,7 +990,7 @@ rs6000_pop_frame (void) still in the link register, otherwise walk the frames and retrieve the saved %pc value in the previous frame. */ - addr = get_pc_function_start (get_frame_pc (frame)); + addr = get_frame_func (frame); (void) skip_prologue (addr, get_frame_pc (frame), &fdata); wordsize = gdbarch_tdep (current_gdbarch)->wordsize; @@ -1499,7 +1499,7 @@ rs6000_frameless_function_invocation (struct frame_info *fi) && !(get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME)) return 0; - func_start = get_pc_function_start (get_frame_pc (fi)); + func_start = get_frame_func (fi); /* If we failed to find the start of the function, it is a mistake to inspect the instructions. */ @@ -1540,7 +1540,7 @@ rs6000_frame_saved_pc (struct frame_info *fi) return deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi), PC_REGNUM); - func_start = get_pc_function_start (get_frame_pc (fi)); + func_start = get_frame_func (fi); /* If we failed to find the start of the function, it is a mistake to inspect the instructions. */ @@ -1596,8 +1596,7 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap) if (fdatap == NULL) { fdatap = &work_fdata; - (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)), - get_frame_pc (fi), fdatap); + (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), fdatap); } frame_saved_regs_zalloc (fi); @@ -1720,8 +1719,7 @@ frame_initial_stack_address (struct frame_info *fi) /* Find out if this function is using an alloca register. */ - (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)), - get_frame_pc (fi), &fdata); + (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), &fdata); /* If saved registers of this frame are not known yet, read and cache them. */ diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index deff25d..2f8f4ff 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -775,7 +775,7 @@ s390_function_start (struct frame_info *fi) if (get_frame_extra_info (fi) && get_frame_extra_info (fi)->initialised) function_start = get_frame_extra_info (fi)->function_start; else if (get_frame_pc (fi)) - function_start = get_pc_function_start (get_frame_pc (fi)); + function_start = get_frame_func (fi); return function_start; } diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 804b34a..d30586c 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1116,7 +1116,7 @@ sh_nofp_frame_init_saved_regs (struct frame_info *fi) that does not appear to be part of the prologue. But give up after 20 of them, since we're getting silly then. */ - pc = get_pc_function_start (get_frame_pc (fi)); + pc = get_frame_func (fi); if (!pc) { deprecated_update_frame_pc_hack (fi, 0); @@ -1456,7 +1456,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) that does not appear to be part of the prologue. But give up after 20 of them, since we're getting silly then. */ - pc = get_pc_function_start (get_frame_pc (fi)); + pc = get_frame_func (fi); if (!pc) { deprecated_update_frame_pc_hack (fi, 0); @@ -1657,7 +1657,7 @@ sh_fp_frame_init_saved_regs (struct frame_info *fi) that does not appear to be part of the prologue. But give up after 20 of them, since we're getting silly then. */ - pc = get_pc_function_start (get_frame_pc (fi)); + pc = get_frame_func (fi); if (!pc) { deprecated_update_frame_pc_hack (fi, 0); |