From a88376a3e1a5e2358f568a4a7aed6d4d99e1e87a Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Fri, 12 Apr 2002 19:48:37 +0000 Subject: [PATCH] Delete DEFAULT_LR_SAVE. --- gdb/ChangeLog | 9 +++++++++ gdb/config/powerpc/tm-ppc-eabi.h | 3 --- gdb/config/rs6000/tm-rs6000.h | 3 --- gdb/ppc-tdep.h | 2 ++ gdb/rs6000-tdep.c | 15 ++++++++++++--- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d3fa62eddd..aa4b1dbb12 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2002-04-12 Kevin Buettner + + * ppc-tdep.h (struct gdbarch_tdep): Add new member ``lr_frame_offset''. + * rs6000-tdep.c (rs6000_frame_saved_pc): Use ``lr_frame_offset'' + from tdep struct instead of DEFAULT_LR_SAVE. + (rs6000_gdbarch_init): Initialize ``lr_frame_offset''. + * config/powerpc/tm-ppc-eabi.h (DEFAULT_LR_SAVE): Delete. + * config/rs6000/tm-rs6000.h (DEFAULT_LR_SAVE): Delete. + 2002-04-12 Michael Snyder * source.c: White space fix-up. diff --git a/gdb/config/powerpc/tm-ppc-eabi.h b/gdb/config/powerpc/tm-ppc-eabi.h index 1e6a05366c..e49b2bd0c9 100644 --- a/gdb/config/powerpc/tm-ppc-eabi.h +++ b/gdb/config/powerpc/tm-ppc-eabi.h @@ -28,9 +28,6 @@ #undef SOFTWARE_SINGLE_STEP_P #define SOFTWARE_SINGLE_STEP_P() 0 -#undef DEFAULT_LR_SAVE -#define DEFAULT_LR_SAVE 4 /* eabi saves LR at 4 off of SP */ - #undef PROCESS_LINENUMBER_HOOK #undef TEXT_SEGMENT_BASE diff --git a/gdb/config/rs6000/tm-rs6000.h b/gdb/config/rs6000/tm-rs6000.h index 015a5928b6..202ac7751a 100644 --- a/gdb/config/rs6000/tm-rs6000.h +++ b/gdb/config/rs6000/tm-rs6000.h @@ -93,9 +93,6 @@ extern void aix_process_linenos (void); prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ()); #define INIT_FRAME_PC(fromleaf, prev) /* nothing */ -/* Default offset from SP where the LR is stored */ -#define DEFAULT_LR_SAVE 8 - /* Flag for machine-specific stuff in shared files. FIXME */ #define IBM6000_TARGET diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h index ec64514321..5dc2db25d3 100644 --- a/gdb/ppc-tdep.h +++ b/gdb/ppc-tdep.h @@ -67,6 +67,8 @@ struct gdbarch_tdep int ppc_mq_regnum; /* Multiply/Divide extension register */ int ppc_vr0_regnum; /* First AltiVec register */ int ppc_vrsave_regnum; /* Last AltiVec register */ + int lr_frame_offset; /* Offset to ABI specific location where + link register is saved. */ }; #endif diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 86c07f4266..f1649d011e 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1319,7 +1319,8 @@ rs6000_frame_saved_pc (struct frame_info *fi) { CORE_ADDR func_start; struct rs6000_framedata fdata; - int wordsize = TDEP->wordsize; + struct gdbarch_tdep *tdep = TDEP; + int wordsize = tdep->wordsize; if (fi->signal_handler_caller) return read_memory_addr (fi->frame + SIG_FRAME_PC_OFFSET, wordsize); @@ -1342,7 +1343,7 @@ rs6000_frame_saved_pc (struct frame_info *fi) return read_memory_addr (fi->next->frame + SIG_FRAME_LR_OFFSET, wordsize); else - return read_memory_addr (FRAME_CHAIN (fi) + DEFAULT_LR_SAVE, + return read_memory_addr (FRAME_CHAIN (fi) + tdep->lr_frame_offset, wordsize); } @@ -2585,7 +2586,15 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) break; } - /* Calculate byte offsets in raw register array. */ + /* Set lr_frame_offset. */ + if (wordsize == 8) + tdep->lr_frame_offset = 16; + else if (sysv_abi) + tdep->lr_frame_offset = 4; + else + tdep->lr_frame_offset = 8; + + /* Calculate byte offsets in raw register array. */ tdep->regoff = xmalloc (v->nregs * sizeof (int)); for (i = off = 0; i < v->nregs; i++) {