OSDN Git Service

Bring COERCE_FLOAT_TO_DOUBLE under gdbarch's control.
authorjimb <jimb>
Tue, 22 Feb 2000 19:17:47 +0000 (19:17 +0000)
committerjimb <jimb>
Tue, 22 Feb 2000 19:17:47 +0000 (19:17 +0000)
* valops.c (COERCE_FLOAT_TO_DOUBLE): Rework definition to be
more function-like.
(default_coerce_float_to_double, standard_coerce_float_to_double):
New functions.
(value_arg_coerce): Adjust for new definition.
* value.h (default_coerce_float_to_double,
standard_coerce_float_to_double): New declarations for the above.
* gdbarch.sh (coerce_float_to_double): New entry, replacing macro.
* gdbarch.c, gdbarch.h: Regenerated.
* tm-alpha.h, tm-fr30.h, tm-m32r.h, tm-mips.h, tm-hppa.h,
tm-rs6000.h, tm-sh.h, tm-sparc.h (COERCE_FLOAT_TO_DOUBLE): Change
definitions.
* mips-tdep.c (mips_coerce_float_to_double): Supply our own custom
function here.
(mips_gdbarch_init): Install that as our coerce_float_to_double
function.

gdb/config/fr30/tm-fr30.h
gdb/config/m32r/tm-m32r.h

index ea32792..d289f6e 100644 (file)
@@ -1,20 +1,22 @@
 /* Parameters for execution on a Fujitsu FR30 processor.
+   Copyright 1999, Free Software Foundation, Inc.
 
-This file is part of GDB.
+   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 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.
+   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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   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 FR30_GENREGS           16
 #define FR30_DEDICATEDREGS     8
@@ -83,7 +85,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #define REGISTER_RAW_SIZE(N) FR30_REGSIZE
 
 /* Largest value REGISTER_RAW_SIZE can have.  */
-#define MAX_REGISTER_RAW_SIZE FR30_REGSIZE 
+#define MAX_REGISTER_RAW_SIZE FR30_REGSIZE
 
 /* Number of bytes of storage in the program's representation
    for register N.  */
@@ -95,7 +97,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 extern void fr30_pop_frame PARAMS ((void));
 #define POP_FRAME fr30_pop_frame()
 
-#define USE_GENERIC_DUMMY_FRAMES
+#define USE_GENERIC_DUMMY_FRAMES 1
 #define CALL_DUMMY                   {0}
 #define CALL_DUMMY_START_OFFSET      (0)
 #define CALL_DUMMY_BREAKPOINT_OFFSET (0)
@@ -129,19 +131,18 @@ extern void fr30_pop_frame PARAMS ((void));
 #define STORE_STRUCT_RETURN(ADDR, SP) \
   { write_register (RETVAL_REG, (ADDR)); }
 
-#define FRAME_ARGS_ADDRESS(fi) (fi->frame)
+#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 = -1)
+#define FRAME_NUM_ARGS(fi) (-1)
 
-#ifdef __STDC__                /* Forward decls for prototypes */
+/* Forward decls for prototypes */
 struct frame_info;
 struct frame_saved_regs;
 struct type;
 struct value;
-#endif
 
 #define EXTRA_FRAME_INFO \
   struct frame_saved_regs fsr;  \
@@ -149,22 +150,25 @@ struct value;
   int frameoffset;             \
   int framereg;
 
-extern CORE_ADDR fr30_frame_chain PARAMS ((struct frame_info *fi));
+extern CORE_ADDR fr30_frame_chain PARAMS ((struct frame_info * fi));
 #define FRAME_CHAIN(fi) fr30_frame_chain (fi)
 
-extern CORE_ADDR fr30_frame_saved_pc   PARAMS ((struct frame_info *));
+extern CORE_ADDR fr30_frame_saved_pc PARAMS ((struct frame_info *));
 #define FRAME_SAVED_PC(fi) (fr30_frame_saved_pc (fi))
 
 #define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
 
 extern CORE_ADDR fr30_skip_prologue PARAMS ((CORE_ADDR pc));
-#define SKIP_PROLOGUE(pc) pc = fr30_skip_prologue (pc)
+#define SKIP_PROLOGUE(pc) (fr30_skip_prologue (pc))
 
-/* Write into appropriate registers a function return value
-   of type TYPE, given in virtual format.  */
+/* Write into appropriate registers a function return value of type
+   TYPE, given in virtual format.  VALBUF is in the target byte order;
+   it's typically the VALUE_CONTENTS of some struct value, and those
+   are in the target's byte order.  */
+extern void fr30_store_return_value PARAMS ((struct type * type, char *valbuf));
 
 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
