This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: i386: Are we settled?
- To: Eli Zaretskii <eliz at gnu dot org>
- Subject: Re: i386: Are we settled?
- From: Jim Blandy <jimb at cygnus dot com>
- Date: 15 Nov 1999 19:05:40 -0500
- Cc: dj at delorie dot com, gdb-patches at sourceware dot cygnus dot com
- References: <199911090018.TAA12933@zwingli.cygnus.com><199911102234.RAA01359@mescaline.gnu.org>
I've applied these. They only affect DJGPP files, so I've applied
them without testing them. Please let me know if you find any problems.
Thanks, Eli!
> These are the patches for go32-specific config files following the new
> tm-i386.h.
>
> --- gdb/config/i386/tm-go32.h~1 Wed Jul 7 20:13:00 1999
> +++ gdb/config/i386/tm-go32.h Wed Nov 10 18:08:46 1999
> @@ -18,108 +18,10 @@
> Foundation, Inc., 59 Temple Place - Suite 330,
> Boston, MA 02111-1307, USA. */
>
> -#include "i386/tm-i386v.h"
> +#undef HAVE_SSE_REGS /* FIXME! go32-nat.c needs to support XMMi registers */
> +#define HAVE_I387_REGS
>
> -/* Number of machine registers. */
> -
> -#undef NUM_FREGS
> -#define NUM_FREGS 15
> -#undef NUM_REGS
> -#define NUM_REGS (16+NUM_FREGS)
> -
> -/* 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). */
> -
> -#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", \
> - "fctrl","fstat", "ftag", "fcs", \
> - "fopsel","fip", "fopoff" }
> -
> -#undef FP_REGNUM
> -#define FP_REGNUM 5 /* (ebp) Contains addr of stack frame */
> -#undef SP_REGNUM
> -#define SP_REGNUM 4 /* (usp) Contains address of top of stack */
> -#undef PS_REGNUM
> -#define PS_REGNUM 9 /* (ps) Contains processor status */
> -#undef PC_REGNUM
> -#define PC_REGNUM 8 /* (eip) Contains program counter */
> -#undef FP0_REGNUM
> -#define FP0_REGNUM 16 /* Floating point register 0 */
> -#undef FPC_REGNUM
> -#define FPC_REGNUM 24 /* 80387 control register */
> -#undef FPCWD_REGNUM
> -#define FPCWD_REGNUM FPC_REGNUM
> -#undef FPSWD_REGNUM
> -#define FPSWD_REGNUM 25 /* 80387 status register */
> -#undef FPTWD_REGNUM
> -#define FPTWD_REGNUM 26 /* 80387 tag register */
> -#undef FPIPO_REGNUM
> -#define FPIPO_REGNUM 29 /* 80387 instruction pointer offset reg */
> -#undef FPIPS_REGNUM
> -#define FPIPS_REGNUM 27 /* 80387 instruction pointer selector reg */
> -#undef FPOOS_REGNUM
> -#define FPOOS_REGNUM 30 /* 80387 operand pointer offset reg */
> -#undef FPOPS_REGNUM
> -#define FPOPS_REGNUM 28 /* 80387 operand pointer selector reg */
> -
> -/* Total amount of space needed to store our copies of the machine's
> - register state, the array `registers'. */
> -
> -#undef REGISTER_BYTES
> -#define REGISTER_BYTES (10*4 + 6*2 + 8*10 + 5*2 + 2*4)
> -
> -/* Index within `registers' of the first byte of the space for
> - register N. */
> -
> -#undef REGISTER_BYTE
> -#define REGBYTE_0 0
> -#define REGBYTE_10 (REGBYTE_0+10*4)
> -#define REGBYTE_16 (REGBYTE_10+6*2)
> -#define REGBYTE_24 (REGBYTE_16+8*10)
> -#define REGBYTE_29 (REGBYTE_24+5*2)
> -#define REGISTER_BYTE(N) (((N) < 10) ? (N) * 4 : \
> - (N) < 16 ? REGBYTE_10 +((N) - 10) * 2 : \
> - (N) < 24 ? REGBYTE_16 +((N) - 16) * 10 : \
> - (N) < 29 ? REGBYTE_24 +((N) - 24) * 2 : \
> - REGBYTE_29 + ((N) - 29) * 4)
> -
> -/* Number of bytes of storage in the actual machine representation
> - for register N. */
> -
> -#undef REGISTER_RAW_SIZE
> -#define REGISTER_RAW_SIZE(N) ((N) < 10 ? 4 : (N) < 16 ? 2 : (N) < 24 ? 10 : \
> - (N) < 29 ? 2 : 4)
> -
> -/* Number of bytes of storage in the program's representation
> - for register N. */
> -
> -#undef REGISTER_VIRTUAL_SIZE
> -#define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N)
> -
> -/* Largest value REGISTER_RAW_SIZE can have. */
> -
> -#undef MAX_REGISTER_RAW_SIZE
> -#define MAX_REGISTER_RAW_SIZE 10
> -
> -/* Largest value REGISTER_VIRTUAL_SIZE can have. */
> -
> -#undef MAX_REGISTER_VIRTUAL_SIZE
> -#define MAX_REGISTER_VIRTUAL_SIZE 10
> -
> -/* Nonzero if register N requires conversion
> - from raw format to virtual format. */
> -
> -#undef REGISTER_CONVERTIBLE
> -#define REGISTER_CONVERTIBLE(N) ((N) < FP0_REGNUM ? 0 :\
> - (N) < FPC_REGNUM ? 1 : 0)
> +#include "i386/tm-i386.h"
>
> /* The host and target are i386 machines and the compiler supports
> long doubles. Long doubles on the host therefore have the same
> @@ -142,70 +44,34 @@
>
> extern int i387_hex_long_double_input (char *p, long double *putithere);
>
> +#ifdef LD_I387 /* otherwise, definitions from tm-i386.h are good enough */
> +
> #undef REGISTER_CONVERT_TO_VIRTUAL
> -#ifdef LD_I387
> -#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
> -{ \
> - if (TYPE == REGISTER_VIRTUAL_TYPE (REGNUM)) \
> - { \
> - memcpy (TO, FROM, TYPE_LENGTH (TYPE)); \
> - } \
> - else \
> - { \
> - long double val = *((long double *)FROM); \
> - store_floating ((TO), TYPE_LENGTH (TYPE), val); \
> - } \
> +#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
> +{ \
> + long double val = *((long double *)(FROM)); \
> + store_floating ((TO), TYPE_LENGTH (TYPE), val); \
> }
> -#else
> -/* Convert data from raw format for register REGNUM in buffer FROM to
> - virtual format with type TYPE in buffer TO. */
> -#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
> -{ \
> - double val; \
> - i387_to_double ((FROM), (char *)&val); \
> - store_floating ((TO), TYPE_LENGTH (TYPE), val); \
> -}
> -#endif
> -
> -extern void i387_to_double PARAMS ((char *, char *));
>
> #undef REGISTER_CONVERT_TO_RAW
> -#ifdef LD_I387
> -#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
> -{ \
> - if (TYPE == REGISTER_VIRTUAL_TYPE (REGNUM)) \
> - { \
> - memcpy (TO, FROM, TYPE_LENGTH (TYPE)); \
> - } \
> - else \
> - { \
> - long double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
> - *((long double *)TO) = val; \
> - } \
> -}
> -#else
> -#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
> -{ \
> - double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
> - double_to_i387((char *)&val, (TO)); \
> +#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
> +{ \
> + long double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
> + *((long double *)(TO)) = val; \
> }
> -#endif
>
> -extern void double_to_i387 PARAMS ((char *, char *));
> +/* 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) \
> + : IS_FP_REGNUM(N) ? builtin_type_long_double \
> + : IS_SSE_REGNUM(N) ? builtin_type_v4sf \
> + : builtin_type_int)
>
> -/* Return the GDB type object for the "standard" data type of data in
> - register N. */
> -
> -#undef REGISTER_VIRTUAL_TYPE
> -#ifdef LD_I387
> -#define REGISTER_VIRTUAL_TYPE(N) \
> - ((N < FP0_REGNUM) ? builtin_type_int : \
> - (N < FPC_REGNUM) ? builtin_type_long_double : builtin_type_int)
> -#else
> -#define REGISTER_VIRTUAL_TYPE(N) \
> - ((N < FP0_REGNUM) ? builtin_type_int : \
> - (N < FPC_REGNUM) ? builtin_type_double : builtin_type_int)
> -#endif
> +#endif /* LD_I387 */
>
> #undef TARGET_LONG_DOUBLE_BIT
> #define TARGET_LONG_DOUBLE_BIT 96
> --- gdb/config/i386/xm-go32.h~1 Mon Apr 26 18:26:22 1999
> +++ gdb/config/i386/xm-go32.h Wed Aug 18 08:30:52 1999
> @@ -25,7 +25,7 @@
>
> #define SLASH_P(X) ((X)=='\\' || (X) == '/')
>
> -#define ROOTED_P(X) ((SLASH_P((X)[0]))|| ((X)[1] ==':'))
> +#define ROOTED_P(X) ((SLASH_P((X)[0])) || ((X)[0] && (X)[1] ==':'))
>
> #define SLASH_CHAR '/'
> #define SLASH_STRING "/"
> --- gdb/config/i386/nm-go32.h~1 Sun Aug 8 12:41:38 1999
> +++ gdb/config/i386/nm-go32.h Sat Aug 14 14:59:08 1999
> @@ -24,8 +23,31 @@
>
> #define TARGET_HAS_HARDWARE_WATCHPOINTS
>
> +/* Returns the number of hardware watchpoints of type TYPE that we can
> + set. Value is positive if we can set CNT watchpoints, zero if
> + setting watchpoints of type TYPE is not supported, and negative if
> + CNT is more than the maximum number of watchpoints of type TYPE
> + that we can support. TYPE is one of bp_hardware_watchpoint,
> + bp_read_watchpoint, bp_write_watchpoint, or bp_hardware_breakpoint.
> + CNT is the number of such watchpoints used so far (including this
> + one). OTHERTYPE is non-zero if other types of watchpoints are
> + currently enabled.
> +
> + We always return 1 here because we don't have enough information
> + about possible overlap of addresses that they want to watch. As
> + an extreme example, consider the case where all the watchpoints
> + watch the same address and the same region length: then we can
> + handle a virtually unlimited number of watchpoints, due to debug
> + register sharing implemented via reference counts in go32-nat.c. */
> +
> #define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1
>
> +/* Returns non-zero if we can use hardware watchpoints to watch a region
> + whose address is ADDR and whose length is LEN. */
> +
> +#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr,len) \
> + go32_region_ok_for_watchpoint(addr,len)
> +
> /* After a watchpoint trap, the PC points to the instruction after the
> one that caused the trap. Therefore we don't need to step over it.
> But we do need to reset the status register to avoid another trap. */
> @@ -33,19 +55,22 @@
> #define HAVE_CONTINUABLE_WATCHPOINT
>
> #define STOPPED_BY_WATCHPOINT(W) \
> - go32_stopped_by_watchpoint (inferior_pid)
> + go32_stopped_by_watchpoint (inferior_pid, 0)
> +
> +#define target_stopped_data_address() \
> + go32_stopped_by_watchpoint (inferior_pid, 1)
>
> /* Use these macros for watchpoint insertion/removal. */
>
> #define target_insert_watchpoint(addr, len, type) \
> - go32_insert_watchpoint (inferior_pid, addr, len, 2)
> + go32_insert_watchpoint (inferior_pid, addr, len, type)
>
> #define target_remove_watchpoint(addr, len, type) \
> - go32_remove_watchpoint (inferior_pid, addr, len)
> + go32_remove_watchpoint (inferior_pid, addr, len, type)
>
> #define target_insert_hw_breakpoint(addr, shadow) \
> go32_insert_hw_breakpoint(addr, shadow)
> -
> +
> #define target_remove_hw_breakpoint(addr, shadow) \
> go32_remove_hw_breakpoint(addr, shadow)
>
> @@ -55,3 +80,4 @@
> #define FLOAT_INFO { i386_go32_float_info (); }
>
> extern void i386_go32_float_info (void);
> +
>