aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Thorpe <thorpej@netbsd.org>2002-01-19 06:44:56 +0000
committerJason Thorpe <thorpej@netbsd.org>2002-01-19 06:44:56 +0000
commit140f998426704f8ef286f58033ab983850d39552 (patch)
tree198523679619cf526d12e5e06f67b376367f2234
parentd734c450e15fb96ea85368f722b560b395183343 (diff)
downloadfsf-binutils-gdb-140f998426704f8ef286f58033ab983850d39552.zip
fsf-binutils-gdb-140f998426704f8ef286f58033ab983850d39552.tar.gz
fsf-binutils-gdb-140f998426704f8ef286f58033ab983850d39552.tar.bz2
* alpha-tdep.c (frame_extra_info): New.
(alpha_find_saved_regs): Make static. Use frame->extra_info. (alpha_frame_init_saved_regs): New function. (alpha_frame_saved_pc): Use frame->extra_info. (temp_saved_regs): Don't declare as struct frame_saved_regs. (heuristic_proc_desc): Adjust for temp_saved_regs changes. (init_extra_frame_info): Rename to... (alpha_init_extra_frame_info): ...this. Use frame->extra_info. (alpha_print_extra_frame_info): New function. (alpha_frame_locals_address): Ditto. (alpha_frame_args_address): Ditto. (alpha_pop_frame): Use frame->extra_info. * config/alpha/tm-alpha.h (FRAME_ARGS_ADDRESS): Use alpha_frame_args_address. (FRAME_LOCALS_ADDRESS): Use alpha_frame_locals_address. (alpha_find_saved_regs): Remove prototype. (FRAME_INIT_SAVED_REGS): Use alpha_frame_init_saved_regs. (EXTRA_FRAME_INFO): Remove. (INIT_EXTRA_FRAME_INFO): Use alpha_init_extra_frame_info. (PRINT_EXTRA_FRAME_INFO): Use alpha_print_extra_frame_info.
-rw-r--r--gdb/ChangeLog24
-rw-r--r--gdb/alpha-tdep.c76
-rw-r--r--gdb/config/alpha/tm-alpha.h34
3 files changed, 97 insertions, 37 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 15f5b59..cb4aa19 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,29 @@
2002-01-18 Jason Thorpe <thorpej@wasabisystems.com>
+ * alpha-tdep.c (frame_extra_info): New.
+ (alpha_find_saved_regs): Make static. Use
+ frame->extra_info.
+ (alpha_frame_init_saved_regs): New function.
+ (alpha_frame_saved_pc): Use frame->extra_info.
+ (temp_saved_regs): Don't declare as struct frame_saved_regs.
+ (heuristic_proc_desc): Adjust for temp_saved_regs changes.
+ (init_extra_frame_info): Rename to...
+ (alpha_init_extra_frame_info): ...this. Use frame->extra_info.
+ (alpha_print_extra_frame_info): New function.
+ (alpha_frame_locals_address): Ditto.
+ (alpha_frame_args_address): Ditto.
+ (alpha_pop_frame): Use frame->extra_info.
+ * config/alpha/tm-alpha.h (FRAME_ARGS_ADDRESS): Use
+ alpha_frame_args_address.
+ (FRAME_LOCALS_ADDRESS): Use alpha_frame_locals_address.
+ (alpha_find_saved_regs): Remove prototype.
+ (FRAME_INIT_SAVED_REGS): Use alpha_frame_init_saved_regs.
+ (EXTRA_FRAME_INFO): Remove.
+ (INIT_EXTRA_FRAME_INFO): Use alpha_init_extra_frame_info.
+ (PRINT_EXTRA_FRAME_INFO): Use alpha_print_extra_frame_info.
+
+2002-01-18 Jason Thorpe <thorpej@wasabisystems.com>
+
* alpha-tdep.c (alpha_osf_in_sigtramp): New function.
(alpha_cannot_fetch_register): Ditto.
(alpha_cannot_store_register): Ditto.
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index a50000e..6345279 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -34,10 +34,19 @@
#include "regcache.h"
#include "doublest.h"
+struct frame_extra_info
+ {
+ alpha_extra_func_info_t proc_desc;
+ int localoff;
+ int pc_reg;
+ };
+
/* FIXME: Some of this code should perhaps be merged with mips-tdep.c. */
/* Prototypes for local functions. */
+static void alpha_find_saved_regs (struct frame_info *);
+
static alpha_extra_func_info_t push_sigtramp_desc (CORE_ADDR low_addr);
static CORE_ADDR read_next_frame_reg (struct frame_info *, int);
@@ -311,7 +320,7 @@ alpha_register_convertible (int regno)
/* Guaranteed to set frame->saved_regs to some values (it never leaves it
NULL). */
-void
+static void
alpha_find_saved_regs (struct frame_info *frame)
{
int ireg;
@@ -351,7 +360,7 @@ alpha_find_saved_regs (struct frame_info *frame)
return;
}
- proc_desc = frame->proc_desc;
+ proc_desc = frame->extra_info->proc_desc;
if (proc_desc == NULL)
/* I'm not sure how/whether this can happen. Normally when we can't
find a proc_desc, we "synthesize" one using heuristic_proc_desc
@@ -399,6 +408,14 @@ alpha_find_saved_regs (struct frame_info *frame)
frame->saved_regs[PC_REGNUM] = frame->saved_regs[returnreg];
}
+void
+alpha_frame_init_saved_regs (struct frame_info *fi)
+{
+ if (fi->saved_regs == NULL)
+ alpha_find_saved_regs (fi);
+ fi->saved_regs[SP_REGNUM] = fi->frame;
+}
+
static CORE_ADDR
read_next_frame_reg (struct frame_info *fi, int regno)
{
@@ -422,10 +439,11 @@ read_next_frame_reg (struct frame_info *fi, int regno)
CORE_ADDR
alpha_frame_saved_pc (struct frame_info *frame)
{
- alpha_extra_func_info_t proc_desc = frame->proc_desc;
+ alpha_extra_func_info_t proc_desc = frame->extra_info->proc_desc;
/* We have to get the saved pc from the sigcontext
if it is a signal handler frame. */
- int pcreg = frame->signal_handler_caller ? PC_REGNUM : frame->pc_reg;
+ int pcreg = frame->signal_handler_caller ? PC_REGNUM
+ : frame->extra_info->pc_reg;
if (proc_desc && PROC_DESC_IS_DUMMY (proc_desc))
return read_memory_integer (frame->frame - 8, 8);
@@ -457,7 +475,7 @@ alpha_saved_pc_after_call (struct frame_info *frame)
static struct alpha_extra_func_info temp_proc_desc;
-static struct frame_saved_regs temp_saved_regs;
+static CORE_ADDR temp_saved_regs[NUM_REGS];
/* Nonzero if instruction at PC is a return instruction. "ret
$zero,($ra),1" on alpha. */
@@ -541,7 +559,7 @@ heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
if (start_pc == 0)
return NULL;
memset (&temp_proc_desc, '\0', sizeof (temp_proc_desc));
- memset (&temp_saved_regs, '\0', sizeof (struct frame_saved_regs));
+ memset (&temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS);
PROC_LOW_ADDR (&temp_proc_desc) = start_pc;
if (start_pc + 200 < limit_pc)
@@ -573,7 +591,7 @@ heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
{
int reg = (word & 0x03e00000) >> 21;
reg_mask |= 1 << reg;
- temp_saved_regs.regs[reg] = sp + (short) word;
+ temp_saved_regs[reg] = sp + (short) word;
/* Starting with OSF/1-3.2C, the system libraries are shipped
without local symbols, but they still contain procedure
@@ -859,23 +877,38 @@ alpha_frame_chain (struct frame_info *frame)
}
void
-init_extra_frame_info (struct frame_info *frame)
+alpha_print_extra_frame_info (struct frame_info *fi)
+{
+ if (fi
+ && fi->extra_info
+ && fi->extra_info->proc_desc
+ && fi->extra_info->proc_desc->pdr.framereg < NUM_REGS)
+ printf_filtered (" frame pointer is at %s+%s\n",
+ REGISTER_NAME (fi->extra_info->proc_desc->pdr.framereg),
+ paddr_d (fi->extra_info->proc_desc->pdr.frameoffset));
+}
+
+void
+alpha_init_extra_frame_info (int fromleaf, struct frame_info *frame)
{
/* Use proc_desc calculated in frame_chain */
alpha_extra_func_info_t proc_desc =
frame->next ? cached_proc_desc : find_proc_desc (frame->pc, frame->next);
+ frame->extra_info = (struct frame_extra_info *)
+ frame_obstack_alloc (sizeof (struct frame_extra_info));
+
frame->saved_regs = NULL;
- frame->localoff = 0;
- frame->pc_reg = RA_REGNUM;
- frame->proc_desc = proc_desc == &temp_proc_desc ? 0 : proc_desc;
+ frame->extra_info->localoff = 0;
+ frame->extra_info->pc_reg = RA_REGNUM;
+ frame->extra_info->proc_desc = proc_desc == &temp_proc_desc ? 0 : proc_desc;
if (proc_desc)
{
/* Get the locals offset and the saved pc register from the
procedure descriptor, they are valid even if we are in the
middle of the prologue. */
- frame->localoff = PROC_LOCALOFF (proc_desc);
- frame->pc_reg = PROC_PC_REG (proc_desc);
+ frame->extra_info->localoff = PROC_LOCALOFF (proc_desc);
+ frame->extra_info->pc_reg = PROC_PC_REG (proc_desc);
/* Fixup frame-pointer - only needed for top frame */
@@ -907,7 +940,8 @@ init_extra_frame_info (struct frame_info *frame)
{
frame->saved_regs = (CORE_ADDR *)
frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS);
- memcpy (frame->saved_regs, temp_saved_regs.regs, SIZEOF_FRAME_SAVED_REGS);
+ memcpy (frame->saved_regs, temp_saved_regs,
+ SIZEOF_FRAME_SAVED_REGS);
frame->saved_regs[PC_REGNUM]
= frame->saved_regs[RA_REGNUM];
}
@@ -915,6 +949,18 @@ init_extra_frame_info (struct frame_info *frame)
}
}
+CORE_ADDR
+alpha_frame_locals_address (struct frame_info *fi)
+{
+ return (fi->frame - fi->extra_info->localoff);
+}
+
+CORE_ADDR
+alpha_frame_args_address (struct frame_info *fi)
+{
+ return (fi->frame - (ALPHA_NUM_ARG_REGS * 8));
+}
+
/* ALPHA stack frames are almost impenetrable. When execution stops,
we basically have to look at symbol information for the function
that we stopped in, which tells us *which* register (if any) is
@@ -1154,7 +1200,7 @@ alpha_pop_frame (void)
struct frame_info *frame = get_current_frame ();
CORE_ADDR new_sp = frame->frame;
- alpha_extra_func_info_t proc_desc = frame->proc_desc;
+ alpha_extra_func_info_t proc_desc = frame->extra_info->proc_desc;
/* we need proc_desc to know how to restore the registers;
if it is NULL, construct (a temporary) one */
diff --git a/gdb/config/alpha/tm-alpha.h b/gdb/config/alpha/tm-alpha.h
index 7630e08..5c53622 100644
--- a/gdb/config/alpha/tm-alpha.h
+++ b/gdb/config/alpha/tm-alpha.h
@@ -276,9 +276,11 @@ extern CORE_ADDR alpha_frame_saved_pc (struct frame_info *);
#define ALPHA_NUM_ARG_REGS 6
-#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame - (ALPHA_NUM_ARG_REGS * 8))
+#define FRAME_ARGS_ADDRESS(fi) alpha_frame_args_address ((fi))
+extern CORE_ADDR alpha_frame_args_address (struct frame_info *);
-#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame - (fi)->localoff)
+#define FRAME_LOCALS_ADDRESS(fi) alpha_frame_locals_address ((fi))
+extern CORE_ADDR alpha_frame_locals_address (struct frame_info *);
/* Return number of args passed to a frame.
Can return -1, meaning no way to tell. */
@@ -295,14 +297,9 @@ extern CORE_ADDR alpha_frame_saved_pc (struct frame_info *);
ways in the stack frame. sp is even more special:
the address we return for it IS the sp for the next frame. */
-extern void alpha_find_saved_regs (struct frame_info *);
-
#define FRAME_INIT_SAVED_REGS(frame_info) \
- do { \
- if ((frame_info)->saved_regs == NULL) \
- alpha_find_saved_regs (frame_info); \
- (frame_info)->saved_regs[SP_REGNUM] = (frame_info)->frame; \
- } while (0)
+ alpha_frame_init_saved_regs (frame_info)
+extern void alpha_frame_init_saved_regs (struct frame_info *);
/* Things needed for making the inferior call functions. */
@@ -391,21 +388,14 @@ typedef struct alpha_extra_func_info
#define mips_extra_func_info alpha_extra_func_info
#define mips_extra_func_info_t alpha_extra_func_info_t
-#define EXTRA_FRAME_INFO \
- int localoff; \
- int pc_reg; \
- alpha_extra_func_info_t proc_desc;
-#define INIT_EXTRA_FRAME_INFO(fromleaf, fci) init_extra_frame_info(fci)
-extern void init_extra_frame_info (struct frame_info *);
+#define INIT_EXTRA_FRAME_INFO(fromleaf, fci) \
+ alpha_init_extra_frame_info(fromleaf, fci)
+extern void alpha_init_extra_frame_info (int, struct frame_info *);
+
+#define PRINT_EXTRA_FRAME_INFO(fi) alpha_print_extra_frame_info ((fi))
+extern void alpha_print_extra_frame_info (struct frame_info *);
-#define PRINT_EXTRA_FRAME_INFO(fi) \
- { \
- if (fi && fi->proc_desc && fi->proc_desc->pdr.framereg < NUM_REGS) \
- printf_filtered (" frame pointer is at %s+%ld\n", \
- REGISTER_NAME (fi->proc_desc->pdr.framereg), \
- fi->proc_desc->pdr.frameoffset); \
- }
/* It takes two values to specify a frame on the ALPHA. Sigh.