-    write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
+  (fr30_store_return_value ((TYPE), (VALBUF)))
 
 /* Put here the code to store, into a struct frame_saved_regs,
    the addresses of the saved registers of frame described by FRAME_INFO.
@@ -186,32 +190,24 @@ extern CORE_ADDR fr30_skip_prologue PARAMS ((CORE_ADDR pc));
 
 /* Define other aspects of the stack frame.  */
 
-/* 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) \
-{                                                      \
-  CORE_ADDR func_start, after_prologue;                        \
-  func_start = (get_pc_function_start ((FI)->pc) +     \
-               FUNCTION_START_OFFSET);                 \
-  after_prologue = func_start;                         \
-  SKIP_PROLOGUE (after_prologue);                      \
-  (FRAMELESS) = (after_prologue == func_start);                \
-}
-
-extern void fr30_init_extra_frame_info PARAMS ((struct frame_info *fi));
+/* An expression that tells us whether the function invocation represented
+   by FI does not have a frame on the stack associated with it.  */
+extern int fr30_frameless_function_invocation PARAMS ((struct frame_info * frame));
+#define FRAMELESS_FUNCTION_INVOCATION(FI) (fr30_frameless_function_invocation (FI));
+
+extern void fr30_init_extra_frame_info PARAMS ((struct frame_info * fi));
 #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) fr30_init_extra_frame_info (fi)
 
-#define FRAME_CHAIN_VALID(FP, FI)      generic_frame_chain_valid (FP, FI)
+#define FRAME_CHAIN_VALID(FP, FI)      generic_file_frame_chain_valid (FP, FI)
 
 extern CORE_ADDR
-fr30_push_arguments PARAMS ((int nargs, struct value **args, CORE_ADDR sp,
-                            int struct_return,
-                            CORE_ADDR struct_addr));
+  fr30_push_arguments PARAMS ((int nargs, struct value ** args, CORE_ADDR sp,
+                              int struct_return,
+                              CORE_ADDR struct_addr));
 #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
