diff options
author | Jason Thorpe <thorpej@netbsd.org> | 2002-04-22 21:32:05 +0000 |
---|---|---|
committer | Jason Thorpe <thorpej@netbsd.org> | 2002-04-22 21:32:05 +0000 |
commit | 52efde73b986abae90c478c68afb14dbf04629b8 (patch) | |
tree | abf19e5a54c2f02befd8e3466e49a1cf0ed5c09a /gdb | |
parent | 80cc45a581bf087fc2c9b25461f423885243b874 (diff) | |
download | gdb-52efde73b986abae90c478c68afb14dbf04629b8.zip gdb-52efde73b986abae90c478c68afb14dbf04629b8.tar.gz gdb-52efde73b986abae90c478c68afb14dbf04629b8.tar.bz2 |
* vax-tdep.c (vax_frame_chain): New function.
(vax_push_dummy_frame): Ditto.
(vax_pop_frame): Ditto.
* config/vax/tm-vax.h (FRAME_CHAIN): vax_frame_chain.
(FRAMELESS_FUNCTION_INVOCATION): Use
generic_frameless_function_invocation_not.
(PUSH_DUMMY_FRAME): Use vax_push_dummy_frame.
(POP_FRAME): Use vax_pop_frame.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 11 | ||||
-rw-r--r-- | gdb/config/vax/tm-vax.h | 77 | ||||
-rw-r--r-- | gdb/vax-tdep.c | 57 |
3 files changed, 77 insertions, 68 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 667ceac..0751d45 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,16 @@ 2002-04-22 Jason Thorpe <thorpej@wasabisystems.com> + * vax-tdep.c (vax_frame_chain): New function. + (vax_push_dummy_frame): Ditto. + (vax_pop_frame): Ditto. + * config/vax/tm-vax.h (FRAME_CHAIN): vax_frame_chain. + (FRAMELESS_FUNCTION_INVOCATION): Use + generic_frameless_function_invocation_not. + (PUSH_DUMMY_FRAME): Use vax_push_dummy_frame. + (POP_FRAME): Use vax_pop_frame. + +2002-04-22 Jason Thorpe <thorpej@wasabisystems.com> + * vax-tdep.c (vax_store_struct_return): New function. (vax_extract_return_value): Ditto. (vax_store_return_value): Ditto. diff --git a/gdb/config/vax/tm-vax.h b/gdb/config/vax/tm-vax.h index 015665c..5bce565 100644 --- a/gdb/config/vax/tm-vax.h +++ b/gdb/config/vax/tm-vax.h @@ -138,29 +138,11 @@ extern void vax_store_return_value (struct type *, char *); extern CORE_ADDR vax_extract_struct_value_address (char *); -/* Describe the pointer in each stack frame to the previous stack frame - (its caller). */ +#define FRAME_CHAIN(FI) vax_frame_chain ((FI)) +extern CORE_ADDR vax_frame_chain (struct frame_info *); -/* FRAME_CHAIN takes a frame's nominal address - and produces the frame's chain-pointer. */ - -/* In the case of the Vax, the frame's nominal address is the FP value, - and 12 bytes later comes the saved previous FP value as a 4-byte word. */ - -#define FRAME_CHAIN(thisframe) \ - (!inside_entry_file ((thisframe)->pc) ? \ - read_memory_integer ((thisframe)->frame + 12, 4) :\ - 0) - -/* Define other aspects of the stack frame. */ - -/* A macro that tells us whether the function invocation represented - by FI does not have a frame on the stack associated with it. If it - does not, FRAMELESS is set to 1, else 0. */ -/* On the vax, all functions have frames. */ -#define FRAMELESS_FUNCTION_INVOCATION(FI) (0) - -/* Saved Pc. Get it from sigcontext if within sigtramp. */ +#define FRAMELESS_FUNCTION_INVOCATION(FI) \ + generic_frameless_function_invocation_not ((FI)) /* Offset to saved PC in sigcontext, from <sys/signal.h>. */ /* XXXJRT should go away */ @@ -179,9 +161,6 @@ extern CORE_ADDR vax_frame_args_address (struct frame_info *); #define FRAME_LOCALS_ADDRESS(fi) vax_frame_locals_address ((fi)) extern CORE_ADDR vax_frame_locals_address (struct frame_info *); -/* Return number of args passed to a frame. - Can return -1, meaning no way to tell. */ - extern int vax_frame_num_args (struct frame_info *fi); #define FRAME_NUM_ARGS(fi) (vax_frame_num_args ((fi))) @@ -192,49 +171,11 @@ extern int vax_frame_num_args (struct frame_info *fi); #define FRAME_INIT_SAVED_REGS(fi) vax_frame_init_saved_regs ((fi)) extern void vax_frame_init_saved_regs (struct frame_info *); -/* Things needed for making the inferior call functions. */ - -/* Push an empty stack frame, to record the current PC, etc. */ - -#define PUSH_DUMMY_FRAME \ -{ register CORE_ADDR sp = read_register (SP_REGNUM);\ - register int regnum; \ - sp = push_word (sp, 0); /* arglist */ \ - for (regnum = 11; regnum >= 0; regnum--) \ - sp = push_word (sp, read_register (regnum)); \ - sp = push_word (sp, read_register (PC_REGNUM)); \ - sp = push_word (sp, read_register (FP_REGNUM)); \ - sp = push_word (sp, read_register (AP_REGNUM)); \ - sp = push_word (sp, (read_register (PS_REGNUM) & 0xffef) \ - + 0x2fff0000); \ - sp = push_word (sp, 0); \ - write_register (SP_REGNUM, sp); \ - write_register (FP_REGNUM, sp); \ - write_register (AP_REGNUM, sp + 17 * sizeof (int)); } - -/* Discard from the stack the innermost frame, restoring all registers. */ - -#define POP_FRAME \ -{ register CORE_ADDR fp = read_register (FP_REGNUM); \ - register int regnum; \ - register int regmask = read_memory_integer (fp + 4, 4); \ - write_register (PS_REGNUM, \ - (regmask & 0xffff) \ - | (read_register (PS_REGNUM) & 0xffff0000)); \ - write_register (PC_REGNUM, read_memory_integer (fp + 16, 4)); \ - write_register (FP_REGNUM, read_memory_integer (fp + 12, 4)); \ - write_register (AP_REGNUM, read_memory_integer (fp + 8, 4)); \ - fp += 16; \ - for (regnum = 0; regnum < 12; regnum++) \ - if (regmask & (0x10000 << regnum)) \ - write_register (regnum, read_memory_integer (fp += 4, 4)); \ - fp = fp + 4 + ((regmask >> 30) & 3); \ - if (regmask & 0x20000000) \ - { regnum = read_memory_integer (fp, 4); \ - fp += (regnum + 1) * 4; } \ - write_register (SP_REGNUM, fp); \ - flush_cached_frames (); \ -} +#define PUSH_DUMMY_FRAME vax_push_dummy_frame() +extern void vax_push_dummy_frame (void); + +#define POP_FRAME vax_pop_frame() +extern void vax_pop_frame (void); /* This sequence of words is the instructions calls #69, @#32323232 diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 2ff2187..d8cc678 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -177,6 +177,63 @@ vax_frame_num_args (struct frame_info *fi) { return (0xff & read_memory_integer (FRAME_ARGS_ADDRESS (fi), 1)); } + +CORE_ADDR +vax_frame_chain (struct frame_info *frame) +{ + /* In the case of the VAX, the frame's nominal address is the FP value, + and 12 bytes later comes the saved previous FP value as a 4-byte word. */ + if (inside_entry_file (frame->pc)) + return (0); + + return (read_memory_integer (frame->frame + 12, 4)); +} + +void +vax_push_dummy_frame (void) +{ + CORE_ADDR sp = read_register (SP_REGNUM); + int regnum; + + sp = push_word (sp, 0); /* arglist */ + for (regnum = 11; regnum >= 0; regnum--) + sp = push_word (sp, read_register (regnum)); + sp = push_word (sp, read_register (PC_REGNUM)); + sp = push_word (sp, read_register (FP_REGNUM)); + sp = push_word (sp, read_register (AP_REGNUM)); + sp = push_word (sp, (read_register (PS_REGNUM) & 0xffef) + 0x2fff0000); + sp = push_word (sp, 0); + write_register (SP_REGNUM, sp); + write_register (FP_REGNUM, sp); + write_register (AP_REGNUM, sp + (17 * 4)); +} + +void +vax_pop_frame (void) +{ + CORE_ADDR fp = read_register (FP_REGNUM); + int regnum; + int regmask = read_memory_integer (fp + 4, 4); + + write_register (PS_REGNUM, + (regmask & 0xffff) + | (read_register (PS_REGNUM) & 0xffff0000)); + write_register (PC_REGNUM, read_memory_integer (fp + 16, 4)); + write_register (FP_REGNUM, read_memory_integer (fp + 12, 4)); + write_register (AP_REGNUM, read_memory_integer (fp + 8, 4)); + fp += 16; + for (regnum = 0; regnum < 12; regnum++) + if (regmask & (0x10000 << regnum)) + write_register (regnum, read_memory_integer (fp += 4, 4)); + fp = fp + 4 + ((regmask >> 30) & 3); + if (regmask & 0x20000000) + { + regnum = read_memory_integer (fp, 4); + fp += (regnum + 1) * 4; + } + write_register (SP_REGNUM, fp); + flush_cached_frames (); +} void vax_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) |