Replace useless FRAME, FRAME_ADDR types with struct frame_info *

and CORE_ADDR, respectively.
	* frame.h (FRAME, FRAME_INFO_ID, FRAME_ADDR): Remove.
	* blockframe.c (get_frame_info): Remove.
	* a29k-tdep.c, alpha-tdep.c, blockframe.c, breakpoint.c,
	breakpoint.h, energize.c, findvar.c, gdbtk.c, gould-pinsn.c,
	h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, i386-tdep.c, i960-tdep.c,
	infcmd.c, inferior.h, infrun.c, m68k-tdep.c, m88k-tdep.c,
	mips-tdep.c, nindy-tdep.c, printcmd.c, pyr-tdep.c, rs6000-tdep.c,
	sh-tdep.c, sparc-tdep.c, stack.c, valops.c, z8k-tdep.c,
	config/a29k/tm-a29k.h, config/alpha/tm-alpha.h,
	config/gould/tm-pn.h, config/h8300/tm-h8300.h,
	config/h8500/tm-h8500.h, config/mips/tm-mips.h,
	config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h,
	config/pyr/tm-pyr.h, config/sparc/tm-sparc.h): Replace FRAME with
	struct frame_info * everywhere, replace FRAME_ADDR with CORE_ADDR,
	rename variables consistently (using `frame' or `fi'), remove
	calls to get_frame_info and FRAME_INFO_ID, remove comments about
	FRAME and FRAME_ADDR cruftiness.
This commit is contained in:
Stan Shebs 1994-11-04 01:19:29 +00:00
parent 0128cbae50
commit 669caa9c19
20 changed files with 336 additions and 331 deletions

View File

@ -1,3 +1,25 @@
Thu Nov 3 15:19:17 1994 Stan Shebs (shebs@andros.cygnus.com)
Replace useless FRAME, FRAME_ADDR types with struct frame_info *
and CORE_ADDR, respectively.
* frame.h (FRAME, FRAME_INFO_ID, FRAME_ADDR): Remove.
* blockframe.c (get_frame_info): Remove.
* a29k-tdep.c, alpha-tdep.c, blockframe.c, breakpoint.c,
breakpoint.h, energize.c, findvar.c, gdbtk.c, gould-pinsn.c,
h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, i386-tdep.c, i960-tdep.c,
infcmd.c, inferior.h, infrun.c, m68k-tdep.c, m88k-tdep.c,
mips-tdep.c, nindy-tdep.c, printcmd.c, pyr-tdep.c, rs6000-tdep.c,
sh-tdep.c, sparc-tdep.c, stack.c, valops.c, z8k-tdep.c,
config/a29k/tm-a29k.h, config/alpha/tm-alpha.h,
config/gould/tm-pn.h, config/h8300/tm-h8300.h,
config/h8500/tm-h8500.h, config/mips/tm-mips.h,
config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h,
config/pyr/tm-pyr.h, config/sparc/tm-sparc.h): Replace FRAME with
struct frame_info * everywhere, replace FRAME_ADDR with CORE_ADDR,
rename variables consistently (using `frame' or `fi'), remove
calls to get_frame_info and FRAME_INFO_ID, remove comments about
FRAME and FRAME_ADDR cruftiness.
Thu Nov 3 14:25:24 1994 Stu Grossman (grossman@cygnus.com)
* corelow.c, exec.c, inftarg.c, m3-nat.c, op50-rom.c, procfs.c,

View File

@ -41,6 +41,7 @@ extern CORE_ADDR text_start; /* FIXME, kludge... */
static CORE_ADDR rstack_high_address = UINT_MAX;
/* Structure to hold cached info about function prologues. */
struct prologue_info
{
CORE_ADDR pc; /* First addr after fn prologue */
@ -66,6 +67,7 @@ struct prologue_info
If MFP_USED is non-NULL, *MFP_USED is set to nonzero if a memory
frame pointer is being used. */
CORE_ADDR
examine_prologue (pc, rsize, msize, mfp_used)
CORE_ADDR pc;
@ -325,9 +327,9 @@ CORE_ADDR
skip_prologue (pc)
CORE_ADDR pc;
{
return examine_prologue (pc, (unsigned *)NULL, (unsigned *)NULL,
(int *)NULL);
return examine_prologue (pc, NULL, NULL, NULL);
}
/*
* Examine the one or two word tag at the beginning of a function.
* The tag word is expect to be at 'p', if it is not there, we fail
@ -337,11 +339,12 @@ skip_prologue (pc)
* convention today (1/15/92).
* msize is return in bytes.
*/
static int /* 0/1 - failure/success of finding the tag word */
examine_tag(p, is_trans, argcount, msize, mfp_used)
examine_tag (p, is_trans, argcount, msize, mfp_used)
CORE_ADDR p;
int *is_trans;
int *argcount;
int *argcount;
unsigned *msize;
int *mfp_used;
{
@ -371,17 +374,18 @@ examine_tag(p, is_trans, argcount, msize, mfp_used)
*argcount = (tag1 >> 16) & 0x1f;
if (mfp_used)
*mfp_used = ((tag1 & (1<<22)) ? 1 : 0);
return(1);
return 1;
}
/* Initialize the frame. In addition to setting "extra" frame info,
we also set ->frame because we use it in a nonstandard way, and ->pc
because we need to know it to get the other stuff. See the diagram
of stacks and the frame cache in tm-a29k.h for more detail. */
static void
init_frame_info (innermost_frame, fci)
init_frame_info (innermost_frame, frame)
int innermost_frame;
struct frame_info *fci;
struct frame_info *frame;
{
CORE_ADDR p;
long insn;
@ -390,12 +394,12 @@ init_frame_info (innermost_frame, fci)
int mfp_used, trans;
struct symbol *func;
p = fci->pc;
p = frame->pc;
if (innermost_frame)
fci->frame = read_register (GR1_REGNUM);
frame->frame = read_register (GR1_REGNUM);
else
fci->frame = fci->next->frame + fci->next->rsize;
frame->frame = frame->next->frame + frame->next->rsize;
#if CALL_DUMMY_LOCATION == ON_STACK
This wont work;
@ -403,14 +407,14 @@ init_frame_info (innermost_frame, fci)
if (PC_IN_CALL_DUMMY (p, 0, 0))
#endif
{
fci->rsize = DUMMY_FRAME_RSIZE;
frame->rsize = DUMMY_FRAME_RSIZE;
/* This doesn't matter since we never try to get locals or args
from a dummy frame. */
fci->msize = 0;
frame->msize = 0;
/* Dummy frames always use a memory frame pointer. */
fci->saved_msp =
read_register_stack_integer (fci->frame + DUMMY_FRAME_RSIZE - 4, 4);
fci->flags |= (TRANSPARENT|MFP_USED);
frame->saved_msp =
read_register_stack_integer (frame->frame + DUMMY_FRAME_RSIZE - 4, 4);
frame->flags |= (TRANSPARENT|MFP_USED);
return;
}
@ -440,10 +444,10 @@ init_frame_info (innermost_frame, fci)
{
/* Couldn't find the trace-back tag.
Something strange is going on. */
fci->saved_msp = 0;
fci->rsize = 0;
fci->msize = 0;
fci->flags = TRANSPARENT;
frame->saved_msp = 0;
frame->rsize = 0;
frame->msize = 0;
frame->flags = TRANSPARENT;
return;
}
else
@ -463,35 +467,35 @@ init_frame_info (innermost_frame, fci)
else /* No tag try prologue */
examine_prologue (p, &rsize, &msize, &mfp_used);
fci->rsize = rsize;
fci->msize = msize;
fci->flags = 0;
frame->rsize = rsize;
frame->msize = msize;
frame->flags = 0;
if (mfp_used)
fci->flags |= MFP_USED;
frame->flags |= MFP_USED;
if (trans)
fci->flags |= TRANSPARENT;
frame->flags |= TRANSPARENT;
if (innermost_frame)
{
fci->saved_msp = read_register (MSP_REGNUM) + msize;
frame->saved_msp = read_register (MSP_REGNUM) + msize;
}
else
{
if (mfp_used)
fci->saved_msp =
read_register_stack_integer (fci->frame + rsize - 4, 4);
frame->saved_msp =
read_register_stack_integer (frame->frame + rsize - 4, 4);
else
fci->saved_msp = fci->next->saved_msp + msize;
frame->saved_msp = frame->next->saved_msp + msize;
}
}
void
init_extra_frame_info (fci)
struct frame_info *fci;
init_extra_frame_info (frame)
struct frame_info *frame;
{
if (fci->next == 0)
if (frame->next == 0)
/* Assume innermost frame. May produce strange results for "info frame"
but there isn't any way to tell the difference. */
init_frame_info (1, fci);
init_frame_info (1, frame);
else {
/* We're in get_prev_frame_info.
Take care of everything in init_frame_pc. */
@ -500,13 +504,13 @@ init_extra_frame_info (fci)
}
void
init_frame_pc (fromleaf, fci)
init_frame_pc (fromleaf, frame)
int fromleaf;
struct frame_info *fci;
struct frame_info *frame;
{
fci->pc = (fromleaf ? SAVED_PC_AFTER_CALL (fci->next) :
fci->next ? FRAME_SAVED_PC (fci->next) : read_pc ());
init_frame_info (fromleaf, fci);
frame->pc = (fromleaf ? SAVED_PC_AFTER_CALL (frame->next) :
frame->next ? FRAME_SAVED_PC (frame->next) : read_pc ());
init_frame_info (fromleaf, frame);
}
/* Local variables (i.e. LOC_LOCAL) are on the memory stack, with their
@ -649,12 +653,13 @@ write_register_stack (memaddr, myaddr, actual_mem_addr)
otherwise it was fetched from a register.
The argument RAW_BUFFER must point to aligned memory. */
void
get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lvalp)
char *raw_buffer;
int *optimized;
CORE_ADDR *addrp;
FRAME frame;
struct frame_info *frame;
int regnum;
enum lval_type *lvalp;
{
@ -665,8 +670,6 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lvalp)
if (frame == 0)
return;
fi = get_frame_info (frame);
/* Once something has a register number, it doesn't get optimized out. */
if (optimized != NULL)
*optimized = 0;
@ -674,7 +677,7 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lvalp)
{
if (raw_buffer != NULL)
{
store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), fi->frame);
store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), frame->frame);
}
if (lvalp != NULL)
*lvalp = not_lval;
@ -684,7 +687,7 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lvalp)
{
if (raw_buffer != NULL)
{
store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), fi->pc);
store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), frame->pc);
}
/* Not sure we have to do this. */
@ -697,10 +700,10 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lvalp)
{
if (raw_buffer != NULL)
{
if (fi->next != NULL)
if (frame->next != NULL)
{
store_address (raw_buffer, REGISTER_RAW_SIZE (regnum),
fi->next->saved_msp);
frame->next->saved_msp);
}
else
read_register_gen (MSP_REGNUM, raw_buffer);
@ -723,7 +726,7 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lvalp)
return;
}
addr = fi->frame + (regnum - LR0_REGNUM) * 4;
addr = frame->frame + (regnum - LR0_REGNUM) * 4;
if (raw_buffer != NULL)
read_register_stack (addr, raw_buffer, &addr, &lval);
if (lvalp != NULL)
@ -739,9 +742,8 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lvalp)
void
pop_frame ()
{
FRAME frame = get_current_frame ();
struct frame_info *fi = get_frame_info (frame);
CORE_ADDR rfb = read_register (RFB_REGNUM);
struct frame_info *frame = get_current_frame ();
CORE_ADDR rfb = read_register (RFB_REGNUM);
CORE_ADDR gr1 = fi->frame + fi->rsize;
CORE_ADDR lr1;
CORE_ADDR original_lr0;
@ -751,7 +753,7 @@ pop_frame ()
/* If popping a dummy frame, need to restore registers. */
if (PC_IN_CALL_DUMMY (read_register (PC_REGNUM),
read_register (SP_REGNUM),
FRAME_FP (fi)))
FRAME_FP (frame)))
{
int lrnum = LR0_REGNUM + DUMMY_ARG/4;
for (i = 0; i < DUMMY_SAVE_SR128; ++i)
@ -769,7 +771,7 @@ pop_frame ()
}
/* Restore the memory stack pointer. */
write_register (MSP_REGNUM, fi->saved_msp);
write_register (MSP_REGNUM, frame->saved_msp);
/* Restore the register stack pointer. */
write_register (GR1_REGNUM, gr1);
@ -784,7 +786,8 @@ pop_frame ()
/* Fill. */
int num_bytes = lr1 - rfb;
int i;
long word;
long word;
write_register (RAB_REGNUM, read_register (RAB_REGNUM) + num_bytes);
write_register (RFB_REGNUM, lr1);
for (i = 0; i < num_bytes; i += 4)
@ -874,37 +877,35 @@ push_dummy_frame ()
three values (FP, PC, and MSP), we really need all three to do a
good job. */
FRAME
struct frame_info *
setup_arbitrary_frame (argc, argv)
int argc;
FRAME_ADDR *argv;
CORE_ADDR *argv;
{
FRAME fid;
struct frame_info *frame;
if (argc != 3)
error ("AMD 29k frame specifications require three arguments: rsp pc msp");
fid = create_new_frame (argv[0], argv[1]);
frame = create_new_frame (argv[0], argv[1]);
if (!fid)
if (!frame)
fatal ("internal: create_new_frame returned invalid frame id");
/* Creating a new frame munges the `frame' value from the current
GR1, so we restore it again here. FIXME, untangle all this
29K frame stuff... */
fid->frame = argv[0];
frame->frame = argv[0];
/* Our MSP is in argv[2]. It'd be intelligent if we could just
save this value in the FRAME. But the way it's set up (FIXME),
we must save our caller's MSP. We compute that by adding our
memory stack frame size to our MSP. */
fid->saved_msp = argv[2] + fid->msize;
frame->saved_msp = argv[2] + frame->msize;
return fid;
return frame;
}
enum a29k_processor_types processor_type = a29k_unknown;
void

