From: Fred Fish Date: Thu, 2 Nov 1995 15:20:50 +0000 (+0000) Subject: * config/i386/tm-i386.h: New file containing generic i*86 target X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7ee7dc27b0a8283399607e7efce8a46a6565fc8c;p=binutils-gdb.git * config/i386/tm-i386.h: New file containing generic i*86 target definitions. (TARGET_BYTE_ORDER): Moved here from tm-i386v.h. (IEEE_FLOAT): Moved here from tm-i386v.h. (START_INFERIOR_TRAPS_EXPECTED): Define default as 2. (FUNCTION_START_OFFSET): Moved here from tm-i386v.h. (SKIP_PROLOGUE): Moved here from tm-i386v.h. (SAVED_PC_AFTER_CALL): Moved here from tm-i386v.h. (INNER_THAN): Moved here from tm-i386v.h. (BREAKPOINT): Moved here from tm-i386v.h. (DECR_PC_AFTER_BREAK): Moved here from tm-i386v.h. (ABOUT_TO_RETURN): Moved here from tm-i386v.h. (REGISTER_SIZE): Moved here from tm-i386v.h. (NUM_REGS): Moved here from tm-i386v.h. (REGISTER_NAMES): Moved here from tm-i386v.h. (EXTRACT_STRUCT_VALUE_ADDRESS): Moved here from tm-i386v.h. (FP_REGNUM): Moved here from tm-i386v.h. (SP_REGNUM): Moved here from tm-i386v.h. (PC_REGNUM): Moved here from tm-i386v.h. (PS_REGNUM): Moved here from tm-i386v.h. (FP0_REGNUM): Moved here from tm-i386aix.h. (FPC_REGNUM): Moved here from tm-sun386.h. (REGISTER_BYTES): Moved here from tm-i386aix.h. (REGISTER_BYTE): Moved here from tm-i386aix.h. (REGISTER_RAW_SIZE): Moved here from tm-i386aix.h. (MAX_REGISTER_RAW_SIZE): Moved here from tm-i386aix.h. (REGISTER_VIRTUAL_SIZE): Moved here from tm-i386aix.h. (MAX_REGISTER_VIRTUAL_SIZE): Moved here from tm-i386aix.h. (EXTRACT_RETURN_VALUE): Moved here from tm-i386aix.h. (STORE_RETURN_VALUE): Moved here from tm-i386aix.h. (REGISTER_VIRTUAL_TYPE): Moved here from tm-i386v.h. (STORE_STRUCT_RETURN): Moved here from tm-i386v.h. (FRAME_CHAIN): Moved here from tm-i386v4.h. (FRAMELESS_FUNCTION_INVOCATION): Moved here from tm-i386v4.h. (FRAME_SAVED_PC): Moved here from tm-i386os9k.h (FRAME_ARGS_ADDRESS): Moved here from tm-i386v.h. (FRAME_LOCALS_ADDRESS): Moved here from tm-i386v.h. (FRAME_NUM_ARGS): Moved here from tm-i386sun.h. (FRAME_ARGS_SKIP): Moved here from tm-i386v.h. (FRAME_FIND_SAVED_REGS): Moved here from tm-i386v.h. (PUSH_DUMMY_FRAME): Moved here from tm-i386v.h. (POP_FRAME): Moved here from tm-i386v.h. (CALL_DUMMY, CALL_DUMMY_LENGTH, CALL_DUMMY_START_OFFSET, CALL_DUMMY_BREAKPOINT_OFFSET, FIX_CALL_DUMMY): Moved here from tm-i386v.h (print_387_control_word, print_387_status_word): Declare prototypes. (struct frame_info, struct frame_saved_regs): Forward decls for prototypes. (SP_ARG0): Moved here from tm-i386v.h. * config/i386/tm-i386v.h: (i386/tm-i386.h): Include. (TARGET_BYTE_ORDER): Remove. (IEEE_FLOAT): Remove. (START_INFERIOR_TRAPS_EXPECTED): Undef before redefine to 4. (FUNCTION_START_OFFSET): Remove. (SKIP_PROLOGUE): Remove. (i386_skip_prologue): Remove prototype. (SAVED_PC_AFTER_CALL): Remove. (INNER_THAN): Remove. (BREAKPOINT): Remove. (DECR_PC_AFTER_BREAK): Remove. (ABOUT_TO_RETURN): Remove. (REGISTER_SIZE): Remove. (NUM_REGS): Undef before redefine to 16 (no FP support). (REGISTER_NAMES): Undef before redefine. (FP_REGNUM, SP_REGNUM, PC_REGNUM, PS_REGNUM): Remove. (REGISTER_BYTES): Undef before redefine. (REGISTER_BYTE): Undef before redefine. (REGISTER_RAW_SIZE): Undef before redefine. (REGISTER_VIRTUAL_SIZE): Undef before redefine. (MAX_REGISTER_RAW_SIZE): Undef before redefine. (MAX_REGISTER_VIRTUAL_SIZE): Undef before redefine. (REGISTER_VIRTUAL_TYPE): Undef before redefine. (STORE_STRUCT_RETURN): Undef before redefine. (EXTRACT_RETURN_VALUE): Undef before redefine. (STORE_RETURN_VALUE): Undef before redefine. (EXTRACT_STRUCT_VALUE_ADDRESS): Remove. (FRAME_CHAIN): Undef before redefine. (FRAMELESS_FUNCTION_INVOCATION): Undef before redefine. (FRAME_SAVED_PC): Undef before redefine. (FRAME_ARGS_ADDRESS): Remove. (FRAME_LOCALS_ADDRESS): Remove. (FRAME_NUM_ARGS): Undef before redefine. (FRAME_ARGS_SKIP): Remove. (FRAME_FIND_SAVED_REGS): Remove. (PUSH_DUMMY_FRAME): Remove. (POP_FRAME): Remove. (CALL_DUMMY): Remove. (CALL_DUMMY_LENGTH): Remove. (CALL_DUMMY_START_OFFSET): Remove. (CALL_DUMMY_BREAKPOINT_OFFSET): Remove (FIX_CALL_DUMMY): Remove. (print_387_control_word): Remove. (print_387_status_word): Remove. (SP_ARG0): Remove. * config/i386/tm-symmetry.h: (TM_SYMMETRY_H): Enclose file in test for define & define if needed. (START_INFERIOR_TRAPS_EXPECTED): Move to after inclusion of tm-i386v4.h or tm-i386v.h, #undef, and #define back to 2. (DECR_PC_AFTER_BREAK): Move to after inclusion of tm-i386v4.h or tm-i386v.h, #undef, and #define to 0. (MAX_REGISTER_RAW_SIZE): Remove. (FRAME_CHAIN): Remove. (FRAMELESS_FUNCTION_INVOCATION): Remove. (FRAME_SAVED_PC): Remove. (print_387_control_word, print_387_status_word): Remove prototypes. * config/i386/tm-ptx.h: (TM_PTX_H): Enclose file in test for define & define if needed. (START_INFERIOR_TRAPS_EXPECTED): Move to after inclusion of tm-i386v4.h or tm-i386v.h, #undef, and #define back to 2. (DECR_PC_AFTER_BREAK): Move to after inclusion of tm-i386v4.h or tm-i386v.h, #undef, and #define to 0. (SDB_REG_TO_REGNUM): Remove obsolete commented out define. (print_387_control_word, print_387_status_word): Remove prototypes. * config/i386/tm-linux.h: (TM_LINUX_H): Enclose file in test for define & define if needed. (i386/tm-i386.h): Include instead of tm-i386v.h. (START_INFERIOR_TRAPS_EXPECTED): Remove. * config/i386/tm-i386v4.h: (TM_I386V4_H): Enclose file in test for define & define if needed. (i386/tm-i386.h): Include instead of tm-i386v.h. (START_INFERIOR_TRAPS_EXPECTED): Remove. (FRAME_CHAIN): Moved to tm-i386.h. (FRAMELESS_FUNCTION_INVOCATION): Moved to tm-i386.h. (FRAME_SAVED_PC): Remove. (sigtramp_saved_pc): Define as i386v4_sigtramp_saved_pc. (FRAME_NUM_ARGS): Remove. * config/i386/tm-i386os9k.h: (TM_I386OS9K_H): Enclose file in test for define & define if needed. (i386/tm-i386.h): Include instead of tm-i386v.h. (START_INFERIOR_TRAPS_EXPECTED): Remove. (NUM_REGS): Undefine before redefining. (FRAME_CHAIN): Remove. (FRAMELESS_FUNCTION_INVOCATION): Remove. (FRAME_SAVED_PC): Move to tm-i386.h. * config/i386/tm-i386nw.h: (TM_I386NW_H): Enclose file in test for define & define if needed. (i386/tm-i386.h): Include instead of tm-i386v.h. (START_INFERIOR_TRAPS_EXPECTED): Remove. * config/i386/tm-i386bsd.h: (TM_I386BSD_H): Enclose file in test for define & define if needed. (i386/tm-i386.h): Include instead of tm-i386v.h. (START_INFERIOR_TRAPS_EXPECTED): Remove. (FRAMELESS_FUNCTION_INVOCATION): Remove. (FRAME_SAVED_PC): Remove. * config/i386/tm-i386aix.h: (i386/tm-i386.h): Include instead of tm-i386v.h. (START_INFERIOR_TRAPS_EXPECTED): Remove. (FP_REGNUM): Remove. (SP_REGNUM): Remove. (PC_REGNUM): Remove. (PS_REGNUM): Remove. (FP0_REGNUM): Moved to tm-i386.h. (NUM_REGS): Remove. (REGISTER_NAMES): Remove. (REGISTER_BYTES): Moved to tm-i386.h. (REGISTER_BYTE): Moved to tm-i386.h. (REGISTER_RAW_SIZE): Moved to tm-i386.h. (MAX_REGISTER_RAW_SIZE): Moved to tm-i386.h. (REGISTER_VIRTUAL_SIZE): Moved to tm-i386.h. (REGISTER_VIRTUAL_TYPE): Removed. (EXTRACT_RETURN_VALUE): Moved to tm-i386.h. (STORE_RETURN_VALUE): Moved to tm-i386.h. * config/i386/tm-sun386.h: (TM_SUN386_H): Enclose file in test for define & define if needed. (i386/tm-i386.h): Include. (TARGET_BYTE_ORDER): Remove. (FUNCTION_START_OFFSET): Remove. (SKIP_PROLOGUE): Remove. (SAVED_PC_AFTER_CALL): Remove. (INNER_THAN): Remove. (BREAKPOINT): Remove. (DECR_PC_AFTER_BREAK): Remove. (ABOUT_TO_RETURN): Remove. (REGISTER_SIZE): Remove. (NUM_REGS): Undefine before defining. (REGISTER_NAMES): Undefine before redefining. (REGISTER_BYTES): Undefine before redefining. (REGISTER_BYTE): Undefine before defining. (FP_REGNUM): Undefine before defining. (PC_REGNUM): Undefine before defining. (FPC_REGNUM): Undefine before defining. (REGISTER_RAW_SIZE): Undefine before defining. (FRAME_CHAIN): Undefine before defining. (FRAMELESS_FUNCTION_INVOCATION): Undefine before defining. (FRAME_SAVED_PC): Undefine before defining. (FRAME_NUM_ARGS): Moved to tm-i386.h. (MAX_REGISTER_RAW_SIZE): Remove. (MAX_REGISTER_VIRTUAL_SIZE): Remove. (STORE_STRUCT_RETURN): Remove. (EXTRACT_STRUCT_VALUE_ADDRESS): Remove. (FRAME_ARGS_ADDRESS): Remove. (FRAME_LOCALS_ADDRESS): Remove. (FRAME_NUM_ARGS): Undefine before defining. (FRAME_ARGS_SKIP): Remove. (FRAME_FIND_SAVED_REGS): Remove. (PUSH_DUMMY_FRAME): Remove. (POP_FRAME): Remove. (CALL_DUMMY, CALL_DUMMY_LENGTH, CALL_DUMMY_START_OFFSET): Remove. (struct frame_info, struct frame_saved_regs): Remove forward decls for prototypes. * config/i386/tm-i386lynx.h (i386/tm-i386.h): Include instead of tm-i386v.h. * config/i386/tm-i386m3.h (i386/tm-i386.h): Include instead of tm-i386v.h. --- diff --git a/gdb/config/i386/.Sanitize b/gdb/config/i386/.Sanitize index 25f9c418a1e..fbeb67be00c 100644 --- a/gdb/config/i386/.Sanitize +++ b/gdb/config/i386/.Sanitize @@ -79,6 +79,7 @@ sun386.mh sun386.mt symmetry.mh symmetry.mt +tm-i386.h tm-i386aix.h tm-i386bsd.h tm-i386lynx.h diff --git a/gdb/config/i386/tm-i386.h b/gdb/config/i386/tm-i386.h new file mode 100644 index 00000000000..819735cea5e --- /dev/null +++ b/gdb/config/i386/tm-i386.h @@ -0,0 +1,310 @@ +/* Macro definitions for GDB on an Intel i[345]86. + Copyright (C) 1995 Free Software Foundation, Inc. + +This file is part of GDB. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifndef TM_I386_H +#define TM_I386_H 1 + +#ifdef __STDC__ /* Forward decl's for prototypes */ +struct frame_info; +struct frame_saved_regs; +struct type; +#endif + +#define TARGET_BYTE_ORDER LITTLE_ENDIAN + +/* Used for example in valprint.c:print_floating() to enable checking + for NaN's */ + +#define IEEE_FLOAT + +/* Number of traps that happen between exec'ing the shell to run an + inferior, and when we finally get to the inferior code. This is 2 + on most implementations. */ + +#define START_INFERIOR_TRAPS_EXPECTED 2 + +/* Offset from address of function to start of its code. + Zero on most machines. */ + +#define FUNCTION_START_OFFSET 0 + +/* Advance PC across any function entry prologue instructions to reach some + "real" code. */ + +#define SKIP_PROLOGUE(frompc) {(frompc) = i386_skip_prologue((frompc));} + +extern int i386_skip_prologue PARAMS ((int)); + +/* Immediately after a function call, return the saved pc. Can't always go + through the frames for this because on some machines the new frame is not + set up until the new function executes some instructions. */ + +#define SAVED_PC_AFTER_CALL(frame) (read_memory_integer (read_register (SP_REGNUM), 4)) + +/* Stack grows downward. */ + +#define INNER_THAN < + +/* Sequence of bytes for breakpoint instruction. */ + +#define BREAKPOINT {0xcc} + +/* Amount PC must be decremented by after a breakpoint. This is often the + number of bytes in BREAKPOINT but not always. */ + +#define DECR_PC_AFTER_BREAK 1 + +/* Nonzero if instruction at PC is a return instruction. */ + +#define ABOUT_TO_RETURN(pc) (read_memory_integer ((pc), 1) == 0xc3) + +/* Say how long (ordinary) registers are. This is a piece of bogosity + used in push_word and a few other places; REGISTER_RAW_SIZE is the + real way to know how big a register is. */ + +#define REGISTER_SIZE 4 + +/* Number of machine registers */ + +#define NUM_FREGS 0 /*8*/ /* Number of FP regs */ +#define NUM_REGS (16 + NUM_FREGS) /* Basic i*86 regs + FP regs */ + +/* Initializer for an array of names of registers. There should be at least + NUM_REGS strings in this initializer. Any excess ones are simply ignored. + The order of the first 8 registers must match the compiler's numbering + scheme (which is the same as the 386 scheme) and also regmap in the various + *-nat.c files. */ + +#define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \ + "esp", "ebp", "esi", "edi", \ + "eip", "eflags", "cs", "ss", \ + "ds", "es", "fs", "gs", \ + "st0", "st1", "st2", "st3", \ + "st4", "st5", "st6", "st7", \ + } + +/* Register numbers of various important registers. + Note that some of these values are "real" register numbers, + and correspond to the general registers of the machine, + and some are "phony" register numbers which are too large + to be actual register numbers as far as the user is concerned + but do serve to get the desired values when passed to read_register. */ + +#define FP_REGNUM 5 /* (ebp) Contains address of executing stack frame */ +#define SP_REGNUM 4 /* (usp) Contains address of top of stack */ +#define PC_REGNUM 8 /* (eip) Contains program counter */ +#define PS_REGNUM 9 /* (ps) Contains processor status */ + +#define FP0_REGNUM 16 /* (st0) 387 register */ +#define FPC_REGNUM 25 /* 80387 control register */ + +/* Total amount of space needed to store our copies of the machine's register + state, the array `registers'. Default is 16 i*86 registers and 8 floating + point registers. */ + +#define REGISTER_BYTES (16*4 + 8*10) + +/* Index within `registers' of the first byte of the space for register N. */ + +#define REGISTER_BYTE(N) \ + (((N) < FP0_REGNUM) ? ((N) * 4) : ((((N) - FP0_REGNUM) * 10) + 64)) + +/* Number of bytes of storage in the actual machine representation for + register N. All registers are 4 bytes, except 387 st(0) - st(7), + which are 80 bits each. */ + +#define REGISTER_RAW_SIZE(N) (((N) < FP0_REGNUM) ? 4 : 10) + +/* Largest value REGISTER_RAW_SIZE can have. */ + +#define MAX_REGISTER_RAW_SIZE 10 + +/* Number of bytes of storage in the program's representation + for register N. */ + +#define REGISTER_VIRTUAL_SIZE(N) (((N) < FP0_REGNUM) ? 4 : 8) + +/* Largest value REGISTER_VIRTUAL_SIZE can have. */ + +#define MAX_REGISTER_VIRTUAL_SIZE 8 + +/* Return the GDB type object for the "standard" data type of data in + register N. Perhaps si and di should go here, but potentially they + could be used for things other than address. */ + +#define REGISTER_VIRTUAL_TYPE(N) \ + (((N) == PC_REGNUM || (N) == FP_REGNUM || (N) == SP_REGNUM) \ + ? lookup_pointer_type (builtin_type_void) \ + : (((N) < FP0_REGNUM) \ + ? builtin_type_int \ + : builtin_type_double)) + +/* 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) \ + { (SP) -= sizeof (ADDR); \ + write_memory ((SP), (char *) &(ADDR), sizeof (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. */ + +#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ + i386_extract_return_value ((TYPE),(REGBUF),(VALBUF)) + +extern void i386_extract_return_value PARAMS ((struct type *, char [], char *)); + +/* Write into appropriate registers a function return value of type TYPE, given + in virtual format. */ + +#define STORE_RETURN_VALUE(TYPE,VALBUF) \ + { \ + if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ + write_register_bytes (REGISTER_BYTE (FP0_REGNUM), (VALBUF), \ + TYPE_LENGTH (TYPE)); \ + else \ + write_register_bytes (0, (VALBUF), TYPE_LENGTH (TYPE)); \ + } + +/* Extract from an array REGBUF containing the (raw) register state the address + in which a function should return its structure value, as a CORE_ADDR (or an + expression that can be used as one). */ + +#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF)) + +/* The following redefines make backtracing through sigtramp work. + They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp + from the sigcontext structure which is pushed by the kernel on the + user stack, along with a pointer to it. */ + +/* FRAME_CHAIN takes a frame's nominal address and produces the frame's + chain-pointer. + In the case of the i386, the frame's nominal address + is the address of a 4-byte word containing the calling frame's address. */ + +#define FRAME_CHAIN(thisframe) \ + ((thisframe)->signal_handler_caller \ + ? (thisframe)->frame \ + : (!inside_entry_file ((thisframe)->pc) \ + ? read_memory_integer ((thisframe)->frame, 4) \ + : 0)) + +/* 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. */ + +#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \ + do { \ + if ((FI)->signal_handler_caller) \ + (FRAMELESS) = 0; \ + else \ + (FRAMELESS) = frameless_look_for_prologue(FI); \ + } while (0) + +/* Saved Pc. Get it from sigcontext if within sigtramp. */ + +#define FRAME_SAVED_PC(FRAME) \ + (((FRAME)->signal_handler_caller \ + ? sigtramp_saved_pc (FRAME) \ + : read_memory_integer ((FRAME)->frame + 4, 4)) \ + ) + +extern CORE_ADDR sigtramp_saved_pc PARAMS ((struct frame_info *)); + +#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) + +#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) + +/* Return number of args passed to a frame. Can return -1, meaning no way + to tell, which is typical now that the C compiler delays popping them. */ + +#define FRAME_NUM_ARGS(numargs, fi) (numargs) = i386_frame_num_args(fi) + +extern int i386_frame_num_args PARAMS ((struct frame_info *)); + +/* Return number of bytes at start of arglist that are not really args. */ + +#define FRAME_ARGS_SKIP 8 + +/* Put here the code to store, into a struct frame_saved_regs, + the addresses of the saved registers of frame described by FRAME_INFO. + This includes special registers such as pc and fp saved in special + ways in the stack frame. sp is even more special: + the address we return for it IS the sp for the next frame. */ + +#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ +{ i386_frame_find_saved_regs ((frame_info), &(frame_saved_regs)); } + +extern void i386_frame_find_saved_regs PARAMS ((struct frame_info *, + struct frame_saved_regs *)); + + +/* Things needed for making the inferior call functions. */ + +/* Push an empty stack frame, to record the current PC, etc. */ + +#define PUSH_DUMMY_FRAME { i386_push_dummy_frame (); } + +extern void i386_push_dummy_frame PARAMS ((void)); + +/* Discard from the stack the innermost frame, restoring all registers. */ + +#define POP_FRAME { i386_pop_frame (); } + +extern void i386_pop_frame PARAMS ((void)); + + +/* this is + * call 11223344 (32 bit relative) + * int3 + */ + +#define CALL_DUMMY { 0x223344e8, 0xcc11 } + +#define CALL_DUMMY_LENGTH 8 + +#define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy */ + +#define CALL_DUMMY_BREAKPOINT_OFFSET 5 + +/* 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, pc, fun, nargs, args, type, gcc_p) \ +{ \ + int from, to, delta, loc; \ + loc = (int)(read_register (SP_REGNUM) - CALL_DUMMY_LENGTH); \ + from = loc + 5; \ + to = (int)(fun); \ + delta = to - from; \ + *((char *)(dummyname) + 1) = (delta & 0xff); \ + *((char *)(dummyname) + 2) = ((delta >> 8) & 0xff); \ + *((char *)(dummyname) + 3) = ((delta >> 16) & 0xff); \ + *((char *)(dummyname) + 4) = ((delta >> 24) & 0xff); \ +} + +extern void print_387_control_word PARAMS ((unsigned int)); +extern void print_387_status_word PARAMS ((unsigned int)); + +/* Offset from SP to first arg on stack at first instruction of a function */ + +#define SP_ARG0 (1 * 4) + +#endif /* ifndef TM_I386_H */ diff --git a/gdb/config/i386/tm-i386aix.h b/gdb/config/i386/tm-i386aix.h index 423301bbf19..b0121fa92df 100644 --- a/gdb/config/i386/tm-i386aix.h +++ b/gdb/config/i386/tm-i386aix.h @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef TM_I386AIX_H #define TM_I386AIX_H 1 -#include "i386/tm-i386v.h" +#include "i386/tm-i386.h" #include #ifndef I386 @@ -32,80 +32,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # define I386_AIX_TARGET 1 #endif -/* number of traps that happen between exec'ing the shell - * to run an inferior, and when we finally get to - * the inferior code. This is 2 on most implementations. - */ -#undef START_INFERIOR_TRAPS_EXPECTED -#define START_INFERIOR_TRAPS_EXPECTED 2 - -/* Number of machine registers */ -#undef NUM_REGS -#define NUM_REGS 24 /* 16+8 */ - -/* Initializer for an array of names of registers. - There should be NUM_REGS strings in this initializer. */ - -/* the order of the first 8 registers must match the compiler's - * numbering scheme (which is the same as the 386 scheme) - * also, this table must match regmap in i386-pinsn.c. - */ -#undef REGISTER_NAMES -#define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \ - "esp", "ebp", "esi", "edi", \ - "eip", "eflags", "cs", "ss", \ - "ds", "es", "fs", "gs", \ - "st0", "st1", "st2", "st3", \ - "st4", "st5", "st6", "st7", \ - } - -/* Register numbers of various important registers. - Note that some of these values are "real" register numbers, - and correspond to the general registers of the machine, - and some are "phony" register numbers which are too large - to be actual register numbers as far as the user is concerned - but do serve to get the desired values when passed to read_register. */ - -#undef FP_REGNUM -#define FP_REGNUM 5 /* (ebp) Contains address of executing stack frame */ -#undef SP_REGNUM -#define SP_REGNUM 4 /* (usp) Contains address of top of stack */ - -#undef PC_REGNUM -#define PC_REGNUM 8 /* (eip) Contains program counter */ -#undef PS_REGNUM -#define PS_REGNUM 9 /* (eflags) Contains processor status */ - -#define FP0_REGNUM 16 /* (st0) 387 register */ - -/* Total amount of space needed to store our copies of the machine's - register state, the array `registers'. */ -/* 16 i386 registers and 8 i387 registers */ -#undef REGISTER_BYTES -#define REGISTER_BYTES (16*4 + 8*10) - -/* Index within `registers' of the first byte of the space for - register N. */ -#undef REGISTER_BYTE -#define REGISTER_BYTE(N) \ - ((N < FP0_REGNUM) ? (N * 4) : \ - (((N - FP0_REGNUM) * 10) + 64)) - -/* Number of bytes of storage in the actual machine representation - * for register N. All registers are 4 bytes, except 387 st(0) - st(7), - * which are 80 bits each. - */ -#undef REGISTER_RAW_SIZE -#define REGISTER_RAW_SIZE(N) \ - ((N < FP0_REGNUM) ? 4 : 10) - -/* Largest value REGISTER_RAW_SIZE can have. */ -#undef MAX_REGISTER_RAW_SIZE -#define MAX_REGISTER_RAW_SIZE 10 - /* Nonzero if register N requires conversion from raw format to virtual format. */ -#undef REGISTER_CONVERTIBLE + +#undef REGISTER_CONVERTIBLE #define REGISTER_CONVERTIBLE(N) \ ((N < FP0_REGNUM) ? 0 : 1) @@ -134,30 +64,4 @@ i387_to_double PARAMS ((char *, char *)); extern void double_to_i387 PARAMS ((char *, char *)); -/* Return the GDB type object for the "standard" data type - of data in register N. */ -#undef REGISTER_VIRTUAL_TYPE -#define REGISTER_VIRTUAL_TYPE(N) \ - ((N < FP0_REGNUM) ? builtin_type_int : \ - builtin_type_double) - -/* 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. */ -#undef EXTRACT_RETURN_VALUE -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ - i386_extract_return_value (TYPE,REGBUF,VALBUF) - -/* Write into appropriate registers a function return value - of type TYPE, given in virtual format. */ -#undef STORE_RETURN_VALUE -#define STORE_RETURN_VALUE(TYPE,VALBUF) \ - { \ - if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ - write_register_bytes (REGISTER_BYTE (FP0_REGNUM), (VALBUF), \ - TYPE_LENGTH (TYPE)); \ - else \ - write_register_bytes (0, (VALBUF), TYPE_LENGTH (TYPE)); \ - } - #endif /* TM_I386AIX_H */ diff --git a/gdb/config/i386/tm-i386bsd.h b/gdb/config/i386/tm-i386bsd.h index 6070d30352c..0b0e3d93917 100644 --- a/gdb/config/i386/tm-i386bsd.h +++ b/gdb/config/i386/tm-i386bsd.h @@ -17,60 +17,27 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Override number of expected traps from sysv. */ -#define START_INFERIOR_TRAPS_EXPECTED 2 +#ifndef TM_I386BSD_H +#define TM_I386BSD_H 1 -/* Most definitions from sysv could be used. */ -#include "i386/tm-i386v.h" +#include "i386/tm-i386.h" /* 386BSD cannot handle the segment registers. */ /* BSDI can't handle them either. */ + #undef NUM_REGS #define NUM_REGS 10 /* On 386 bsd, sigtramp is above the user stack and immediately below the user area. Using constants here allows for cross debugging. These are tested for BSDI but should work on 386BSD. */ + #define SIGTRAMP_START 0xfdbfdfc0 #define SIGTRAMP_END 0xfdbfe000 -/* The following redefines make backtracing through sigtramp work. - They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp - from the sigcontext structure which is pushed by the kernel on the - user stack, along with a pointer to it. */ - -/* FRAME_CHAIN takes a frame's nominal address and produces the frame's - chain-pointer. - In the case of the i386, the frame's nominal address - is the address of a 4-byte word containing the calling frame's address. */ -#undef FRAME_CHAIN -#define FRAME_CHAIN(thisframe) \ - (thisframe->signal_handler_caller \ - ? thisframe->frame \ - : (!inside_entry_file ((thisframe)->pc) \ - ? read_memory_integer ((thisframe)->frame, 4) \ - : 0)) - -/* 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. */ -#undef FRAMELESS_FUNCTION_INVOCATION -#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \ - do { \ - if ((FI)->signal_handler_caller) \ - (FRAMELESS) = 0; \ - else \ - (FRAMELESS) = frameless_look_for_prologue(FI); \ - } while (0) - /* Saved Pc. Get it from sigcontext if within sigtramp. */ /* Offset to saved PC in sigcontext, from . */ #define SIGCONTEXT_PC_OFFSET 20 -#undef FRAME_SAVED_PC -#define FRAME_SAVED_PC(FRAME) \ - (((FRAME)->signal_handler_caller \ - ? sigtramp_saved_pc (FRAME) \ - : read_memory_integer ((FRAME)->frame + 4, 4)) \ - ) +#endif /* ifndef TM_I386BSD_H */ diff --git a/gdb/config/i386/tm-i386lynx.h b/gdb/config/i386/tm-i386lynx.h index 20d518a2e66..9e732b32e6b 100644 --- a/gdb/config/i386/tm-i386lynx.h +++ b/gdb/config/i386/tm-i386lynx.h @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "tm-lynx.h" /* Most definitions from sysv could be used. */ -#include "i386/tm-i386v.h" +#include "i386/tm-i386.h" #undef SAVED_PC_AFTER_CALL diff --git a/gdb/config/i386/tm-i386m3.h b/gdb/config/i386/tm-i386m3.h index 338881d82bc..2f97505a19a 100644 --- a/gdb/config/i386/tm-i386m3.h +++ b/gdb/config/i386/tm-i386m3.h @@ -46,7 +46,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define NAMES_HAVE_UNDERSCORE /* Sigh. There should be a file for i386 but no sysv stuff in it */ -#include "i386/tm-i386v.h" +#include "i386/tm-i386.h" /* I want to test this float info code. See comment in tm-i386v.h */ #undef FLOAT_INFO diff --git a/gdb/config/i386/tm-i386nw.h b/gdb/config/i386/tm-i386nw.h index 9bda41f73a7..43a1e1a1496 100644 --- a/gdb/config/i386/tm-i386nw.h +++ b/gdb/config/i386/tm-i386nw.h @@ -17,14 +17,10 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Override number of expected traps from sysv. */ -#define START_INFERIOR_TRAPS_EXPECTED 2 +#ifndef TM_I386NW_H +#define TM_I386NW_H 1 -/* FIXME: tm-i386v.h seems to be used in a lot of target config files as a - generic i386 target config file. The parts that are truely generic should - be extracted out and placed in a tm-i386.h file that all the others, - including tm-i386v.h, includes as needed. */ -#include "i386/tm-i386v.h" +#include "i386/tm-i386.h" /* Stop backtracing when we wander into main. */ @@ -48,3 +44,6 @@ extern int get_longjmp_target PARAMS ((CORE_ADDR *)); #define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR) + +#endif /* ifndef TM_I386NW_H */ + diff --git a/gdb/config/i386/tm-i386os9k.h b/gdb/config/i386/tm-i386os9k.h index ac1468e62db..75de74e0b34 100644 --- a/gdb/config/i386/tm-i386os9k.h +++ b/gdb/config/i386/tm-i386os9k.h @@ -16,20 +16,23 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Override number of expected traps from sysv. */ -#define START_INFERIOR_TRAPS_EXPECTED 2 +#ifndef TM_I386OS9K_H +#define TM_I386OS9K_H 1 -/* Most definitions from sysv could be used. */ -#include "i386/tm-i386v.h" +#include "i386/tm-i386.h" -/* 386BSD cannot handle the segment registers. */ -/* BSDI can't handle them either. */ -#if 0 -#undef NUM_REGS -#define NUM_REGS 10 -#endif 0 +/* Number of machine registers */ -#undef REGISTER_NAMES +#undef NUM_REGS +#define NUM_REGS (16) /* Basic i*86 regs */ + +/* Initializer for an array of names of registers. There should be at least + NUM_REGS strings in this initializer. Any excess ones are simply ignored. + The order of the first 8 registers must match the compiler's numbering + scheme (which is the same as the 386 scheme) and also regmap in the various + *-nat.c files. */ + +#undef REGISTER_NAMES #define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \ "esp", "ebp", "esi", "edi", \ "eip", "eflags", "cs", "ss", \ @@ -37,6 +40,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ } #define DATABASE_REG 3 /* ebx */ + +/* Amount PC must be decremented by after a breakpoint. This is often the + number of bytes in BREAKPOINT but not always (such as now). */ + #undef DECR_PC_AFTER_BREAK #define DECR_PC_AFTER_BREAK 0 @@ -46,45 +53,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define SIGTRAMP_START 0xfdbfdfc0 #define SIGTRAMP_END 0xfdbfe000 -/* The following redefines make backtracing through sigtramp work. - They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp - from the sigcontext structure which is pushed by the kernel on the - user stack, along with a pointer to it. */ - -/* FRAME_CHAIN takes a frame's nominal address and produces the frame's - chain-pointer. - In the case of the i386, the frame's nominal address - is the address of a 4-byte word containing the calling frame's address. */ -#undef FRAME_CHAIN -#define FRAME_CHAIN(thisframe) \ - (thisframe->signal_handler_caller \ - ? thisframe->frame \ - : (!inside_entry_file ((thisframe)->pc) \ - ? read_memory_integer ((thisframe)->frame, 4) \ - : 0)) - -/* 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. */ -#undef FRAMELESS_FUNCTION_INVOCATION -#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \ - do { \ - if ((FI)->signal_handler_caller) \ - (FRAMELESS) = 0; \ - else \ - (FRAMELESS) = frameless_look_for_prologue(FI); \ - } while (0) - /* Saved Pc. Get it from sigcontext if within sigtramp. */ /* Offset to saved PC in sigcontext, from . */ #define SIGCONTEXT_PC_OFFSET 20 -#undef FRAME_SAVED_PC(FRAME) -#define FRAME_SAVED_PC(FRAME) \ - (((FRAME)->signal_handler_caller \ - ? sigtramp_saved_pc (FRAME) \ - : read_memory_integer ((FRAME)->frame + 4, 4)) \ - ) - #define BELIEVE_PCC_PROMOTION 1 + +#endif /* #ifndef TM_I386OS9K_H */ diff --git a/gdb/config/i386/tm-i386v.h b/gdb/config/i386/tm-i386v.h index 17e6ba6d357..235558b78cc 100644 --- a/gdb/config/i386/tm-i386v.h +++ b/gdb/config/i386/tm-i386v.h @@ -17,76 +17,23 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if !defined (TM_I386V_H) +#ifndef TM_I386V_H #define TM_I386V_H 1 -/* - * Changes for 80386 by Pace Willisson (pace@prep.ai.mit.edu) - * July 1988 - */ +/* First pick up the generic *86 target file. */ -#define TARGET_BYTE_ORDER LITTLE_ENDIAN +#include "i386/tm-i386.h" -/* turn this on when rest of gdb is ready */ -#define IEEE_FLOAT +/* Number of traps that happen between exec'ing the shell to run an + inferior, and when we finally get to the inferior code. This is + 2 on most implementations. Override here to 4. */ -/* number of traps that happen between exec'ing the shell - * to run an inferior, and when we finally get to - * the inferior code. This is 2 on most implementations. - */ -#ifndef START_INFERIOR_TRAPS_EXPECTED +#undef START_INFERIOR_TRAPS_EXPECTED #define START_INFERIOR_TRAPS_EXPECTED 4 -#endif - -/* Offset from address of function to start of its code. - Zero on most machines. */ - -#define FUNCTION_START_OFFSET 0 - -/* Advance PC across any function entry prologue instructions - to reach some "real" code. */ - -#define SKIP_PROLOGUE(frompc) {(frompc) = i386_skip_prologue((frompc));} - -extern int -i386_skip_prologue PARAMS ((int)); - -/* Immediately after a function call, return the saved pc. - Can't always go through the frames for this because on some machines - the new frame is not set up until the new function executes - some instructions. */ - -#define SAVED_PC_AFTER_CALL(frame) \ - (read_memory_integer (read_register (SP_REGNUM), 4)) - -/* Stack grows downward. */ - -#define INNER_THAN < - -/* Sequence of bytes for breakpoint instruction. */ - -#define BREAKPOINT {0xcc} - -/* Amount PC must be decremented by after a breakpoint. - This is often the number of bytes in BREAKPOINT - but not always. */ - -#ifndef DECR_PC_AFTER_BREAK -#define DECR_PC_AFTER_BREAK 1 -#endif - -/* Nonzero if instruction at PC is a return instruction. */ - -#define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0xc3) - -/* Say how long (ordinary) registers are. This is a piece of bogosity - used in push_word and a few other places; REGISTER_RAW_SIZE is the - real way to know how big a register is. */ - -#define REGISTER_SIZE 4 /* Number of machine registers */ +#undef NUM_REGS #define NUM_REGS 16 /* Initializer for an array of names of registers. @@ -96,56 +43,54 @@ i386_skip_prologue PARAMS ((int)); * numbering scheme (which is the same as the 386 scheme) * also, this table must match regmap in i386-pinsn.c. */ + +#undef REGISTER_NAMES #define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \ "esp", "ebp", "esi", "edi", \ "eip", "ps", "cs", "ss", \ "ds", "es", "fs", "gs", \ } -/* Register numbers of various important registers. - Note that some of these values are "real" register numbers, - and correspond to the general registers of the machine, - and some are "phony" register numbers which are too large - to be actual register numbers as far as the user is concerned - but do serve to get the desired values when passed to read_register. */ - -#define FP_REGNUM 5 /* Contains address of executing stack frame */ -#define SP_REGNUM 4 /* Contains address of top of stack */ - -#define PC_REGNUM 8 -#define PS_REGNUM 9 - /* Total amount of space needed to store our copies of the machine's register state, the array `registers'. */ + +#undef REGISTER_BYTES #define REGISTER_BYTES (NUM_REGS * 4) /* Index within `registers' of the first byte of the space for register N. */ +#undef REGISTER_BYTE #define REGISTER_BYTE(N) ((N)*4) /* Number of bytes of storage in the actual machine representation for register N. */ +#undef REGISTER_RAW_SIZE #define REGISTER_RAW_SIZE(N) (4) /* Number of bytes of storage in the program's representation for register N. */ +#undef REGISTER_VIRTUAL_SIZE #define REGISTER_VIRTUAL_SIZE(N) (4) /* Largest value REGISTER_RAW_SIZE can have. */ +#undef MAX_REGISTER_RAW_SIZE #define MAX_REGISTER_RAW_SIZE 4 /* Largest value REGISTER_VIRTUAL_SIZE can have. */ +#undef MAX_REGISTER_VIRTUAL_SIZE #define MAX_REGISTER_VIRTUAL_SIZE 4 /* Return the GDB type object for the "standard" data type of data in register N. */ /* Perhaps si and di should go here, but potentially they could be used for things other than address. */ + +#undef REGISTER_VIRTUAL_TYPE #define REGISTER_VIRTUAL_TYPE(N) \ ((N) == PC_REGNUM || (N) == FP_REGNUM || (N) == SP_REGNUM ? \ lookup_pointer_type (builtin_type_void) : builtin_type_int) @@ -153,6 +98,7 @@ i386_skip_prologue PARAMS ((int)); /* Store the address of the place in which to copy the structure the subroutine will return. This is called from call_function. */ +#undef STORE_STRUCT_RETURN #define STORE_STRUCT_RETURN(ADDR, SP) \ { (SP) -= sizeof (ADDR); \ write_memory ((SP), (char *) &(ADDR), sizeof (ADDR)); } @@ -161,21 +107,17 @@ i386_skip_prologue PARAMS ((int)); a function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ +#undef EXTRACT_RETURN_VALUE #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ memcpy ((VALBUF), (REGBUF), TYPE_LENGTH (TYPE)) /* Write into appropriate registers a function return value of type TYPE, given in virtual format. */ +#undef STORE_RETURN_VALUE #define STORE_RETURN_VALUE(TYPE,VALBUF) \ write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)) -/* Extract from an array REGBUF containing the (raw) register state - the address in which a function should return its structure value, - as a CORE_ADDR (or an expression that can be used as one). */ - -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF)) - /* Describe the pointer in each stack frame to the previous stack frame (its caller). */ @@ -183,6 +125,7 @@ i386_skip_prologue PARAMS ((int)); /* FRAME_CHAIN takes a frame's nominal address and produces the frame's chain-pointer. */ +#undef FRAME_CHAIN #define FRAME_CHAIN(thisframe) \ (!inside_entry_file ((thisframe)->pc) ? \ read_memory_integer ((thisframe)->frame, 4) :\ @@ -193,18 +136,18 @@ i386_skip_prologue PARAMS ((int)); /* 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. */ + +#undef FRAMELESS_FUNCTION_INVOCATION #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \ (FRAMELESS) = frameless_look_for_prologue(FI) +#undef FRAME_SAVED_PC #define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4)) -#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) - -#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) - /* Return number of args passed to a frame. Can return -1, meaning no way to tell. */ +#undef FRAME_NUM_ARGS #define FRAME_NUM_ARGS(numargs, fi) (numargs) = -1 #ifdef __STDC__ /* Forward decl's for prototypes */ @@ -215,77 +158,4 @@ struct frame_saved_regs; extern int i386_frame_num_args PARAMS ((struct frame_info *)); -/* Return number of bytes at start of arglist that are not really args. */ - -#define FRAME_ARGS_SKIP 8 - -/* Put here the code to store, into a struct frame_saved_regs, - the addresses of the saved registers of frame described by FRAME_INFO. - This includes special registers such as pc and fp saved in special - ways in the stack frame. sp is even more special: - the address we return for it IS the sp for the next frame. */ - -#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ -{ i386_frame_find_saved_regs ((frame_info), &(frame_saved_regs)); } - -extern void -i386_frame_find_saved_regs PARAMS ((struct frame_info *, - struct frame_saved_regs *)); - - -/* Things needed for making the inferior call functions. */ - -/* Push an empty stack frame, to record the current PC, etc. */ - -#define PUSH_DUMMY_FRAME { i386_push_dummy_frame (); } - -extern void -i386_push_dummy_frame PARAMS ((void)); - -/* Discard from the stack the innermost frame, restoring all registers. */ - -#define POP_FRAME { i386_pop_frame (); } - -extern void -i386_pop_frame PARAMS ((void)); - -/* this is - * call 11223344 (32 bit relative) - * int3 - */ - -#define CALL_DUMMY { 0x223344e8, 0xcc11 } - -#define CALL_DUMMY_LENGTH 8 - -#define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy */ - -#define CALL_DUMMY_BREAKPOINT_OFFSET 5 - -/* 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, pc, fun, nargs, args, type, gcc_p) \ -{ \ - int from, to, delta, loc; \ - loc = (int)(read_register (SP_REGNUM) - CALL_DUMMY_LENGTH); \ - from = loc + 5; \ - to = (int)(fun); \ - delta = to - from; \ - *((char *)(dummyname) + 1) = (delta & 0xff); \ - *((char *)(dummyname) + 2) = ((delta >> 8) & 0xff); \ - *((char *)(dummyname) + 3) = ((delta >> 16) & 0xff); \ - *((char *)(dummyname) + 4) = ((delta >> 24) & 0xff); \ -} - -extern void -print_387_control_word PARAMS ((unsigned int)); - -extern void -print_387_status_word PARAMS ((unsigned int)); - -/* Offset from SP to first arg on stack at first instruction of a function */ - -#define SP_ARG0 (1 * 4) - -#endif /* !defined (TM_I386V_H) */ +#endif /* ifndef TM_I386V_H */ diff --git a/gdb/config/i386/tm-i386v4.h b/gdb/config/i386/tm-i386v4.h index 807fdd11f4d..0a1e56df6f2 100644 --- a/gdb/config/i386/tm-i386v4.h +++ b/gdb/config/i386/tm-i386v4.h @@ -1,6 +1,6 @@ /* Macro definitions for GDB on an Intel i386 running SVR4. Copyright (C) 1991, 1994 Free Software Foundation, Inc. - Written by Fred Fish at Cygnus Support (fnf@cygint) + Written by Fred Fish at Cygnus Support (fnf@cygnus.com) This file is part of GDB. @@ -18,29 +18,20 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Use the alternate method of determining valid frame chains. */ - -#define FRAME_CHAIN_VALID_ALTERNATE - -/* number of traps that happen between exec'ing the shell - * to run an inferior, and when we finally get to - * the inferior code. This is 2 on most implementations. - */ -#define START_INFERIOR_TRAPS_EXPECTED 2 +#ifndef TM_I386V4_H +#define TM_I386V4_H 1 /* Pick up most of what we need from the generic i386 target include file. */ -#include "i386/tm-i386v.h" +#include "i386/tm-i386.h" /* Pick up more stuff from the generic SVR4 host include file. */ #include "tm-sysv4.h" -/* We can't tell how many args there are - now that the C compiler delays popping them. */ +/* Use the alternate method of determining valid frame chains. */ -#undef FRAME_NUM_ARGS -#define FRAME_NUM_ARGS(val,fi) (val = -1) +#define FRAME_CHAIN_VALID_ALTERNATE /* Offsets (in target ints) into jmp_buf. Not defined in any system header file, so we have to step through setjmp/longjmp with a debugger and figure @@ -79,36 +70,9 @@ get_longjmp_target PARAMS ((CORE_ADDR *)); || STREQ ("_sigacthandler", name) \ || STREQ ("sigvechandler", name))) -/* FRAME_CHAIN takes a frame's nominal address and produces the frame's - chain-pointer. - In the case of the i386, the frame's nominal address - is the address of a 4-byte word containing the calling frame's address. */ -#undef FRAME_CHAIN -#define FRAME_CHAIN(thisframe) \ - ((thisframe)->signal_handler_caller \ - ? (thisframe)->frame \ - : (!inside_entry_file ((thisframe)->pc) \ - ? read_memory_integer ((thisframe)->frame, 4) \ - : 0)) - -/* 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. */ -#undef FRAMELESS_FUNCTION_INVOCATION -#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \ - do { \ - if ((FI)->signal_handler_caller) \ - (FRAMELESS) = 0; \ - else \ - (FRAMELESS) = frameless_look_for_prologue(FI); \ - } while (0) - /* Saved Pc. Get it from ucontext if within sigtramp. */ -#undef FRAME_SAVED_PC -#define FRAME_SAVED_PC(FRAME) \ - (((FRAME)->signal_handler_caller \ - ? i386v4_sigtramp_saved_pc (FRAME) \ - : read_memory_integer ((FRAME)->frame + 4, 4)) \ - ) +#define sigtramp_saved_pc i386v4_sigtramp_saved_pc extern CORE_ADDR i386v4_sigtramp_saved_pc PARAMS ((struct frame_info *)); + +#endif /* ifndef TM_I386V4_H */ diff --git a/gdb/config/i386/tm-ptx.h b/gdb/config/i386/tm-ptx.h index 9746eb2dda5..c9f67d7f6d8 100644 --- a/gdb/config/i386/tm-ptx.h +++ b/gdb/config/i386/tm-ptx.h @@ -19,22 +19,13 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef TM_PTX_H +#define TM_PTX_H 1 + /* I don't know if this will work for cross-debugging, even if you do get a copy of the right include file. */ -#include - -/* -#define SDB_REG_TO_REGNUM(value) ptx_coff_regno_to_gdb(value) -extern int ptx_coff_regno_to_gdb(); -*/ - -#define START_INFERIOR_TRAPS_EXPECTED 2 -/* Amount PC must be decremented by after a breakpoint. - This is often the number of bytes in BREAKPOINT - but not always. */ - -#define DECR_PC_AFTER_BREAK 0 +#include #ifdef SEQUENT_PTX4 #include "i386/tm-i386v4.h" @@ -42,6 +33,20 @@ extern int ptx_coff_regno_to_gdb(); #include "i386/tm-i386v.h" #endif +/* Number of traps that happen between exec'ing the shell to run an + inferior, and when we finally get to the inferior code. This is 2 + on most implementations. Here we have to undo what tm-i386v.h gave + us and restore the default. */ + +#undef START_INFERIOR_TRAPS_EXPECTED +#define START_INFERIOR_TRAPS_EXPECTED 2 + +/* Amount PC must be decremented by after a breakpoint. This is often the + number of bytes in BREAKPOINT but not always (such as now). */ + +#undef DECR_PC_AFTER_BREAK +#define DECR_PC_AFTER_BREAK 0 + #if 0 --- this code can't be used unless we know we are running native, since it uses host specific ptrace calls. @@ -52,23 +57,30 @@ extern int ptx_coff_regno_to_gdb(); #endif /* Number of machine registers */ -#undef NUM_REGS + +#undef NUM_REGS #define NUM_REGS 49 -/* Initializer for an array of names of registers. - There should be NUM_REGS strings in this initializer. */ - -#undef REGISTER_NAMES -#define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \ - "esp", "ebp", "esi", "edi", \ - "eip", "eflags", "st0", "st1", "st2", \ - "st3", "st4", "st5", "st6", "st7", \ - "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7", \ - "fp8", "fp9", "fp10", "fp11", "fp12", \ - "fp13", "fp14", "fp15", "fp16", "fp17", \ - "fp18", "fp19", "fp20", "fp21", "fp22", \ - "fp23", "fp24", "fp25", "fp26", "fp27", \ - "fp28", "fp29", "fp30", "fp31" } +/* Initializer for an array of names of registers. There should be at least + NUM_REGS strings in this initializer. Any excess ones are simply ignored. + The order of the first 8 registers must match the compiler's numbering + scheme (which is the same as the 386 scheme) and also regmap in the various + *-nat.c files. */ + +#undef REGISTER_NAMES +#define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \ + "esp", "ebp", "esi", "edi", \ + "eip", "eflags", "st0", "st1", \ + "st2", "st3", "st4", "st5", \ + "st6", "st7", "fp1", "fp2", \ + "fp3", "fp4", "fp5", "fp6", \ + "fp7", "fp8", "fp9", "fp10", \ + "fp11", "fp12", "fp13", "fp14", \ + "fp15", "fp16", "fp17", "fp18", \ + "fp19", "fp20", "fp21", "fp22", \ + "fp23", "fp24", "fp25", "fp26", \ + "fp27", "fp28", "fp29", "fp30", \ + "fp31" } /* Register numbers of various important registers. Note that some of these values are "real" register numbers, @@ -104,13 +116,13 @@ extern int ptx_coff_regno_to_gdb(); #define FP1_REGNUM 18 /* first 1167 register */ /* Get %fp2 - %fp31 by addition, since they are contiguous */ -#undef SP_REGNUM +#undef SP_REGNUM #define SP_REGNUM ESP_REGNUM /* Contains address of top of stack */ -#undef FP_REGNUM +#undef FP_REGNUM #define FP_REGNUM EBP_REGNUM /* Contains address of executing stack frame */ -#undef PC_REGNUM +#undef PC_REGNUM #define PC_REGNUM EIP_REGNUM /* Contains program counter */ -#undef PS_REGNUM +#undef PS_REGNUM #define PS_REGNUM EFLAGS_REGNUM /* Contains processor status */ /* @@ -129,36 +141,34 @@ extern int ptx_coff_regno_to_gdb(); extern int ptx_register_u_addr PARAMS ((int, int)); - /* Total amount of space needed to store our copies of the machine's - register state, the array `registers'. */ -/* 10 i386 registers, 8 i387 registers, and 31 Weitek 1167 registers */ -#undef REGISTER_BYTES + register state, the array `registers'. 10 i*86 registers, 8 i387 + registers, and 31 Weitek 1167 registers */ + +#undef REGISTER_BYTES #define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4)) -/* Index within `registers' of the first byte of the space for - register N. */ +/* Index within `registers' of the first byte of the space for register N. */ -#undef REGISTER_BYTE +#undef REGISTER_BYTE #define REGISTER_BYTE(N) \ -((N < ST0_REGNUM) ? (N * 4) : \ - (N < FP1_REGNUM) ? (40 + ((N - ST0_REGNUM) * 10)) : \ - (40 + 80 + ((N - FP1_REGNUM) * 4))) +(((N) < ST0_REGNUM) ? ((N) * 4) : \ + ((N) < FP1_REGNUM) ? (40 + (((N) - ST0_REGNUM) * 10)) : \ + (40 + 80 + (((N) - FP1_REGNUM) * 4))) -/* Number of bytes of storage in the actual machine representation - * for register N. All registers are 4 bytes, except 387 st(0) - st(7), - * which are 80 bits each. - */ +/* Number of bytes of storage in the actual machine representation for + register N. All registers are 4 bytes, except 387 st(0) - st(7), + which are 80 bits each. */ -#undef REGISTER_RAW_SIZE +#undef REGISTER_RAW_SIZE #define REGISTER_RAW_SIZE(N) \ -((N < ST0_REGNUM) ? 4 : \ - (N < FP1_REGNUM) ? 10 : \ +(((N) < ST0_REGNUM) ? 4 : \ + ((N) < FP1_REGNUM) ? 10 : \ 4) /* Largest value REGISTER_RAW_SIZE can have. */ -#undef MAX_REGISTER_RAW_SIZE +#undef MAX_REGISTER_RAW_SIZE #define MAX_REGISTER_RAW_SIZE 10 /* Nonzero if register N requires conversion @@ -209,24 +219,14 @@ extern const struct floatformat floatformat_i387_ext; /* from floatformat.h */ a function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ -#undef EXTRACT_RETURN_VALUE +#undef EXTRACT_RETURN_VALUE #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ symmetry_extract_return_value(TYPE, REGBUF, VALBUF) - /* - * Removed extra PUSH_DUMMY_FRAME, et al: it was identical to the - * i386-tdep.c version. - */ - -extern void -print_387_control_word PARAMS ((unsigned int)); - -extern void -print_387_status_word PARAMS ((unsigned int)); - -/* -#undef FRAME_FIND_SAVED_REGS +#undef FRAME_FIND_SAVED_REGS #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ { ptx_frame_find_saved_regs((frame_info), &(frame_saved_regs)); } */ + +#endif /* ifndef TM_PTX_H */ diff --git a/gdb/config/i386/tm-sun386.h b/gdb/config/i386/tm-sun386.h index 419944622c8..259fd518238 100644 --- a/gdb/config/i386/tm-sun386.h +++ b/gdb/config/i386/tm-sun386.h @@ -17,7 +17,10 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define TARGET_BYTE_ORDER LITTLE_ENDIAN +#if !defined (TM_SUN386_H) +#define TM_SUN386_H 1 + +#include "i386/tm-i386.h" #ifndef sun386 #define sun386 @@ -38,66 +41,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* sun386 ptrace seems unable to change the frame pointer */ #define PTRACE_FP_BUG -/* Offset from address of function to start of its code. - Zero on most machines. */ - -#define FUNCTION_START_OFFSET 0 - -/* Advance PC across any function entry prologue instructions - to reach some "real" code. */ - -#define SKIP_PROLOGUE(frompc) {(frompc) = i386_skip_prologue((frompc));} - -extern int -i386_skip_prologue PARAMS ((int)); - -/* Immediately after a function call, return the saved pc. - Can't always go through the frames for this because on some machines - the new frame is not set up until the new function executes - some instructions. */ - -#define SAVED_PC_AFTER_CALL(frame) \ - (read_memory_integer (read_register (SP_REGNUM), 4)) - /* Address of end of stack space. */ #define STACK_END_ADDR 0xfc000000 -/* Stack grows downward. */ - -#define INNER_THAN < - -/* Sequence of bytes for breakpoint instruction. */ - -#define BREAKPOINT {0xcc} - -/* Amount PC must be decremented by after a breakpoint. - This is often the number of bytes in BREAKPOINT - but not always. */ - -#define DECR_PC_AFTER_BREAK 1 - -/* Nonzero if instruction at PC is a return instruction. */ - -#define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0xc3) - -/* Say how long (ordinary) registers are. This is a piece of bogosity - used in push_word and a few other places; REGISTER_RAW_SIZE is the - real way to know how big a register is. */ - -#define REGISTER_SIZE 4 - /* Number of machine registers */ +#undef NUM_REGS #define NUM_REGS 35 -/* Initializer for an array of names of registers. - There should be NUM_REGS strings in this initializer. */ +/* Initializer for an array of names of registers. There should be NUM_REGS + strings in this initializer. The order of the first 8 registers must match + the compiler's numbering scheme (which is the same as the 386 scheme) also, + this table must match regmap in i386-pinsn.c. */ -/* the order of the first 8 registers must match the compiler's - * numbering scheme (which is the same as the 386 scheme) - * also, this table must match regmap in i386-pinsn.c. - */ +#undef REGISTER_NAMES #define REGISTER_NAMES { "gs", "fs", "es", "ds", \ "edi", "esi", "ebp", "esp", \ "ebx", "edx", "ecx", "eax", \ @@ -116,20 +74,29 @@ i386_skip_prologue PARAMS ((int)); to be actual register numbers as far as the user is concerned but do serve to get the desired values when passed to read_register. */ -#define FP_REGNUM 6 /* Contains address of executing stack frame */ -#define SP_REGNUM 18 /* Contains address of top of stack */ -#define PS_REGNUM 17 /* Contains processor status */ -#define PC_REGNUM 15 /* Contains program counter */ -#define FP0_REGNUM 20 /* Floating point register 0 */ -#define FPC_REGNUM 28 /* 80387 control register */ +#undef FP_REGNUM +#define FP_REGNUM 6 /* (ebp) Contains address of executing stack frame */ +#undef SP_REGNUM +#define SP_REGNUM 18 /* (usp) Contains address of top of stack */ +#undef PS_REGNUM +#define PS_REGNUM 17 /* (ps) Contains processor status */ +#undef PC_REGNUM +#define PC_REGNUM 15 /* (eip) Contains program counter */ +#undef FP0_REGNUM +#define FP0_REGNUM 20 /* Floating point register 0 */ +#undef FPC_REGNUM +#define FPC_REGNUM 28 /* 80387 control register */ /* Total amount of space needed to store our copies of the machine's register state, the array `registers'. */ + +#undef REGISTER_BYTES #define REGISTER_BYTES (20*4+8*10+7*4) /* Index within `registers' of the first byte of the space for register N. */ +#undef REGISTER_BYTE #define REGISTER_BYTE(N) \ ((N) >= FPC_REGNUM ? (((N) - FPC_REGNUM) * 4) + 160 \ : (N) >= FP0_REGNUM ? (((N) - FP0_REGNUM) * 10) + 80 \ @@ -138,29 +105,25 @@ i386_skip_prologue PARAMS ((int)); /* Number of bytes of storage in the actual machine representation for register N. */ +#undef REGISTER_RAW_SIZE #define REGISTER_RAW_SIZE(N) (((unsigned)((N) - FP0_REGNUM)) < 8 ? 10 : 4) /* Number of bytes of storage in the program's representation for register N. */ +#undef REGISTER_VIRTUAL_SIZE #define REGISTER_VIRTUAL_SIZE(N) (((unsigned)((N) - FP0_REGNUM)) < 8 ? 8 : 4) -/* Largest value REGISTER_RAW_SIZE can have. */ - -#define MAX_REGISTER_RAW_SIZE 10 - -/* Largest value REGISTER_VIRTUAL_SIZE can have. */ - -#define MAX_REGISTER_VIRTUAL_SIZE 8 - /* Nonzero if register N requires conversion from raw format to virtual format. */ +#undef REGISTER_CONVERTIBLE #define REGISTER_CONVERTIBLE(N) (((unsigned)((N) - FP0_REGNUM)) < 8) /* Convert data from raw format for register REGNUM in buffer FROM to virtual format with type TYPE in buffer TO. */ +#undef REGISTER_CONVERT_TO_VIRTUAL #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \ { \ double val; \ @@ -173,6 +136,7 @@ i387_to_double PARAMS ((char *, char *)); /* Convert data from virtual format with type TYPE in buffer FROM to raw format for register REGNUM in buffer TO. */ +#undef REGISTER_CONVERT_TO_RAW #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \ { \ double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \ @@ -184,41 +148,32 @@ double_to_i387 PARAMS ((char *, char *)); /* Return the GDB type object for the "standard" data type of data in register N. */ +#undef REGISTER_VIRTUAL_TYPE #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) \ - { (SP) -= sizeof (ADDR); \ - write_memory ((SP), &(ADDR), sizeof (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. */ +#undef EXTRACT_RETURN_VALUE #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ memcpy (VALBUF, REGBUF + REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 11), TYPE_LENGTH (TYPE)) /* Write into appropriate registers a function return value of type TYPE, given in virtual format. */ +#undef STORE_RETURN_VALUE #define STORE_RETURN_VALUE(TYPE,VALBUF) \ write_register_bytes (REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 11), VALBUF, TYPE_LENGTH (TYPE)) -/* Extract from an array REGBUF containing the (raw) register state - the address in which a function should return its structure value, - as a CORE_ADDR (or an expression that can be used as one). */ - -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF)) - /* 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. */ +#undef FRAME_CHAIN #define FRAME_CHAIN(thisframe) \ (!inside_entry_file ((thisframe)->pc) ? \ read_memory_integer ((thisframe)->frame, 4) :\ @@ -229,77 +184,22 @@ double_to_i387 PARAMS ((char *, char *)); /* 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. */ + +#undef FRAMELESS_FUNCTION_INVOCATION #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \ { (FRAMELESS) = frameless_look_for_prologue (FI); } +#undef FRAME_SAVED_PC #define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4)) -#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) - -#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) - -/* Return number of args passed to a frame. - Can return -1, meaning no way to tell. */ - -#define FRAME_NUM_ARGS(numargs, fi) (numargs) = i386_frame_num_args(fi) - -#ifdef __STDC__ /* Forward decl's for prototypes */ -struct frame_info; -struct frame_saved_regs; -#endif - -extern int -i386_frame_num_args PARAMS ((struct frame_info *)); - -/* Return number of bytes at start of arglist that are not really args. */ - -#define FRAME_ARGS_SKIP 8 - -/* Put here the code to store, into a struct frame_saved_regs, - the addresses of the saved registers of frame described by FRAME_INFO. - This includes special registers such as pc and fp saved in special - ways in the stack frame. sp is even more special: - the address we return for it IS the sp for the next frame. */ - -#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ -{ i386_frame_find_saved_regs ((frame_info), &(frame_saved_regs)); } - -extern void -i386_frame_find_saved_regs PARAMS ((struct frame_info *, - struct frame_saved_regs *)); - - -/* Things needed for making the inferior call functions. */ - -/* Push an empty stack frame, to record the current PC, etc. */ - -#define PUSH_DUMMY_FRAME { i386_push_dummy_frame (); } - -extern void -i386_push_dummy_frame PARAMS ((void)); - -/* Discard from the stack the innermost frame, restoring all registers. */ - -#define POP_FRAME { i386_pop_frame (); } - -extern void -i386_pop_frame PARAMS ((void)); - -/* this is - * call 11223344 (32 bit relative) - * int3 - */ - -#define CALL_DUMMY { 0x223344e8, 0xcc11 } - -#define CALL_DUMMY_LENGTH 8 - -#define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy */ - /* Insert the specified number of args and function address into a call sequence of the above form stored at DUMMYNAME. */ +#undef FIX_CALL_DUMMY #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ { \ *(int *)((char *)(dummyname) + 1) = (int)(fun) - (pc) - 5; \ } + +#endif /* !defined (TM_SUN386_H) */ + diff --git a/gdb/config/i386/tm-symmetry.h b/gdb/config/i386/tm-symmetry.h index b66b19380fb..11931d41724 100644 --- a/gdb/config/i386/tm-symmetry.h +++ b/gdb/config/i386/tm-symmetry.h @@ -20,20 +20,24 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef TM_SYMMETRY_H +#define TM_SYMMETRY_H 1 + /* I don't know if this will work for cross-debugging, even if you do get a copy of the right include file. */ #include +#include "i386/tm-i386v.h" + +#undef START_INFERIOR_TRAPS_EXPECTED #define START_INFERIOR_TRAPS_EXPECTED 2 -/* Amount PC must be decremented by after a breakpoint. - This is often the number of bytes in BREAKPOINT - but not always. */ +/* Amount PC must be decremented by after a breakpoint. This is often the + number of bytes in BREAKPOINT but not always (such as now). */ +#undef DECR_PC_AFTER_BREAK #define DECR_PC_AFTER_BREAK 0 -#include "i386/tm-i386v.h" - #if 0 /* --- this code can't be used unless we know we are running native, since it uses host specific ptrace calls. */ @@ -44,29 +48,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #endif /* Number of machine registers */ + #undef NUM_REGS #define NUM_REGS 49 /* Initializer for an array of names of registers. There should be NUM_REGS strings in this initializer. */ -/* Symmetry registers are in this weird order to match the register - numbers in the symbol table entries. If you change the order, - things will probably break mysteriously for no apparent reason. - Also note that the st(0)...st(7) 387 registers are represented as - st0...st7. */ - -#undef REGISTER_NAMES -#define REGISTER_NAMES { "eax", "edx", "ecx", "st0", "st1", \ - "ebx", "esi", "edi", "st2", "st3", \ - "st4", "st5", "st6", "st7", "esp", \ - "ebp", "eip", "eflags", "fp1", "fp2", \ - "fp3", "fp4", "fp5", "fp6", "fp7", \ - "fp8", "fp9", "fp10", "fp11", "fp12", \ - "fp13", "fp14", "fp15", "fp16", "fp17", \ - "fp18", "fp19", "fp20", "fp21", "fp22", \ - "fp23", "fp24", "fp25", "fp26", "fp27", \ - "fp28", "fp29", "fp30", "fp31" } +/* Initializer for an array of names of registers. There should be at least + NUM_REGS strings in this initializer. Any excess ones are simply ignored. + Symmetry registers are in this weird order to match the register numbers + in the symbol table entries. If you change the order, things will probably + break mysteriously for no apparent reason. Also note that the st(0)... + st(7) 387 registers are represented as st0...st7. */ + +#undef REGISTER_NAMES +#define REGISTER_NAMES { "eax", "edx", "ecx", "st0", "st1", \ + "ebx", "esi", "edi", "st2", "st3", \ + "st4", "st5", "st6", "st7", "esp", \ + "ebp", "eip", "eflags","fp1", "fp2", \ + "fp3", "fp4", "fp5", "fp6", "fp7", \ + "fp8", "fp9", "fp10", "fp11", "fp12", \ + "fp13", "fp14", "fp15", "fp16", "fp17", \ + "fp18", "fp19", "fp20", "fp21", "fp22", \ + "fp23", "fp24", "fp25", "fp26", "fp27", \ + "fp28", "fp29", "fp30", "fp31" } /* Register numbers of various important registers. Note that some of these values are "real" register numbers, @@ -94,17 +100,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define FP1_REGNUM 18 /* first 1167 register */ /* Get %fp2 - %fp31 by addition, since they are contiguous */ -#undef SP_REGNUM -#define SP_REGNUM 14 /* esp--Contains address of top of stack */ +#undef SP_REGNUM +#define SP_REGNUM 14 /* (usp) Contains address of top of stack */ #define ESP_REGNUM 14 -#undef FP_REGNUM -#define FP_REGNUM 15 /* ebp--Contains address of executing stack frame */ +#undef FP_REGNUM +#define FP_REGNUM 15 /* (ebp) Contains address of executing stack frame */ #define EBP_REGNUM 15 -#undef PC_REGNUM -#define PC_REGNUM 16 /* eip--Contains program counter */ +#undef PC_REGNUM +#define PC_REGNUM 16 /* (eip) Contains program counter */ #define EIP_REGNUM 16 -#undef PS_REGNUM -#define PS_REGNUM 17 /* eflags--Contains processor status */ +#undef PS_REGNUM +#define PS_REGNUM 17 /* (ps) Contains processor status */ #define EFLAGS_REGNUM 17 /* @@ -209,49 +215,45 @@ switch (regno) { \ } /* Total amount of space needed to store our copies of the machine's - register state, the array `registers'. */ -/* 10 i386 registers, 8 i387 registers, and 31 Weitek 1167 registers */ -#undef REGISTER_BYTES + register state, the array `registers'. 10 i*86 registers, 8 i387 + registers, and 31 Weitek 1167 registers */ + +#undef REGISTER_BYTES #define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4)) /* Index within `registers' of the first byte of the space for register N. */ -#undef REGISTER_BYTE +#undef REGISTER_BYTE #define REGISTER_BYTE(N) \ -((N < 3) ? (N * 4) : \ -(N < 5) ? (((N - 2) * 10) + 2) : \ -(N < 8) ? (((N - 5) * 4) + 32) : \ -(N < 14) ? (((N - 8) * 10) + 44) : \ - (((N - 14) * 4) + 104)) +(((N) < 3) ? ((N) * 4) : \ +((N) < 5) ? ((((N) - 2) * 10) + 2) : \ +((N) < 8) ? ((((N) - 5) * 4) + 32) : \ +((N) < 14) ? ((((N) - 8) * 10) + 44) : \ + ((((N) - 14) * 4) + 104)) /* Number of bytes of storage in the actual machine representation * for register N. All registers are 4 bytes, except 387 st(0) - st(7), * which are 80 bits each. */ -#undef REGISTER_RAW_SIZE +#undef REGISTER_RAW_SIZE #define REGISTER_RAW_SIZE(N) \ -((N < 3) ? 4 : \ -(N < 5) ? 10 : \ -(N < 8) ? 4 : \ -(N < 14) ? 10 : \ +(((N) < 3) ? 4 : \ +((N) < 5) ? 10 : \ +((N) < 8) ? 4 : \ +((N) < 14) ? 10 : \ 4) -/* Largest value REGISTER_RAW_SIZE can have. */ - -#undef MAX_REGISTER_RAW_SIZE -#define MAX_REGISTER_RAW_SIZE 10 - /* Nonzero if register N requires conversion from raw format to virtual format. */ -#undef REGISTER_CONVERTIBLE +#undef REGISTER_CONVERTIBLE #define REGISTER_CONVERTIBLE(N) \ -((N < 3) ? 0 : \ -(N < 5) ? 1 : \ -(N < 8) ? 0 : \ -(N < 14) ? 1 : \ +(((N) < 3) ? 0 : \ +((N) < 5) ? 1 : \ +((N) < 8) ? 0 : \ +((N) < 14) ? 1 : \ 0) #include "floatformat.h" @@ -294,24 +296,17 @@ switch (regno) { \ passes it on the stack. gcc should be fixed in future versions to adopt native cc conventions. */ -#undef STORE_STRUCT_RETURN +#undef STORE_STRUCT_RETURN #define STORE_STRUCT_RETURN(ADDR, SP) write_register(0, (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. */ -#undef EXTRACT_RETURN_VALUE +#undef EXTRACT_RETURN_VALUE #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ symmetry_extract_return_value(TYPE, REGBUF, VALBUF) - -extern void -print_387_control_word PARAMS ((unsigned int)); - -extern void -print_387_status_word PARAMS ((unsigned int)); - /* The following redefines make backtracing through sigtramp work. They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp from the sigcontext structure which is pushed by the kernel on the @@ -322,35 +317,5 @@ print_387_status_word PARAMS ((unsigned int)); /* Offset to saved PC in sigcontext, from . */ #define SIGCONTEXT_PC_OFFSET 16 -/* FRAME_CHAIN takes a frame's nominal address and produces the frame's - chain-pointer. - In the case of the i386, the frame's nominal address - is the address of a 4-byte word containing the calling frame's address. */ -#undef FRAME_CHAIN -#define FRAME_CHAIN(thisframe) \ - (thisframe->signal_handler_caller \ - ? thisframe->frame \ - : (!inside_entry_file ((thisframe)->pc) \ - ? read_memory_integer ((thisframe)->frame, 4) \ - : 0)) - -/* 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. */ -#undef FRAMELESS_FUNCTION_INVOCATION -#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \ - do { \ - if ((FI)->signal_handler_caller) \ - (FRAMELESS) = 0; \ - else \ - (FRAMELESS) = frameless_look_for_prologue(FI); \ - } while (0) - -/* Saved Pc. Get it from sigcontext if within sigtramp. */ - -#undef FRAME_SAVED_PC -#define FRAME_SAVED_PC(FRAME) \ - (((FRAME)->signal_handler_caller \ - ? sigtramp_saved_pc (FRAME) \ - : read_memory_integer ((FRAME)->frame + 4, 4)) \ - ) +#endif /* ifndef TM_SYMMETRY_H */ +