From f510d44e69eeb913ee456c0d86465fa16e588633 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 26 Apr 2002 01:56:04 +0000 Subject: [PATCH] 2002-04-24 David S. Miller * sparc-tdep.c (sparc_gdbarch_skip_prologue): Kill, duplicates sparc_skip_prologue. (sparc_skip_prologue): Kill frameless_p arg, and use line number information to find prologue when possible. (sparc_prologue_frameless_p): Call examine_prologue directly. (sparc_gdbarch_init): Update set_gdbarch_skip_prologue call. * config/sparc/tm-sparc.h (sparc_skip_prologue): Update for killed second argument. (SKIP_PROLOGUE): Likewise. --- gdb/ChangeLog | 12 ++++++++++++ gdb/config/sparc/tm-sparc.h | 4 ++-- gdb/sparc-tdep.c | 35 ++++++++++++++++++++++------------- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9340f33fa69..8dd3fdd10dc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2002-04-24 David S. Miller + + * sparc-tdep.c (sparc_gdbarch_skip_prologue): Kill, duplicates + sparc_skip_prologue. + (sparc_skip_prologue): Kill frameless_p arg, and use line number + information to find prologue when possible. + (sparc_prologue_frameless_p): Call examine_prologue directly. + (sparc_gdbarch_init): Update set_gdbarch_skip_prologue call. + * config/sparc/tm-sparc.h (sparc_skip_prologue): Update for killed + second argument. + (SKIP_PROLOGUE): Likewise. + 2002-04-25 Jason Thorpe * alpha-tdep.c (alpha_skip_prologue_internal): Remove diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index daa8141cc71..4a5358036be 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -250,8 +250,8 @@ extern int sparc_intreg_size (void); /* Advance PC across any function entry prologue instructions to reach some "real" code. */ -extern CORE_ADDR sparc_skip_prologue (CORE_ADDR, int); -#define SKIP_PROLOGUE(PC) sparc_skip_prologue (PC, 0) +extern CORE_ADDR sparc_skip_prologue (CORE_ADDR); +#define SKIP_PROLOGUE(PC) sparc_skip_prologue (PC) /* Immediately after a function call, return the saved pc. Can't go through the frames for this because on some machines diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 0872b092acc..4f7f57b0d37 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -685,10 +685,28 @@ examine_prologue (CORE_ADDR start_pc, int frameless_p, struct frame_info *fi, return pc; } +/* Advance PC across any function entry prologue instructions to reach + some "real" code. */ + CORE_ADDR -sparc_skip_prologue (CORE_ADDR start_pc, int frameless_p) +sparc_skip_prologue (CORE_ADDR start_pc) { - return examine_prologue (start_pc, frameless_p, NULL, NULL); + struct symtab_and_line sal; + CORE_ADDR func_start, func_end; + + /* This is the preferred method, find the end of the prologue by + using the debugging information. */ + if (find_pc_partial_function (start_pc, NULL, &func_start, &func_end)) + { + sal = find_pc_line (func_start, 0); + + if (sal.end < func_end + && start_pc <= sal.end) + return sal.end; + } + + /* Oh well, examine the code by hand. */ + return examine_prologue (start_pc, 0, NULL, NULL); } /* Is the prologue at IP frameless? */ @@ -696,7 +714,7 @@ sparc_skip_prologue (CORE_ADDR start_pc, int frameless_p) int sparc_prologue_frameless_p (CORE_ADDR ip) { - return ip == sparc_skip_prologue (ip, 1); + return ip == examine_prologue (ip, 1, NULL, NULL); } /* Check instruction at ADDR to see if it is a branch. @@ -2784,15 +2802,6 @@ sparc64_register_byte (int regno) return 64 * 8 + (regno - 80) * 8; } -/* Advance PC across any function entry prologue instructions to reach - some "real" code. */ - -static CORE_ADDR -sparc_gdbarch_skip_prologue (CORE_ADDR ip) -{ - return examine_prologue (ip, 0, NULL, NULL); -} - /* Immediately after a function call, return the saved pc. Can't go through the frames for this because on some machines the new frame is not set up until the new function executes @@ -2993,7 +3002,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_saved_pc_after_call (gdbarch, sparc_saved_pc_after_call); set_gdbarch_prologue_frameless_p (gdbarch, sparc_prologue_frameless_p); set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT); - set_gdbarch_skip_prologue (gdbarch, sparc_gdbarch_skip_prologue); + set_gdbarch_skip_prologue (gdbarch, sparc_skip_prologue); set_gdbarch_sp_regnum (gdbarch, SPARC_SP_REGNUM); set_gdbarch_use_generic_dummy_frames (gdbarch, 0); set_gdbarch_write_pc (gdbarch, generic_target_write_pc); -- 2.30.2