diff options
Diffstat (limited to 'gdb/m-sun2.h')
-rw-r--r-- | gdb/m-sun2.h | 72 |
1 files changed, 50 insertions, 22 deletions
diff --git a/gdb/m-sun2.h b/gdb/m-sun2.h index 74181f8..e42bc57 100644 --- a/gdb/m-sun2.h +++ b/gdb/m-sun2.h @@ -86,6 +86,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 registers are. */ #define REGISTER_TYPE long @@ -162,6 +168,12 @@ read_memory_integer (read_register (SP_REGNUM), 4) #define REGISTER_VIRTUAL_TYPE(N) 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. */ @@ -181,6 +193,18 @@ read_memory_integer (read_register (SP_REGNUM), 4) #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF)) +/* Enable use of alternate code to read and write registers. */ + +#define NEW_SUN_PTRACE + +/* Enable use of alternate code for Sun's format of core dump file. */ + +#define NEW_SUN_CORE + +/* Do implement the attach and detach commands. */ + +#define ATTACH_DETACH + /* This is a piece of magic that is given a register number REGNO and as BLOCKEND the address in the system of the end of the user structure and stores in ADDR the address in the kernel or core dump @@ -205,20 +229,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. */ @@ -229,7 +253,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 */ \ @@ -258,19 +282,19 @@ read_memory_integer (read_register (SP_REGNUM), 4) register CORE_ADDR next_addr; \ register CORE_ADDR pc; \ bzero (&frame_saved_regs, sizeof frame_saved_regs); \ - if ((frame_info).pc >= (frame_info).frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 4 \ - && (frame_info).pc <= (frame_info).frame) \ - { next_addr = (frame_info).frame; \ - pc = (frame_info).frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 4; }\ + if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 4 \ + && (frame_info)->pc <= (frame_info)->frame) \ + { next_addr = (frame_info)->frame; \ + pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 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) \ @@ -295,9 +319,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. */ @@ -318,12 +342,14 @@ read_memory_integer (read_register (SP_REGNUM), 4) /* Discard from the stack the innermost frame, restoring all 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; \ - fi = get_frame_info (fp); \ - get_frame_saved_regs (&fi, &fsr); \ + struct frame_info *fi; \ + fi = get_frame_info (frame); \ + fp = fi->frame; \ + get_frame_saved_regs (fi, &fsr); \ for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) \ if (fsr.regs[regnum]) \ write_register (regnum, read_memory_integer (fsr.regs[regnum], 4)); \ @@ -332,7 +358,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); \ -} + flush_cached_frames (); \ + set_current_frame ( create_new_frame (read_register (FP_REGNUM),\ + read_pc ())); } /* This sequence of words is the instructions moveml 0xfffc,-(sp) @@ -364,7 +392,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 + 16) = nargs * 4; \ *(int *)((char *) dummyname + 10) = fun; } |