1 /* Parameters for execution on a Sun, for GDB, the GNU debugger.
2 Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
22 /* TARGET_SUN3 might be a more logical name, but that's used by
23 ../include/target.h (included by ../include/a.out.gnu.h). */
24 #define GDB_TARGET_IS_SUN3 1
28 /* Define this if the C compiler puts an underscore at the front
29 of external names before giving them to the linker. */
31 #define NAMES_HAVE_UNDERSCORE
33 /* Debugger information will be in DBX format. */
35 #define READ_DBX_FORMAT
37 /* Address of the end of stack space. We get this from the system
39 #include <sys/types.h>
40 #include <machine/vmparam.h>
41 #define STACK_END_ADDR USRSTACK
43 /* Things needed for making the inferior call functions. */
45 /* Push an empty stack frame, to record the current PC, etc. */
47 #define PUSH_DUMMY_FRAME \
48 { register CORE_ADDR sp = read_register (SP_REGNUM); \
49 register int regnum; \
50 char raw_buffer[12]; \
51 sp = push_word (sp, read_register (PC_REGNUM)); \
52 sp = push_word (sp, read_register (FP_REGNUM)); \
53 write_register (FP_REGNUM, sp); \
54 for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--) \
55 { read_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12); \
56 sp = push_bytes (sp, raw_buffer, 12); } \
57 for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) \
58 sp = push_word (sp, read_register (regnum)); \
59 sp = push_word (sp, read_register (PS_REGNUM)); \
60 write_register (SP_REGNUM, sp); }
62 /* Discard from the stack the innermost frame,
63 restoring all saved registers. */
66 { register FRAME frame = get_current_frame (); \
67 register CORE_ADDR fp; \
68 register int regnum; \
69 struct frame_saved_regs fsr; \
70 struct frame_info *fi; \
71 char raw_buffer[12]; \
72 fi = get_frame_info (frame); \
74 get_frame_saved_regs (fi, &fsr); \
75 for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--) \
76 if (fsr.regs[regnum]) \
77 { read_memory (fsr.regs[regnum], raw_buffer, 12); \
78 write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12); }\
79 for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) \
80 if (fsr.regs[regnum]) \
81 write_register (regnum, read_memory_integer (fsr.regs[regnum], 4)); \
82 if (fsr.regs[PS_REGNUM]) \
83 write_register (PS_REGNUM, read_memory_integer (fsr.regs[PS_REGNUM], 4)); \
84 write_register (FP_REGNUM, read_memory_integer (fp, 4)); \
85 write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); \
86 write_register (SP_REGNUM, fp + 8); \
87 flush_cached_frames (); \
88 set_current_frame (create_new_frame (read_register (FP_REGNUM), \
91 /* This sequence of words is the instructions
96 /..* The arguments are pushed at this point by GDB;
97 no code is needed in the dummy for this.
98 The CALL_DUMMY_START_OFFSET gives the position of
99 the following jsr instruction. *../
104 Note this is 28 bytes.
105 We actually start executing at the jsr, since the pushing of the
106 registers is done by PUSH_DUMMY_FRAME. If this were real code,
107 the arguments for the function called by the jsr would be pushed
108 between the moveml and the jsr, and we could allow it to execute through.
109 But the arguments have to be pushed by GDB after the PUSH_DUMMY_FRAME is done,
110 and we cannot allow the moveml to push the registers again lest they be
111 taken for the arguments. */
113 #define CALL_DUMMY {0xf227e0ff, 0x48e7fffc, 0x426742e7, 0x4eb93232, 0x3232dffc, 0x69696969, 0x4e4f4e71}
115 #define CALL_DUMMY_LENGTH 28
117 #define CALL_DUMMY_START_OFFSET 12
119 /* Insert the specified number of args and function address
120 into a call sequence of the above form stored at DUMMYNAME. */
122 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
123 { *(int *)((char *) dummyname + 20) = nargs * 4; \
124 *(int *)((char *) dummyname + 14) = fun; }
This page took 0.030984 seconds and 4 git commands to generate.