diff options
Diffstat (limited to 'gdb/m-sun3.h')
-rw-r--r-- | gdb/m-sun3.h | 64 |
1 files changed, 41 insertions, 23 deletions
diff --git a/gdb/m-sun3.h b/gdb/m-sun3.h index 9c4095e..1ac0ee1 100644 --- a/gdb/m-sun3.h +++ b/gdb/m-sun3.h @@ -85,6 +85,12 @@ read_memory_integer (read_register (SP_REGNUM), 4) #define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */ +/* Largest integer type */ +#define LONGEST long + +/* Name of the builtin type for the LONGEST type above. */ +#define BUILTIN_TYPE_LONGEST builtin_type_long + /* Say how long (ordinary) registers are. */ #define REGISTER_TYPE long @@ -132,6 +138,8 @@ read_memory_integer (read_register (SP_REGNUM), 4) /* Number of bytes of storage in the actual machine representation for register N. On the 68000, all regs are 4 bytes except the floating point regs which are 12 bytes. */ +/* Note that the unsigned cast here forces the result of the + subtractiion to very high positive values if N < FP0_REGNUM */ #define REGISTER_RAW_SIZE(N) (((unsigned)(N) - FP0_REGNUM) < 8 ? 12 : 4) @@ -178,6 +186,12 @@ read_memory_integer (read_register (SP_REGNUM), 4) #define REGISTER_VIRTUAL_TYPE(N) \ (((unsigned)(N) - FP0_REGNUM) < 8 ? builtin_type_double : builtin_type_int) +/* Store the address of the place in which to copy the structure the + subroutine will return. This is called from call_function. */ + +#define STORE_STRUCT_RETURN(ADDR, SP) \ + { write_register (9, (ADDR)); } + /* Extract from an array REGBUF containing the (raw) register state a function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ @@ -230,20 +244,20 @@ read_memory_integer (read_register (SP_REGNUM), 4) /* In the case of the Sun, the frame's nominal address is the address of a 4-byte word containing the calling frame's address. */ -#define FRAME_CHAIN(thisframe) (read_memory_integer (thisframe, 4)) +#define FRAME_CHAIN(thisframe) (read_memory_integer ((thisframe)->frame, 4)) #define FRAME_CHAIN_VALID(chain, thisframe) \ - (chain != 0 && (FRAME_SAVED_PC (thisframe,0) >= first_object_file_end)) + (chain != 0 && (FRAME_SAVED_PC (thisframe) >= first_object_file_end)) #define FRAME_CHAIN_COMBINE(chain, thisframe) (chain) /* Define other aspects of the stack frame. */ -#define FRAME_SAVED_PC(frame,ignore) (read_memory_integer (frame + 4, 4)) +#define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4)) -#define FRAME_ARGS_ADDRESS(fi) (fi.frame) +#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) -#define FRAME_LOCALS_ADDRESS(fi) (fi.frame) +#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) /* Set VAL to the number of args passed to frame described by FI. Can set VAL to -1, meaning no way to tell. */ @@ -254,7 +268,7 @@ read_memory_integer (read_register (SP_REGNUM), 4) #if 0 #define FRAME_NUM_ARGS(val, fi) \ -{ register CORE_ADDR pc = FRAME_SAVED_PC (fi.frame,0); \ +{ register CORE_ADDR pc = FRAME_SAVED_PC (fi); \ register int insn = 0177777 & read_memory_integer (pc, 2); \ val = 0; \ if (insn == 0047757 || insn == 0157374) /* lea W(sp),sp or addaw #W,sp */ \ @@ -284,19 +298,19 @@ read_memory_integer (read_register (SP_REGNUM), 4) register CORE_ADDR pc; \ int nextinsn; \ bzero (&frame_saved_regs, sizeof frame_saved_regs); \ - if ((frame_info).pc >= (frame_info).frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 8*12 - 4 \ - && (frame_info).pc <= (frame_info).frame) \ - { next_addr = (frame_info).frame; \ - pc = (frame_info).frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 8*12 - 4; }\ + if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 8*12 - 4 \ + && (frame_info)->pc <= (frame_info)->frame) \ + { next_addr = (frame_info)->frame; \ + pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 8*12 - 4; }\ else \ - { pc = get_pc_function_start ((frame_info).pc); \ + { pc = get_pc_function_start ((frame_info)->pc); \ /* Verify we have a link a6 instruction next; \ if not we lose. If we win, find the address above the saved \ regs using the amount of storage from the link instruction. */\ if (044016 == read_memory_integer (pc, 2)) \ - next_addr = (frame_info).frame + read_memory_integer (pc += 2, 4), pc+=4; \ + next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 4), pc+=4; \ else if (047126 == read_memory_integer (pc, 2)) \ - next_addr = (frame_info).frame + read_memory_integer (pc += 2, 2), pc+=2; \ + next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 2), pc+=2; \ else goto lose; \ /* If have an addal #-n, sp next, adjust next_addr. */ \ if ((0177777 & read_memory_integer (pc, 2)) == 0157774) \ @@ -323,7 +337,7 @@ read_memory_integer (read_register (SP_REGNUM), 4) for (regnum = 15; regnum >= 0; regnum--, regmask >>= 1) \ if (regmask & 1) \ (frame_saved_regs).regs[regnum] = (next_addr -= 4); } \ - else if (0x2f00 == 0xfff0 & read_memory_integer (pc, 2)) \ + else if (0x2f00 == (0xfff0 & read_memory_integer (pc, 2))) \ { regnum = 0xf & read_memory_integer (pc, 2); pc += 2; \ (frame_saved_regs).regs[regnum] = (next_addr -= 4); } \ /* fmovemx to index of sp may follow. */ \ @@ -340,9 +354,9 @@ read_memory_integer (read_register (SP_REGNUM), 4) if (0x426742e7 == read_memory_integer (pc, 4)) \ (frame_saved_regs).regs[PS_REGNUM] = (next_addr -= 4); \ lose: ; \ - (frame_saved_regs).regs[SP_REGNUM] = (frame_info).frame + 8; \ - (frame_saved_regs).regs[FP_REGNUM] = (frame_info).frame; \ - (frame_saved_regs).regs[PC_REGNUM] = (frame_info).frame + 4; \ + (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame + 8; \ + (frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame; \ + (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 4; \ } /* Things needed for making the inferior call functions. */ @@ -368,13 +382,15 @@ read_memory_integer (read_register (SP_REGNUM), 4) restoring all saved registers. */ #define POP_FRAME \ -{ register CORE_ADDR fp = read_register (FP_REGNUM); \ +{ register FRAME frame = get_current_frame (); \ + register CORE_ADDR fp; \ register int regnum; \ struct frame_saved_regs fsr; \ - struct frame_info fi; \ + struct frame_info *fi; \ char raw_buffer[12]; \ - fi = get_frame_info (fp); \ - get_frame_saved_regs (&fi, &fsr); \ + fi = get_frame_info (frame); \ + fp = fi->frame; \ + get_frame_saved_regs (fi, &fsr); \ for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--) \ if (fsr.regs[regnum]) \ { read_memory (fsr.regs[regnum], raw_buffer, 12); \ @@ -387,7 +403,9 @@ read_memory_integer (read_register (SP_REGNUM), 4) write_register (FP_REGNUM, read_memory_integer (fp, 4)); \ write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); \ write_register (SP_REGNUM, fp + 8); \ - set_current_frame (read_register (FP_REGNUM)); } + flush_cached_frames (); \ + set_current_frame (create_new_frame (read_register (FP_REGNUM),\ + read_pc ())); } /* This sequence of words is the instructions fmovem 0xff,-(sp) @@ -420,7 +438,7 @@ taken for the arguments. */ /* Insert the specified number of args and function address into a call sequence of the above form stored at DUMMYNAME. */ -#define FIX_CALL_DUMMY(dummyname, fun, nargs) \ +#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, type) \ { *(int *)((char *) dummyname + 20) = nargs * 4; \ *(int *)((char *) dummyname + 14) = fun; } |