-  (SP) = fr30_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)
+  (fr30_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
 
-#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP)
+#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
 
 /* Fujitsu's ABI requires all structs to be passed using a pointer.
    That is obviously not very efficient, so I am leaving the definitions
@@ -230,3 +226,12 @@ fr30_push_arguments PARAMS ((int nargs, struct value **args, CORE_ADDR sp,
 #endif
 /* alway return struct by value by input pointer */
 #define USE_STRUCT_CONVENTION(GCC_P, TYPE)     1
+
+/* The stack should always be aligned on a four-word boundary.  */
+#define STACK_ALIGN(len) (((len) + 3) & ~3)
+
+/* I think the comment about this in value_arg_coerce is wrong; this
+   should be true on any system where you can rely on the prototyping
+   information.  When this is true, value_arg_coerce will promote
+   floats to doubles iff the function is not prototyped.  */
+#define COERCE_FLOAT_TO_DOUBLE(formal, actual) (1)
index 8273b4e..a68720a 100644 (file)
@@ -1,21 +1,22 @@
 /* Parameters for execution on a Mitsubishi m32r processor.
    Copyright 1996, 1997 Free Software Foundation, Inc. 
 
-This file is part of GDB.
+   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 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.
+   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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   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.  */
 
 /* Used by mswin.  */
 #define TARGET_M32R 1
@@ -88,12 +89,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 /* mvs_check  SAVED_PC_AFTER_CALL */
 #define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
 
-#ifdef __STDC__
 struct frame_info;
 struct frame_saved_regs;
 struct type;
 struct value;
-#endif
 
 /* Define other aspects of the stack frame. 
    We keep the offsets of all saved registers, 'cause we need 'em a lot!
@@ -108,15 +107,15 @@ struct value;
   int using_frame_pointer;
 
 
-extern void m32r_init_extra_frame_info PARAMS ((struct frame_info *fi));
+extern void m32r_init_extra_frame_info PARAMS ((struct frame_info * fi));
 /* mvs_check  INIT_EXTRA_FRAME_INFO */
 #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) m32r_init_extra_frame_info (fi)
 /* mvs_no_check  INIT_FRAME_PC */
 #define INIT_FRAME_PC          /* Not necessary */
 
-extern void 
-m32r_frame_find_saved_regs PARAMS ((struct frame_info *fi, 
-                                   struct frame_saved_regs *regaddr));
+extern void
+m32r_frame_find_saved_regs PARAMS ((struct frame_info * fi,
+                                   struct frame_saved_regs * regaddr));
 
 /* Put here the code to store, into a struct frame_saved_regs,
    the addresses of the saved registers of frame described by FRAME_INFO.
@@ -128,15 +127,15 @@ m32r_frame_find_saved_regs PARAMS ((struct frame_info *fi,
 #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs)        \
    m32r_frame_find_saved_regs(frame_info, &(frame_saved_regs))
 
-extern CORE_ADDR m32r_frame_chain PARAMS ((struct frame_info *fi));
+extern CORE_ADDR m32r_frame_chain PARAMS ((struct frame_info * fi));
 /* mvs_check  FRAME_CHAIN */
 #define FRAME_CHAIN(fi)                m32r_frame_chain (fi)
 
-#define FRAME_CHAIN_VALID(fp, frame)   generic_frame_chain_valid (fp, frame)
+#define FRAME_CHAIN_VALID(fp, frame)   generic_file_frame_chain_valid (fp, frame)
 
-extern CORE_ADDR m32r_find_callers_reg PARAMS ((struct frame_info *fi, 
+extern CORE_ADDR m32r_find_callers_reg PARAMS ((struct frame_info * fi,
                                                int regnum));
-extern CORE_ADDR m32r_frame_saved_pc PARAMS((struct frame_info *));
+extern CORE_ADDR m32r_frame_saved_pc PARAMS ((struct frame_info *));
 /* mvs_check  FRAME_SAVED_PC */
 #define FRAME_SAVED_PC(fi)             m32r_frame_saved_pc (fi)
 
@@ -155,7 +154,7 @@ extern CORE_ADDR m32r_frame_saved_pc PARAMS((struct frame_info *));
 
 extern CORE_ADDR m32r_skip_prologue PARAMS ((CORE_ADDR pc));
 /* mvs_check  SKIP_PROLOGUE */
-#define SKIP_PROLOGUE(pc) pc = m32r_skip_prologue (pc)
+#define SKIP_PROLOGUE(pc) (m32r_skip_prologue (pc))
 
 /* mvs_no_check  FRAME_ARGS_SKIP */
 #define FRAME_ARGS_SKIP 0
@@ -165,10 +164,11 @@ extern CORE_ADDR m32r_skip_prologue PARAMS ((CORE_ADDR pc));
 /* mvs_no_check  FRAME_LOCALS_ADDRESS */
 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
 /* mvs_no_check  FRAME_NUM_ARGS */
-#define FRAME_NUM_ARGS(val, fi) ((val) = -1)
+#define FRAME_NUM_ARGS(fi) (-1)
 
-#define COERCE_FLOAT_TO_DOUBLE 1
+#define COERCE_FLOAT_TO_DOUBLE(formal, actual) (1)
 
+extern void m32r_write_sp (CORE_ADDR val);
 #define TARGET_WRITE_SP m32r_write_sp
 
 
@@ -193,12 +193,12 @@ extern use_struct_convention_fn m32r_use_struct_convention;
 /* generic dummy frame stuff */
 
 #define PUSH_DUMMY_FRAME             generic_push_dummy_frame ()
-#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP)
+#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
 
 
 /* target-specific dummy_frame stuff */
 
-extern struct frame_info *m32r_pop_frame PARAMS ((struct frame_info *frame));
+extern struct frame_info *m32r_pop_frame PARAMS ((struct frame_info * frame));
 /* mvs_check  POP_FRAME */
 #define POP_FRAME m32r_pop_frame (get_current_frame ())
 
@@ -206,8 +206,8 @@ extern struct frame_info *m32r_pop_frame PARAMS ((struct frame_info *frame));
 /* #define STACK_ALIGN(x) ((x + 3) & ~3) */
 
 extern CORE_ADDR m32r_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR));
-extern CORE_ADDR m32r_push_arguments PARAMS ((int nargs, 
-                                             struct value **args, 
+extern CORE_ADDR m32r_push_arguments PARAMS ((int nargs,
+                                             struct value ** args,
                                              CORE_ADDR sp,
                                              unsigned char struct_return,
                                              CORE_ADDR struct_addr));
@@ -216,15 +216,17 @@ extern CORE_ADDR m32r_push_arguments PARAMS ((int nargs,
 
 /* mvs_no_check  PUSH_ARGUMENTS */
 #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
-  (SP) = m32r_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)
+  (m32r_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
 
 #define PUSH_RETURN_ADDRESS(PC, SP)      m32r_push_return_address (PC, SP)
 
 /* override the standard get_saved_register function with 
    one that takes account of generic CALL_DUMMY frames */
-#define GET_SAVED_REGISTER
+#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
+     generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
 
-#define USE_GENERIC_DUMMY_FRAMES
+
+#define USE_GENERIC_DUMMY_FRAMES 1
 #define CALL_DUMMY                   {0}
 #define CALL_DUMMY_LENGTH            (0)
 #define CALL_DUMMY_START_OFFSET      (0)