along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* A successful ptrace(continue) might return errno != 0 in this particular port
- of rs6000. I am not sure why. We will use this kludge and ignore it until
- we figure out the real problem. */
-
-#define AIX_BUGGY_PTRACE_CONTINUE \
-{ \
- int ret = ptrace (PT_CONTINUE, inferior_pid, (int *)1, signal, 0); \
- if (errno) { \
-/* printf ("ret: %d, errno: %d, signal: %d\n", ret, errno, signal); */ \
- errno = 0; } \
-}
-
extern int symtab_relocated;
/* Minimum possible text address in AIX */
if (!symtab_relocated && !inferior_pid && (PC) > TEXT_SEGMENT_BASE) \
(PC) -= ( TEXT_SEGMENT_BASE + text_adjustment (exec_bfd));
+/* Load segment of a given pc value. */
+
+#define PC_LOAD_SEGMENT(PC) pc_load_segment_name(PC)
+
+
/* Conversion between a register number in stab string to actual register num. */
#define STAB_REG_TO_REGNUM(value) (value)
/* We are missing register descriptions in the system header files. Sigh! */
struct regs {
- int gregs [32]; /* general purpose registers */
- int pc; /* program conter */
- int ps; /* processor status, or machine state */
+ int gregs [32]; /* general purpose registers */
+ int pc; /* program conter */
+ int ps; /* processor status, or machine state */
};
struct fp_status {
- double fpregs [32]; /* floating GP registers */
+ double fpregs [32]; /* floating GP registers */
+};
+
+
+/* To be used by function_frame_info. */
+
+struct aix_framedata {
+ int offset; /* # of bytes in gpr's and fpr's are saved */
+ int saved_gpr; /* smallest # of saved gpr */
+ int saved_fpr; /* smallest # of saved fpr */
+ int alloca_reg; /* alloca register number (frame ptr) */
+ char frameless; /* true if frameless functions. */
};
+void
+function_frame_info PARAMS ((CORE_ADDR, struct aix_framedata *));
+
/* Define the byte order of the machine. */
#define TARGET_BYTE_ORDER BIG_ENDIAN
#undef NAMES_HAVE_UNDERSCORE
+/* AIX's assembler doesn't grok dollar signs in identifiers.
+ So we use dots instead. This item must be coordinated with G++. */
+#undef CPLUS_MARKER
+#define CPLUS_MARKER '.'
+
/* Offset from address of function to start of its code.
Zero on most machines. */
figured out where they go. But we want to do this relocation just
once. */
-extern int aix_loadInfoTextIndex;
+extern int loadinfotextindex;
-#define SOLIB_CREATE_INFERIOR_HOOK() \
+#define SOLIB_CREATE_INFERIOR_HOOK(PID) \
do { \
- if (aix_loadInfoTextIndex == 0) \
- aixcoff_relocate_symtab (pid); \
+ if (loadinfotextindex == 0) \
+ xcoff_relocate_symtab (PID); \
} while (0)
-/* In aix, number of the trap signals we need to skip over once the
- inferior process starts running is different in version 3.1 and 3.2.
- This will be 2 for version 3.1x, 3 for version 3.2x. */
+/* Number of trap signals we need to skip over, once the inferior process
+ starts running. */
+
+#define START_INFERIOR_TRAPS_EXPECTED 2
+
+/* AIX might return a sigtrap, with a "stop after load" status. It should
+ be ignored by gdb, shouldn't be mixed up with breakpoint traps. */
-#define START_INFERIOR_TRAPS_EXPECTED aix_starting_inferior_traps ()
+/* Another little glitch in AIX is signal 0. I have no idea why wait(2)
+ returns with this status word. It looks harmless. */
-/* In aixcoff, we cannot process line numbers when we see them. This is
+#define SIGTRAP_STOP_AFTER_LOAD(W) \
+ if ( (W) == 0x57c || (W) == 0x7f) { \
+ if ((W)==0x57c && breakpoints_inserted) { \
+ mark_breakpoints_out (); \
+ insert_breakpoints (); \
+ insert_step_breakpoint (); \
+ } \
+ resume (0, 0); \
+ continue; \
+ }
+
+/* In xcoff, we cannot process line numbers when we see them. This is
mainly because we don't know the boundaries of the include files. So,
we postpone that, and then enter and sort(?) the whole line table at
once, when we are closing the current symbol table in end_symtab(). */
load segments. */
#define SOLIB_ADD(a, b, c) \
- if (inferior_pid) aixcoff_relocate_symtab (inferior_pid)
+ if (inferior_pid) xcoff_relocate_symtab (inferior_pid)
/* Immediately after a function call, return the saved pc.
Can't go through the frames for this because on some machines
the new frame is not set up until the new function executes
some instructions. */
-extern char registers[];
-extern char register_valid [];
-
#define SAVED_PC_AFTER_CALL(frame) \
(register_valid [LR_REGNUM] ? \
(*(int*)®isters[REGISTER_BYTE (LR_REGNUM)]) : \
as a CORE_ADDR (or an expression that can be used as one). */
#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) rs6000_struct_return_address
-
-
-/* Do implement the attach and detach commands. */
-
-#define ATTACH_DETACH
-
-/* infptrace.c requires those. */
-
-#define PTRACE_ATTACH 30
-#define PTRACE_DETACH 31
-
\f
/* Describe the pointer in each stack frame to the previous stack frame
(its caller). */
/* FRAME_CHAIN takes a frame's nominal address
- and produces the frame's chain-pointer.
-
- However, if FRAME_CHAIN_VALID returns zero,
- it means the given frame is the outermost one and has no caller. */
+ and produces the frame's chain-pointer. */
/* In the case of the RS6000, the frame's nominal address
is the address of a 4-byte word containing the calling frame's address. */
#define FRAME_CHAIN(thisframe) \
- (outside_startup_file ((thisframe)->pc) ? \
+ (!inside_entry_file ((thisframe)->pc) ? \
read_memory_integer ((thisframe)->frame, 4) :\
0)
-#define FRAME_CHAIN_VALID(chain, thisframe) \
- (chain != 0 && (outside_startup_file (FRAME_SAVED_PC (thisframe))))
-
/* Define other aspects of the stack frame. */
/* A macro that tells us whether the function invocation represented
#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
FRAMELESS = frameless_function_invocation (FI)
+/* Functions calling alloca() change the value of the stack pointer. We
+ need to use initial stack pointer (which is saved in r31 by gcc) in
+ such cases. If a compiler emits traceback table, then we should use the
+ alloca register specified in traceback table. FIXME. */
+/* Also, it is a good idea to cache information about frame's saved registers
+ in the frame structure to speed things up. See tm-m88k.h. FIXME. */
+
+#define EXTRA_FRAME_INFO \
+ CORE_ADDR initial_sp; /* initial stack pointer. */ \
+ struct frame_saved_regs *cache_fsr; /* saved registers */
+
/* Frameless function invocation in IBM RS/6000 is half-done. It perfectly
sets up a new frame, e.g. a new frame (in fact stack) pointer, etc, but it
doesn't save the %pc. In the following, even though it is considered a
frameless invocation, we still need to walk one frame up. */
#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \
- if (fromleaf) { \
- int tmp = 0; \
- read_memory ((fi)->frame, &tmp, sizeof (int)); \
- (fi)->frame = tmp; \
- }
+ fi->initial_sp = 0; \
+ fi->cache_fsr = 0;
#define FRAME_SAVED_PC(FRAME) \
read_memory_integer (read_memory_integer ((FRAME)->frame, 4)+8, 4)
-#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
+#define FRAME_ARGS_ADDRESS(FI) \
+ (((struct frame_info*)(FI))->initial_sp ? \
+ ((struct frame_info*)(FI))->initial_sp : \
+ frame_initial_stack_address (FI))
+
+#define FRAME_LOCALS_ADDRESS(FI) FRAME_ARGS_ADDRESS(FI)
-#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. */
#define FRAME_FIND_SAVED_REGS(FRAME_INFO, FRAME_SAVED_REGS) \
{ \
- int frameless, offset, saved_gpr, saved_fpr, ii, frame_addr, func_start; \
- \
- /* find the start of the function and collect info about its frame. */ \
- \
- func_start = get_pc_function_start ((FRAME_INFO)->pc) + FUNCTION_START_OFFSET;\
- function_frame_info (func_start, &frameless, &offset, &saved_gpr, &saved_fpr);\
- bzero (&(FRAME_SAVED_REGS), sizeof (FRAME_SAVED_REGS)); \
- \
- /* if there were any saved registers, figure out parent's stack pointer. */ \
- frame_addr = 0; \
- if (saved_fpr >= 0 || saved_gpr >= 0) { \
- if ((FRAME_INFO)->prev && (FRAME_INFO)->prev->frame) \
- frame_addr = (FRAME_INFO)->prev->frame; \
- else \
- frame_addr = read_memory_integer ((FRAME_INFO)->frame, 4); \
- } \
- \
- /* if != -1, saved_fpr is the smallest number of saved_fpr. All fpr's \
- from saved_fpr to fp31 are saved right underneath caller stack pointer, \
- starting from fp31 first. */ \
- \
- if (saved_fpr >= 0) { \
- for (ii=31; ii >= saved_fpr; --ii) \
- (FRAME_SAVED_REGS).regs [FP0_REGNUM + ii] = frame_addr - ((32 - ii) * 8); \
- frame_addr -= (32 - saved_fpr) * 8; \
- } \
- \
- /* if != -1, saved_gpr is the smallest number of saved_gpr. All gpr's \
- from saved_gpr to gpr31 are saved right under saved fprs, starting \
- from r31 first. */ \
- \
- if (saved_gpr >= 0) \
- for (ii=31; ii >= saved_gpr; --ii) \
- (FRAME_SAVED_REGS).regs [ii] = frame_addr - ((32 - ii) * 4); \
+ int ii; \
+ CORE_ADDR frame_addr, func_start; \
+ struct aix_framedata fdata; \
+ \
+ /* find the start of the function and collect info about its frame. */\
+ \
+ func_start = get_pc_function_start ((FRAME_INFO)->pc) + FUNCTION_START_OFFSET; \
+ function_frame_info (func_start, &fdata); \
+ bzero (&(FRAME_SAVED_REGS), sizeof (FRAME_SAVED_REGS)); \
+ \
+ /* if there were any saved registers, figure out parent's stack pointer. */ \
+ frame_addr = 0; \
+ /* the following is true only if the frame doesn't have a call to alloca(), \
+ FIXME. */ \
+ if (fdata.saved_fpr >= 0 || fdata.saved_gpr >= 0) { \
+ if ((FRAME_INFO)->prev && (FRAME_INFO)->prev->frame) \
+ frame_addr = (FRAME_INFO)->prev->frame; \
+ else \
+ frame_addr = read_memory_integer ((FRAME_INFO)->frame, 4); \
+ } \
+ \
+ /* if != -1, fdata.saved_fpr is the smallest number of saved_fpr. All fpr's \
+ from saved_fpr to fp31 are saved right underneath caller stack pointer, \
+ starting from fp31 first. */ \
+ \
+ if (fdata.saved_fpr >= 0) { \
+ for (ii=31; ii >= fdata.saved_fpr; --ii) \
+ (FRAME_SAVED_REGS).regs [FP0_REGNUM + ii] = frame_addr - ((32 - ii) * 8); \
+ frame_addr -= (32 - fdata.saved_fpr) * 8; \
+ } \
+ \
+ /* if != -1, fdata.saved_gpr is the smallest number of saved_gpr. All gpr's \
+ from saved_gpr to gpr31 are saved right under saved fprs, starting \
+ from r31 first. */ \
+ \
+ if (fdata.saved_gpr >= 0) \
+ for (ii=31; ii >= fdata.saved_gpr; --ii) \
+ (FRAME_SAVED_REGS).regs [ii] = frame_addr - ((32 - ii) * 4); \
}
\f
#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, using_gcc) \
fix_call_dummy(dummyname, pc, fun, nargs, type)
+
+/* Signal handler for SIGWINCH `window size changed'. */
+
+#define SIGWINCH_HANDLER aix_resizewindow
+extern void aix_resizewindow ();
+
+/* `lines_per_page' and `chars_per_line' are local to utils.c. Rectify this. */
+
+#define SIGWINCH_HANDLER_BODY \
+ \
+/* Respond to SIGWINCH `window size changed' signal, and reset GDB's \
+ window settings approproatelt. */ \
+ \
+void \
+aix_resizewindow () \
+{ \
+ int fd = fileno (stdout); \
+ if (isatty (fd)) { \
+ int val; \
+ \
+ val = atoi (termdef (fd, 'l')); \
+ if (val > 0) \
+ lines_per_page = val; \
+ val = atoi (termdef (fd, 'c')); \
+ if (val > 0) \
+ chars_per_line = val; \
+ } \
+}
+
+
/* Flag for machine-specific stuff in shared files. FIXME */
-#ifndef IBM6000
-#define IBM6000
-#endif
+#define IBM6000_TARGET
+
+/* RS6000/AIX does not support PT_STEP. Has to be simulated. */
+
+#define NO_SINGLE_STEP