View File

@ -36,23 +36,19 @@ extern struct obstack frame_cache_obstack;
/* Forward declarations. */
static CORE_ADDR
read_next_frame_reg PARAMS ((FRAME, int));
static CORE_ADDR read_next_frame_reg PARAMS ((struct frame_info *, int));
static CORE_ADDR
heuristic_proc_start PARAMS ((CORE_ADDR));
static CORE_ADDR heuristic_proc_start PARAMS ((CORE_ADDR));
static alpha_extra_func_info_t
heuristic_proc_desc PARAMS ((CORE_ADDR, CORE_ADDR, FRAME));
static alpha_extra_func_info_t heuristic_proc_desc PARAMS ((CORE_ADDR,
CORE_ADDR,
struct frame_info *));
static alpha_extra_func_info_t
find_proc_desc PARAMS ((CORE_ADDR, FRAME));
static alpha_extra_func_info_t find_proc_desc PARAMS ((CORE_ADDR, struct frame_info *));
static int
alpha_in_lenient_prologue PARAMS ((CORE_ADDR, CORE_ADDR));
static int alpha_in_lenient_prologue PARAMS ((CORE_ADDR, CORE_ADDR));
static void
reinit_frame_cache_sfunc PARAMS ((char *, int, struct cmd_list_element *));
static void reinit_frame_cache_sfunc PARAMS ((char *, int, struct cmd_list_element *));
static CORE_ADDR after_prologue PARAMS ((CORE_ADDR pc,
alpha_extra_func_info_t proc_desc));
@ -135,8 +131,8 @@ struct linked_proc_info
NULL). */
void
alpha_find_saved_regs (fci)
FRAME fci;
alpha_find_saved_regs (frame)
struct frame_info *frame;
{
int ireg;
CORE_ADDR reg_position;
@ -144,11 +140,11 @@ alpha_find_saved_regs (fci)
alpha_extra_func_info_t proc_desc;
int returnreg;
fci->saved_regs = (struct frame_saved_regs *)
frame->saved_regs = (struct frame_saved_regs *)
obstack_alloc (&frame_cache_obstack, sizeof(struct frame_saved_regs));
memset (fci->saved_regs, 0, sizeof (struct frame_saved_regs));
memset (frame->saved_regs, 0, sizeof (struct frame_saved_regs));
proc_desc = fci->proc_desc;
proc_desc = frame->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
@ -158,7 +154,7 @@ alpha_find_saved_regs (fci)
/* Fill in the offsets for the registers which gen_mask says
were saved. */
reg_position = fci->frame + PROC_REG_OFFSET (proc_desc);
reg_position = frame->frame + PROC_REG_OFFSET (proc_desc);
mask = PROC_REG_MASK (proc_desc);
returnreg = PROC_PC_REG (proc_desc);
@ -167,7 +163,7 @@ alpha_find_saved_regs (fci)
register number. */
if (mask & (1 << returnreg))
{
fci->saved_regs->regs[returnreg] = reg_position;
frame->saved_regs->regs[returnreg] = reg_position;
reg_position += 8;
mask &= ~(1 << returnreg); /* Clear bit for RA so we
don't save again later. */
@ -176,29 +172,29 @@ alpha_find_saved_regs (fci)
for (ireg = 0; ireg <= 31 ; ++ireg)
if (mask & (1 << ireg))
{
fci->saved_regs->regs[ireg] = reg_position;
frame->saved_regs->regs[ireg] = reg_position;
reg_position += 8;
}
/* Fill in the offsets for the registers which float_mask says
were saved. */
reg_position = fci->frame + PROC_FREG_OFFSET (proc_desc);
reg_position = frame->frame + PROC_FREG_OFFSET (proc_desc);
mask = PROC_FREG_MASK (proc_desc);
for (ireg = 0; ireg <= 31 ; ++ireg)
if (mask & (1 << ireg))
{
fci->saved_regs->regs[FP0_REGNUM+ireg] = reg_position;
frame->saved_regs->regs[FP0_REGNUM+ireg] = reg_position;
reg_position += 8;
}
fci->saved_regs->regs[PC_REGNUM] = fci->saved_regs->regs[returnreg];
frame->saved_regs->regs[PC_REGNUM] = frame->saved_regs->regs[returnreg];
}
static CORE_ADDR
read_next_frame_reg(fi, regno)
FRAME fi;
struct frame_info *fi;
int regno;
{
/* If it is the frame for sigtramp we have a pointer to the sigcontext
@ -239,7 +235,7 @@ read_next_frame_reg(fi, regno)
CORE_ADDR
alpha_frame_saved_pc(frame)
FRAME frame;
struct frame_info *frame;
{
alpha_extra_func_info_t proc_desc = frame->proc_desc;
/* We have to get the saved pc from the sigcontext
@ -255,7 +251,7 @@ alpha_frame_saved_pc(frame)
CORE_ADDR
alpha_saved_pc_after_call (frame)
FRAME frame;
struct frame_info *frame;
{
alpha_extra_func_info_t proc_desc = find_proc_desc (frame->pc, frame->next);
int pcreg = proc_desc ? PROC_PC_REG (proc_desc) : RA_REGNUM;
@ -327,7 +323,7 @@ Otherwise, you told GDB there was a function where there isn't one, or\n\
static alpha_extra_func_info_t
heuristic_proc_desc(start_pc, limit_pc, next_frame)
CORE_ADDR start_pc, limit_pc;
FRAME next_frame;
struct frame_info *next_frame;
{
CORE_ADDR sp = read_next_frame_reg (next_frame, SP_REGNUM);
CORE_ADDR cur_pc;
@ -337,9 +333,9 @@ heuristic_proc_desc(start_pc, limit_pc, next_frame)
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));
PROC_LOW_ADDR(&temp_proc_desc) = start_pc;
memset (&temp_proc_desc, '\0', sizeof(temp_proc_desc));
memset (&temp_saved_regs, '\0', sizeof(struct frame_saved_regs));
PROC_LOW_ADDR (&temp_proc_desc) = start_pc;
if (start_pc + 200 < limit_pc)
limit_pc = start_pc + 200;
@ -436,9 +432,9 @@ in_prologue (pc, proc_desc)
}
static alpha_extra_func_info_t
find_proc_desc(pc, next_frame)
find_proc_desc (pc, next_frame)
CORE_ADDR pc;
FRAME next_frame;
struct frame_info *next_frame;
{
alpha_extra_func_info_t proc_desc;
struct block *b;
@ -536,9 +532,9 @@ find_proc_desc(pc, next_frame)
alpha_extra_func_info_t cached_proc_desc;
FRAME_ADDR
CORE_ADDR
alpha_frame_chain(frame)
FRAME frame;
struct frame_info *frame;
{
alpha_extra_func_info_t proc_desc;
CORE_ADDR saved_pc = FRAME_SAVED_PC(frame);
@ -555,7 +551,7 @@ alpha_frame_chain(frame)
/* Fetch the frame pointer for a dummy frame from the procedure
descriptor. */
if (PROC_DESC_IS_DUMMY(proc_desc))
return (FRAME_ADDR) PROC_DUMMY_FRAME(proc_desc);
return (CORE_ADDR) PROC_DUMMY_FRAME(proc_desc);
/* If no frame pointer and frame size is zero, we must be at end
of stack (or otherwise hosed). If we don't check frame size,
@ -582,45 +578,45 @@ alpha_frame_chain(frame)
}
void
init_extra_frame_info(fci)
struct frame_info *fci;
init_extra_frame_info (frame)
struct frame_info *frame;
{
/* Use proc_desc calculated in frame_chain */
alpha_extra_func_info_t proc_desc =
fci->next ? cached_proc_desc : find_proc_desc(fci->pc, fci->next);
frame->next ? cached_proc_desc : find_proc_desc(frame->pc, frame->next);
fci->saved_regs = NULL;
fci->proc_desc =
frame->saved_regs = NULL;
frame->proc_desc =
proc_desc == &temp_proc_desc ? 0 : proc_desc;
if (proc_desc)
{
/* Get the locals offset from the procedure descriptor, it is valid
even if we are in the middle of the prologue. */
fci->localoff = PROC_LOCALOFF(proc_desc);
frame->localoff = PROC_LOCALOFF(proc_desc);
/* Fixup frame-pointer - only needed for top frame */
/* Fetch the frame pointer for a dummy frame from the procedure
descriptor. */
if (PROC_DESC_IS_DUMMY(proc_desc))
fci->frame = (FRAME_ADDR) PROC_DUMMY_FRAME(proc_desc);
frame->frame = (CORE_ADDR) PROC_DUMMY_FRAME(proc_desc);
/* This may not be quite right, if proc has a real frame register.
Get the value of the frame relative sp, procedure might have been
interrupted by a signal at it's very start. */
else if (fci->pc == PROC_LOW_ADDR (proc_desc) && !PROC_DESC_IS_DUMMY (proc_desc))
fci->frame = read_next_frame_reg (fci->next, SP_REGNUM);
else if (frame->pc == PROC_LOW_ADDR (proc_desc) && !PROC_DESC_IS_DUMMY (proc_desc))
frame->frame = read_next_frame_reg (frame->next, SP_REGNUM);
else
fci->frame = read_next_frame_reg (fci->next, PROC_FRAME_REG (proc_desc))
+ PROC_FRAME_OFFSET (proc_desc);
frame->frame = read_next_frame_reg (frame->next, PROC_FRAME_REG (proc_desc))
+ PROC_FRAME_OFFSET (proc_desc);
if (proc_desc == &temp_proc_desc)
{
fci->saved_regs = (struct frame_saved_regs*)
frame->saved_regs = (struct frame_saved_regs*)
obstack_alloc (&frame_cache_obstack,
sizeof (struct frame_saved_regs));
*fci->saved_regs = temp_saved_regs;
fci->saved_regs->regs[PC_REGNUM] = fci->saved_regs->regs[RA_REGNUM];
*frame->saved_regs = temp_saved_regs;
frame->saved_regs->regs[PC_REGNUM] = frame->saved_regs->regs[RA_REGNUM];
}
}
}
@ -640,10 +636,10 @@ init_extra_frame_info(fci)
cache. This allows the rest of info frame to extract the important
arguments without difficulty. */
FRAME
struct frame_info *
setup_arbitrary_frame (argc, argv)
int argc;
FRAME_ADDR *argv;
CORE_ADDR *argv;
{
if (argc != 2)
error ("ALPHA frame specifications require two arguments: sp and pc");
@ -847,7 +843,7 @@ void
alpha_pop_frame()
{
register int regnum;
FRAME frame = get_current_frame ();
struct frame_info *frame = get_current_frame ();
CORE_ADDR new_sp = frame->frame;
alpha_extra_func_info_t proc_desc = frame->proc_desc;
@ -1056,6 +1052,7 @@ alpha_register_convert_to_raw (valtype, regnum, virtual_buffer, raw_buffer)
/* Given a return value in `regbuf' with a type `valtype',
extract and copy its value into `valbuf'. */
void
alpha_extract_return_value (valtype, regbuf, valbuf)
struct type *valtype;
@ -1071,6 +1068,7 @@ alpha_extract_return_value (valtype, regbuf, valbuf)
/* Given a return value in `regbuf' with a type `valtype',
write its value into the appropriate register. */
void
alpha_store_return_value (valtype, valbuf)
struct type *valtype;
@ -1102,6 +1100,7 @@ print_insn (memaddr, stream)
/* Just like reinit_frame_cache, but with the right arguments to be
callable as an sfunc. */
static void
reinit_frame_cache_sfunc (args, from_tty, c)
char *args;

View File

@ -713,6 +713,4 @@ extern enum a29k_processor_types {
"frame" or "info frame" command. */
#define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv)
/* FIXME: Depends on equivalence between FRAME and "struct frame_info *",
and equivalence between CORE_ADDR and FRAME_ADDR. */
extern struct frame_info *setup_arbitrary_frame PARAMS ((int, CORE_ADDR *));
extern struct frame_info *setup_arbitrary_frame PARAMS ((int, FRAME_ADDR *));

View File

@ -179,6 +179,9 @@ extern CORE_ADDR h8300_skip_prologue ();
However, if FRAME_CHAIN_VALID returns zero,
it means the given frame is the outermost one and has no caller. */
#define FRAME_CHAIN(FRAME) h8300_frame_chain(FRAME)
CORE_ADDR h8300_frame_chain PARAMS ((struct frame_info *));
/* In the case of the H8/300, the frame's nominal address
is the address of a 2-byte word containing the calling frame's address. */

View File

@ -217,7 +217,7 @@ struct type *h8500_register_virtual_type PARAMS ((int regno));
*/
CORE_ADDR h8500_frame_chain (/* FRAME thisframe */);
CORE_ADDR h8500_frame_chain PARAMS ((struct frame_info *));
#define INIT_EXTRA_FRAME_INFO(fromleaf, fci) ;
/* (fci)->frame |= read_register(SEG_T_REGNUM) << 16;*/

View File

@ -34,6 +34,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Floating point is IEEE compliant */
#define IEEE_FLOAT
extern int mips_processor_id;
/* Some MIPS boards are provided both with and without a floating
point coprocessor; we provide a user settable variable to tell gdb
whether there is one or not. */
@ -251,7 +253,7 @@ extern int in_sigtramp PARAMS ((CORE_ADDR, char *));
/* FRAME_CHAIN takes a frame's nominal address
and produces the frame's chain-pointer. */
#define FRAME_CHAIN(thisframe) (FRAME_ADDR)mips_frame_chain(thisframe)
#define FRAME_CHAIN(thisframe) (CORE_ADDR) mips_frame_chain (thisframe)
/* Define other aspects of the stack frame. */
@ -452,8 +454,6 @@ typedef struct mips_extra_func_info {
but there is nothing we can do about that). */
#define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv)
/* FIXME: Depends on equivalence between FRAME and "struct frame_info *",
and equivalence between CORE_ADDR and FRAME_ADDR. */
extern struct frame_info *setup_arbitrary_frame PARAMS ((int, CORE_ADDR *));
/* Convert a dbx stab register number (from `r' declaration) to a gdb REGNUM */

View File

@ -274,14 +274,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Discard from the stack the innermost frame, restoring all registers. */
#define POP_FRAME \
{ register FRAME frame = get_current_frame (); \
{ register struct frame_info *frame = get_current_frame (); \
register CORE_ADDR fp; \
register int regnum; \
struct frame_saved_regs fsr; \
struct frame_info *fi; \
fi = get_frame_info (frame); \
fp = fi->frame; \
get_frame_saved_regs (fi, &fsr); \
fp = frame->frame; \
get_frame_saved_regs (frame, &fsr); \
for (regnum = 0; regnum < 8; regnum++) \
if (fsr.regs[regnum]) \
write_register (regnum, read_memory_integer (fsr.regs[regnum], 4)); \

View File

@ -329,14 +329,13 @@ extern CORE_ADDR ns32k_get_enter_addr ();
/* Discard from the stack the innermost frame, restoring all registers. */
#define POP_FRAME \
{ register FRAME frame = get_current_frame (); \
{ register struct frame_info *frame = get_current_frame (); \
register CORE_ADDR fp; \
register int regnum; \
struct frame_saved_regs fsr; \
struct frame_info *fi; \
fi = get_frame_info (frame); \
fp = fi->frame; \
get_frame_saved_regs (fi, &fsr); \
fp = frame->frame; \
get_frame_saved_regs (frame, &fsr); \
for (regnum = 0; regnum < 8; regnum++) \
if (fsr.regs[regnum]) \
write_register (regnum, read_memory_integer (fsr.regs[regnum], 4)); \

View File

@ -328,7 +328,7 @@ sparc_extract_struct_value_address PARAMS ((char [REGISTER_BYTES]));
stack frames are allocated in different segments (e.g. some on a
stack, some on a heap in the data segment). */
#define EXTRA_FRAME_INFO FRAME_ADDR bottom;
#define EXTRA_FRAME_INFO CORE_ADDR bottom;
#define INIT_EXTRA_FRAME_INFO(fromleaf, fci) \
(fci)->bottom = \
((fci)->next ? \
@ -579,8 +579,6 @@ extern void single_step PARAMS ((int));
"frame" or "info frame" command. */
#define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv)
/* FIXME: Depends on equivalence between FRAME and "struct frame_info *",
and equivalence between CORE_ADDR and FRAME_ADDR. */
extern struct frame_info *setup_arbitrary_frame PARAMS ((int, CORE_ADDR *));
/* To print every pair of float registers as a double, we use this hook. */

View File

@ -117,9 +117,9 @@ print_insn (memaddr, stream)
For us, the frame address is its stack pointer value, so we look up
the function prologue to determine the caller's sp value, and return it. */
FRAME_ADDR
FRAME_CHAIN (thisframe)
FRAME thisframe;
CORE_ADDR
h8300_frame_chain (thisframe)
struct frame_info *thisframe;
{
frame_find_saved_regs (thisframe, (struct frame_saved_regs *) 0);
return thisframe->fsr->regs[SP_REGNUM];
@ -208,7 +208,7 @@ static CORE_ADDR
examine_prologue (ip, limit, after_prolog_fp, fsr, fi)
register CORE_ADDR ip;
register CORE_ADDR limit;
FRAME_ADDR after_prolog_fp;
CORE_ADDR after_prolog_fp;
struct frame_saved_regs *fsr;
struct frame_info *fi;
{
@ -331,7 +331,7 @@ init_extra_frame_info (fromleaf, fi)
CORE_ADDR
frame_saved_pc (frame)
FRAME frame;
struct frame_info *frame;
{
return frame->from_pc;
}
@ -373,19 +373,15 @@ h8300_pop_frame ()
{
unsigned regnum;
struct frame_saved_regs fsr;
struct frame_info *fi;
FRAME frame = get_current_frame ();
struct frame_info *frame = get_current_frame ();
fi = get_frame_info (frame);
get_frame_saved_regs (fi, &fsr);
get_frame_saved_regs (frame, &fsr);
for (regnum = 0; regnum < 8; regnum++)
{
if (fsr.regs[regnum])
{
write_register (regnum, read_memory_integer(fsr.regs[regnum]), BINWORD);
}
write_register (regnum, read_memory_integer(fsr.regs[regnum]), BINWORD);
flush_cached_frames ();
}

View File

@ -1,5 +1,5 @@
/* Target-machine dependent code for Hitachi H8/500, for GDB.
Copyright (C) 1993 Free Software Foundation, Inc.
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
This file is part of GDB.
@ -121,9 +121,9 @@ print_insn (memaddr, stream)
For us, the frame address is its stack pointer value, so we look up
the function prologue to determine the caller's sp value, and return it. */
FRAME_ADDR
CORE_ADDR
h8500_frame_chain (thisframe)
FRAME thisframe;
struct frame_info *thisframe;
{
if (!inside_entry_file (thisframe->pc))
return (read_memory_integer (FRAME_FP (thisframe), PTR_SIZE));
@ -166,9 +166,9 @@ NEXT_PROLOGUE_INSN (addr, lim, pword1)
CORE_ADDR
frame_saved_pc (frame)
FRAME frame;
struct frame_info *frame;
{
return read_memory_integer ((frame)->frame + 2, PTR_SIZE);
return read_memory_integer (FRAME_FP (frame) + 2, PTR_SIZE);
}
CORE_ADDR
@ -193,19 +193,14 @@ h8300_pop_frame ()
{
unsigned regnum;
struct frame_saved_regs fsr;
struct frame_info *fi;
struct frame_info *frame = get_current_frame ();
FRAME frame = get_current_frame ();
fi = get_frame_info (frame);
get_frame_saved_regs (fi, &fsr);
get_frame_saved_regs (frame, &fsr);
for (regnum = 0; regnum < 8; regnum++)
{
if (fsr.regs[regnum])
{
write_register (regnum, read_memory_short (fsr.regs[regnum]));
}
flush_cached_frames ();
}

View File

@ -1,6 +1,6 @@
/* Machine-dependent code which would otherwise be in inflow.c and core.c,
for GDB, the GNU debugger. This code is for the HP PA-RISC cpu.
Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
/* Target-dependent code for the HP PA architecture, for GDB.
Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994
Free Software Foundation, Inc.
Contributed by the Center for Software Science at the
University of Utah (pa-gdb-bugs@cs.utah.edu).
@ -56,18 +56,29 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "symfile.h"
#include "objfiles.h"
static int restore_pc_queue PARAMS ((struct frame_saved_regs *fsr));
static int hppa_alignof PARAMS ((struct type *arg));
CORE_ADDR frame_saved_pc PARAMS ((FRAME frame));
static int restore_pc_queue PARAMS ((struct frame_saved_regs *));
static int hppa_alignof PARAMS ((struct type *));
CORE_ADDR frame_saved_pc PARAMS ((struct frame_info *));
static int prologue_inst_adjust_sp PARAMS ((unsigned long));
static int is_branch PARAMS ((unsigned long));
static int inst_saves_gr PARAMS ((unsigned long));
static int inst_saves_fr PARAMS ((unsigned long));
static int pc_in_interrupt_handler PARAMS ((CORE_ADDR));
static int pc_in_linker_stub PARAMS ((CORE_ADDR));
static int compare_unwind_entries PARAMS ((const struct unwind_table_entry *,
static int compare_unwind_entries PARAMS ((const struct unwind_table_entry *,
const struct unwind_table_entry *));
static void read_unwind_info PARAMS ((struct objfile *));
static void internalize_unwinds PARAMS ((struct objfile *,
struct unwind_table_entry *,
asection *, unsigned int,
@ -704,7 +715,7 @@ rp_saved (pc)
int
frameless_function_invocation (frame)
FRAME frame;
struct frame_info *frame;
{
struct unwind_table_entry *u;
@ -718,7 +729,7 @@ frameless_function_invocation (frame)
CORE_ADDR
saved_pc_after_call (frame)
FRAME frame;
struct frame_info *frame;
{
int ret_regnum;
CORE_ADDR pc;
@ -738,7 +749,7 @@ saved_pc_after_call (frame)
CORE_ADDR
frame_saved_pc (frame)
FRAME frame;
struct frame_info *frame;
{
CORE_ADDR pc = get_frame_pc (frame);
struct unwind_table_entry *u;
@ -772,11 +783,9 @@ frame_saved_pc (frame)
&& (frame->next->signal_handler_caller
|| pc_in_interrupt_handler (frame->next->pc)))
{
struct frame_info *fi;
struct frame_saved_regs saved_regs;
fi = get_frame_info (frame->next);
get_frame_saved_regs (fi, &saved_regs);
get_frame_saved_regs (frame, &saved_regs);
if (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], 4) & 0x2)
pc = read_memory_integer (saved_regs.regs[31], 4) & ~0x3;
else
@ -799,11 +808,9 @@ restart:
&& (frame->next->signal_handler_caller
|| pc_in_interrupt_handler (frame->next->pc)))
{
struct frame_info *fi;
struct frame_saved_regs saved_regs;
fi = get_frame_info (frame->next);
get_frame_saved_regs (fi, &saved_regs);
get_frame_saved_regs (frame->next, &saved_regs);
if (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], 4) & 0x2)
pc = read_memory_integer (saved_regs.regs[31], 4) & ~0x3;
else
@ -885,9 +892,8 @@ init_extra_frame_info (fromleaf, frame)
This may involve searching through prologues for several functions
at boundaries where GCC calls HP C code, or where code which has
a frame pointer calls code without a frame pointer. */
FRAME_ADDR
CORE_ADDR
frame_chain (frame)
struct frame_info *frame;
{
@ -975,11 +981,9 @@ frame_chain (frame)
/* %r3 was saved somewhere in the stack. Dig it out. */
else
{
struct frame_info *fi;
struct frame_saved_regs saved_regs;
fi = get_frame_info (frame);
get_frame_saved_regs (fi, &saved_regs);
get_frame_saved_regs (frame, &saved_regs);
return read_memory_integer (saved_regs.regs[FP_REGNUM], 4);
}
}
@ -997,13 +1001,13 @@ frame_chain (frame)
int
frame_chain_valid (chain, thisframe)
FRAME_ADDR chain;
FRAME thisframe;
CORE_ADDR chain;
struct frame_info *thisframe;
{
struct minimal_symbol *msym_us;
struct minimal_symbol *msym_start;
struct unwind_table_entry *u, *next_u = NULL;
FRAME next;
struct frame_info *next;
if (!chain)
return 0;
@ -1126,16 +1130,14 @@ find_dummy_frame_regs (frame, frame_saved_regs)
int
hppa_pop_frame ()
{
register FRAME frame = get_current_frame ();
register struct frame_info *frame = get_current_frame ();
register CORE_ADDR fp;
register int regnum;
struct frame_saved_regs fsr;
struct frame_info *fi;
double freg_buffer;
fi = get_frame_info (frame);
fp = fi->frame;
get_frame_saved_regs (fi, &fsr);
fp = FRAME_FP (frame);
get_frame_saved_regs (frame, &fsr);
#ifndef NO_PC_SPACE_QUEUE_RESTORE
if (fsr.regs[IPSW_REGNUM]) /* Restoring a call dummy frame */
@ -1398,6 +1400,7 @@ hppa_fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p)
/* Get the PC from %r31 if currently in a syscall. Also mask out privilege
bits. */
CORE_ADDR
target_read_pc (pid)
int pid;
@ -1411,6 +1414,7 @@ target_read_pc (pid)
/* Write out the PC. If currently in a syscall, then also write the new
PC value into %r31. */
void
target_write_pc (v, pid)
CORE_ADDR v;
@ -1597,7 +1601,7 @@ skip_trampoline_code (pc, name)
}
/* Addresses passed to dyncall may *NOT* be the actual address
of the funtion. So we may have to do something special. */
of the function. So we may have to do something special. */
if (pc == dyncall)
{
pc = (CORE_ADDR) read_register (22);
@ -2016,7 +2020,7 @@ skip_prologue (pc)
void
hppa_frame_find_saved_regs (frame_info, frame_saved_regs)
struct frame_info *frame_info;
struct frame_info *frame;
struct frame_saved_regs *frame_saved_regs;
{
CORE_ADDR pc;
@ -2033,38 +2037,38 @@ hppa_frame_find_saved_regs (frame_info, frame_saved_regs)
examine the dummy code to determine locations of saved registers;
instead, let find_dummy_frame_regs fill in the correct offsets
for the saved registers. */
if ((frame_info->pc >= frame_info->frame
&& frame_info->pc <= (frame_info->frame + CALL_DUMMY_LENGTH
if ((frame->pc >= frame->frame
&& frame->pc <= (frame->frame + CALL_DUMMY_LENGTH
+ 32 * 4 + (NUM_REGS - FP0_REGNUM) * 8
+ 6 * 4)))
find_dummy_frame_regs (frame_info, frame_saved_regs);
find_dummy_frame_regs (frame, frame_saved_regs);
/* Interrupt handlers are special too. They lay out the register
state in the exact same order as the register numbers in GDB. */
if (pc_in_interrupt_handler (frame_info->pc))
if (pc_in_interrupt_handler (frame->pc))
{
for (i = 0; i < NUM_REGS; i++)
{
/* SP is a little special. */
if (i == SP_REGNUM)
frame_saved_regs->regs[SP_REGNUM]
= read_memory_integer (frame_info->frame + SP_REGNUM * 4, 4);
= read_memory_integer (frame->frame + SP_REGNUM * 4, 4);
else
frame_saved_regs->regs[i] = frame_info->frame + i * 4;
frame_saved_regs->regs[i] = frame->frame + i * 4;
}
return;
}
/* Handle signal handler callers. */
if (frame_info->signal_handler_caller)
if (frame->signal_handler_caller)
{
FRAME_FIND_SAVED_REGS_IN_SIGTRAMP (frame_info, frame_saved_regs);
FRAME_FIND_SAVED_REGS_IN_SIGTRAMP (frame, frame_saved_regs);
return;
}
/* Get the starting address of the function referred to by the PC
saved in frame_info. */
pc = get_pc_function_start (frame_info->pc);
saved in frame. */
pc = get_pc_function_start (frame->pc);
/* Yow! */
u = find_unwind_entry (pc);
@ -2097,7 +2101,7 @@ hppa_frame_find_saved_regs (frame_info, frame_saved_regs)
/* The frame always represents the value of %sp at entry to the
current function (and is thus equivalent to the "saved" stack
pointer. */
frame_saved_regs->regs[SP_REGNUM] = frame_info->frame;
frame_saved_regs->regs[SP_REGNUM] = frame->frame;
/* Loop until we find everything of interest or hit a branch.
@ -2129,7 +2133,7 @@ hppa_frame_find_saved_regs (frame_info, frame_saved_regs)
if (inst == 0x6bc23fd9)
{
save_rp = 0;
frame_saved_regs->regs[RP_REGNUM] = frame_info->frame - 20;
frame_saved_regs->regs[RP_REGNUM] = frame->frame - 20;
}
/* Just note that we found the save of SP into the stack. The
@ -2147,16 +2151,16 @@ hppa_frame_find_saved_regs (frame_info, frame_saved_regs)
/* stwm with a positive displacement is a *post modify*. */
if ((inst >> 26) == 0x1b
&& extract_14 (inst) >= 0)
frame_saved_regs->regs[reg] = frame_info->frame;
frame_saved_regs->regs[reg] = frame->frame;
else
{
/* Handle code with and without frame pointers. */
if (u->Save_SP)
frame_saved_regs->regs[reg]
= frame_info->frame + extract_14 (inst);
= frame->frame + extract_14 (inst);
else
frame_saved_regs->regs[reg]
= frame_info->frame + (u->Total_frame_size << 3)
= frame->frame + (u->Total_frame_size << 3)
+ extract_14 (inst);
}
}
@ -2188,13 +2192,13 @@ hppa_frame_find_saved_regs (frame_info, frame_saved_regs)
/* 1st HP CC FP register store. After this instruction
we've set enough state that the GCC and HPCC code are
both handled in the same manner. */
frame_saved_regs->regs[reg + FP4_REGNUM + 4] = frame_info->frame;
frame_saved_regs->regs[reg + FP4_REGNUM + 4] = frame->frame;
fp_loc = 8;
}
else
{
frame_saved_regs->regs[reg + FP0_REGNUM + 4]
= frame_info->frame + fp_loc;
= frame->frame + fp_loc;
fp_loc += 8;
}
}

View File

@ -19,9 +19,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Miscellaneous i80960-dependent routines.
Most are called from macros defined in "tm-i960.h". */
#include "defs.h"
#include "symtab.h"
#include "value.h"
@ -125,7 +122,7 @@ static CORE_ADDR
examine_prologue (ip, limit, frame_addr, fsr)
register CORE_ADDR ip;
register CORE_ADDR limit;
FRAME_ADDR frame_addr;
CORE_ADDR frame_addr;
struct frame_saved_regs *fsr;
{
register CORE_ADDR next_ip;
@ -298,7 +295,7 @@ skip_prologue (ip)
sal = find_pc_line (ip, 0);
limit = (sal.end) ? sal.end : 0xffffffff;
return (examine_prologue (ip, limit, (FRAME_ADDR) 0, &saved_regs_dummy));
return (examine_prologue (ip, limit, (CORE_ADDR) 0, &saved_regs_dummy));
}
/* Put here the code to store, into a struct frame_saved_regs,
@ -384,7 +381,6 @@ CORE_ADDR
frame_args_address (fi, must_be_correct)
struct frame_info *fi;
{
register FRAME frame;
struct frame_saved_regs fsr;
CORE_ADDR ap;
@ -392,20 +388,20 @@ frame_args_address (fi, must_be_correct)
the saved value. If the frame is current and we are being sloppy,
return the value of g14. Otherwise, return zero. */
frame = FRAME_INFO_ID (fi);
get_frame_saved_regs (fi, &fsr);
if (fsr.regs[G14_REGNUM])
ap = read_memory_integer (fsr.regs[G14_REGNUM],4);
else {
if (must_be_correct)
return 0; /* Don't cache this result */
if (get_next_frame (frame))
ap = 0;
else
ap = read_register (G14_REGNUM);
if (ap == 0)
ap = fi->frame;
}
else
{
if (must_be_correct)
return 0; /* Don't cache this result */
if (get_next_frame (fi))
ap = 0;
else
ap = read_register (G14_REGNUM);
if (ap == 0)
ap = fi->frame;
}
fi->arg_pointer = ap; /* Cache it for next time */
return ap;
}
@ -417,7 +413,6 @@ CORE_ADDR
frame_struct_result_address (fi)
struct frame_info *fi;
{
register FRAME frame;
struct frame_saved_regs fsr;
CORE_ADDR ap;
@ -429,16 +424,17 @@ frame_struct_result_address (fi)
the function prologue, and only use the current value if we have
no saved value and are at TOS? -- gnu@cygnus.com */
frame = FRAME_INFO_ID (fi);
if (get_next_frame (frame)) {
get_frame_saved_regs (fi, &fsr);
if (fsr.regs[G13_REGNUM])
ap = read_memory_integer (fsr.regs[G13_REGNUM],4);
else
ap = 0;
} else {
if (get_next_frame (fi))
{
get_frame_saved_regs (fi, &fsr);
if (fsr.regs[G13_REGNUM])
ap = read_memory_integer (fsr.regs[G13_REGNUM],4);
else
ap = 0;
}
else
ap = read_register (G13_REGNUM);
}
return ap;
}
@ -507,16 +503,15 @@ leafproc_return (ip)
CORE_ADDR
saved_pc_after_call (frame)
FRAME frame;
struct frame_info *frame;
{
CORE_ADDR saved_pc;
CORE_ADDR get_frame_pc ();
saved_pc = leafproc_return (get_frame_pc (frame));
if (!saved_pc)
saved_pc = FRAME_SAVED_PC (frame);
return (saved_pc);
return saved_pc;
}
/* Discard from the stack the innermost frame,
@ -531,7 +526,7 @@ pop_frame ()
struct frame_saved_regs fsr;
char local_regs_buf[16 * 4];
current_fi = get_frame_info (get_current_frame ());
current_fi = get_current_frame ();
/* First, undo what the hardware does when we return.
If this is a non-leaf procedure, restore local registers from
@ -542,7 +537,7 @@ pop_frame ()
if (!leaf_return_addr)
{
/* Non-leaf procedure. Restore local registers, incl IP. */
prev_fi = get_frame_info (get_prev_frame (FRAME_INFO_ID (current_fi)));
prev_fi = get_prev_frame (current_fi);
read_memory (prev_fi->frame, local_regs_buf, sizeof (local_regs_buf));
write_register_bytes (REGISTER_BYTE (R0_REGNUM), local_regs_buf,
sizeof (local_regs_buf));
@ -585,15 +580,15 @@ i960_fault_to_signal (fault)
case 3: return TARGET_SIGNAL_FPE; /* arithmetic fault */
case 4: return TARGET_SIGNAL_FPE; /* floating point fault */
/* constraint fault. This appears not to distinguish between
a range constraint fault (which should be SIGFPE) and a privileged
fault (which should be SIGILL). */
/* constraint fault. This appears not to distinguish between
a range constraint fault (which should be SIGFPE) and a privileged
fault (which should be SIGILL). */
case 5: return TARGET_SIGNAL_ILL;
case 6: return TARGET_SIGNAL_SEGV; /* virtual memory fault */
/* protection fault. This is for an out-of-range argument to
"calls". I guess it also could be SIGILL. */
/* protection fault. This is for an out-of-range argument to
"calls". I guess it also could be SIGILL. */
case 7: return TARGET_SIGNAL_SEGV;
case 8: return TARGET_SIGNAL_BUS; /* machine fault */

View File

@ -1,5 +1,5 @@
/* Target-machine dependent code for Motorola 88000 series, for GDB.
Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
Copyright (C) 1988, 1990, 1991, 1994 Free Software Foundation, Inc.
This file is part of GDB.
@ -22,7 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "inferior.h"
#include "value.h"
#include "gdbcore.h"
#include "symtab.h"
#include "setjmp.h"
#include "value.h"
@ -32,8 +31,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
void frame_find_saved_regs ();
/* is this target an m88110? Otherwise assume m88100. This has
relevance for the ways in which we screw with instruction pointers. */
/* Is this target an m88110? Otherwise assume m88100. This has
relevance for the ways in which we screw with instruction pointers. */
int target_is_m88110 = 0;
/* Given a GDB frame, determine the address of the calling function's frame.
@ -43,9 +43,9 @@ int target_is_m88110 = 0;
For us, the frame address is its stack pointer value, so we look up
the function prologue to determine the caller's sp value, and return it. */
FRAME_ADDR
CORE_ADDR
frame_chain (thisframe)
FRAME thisframe;
struct frame_info *thisframe;
{
frame_find_saved_regs (thisframe, (struct frame_saved_regs *) 0);
@ -60,7 +60,7 @@ frame_chain (thisframe)
int
frameless_function_invocation (frame)
FRAME frame;
struct frame_info *frame;
{
frame_find_saved_regs (frame, (struct frame_saved_regs *) 0);
@ -74,13 +74,13 @@ frameless_function_invocation (frame)
}
void
init_extra_frame_info (fromleaf, fi)
init_extra_frame_info (fromleaf, frame)
int fromleaf;
struct frame_info *fi;
struct frame_info *frame;
{
fi->fsr = 0; /* Not yet allocated */
fi->args_pointer = 0; /* Unknown */
fi->locals_pointer = 0; /* Unknown */
frame->fsr = 0; /* Not yet allocated */
frame->args_pointer = 0; /* Unknown */
frame->locals_pointer = 0; /* Unknown */
}
/* Examine an m88k function prologue, recording the addresses at which
@ -204,14 +204,15 @@ next_insn (memaddr, pword1)
/* Read a register from frames called by us (or from the hardware regs). */
static int
read_next_frame_reg(fi, regno)
FRAME fi;
read_next_frame_reg(frame, regno)
struct frame_info *frame;
int regno;
{
for (; fi; fi = fi->next) {
if (regno == SP_REGNUM) return fi->frame;
else if (fi->fsr->regs[regno])
return read_memory_integer(fi->fsr->regs[regno], 4);
for (; frame; frame = frame->next) {
if (regno == SP_REGNUM)
return FRAME_FP (frame);
else if (frame->fsr->regs[regno])
return read_memory_integer(frame->fsr->regs[regno], 4);
}
return read_register(regno);
}
@ -229,7 +230,7 @@ static CORE_ADDR
examine_prologue (ip, limit, frame_sp, fsr, fi)
register CORE_ADDR ip;
register CORE_ADDR limit;
FRAME_ADDR frame_sp;
CORE_ADDR frame_sp;
struct frame_saved_regs *fsr;
struct frame_info *fi;
{
@ -395,7 +396,7 @@ skip_prologue (ip)
sal = find_pc_line (ip, 0);
limit = (sal.end) ? sal.end : 0xffffffff;
return (examine_prologue (ip, limit, (FRAME_ADDR) 0, &saved_regs_dummy,
return (examine_prologue (ip, limit, (CORE_ADDR) 0, &saved_regs_dummy,
(struct frame_info *)0 ));
}
@ -502,7 +503,7 @@ frame_args_address (fi)
CORE_ADDR
frame_saved_pc (frame)
FRAME frame;
struct frame_info *frame;
{
return read_next_frame_reg(frame, SRP_REGNUM);
}
@ -559,17 +560,15 @@ m88k_push_dummy_frame()
void
pop_frame ()
{
register FRAME frame = get_current_frame ();
register struct frame_info *frame = get_current_frame ();
register CORE_ADDR fp;
register int regnum;
struct frame_saved_regs fsr;
struct frame_info *fi;
fi = get_frame_info (frame);
fp = fi -> frame;
get_frame_saved_regs (fi, &fsr);
fp = FRAME_FP (frame);
get_frame_saved_regs (frame, &fsr);
if (PC_IN_CALL_DUMMY (read_pc(), read_register(SP_REGNUM), FRAME_FP(fi)))
if (PC_IN_CALL_DUMMY (read_pc (), read_register (SP_REGNUM), FRAME_FP (fi)))
{
/* FIXME: I think get_frame_saved_regs should be handling this so
that we can deal with the saved registers properly (e.g. frame
@ -605,7 +604,7 @@ pop_frame ()
if (fsr.regs[regnum])
write_register (regnum,
read_memory_integer (fsr.regs[regnum], 4));
write_pc(frame_saved_pc(frame));
write_pc (frame_saved_pc (frame));
}
reinit_frame_cache ();
}

View File

@ -34,7 +34,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
int
nindy_frame_chain_valid (chain, curframe)
unsigned int chain;
FRAME curframe;
struct frame_info *curframe;
{
struct symbol *sym;
struct minimal_symbol *msymbol;

View File

@ -84,7 +84,7 @@ pyr_do_registers_info (regnum, fpregs)
/*** Debugging editions of various macros from m-pyr.h ****/
CORE_ADDR frame_locals_address (frame)
FRAME frame;
struct frame_info *frame;
{
register int addr = find_saved_register (frame,CFP_REGNUM);
register int result = read_memory_integer (addr, 4);
@ -109,7 +109,7 @@ CORE_ADDR frame_locals_address (frame)
}
CORE_ADDR frame_args_addr (frame)
FRAME frame;
struct frame_info *frame;
{
register int addr = find_saved_register (frame,CFP_REGNUM);
register int result = read_memory_integer (addr, 4);

View File

@ -455,11 +455,11 @@ pop_frame ()
{
CORE_ADDR pc, lr, sp, prev_sp; /* %pc, %lr, %sp */
struct aix_framedata fdata;
FRAME fr = get_current_frame ();
struct frame_info *frame = get_current_frame ();
int addr, ii;
pc = read_pc ();
sp = FRAME_FP (fr);
sp = FRAME_FP (frame);
if (stop_stack_dummy && dummy_frame_count) {
pop_dummy_frame ();
@ -492,13 +492,13 @@ pop_frame ()
addr = prev_sp - fdata.offset;
if (fdata.saved_gpr != -1)
for (ii=fdata.saved_gpr; ii <= 31; ++ii) {
for (ii = fdata.saved_gpr; ii <= 31; ++ii) {
read_memory (addr, &registers [REGISTER_BYTE (ii)], 4);
addr += 4;
}
if (fdata.saved_fpr != -1)
for (ii=fdata.saved_fpr; ii <= 31; ++ii) {
for (ii = fdata.saved_fpr; ii <= 31; ++ii) {
read_memory (addr, &registers [REGISTER_BYTE (ii+FP0_REGNUM)], 8);
addr += 8;
}
@ -1090,11 +1090,11 @@ frame_initial_stack_address (fi)
return fi->initial_sp = read_register (fdata.alloca_reg);
}
FRAME_ADDR
CORE_ADDR
rs6000_frame_chain (thisframe)
struct frame_info *thisframe;
{
FRAME_ADDR fp;
CORE_ADDR fp;
if (inside_entry_file ((thisframe)->pc))
return 0;
if (thisframe->signal_handler_caller)

View File

@ -32,9 +32,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "dis-asm.h"
#include "../opcodes/sh-opc.h"
/* Prologue looks like
[mov.l <regs>,@-r15]...
[sts.l pr,@-r15]
@ -56,7 +53,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
CORE_ADDR
sh_skip_prologue (start_pc)
CORE_ADDR start_pc;
{
int w;
@ -84,7 +80,9 @@ print_insn (memaddr, stream)
GDB_FILE *stream;
{
disassemble_info info;
GDB_INIT_DISASSEMBLE_INFO (info, stream);
return print_insn_sh (memaddr, &info);
}
@ -95,12 +93,12 @@ print_insn (memaddr, stream)
For us, the frame address is its stack pointer value, so we look up
the function prologue to determine the caller's sp value, and return it. */
FRAME_ADDR
sh_frame_chain (thisframe)
FRAME thisframe;
CORE_ADDR
sh_frame_chain (frame)
struct frame_info *frame;
{
if (!inside_entry_file (thisframe->pc))
return (read_memory_integer (FRAME_FP (thisframe) + thisframe->f_offset, 4));
if (!inside_entry_file (frame->pc))
return read_memory_integer (FRAME_FP (frame) + frame->f_offset, 4);
else
return 0;
}
@ -254,15 +252,13 @@ init_extra_frame_info (fromleaf, fi)
void
pop_frame ()
{
register FRAME frame = get_current_frame ();
register struct frame_info *frame = get_current_frame ();
register CORE_ADDR fp;
register int regnum;
struct frame_saved_regs fsr;
struct frame_info *fi;
fi = get_frame_info (frame);
fp = fi->frame;
get_frame_saved_regs (fi, &fsr);
fp = FRAME_FP (frame);
get_frame_saved_regs (frame, &fsr);
/* Copy regs from where they were saved in the frame */
for (regnum = 0; regnum < NUM_REGS; regnum++)
@ -279,10 +275,11 @@ pop_frame ()
}
/* Print the registers in a form similar to the E7000 */
static void
show_regs (args, from_tty)
char *args;
int from_tty;
char *args;
int from_tty;
{
printf_filtered("PC=%08x SR=%08x PR=%08x MACH=%08x MACHL=%08x\n",
read_register(PC_REGNUM),

View File

@ -1,5 +1,5 @@
/* Target-machine dependent code for Zilog Z8000, for GDB.
Copyright (C) 1992,1993 Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
This file is part of GDB.
@ -29,6 +29,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcmd.h"
#include "gdbtypes.h"
#include "dis-asm.h"
/* Return the saved PC from this frame.
If the frame has a memory copy of SRP_REGNUM, use that. If not,
@ -36,9 +37,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
CORE_ADDR
frame_saved_pc (frame)
FRAME frame;
struct frame_info *frame;
{
return (read_memory_pointer (frame->frame + (BIG ? 4 : 2)));
return read_memory_pointer (frame->frame + (BIG ? 4 : 2));
}
#define IS_PUSHL(x) (BIG ? ((x & 0xfff0) == 0x91e0):((x & 0xfff0) == 0x91F0))
@ -147,24 +148,24 @@ addr_bits_remove (x)
return x & PTR_MASK;
}
int
read_memory_pointer (x)
CORE_ADDR x;
{
return read_memory_integer (ADDR_BITS_REMOVE (x), BIG ? 4 : 2);
}
FRAME_ADDR
CORE_ADDR
frame_chain (thisframe)
FRAME thisframe;
struct frame_info *thisframe;
{
if (thisframe->prev == 0)
{
/* This is the top of the stack, let's get the sp for real */
}
if (!inside_entry_file ((thisframe)->pc))
if (!inside_entry_file (thisframe->pc))
{
return read_memory_pointer ((thisframe)->frame);
return read_memory_pointer (thisframe->frame);
}
return 0;
}
@ -210,7 +211,7 @@ print_insn (memaddr, stream)
{
disassemble_info info;
GDB_INIT_DISASSEMBLE_INFO(info, stream);
GDB_INIT_DISASSEMBLE_INFO (info, stream);
if (BIG)
{
@ -268,7 +269,7 @@ frame_find_saved_regs (fip, fsrp)
pc = skip_adjust (get_pc_function_start (fip->pc), &locals);
{
adr = fip->frame - locals;
adr = FRAME_FP (fip) - locals;
for (i = 0; i < 8; i++)
{
int word = read_memory_short (pc);
@ -304,41 +305,42 @@ saved_pc_after_call ()
}
extract_return_value(type, regbuf, valbuf)
struct type *type;
char *regbuf;
char *valbuf;
extract_return_value (type, regbuf, valbuf)
struct type *type;
char *regbuf;
char *valbuf;
{
int b;
int len = TYPE_LENGTH(type);
int len = TYPE_LENGTH (type);
for (b = 0; b < len; b += 2) {
int todo = len - b;
if (todo > 2)
todo = 2;
memcpy(valbuf + b, regbuf + b, todo);
}
}
void
write_return_value(type, valbuf)
struct type *type;
char *valbuf;
{
int reg;
int len;
for (len = 0; len < TYPE_LENGTH(type); len += 2)
for (b = 0; b < len; b += 2)
{
write_register_bytes(REGISTER_BYTE(len /2 + 2), valbuf + len, 2);
int todo = len - b;
if (todo > 2)
todo = 2;
memcpy (valbuf + b, regbuf + b, todo);
}
}
void
store_struct_return(addr, sp)
CORE_ADDR addr;
CORE_ADDR sp;
write_return_value (type, valbuf)
struct type *type;
char *valbuf;
{
write_register(2, addr);
int reg;
int len;
for (len = 0; len < TYPE_LENGTH (type); len += 2)
write_register_bytes (REGISTER_BYTE (len / 2 + 2), valbuf + len, 2);
}
void
store_struct_return (addr, sp)
CORE_ADDR addr;
CORE_ADDR sp;
{
write_register (2, addr);
}
@ -427,10 +429,8 @@ unsegmented_command (args, from_tty)
int from_tty;
{
z8k_set_pointer_size (16);
}
static void
set_memory (args, from_tty)
char *args;