From 5e74b15c0d46e80dfff4d265dfb82340631fcfb8 Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Wed, 6 Feb 2002 13:00:49 +0000 Subject: [PATCH] * gdbarch.sh (PRINT_FLOAT_INFO): Add rule. * gdbarch.c gdbarch.h: Regenerate. * arch-utils.c (default_print_float_info): New function. * arch-utils.h (default_print_float_info): Prototype it. * infcmd.c (float_info): Call PRINT_FLOAT_INFO. * doc/gdbint.texinfo (FLOAT_INFO): Mark as deprecated. (PRINT_FLOAT_INFO): Document it. * arm-tdep.c (arm_print_float_info): Renamed from arm_float_info. * config/arm/tm-arm.h (FLOAT_INFO): Delete. (PRINT_FLOAT_INFO): Define. --- gdb/arch-utils.c | 13 ++++ gdb/arch-utils.h | 2 + gdb/arm-tdep.c | 4 +- gdb/config/arm/tm-arm.h | 8 +-- gdb/doc/gdbint.texinfo | 8 ++- gdb/gdbarch.c | 142 +++++++++++++++++++++++++--------------- gdb/gdbarch.h | 17 +++++ gdb/gdbarch.sh | 1 + gdb/infcmd.c | 6 +- 9 files changed, 134 insertions(+), 67 deletions(-) diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index a01fb4ef0c0..5612ddf841c 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -225,6 +225,19 @@ default_double_format (struct gdbarch *gdbarch) } } +void +default_print_float_info (void) +{ +#ifdef FLOAT_INFO +#if GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL +#error "FLOAT_INFO defined in multi-arch" +#endif + FLOAT_INFO; +#else + printf_filtered ("No floating point info available for this processor.\n"); +#endif +} + /* Misc helper functions for targets. */ int diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 434edc3f090..96d1b8b6174 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -146,6 +146,8 @@ extern int generic_in_solib_call_trampoline (CORE_ADDR pc, char *name); extern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc); +extern void default_print_float_info (void); + /* Assume all registers are the same size and a size identical to that of the integer type. */ extern int generic_register_raw_size (int regnum); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 88135e883b3..b6e4befcf53 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -1559,8 +1559,10 @@ print_fpu_flags (int flags) putchar ('\n'); } +/* Print interesting information about the floating point processor + (if present) or emulator. */ void -arm_float_info (void) +arm_print_float_info (void) { register unsigned long status = read_register (FPS_REGNUM); int type; diff --git a/gdb/config/arm/tm-arm.h b/gdb/config/arm/tm-arm.h index 4f0f8d2ad94..0ff2c337c06 100644 --- a/gdb/config/arm/tm-arm.h +++ b/gdb/config/arm/tm-arm.h @@ -120,12 +120,8 @@ extern breakpoint_from_pc_fn arm_breakpoint_from_pc; #define DECR_PC_AFTER_BREAK 0 -/* Code to execute to print interesting information about the floating - point processor (if any) or emulator. No need to define if there - is nothing to do. */ -extern void arm_float_info (void); - -#define FLOAT_INFO { arm_float_info (); } +void arm_print_float_info (void); +#define PRINT_FLOAT_INFO() arm_print_float_info () /* 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 diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index cc7a19b74cc..45075212add 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -2864,6 +2864,11 @@ library in which breakpoints cannot be set and so should be disabled. @findex DO_REGISTERS_INFO If defined, use this to print the value of a register or all registers. +@item PRINT_FLOAT_INFO() +#findex PRINT_FLOAT_INFO +If defined, then the @samp{info float} command will print information about +the processor's floating point unit. + @item DWARF_REG_TO_REGNUM @findex DWARF_REG_TO_REGNUM Convert DWARF register number into @value{GDBN} regnum. If not defined, @@ -2904,8 +2909,7 @@ Predicate for @code{EXTRACT_STRUCT_VALUE_ADDRESS}. @item FLOAT_INFO @findex FLOAT_INFO -If defined, then the @samp{info float} command will print information about -the processor's floating point unit. +Deprecated in favor of @code{PRINT_FLOAT_INFO}. @item FP_REGNUM @findex FP_REGNUM diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index bf398316757..25824b8d975 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -177,6 +177,7 @@ struct gdbarch int max_register_virtual_size; gdbarch_register_virtual_type_ftype *register_virtual_type; gdbarch_do_registers_info_ftype *do_registers_info; + gdbarch_print_float_info_ftype *print_float_info; gdbarch_register_sim_regno_ftype *register_sim_regno; gdbarch_register_bytes_ok_ftype *register_bytes_ok; gdbarch_cannot_fetch_register_ftype *cannot_fetch_register; @@ -344,6 +345,7 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + 0, generic_get_saved_register, 0, 0, @@ -478,6 +480,7 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->max_register_raw_size = -1; current_gdbarch->max_register_virtual_size = -1; current_gdbarch->do_registers_info = do_registers_info; + current_gdbarch->print_float_info = default_print_float_info; current_gdbarch->register_sim_regno = default_register_sim_regno; current_gdbarch->cannot_fetch_register = cannot_register_not; current_gdbarch->cannot_store_register = cannot_register_not; @@ -629,6 +632,7 @@ verify_gdbarch (struct gdbarch *gdbarch) && (gdbarch->register_virtual_type == 0)) fprintf_unfiltered (log, "\n\tregister_virtual_type"); /* Skip verify of do_registers_info, invalid_p == 0 */ + /* Skip verify of print_float_info, invalid_p == 0 */ /* Skip verify of register_sim_regno, invalid_p == 0 */ /* Skip verify of register_bytes_ok, has predicate */ /* Skip verify of cannot_fetch_register, invalid_p == 0 */ @@ -800,17 +804,18 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: GDB_MULTI_ARCH = %d\n", GDB_MULTI_ARCH); -#ifdef ADDR_BITS_REMOVE - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "ADDR_BITS_REMOVE(addr)", - XSTRING (ADDR_BITS_REMOVE (addr))); if (GDB_MULTI_ARCH) fprintf_unfiltered (file, - "gdbarch_dump: ADDR_BITS_REMOVE = 0x%08lx\n", - (long) current_gdbarch->addr_bits_remove - /*ADDR_BITS_REMOVE ()*/); -#endif + "gdbarch_dump: in_function_epilogue_p = 0x%08lx\n", + (long) current_gdbarch->in_function_epilogue_p); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: register_read = 0x%08lx\n", + (long) current_gdbarch->register_read); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: register_write = 0x%08lx\n", + (long) current_gdbarch->register_write); #ifdef ADDRESS_TO_POINTER #if GDB_MULTI_ARCH /* Macro might contain `[{}]' when not multi-arch */ @@ -825,6 +830,17 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->address_to_pointer /*ADDRESS_TO_POINTER ()*/); #endif +#ifdef ADDR_BITS_REMOVE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "ADDR_BITS_REMOVE(addr)", + XSTRING (ADDR_BITS_REMOVE (addr))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: ADDR_BITS_REMOVE = 0x%08lx\n", + (long) current_gdbarch->addr_bits_remove + /*ADDR_BITS_REMOVE ()*/); +#endif #ifdef BELIEVE_PCC_PROMOTION fprintf_unfiltered (file, "gdbarch_dump: BELIEVE_PCC_PROMOTION # %s\n", @@ -1160,6 +1176,17 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: FP_REGNUM = %d\n", FP_REGNUM); #endif +#ifdef FRAMELESS_FUNCTION_INVOCATION + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "FRAMELESS_FUNCTION_INVOCATION(fi)", + XSTRING (FRAMELESS_FUNCTION_INVOCATION (fi))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: FRAMELESS_FUNCTION_INVOCATION = 0x%08lx\n", + (long) current_gdbarch->frameless_function_invocation + /*FRAMELESS_FUNCTION_INVOCATION ()*/); +#endif #ifdef FRAME_ARGS_ADDRESS fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1215,17 +1242,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->frame_init_saved_regs /*FRAME_INIT_SAVED_REGS ()*/); #endif -#ifdef FRAMELESS_FUNCTION_INVOCATION - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "FRAMELESS_FUNCTION_INVOCATION(fi)", - XSTRING (FRAMELESS_FUNCTION_INVOCATION (fi))); - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: FRAMELESS_FUNCTION_INVOCATION = 0x%08lx\n", - (long) current_gdbarch->frameless_function_invocation - /*FRAMELESS_FUNCTION_INVOCATION ()*/); -#endif #ifdef FRAME_LOCALS_ADDRESS fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1295,33 +1311,33 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->init_extra_frame_info /*INIT_EXTRA_FRAME_INFO ()*/); #endif -#ifdef INIT_FRAME_PC_FIRST +#ifdef INIT_FRAME_PC #if GDB_MULTI_ARCH /* Macro might contain `[{}]' when not multi-arch */ fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", - "INIT_FRAME_PC_FIRST(fromleaf, prev)", - XSTRING (INIT_FRAME_PC_FIRST (fromleaf, prev))); + "INIT_FRAME_PC(fromleaf, prev)", + XSTRING (INIT_FRAME_PC (fromleaf, prev))); #endif if (GDB_MULTI_ARCH) fprintf_unfiltered (file, - "gdbarch_dump: INIT_FRAME_PC_FIRST = 0x%08lx\n", - (long) current_gdbarch->init_frame_pc_first - /*INIT_FRAME_PC_FIRST ()*/); + "gdbarch_dump: INIT_FRAME_PC = 0x%08lx\n", + (long) current_gdbarch->init_frame_pc + /*INIT_FRAME_PC ()*/); #endif -#ifdef INIT_FRAME_PC +#ifdef INIT_FRAME_PC_FIRST #if GDB_MULTI_ARCH /* Macro might contain `[{}]' when not multi-arch */ fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", - "INIT_FRAME_PC(fromleaf, prev)", - XSTRING (INIT_FRAME_PC (fromleaf, prev))); + "INIT_FRAME_PC_FIRST(fromleaf, prev)", + XSTRING (INIT_FRAME_PC_FIRST (fromleaf, prev))); #endif if (GDB_MULTI_ARCH) fprintf_unfiltered (file, - "gdbarch_dump: INIT_FRAME_PC = 0x%08lx\n", - (long) current_gdbarch->init_frame_pc - /*INIT_FRAME_PC ()*/); + "gdbarch_dump: INIT_FRAME_PC_FIRST = 0x%08lx\n", + (long) current_gdbarch->init_frame_pc_first + /*INIT_FRAME_PC_FIRST ()*/); #endif #ifdef INNER_THAN fprintf_unfiltered (file, @@ -1334,17 +1350,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->inner_than /*INNER_THAN ()*/); #endif -#ifdef IN_SOLIB_CALL_TRAMPOLINE - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "IN_SOLIB_CALL_TRAMPOLINE(pc, name)", - XSTRING (IN_SOLIB_CALL_TRAMPOLINE (pc, name))); - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: IN_SOLIB_CALL_TRAMPOLINE = 0x%08lx\n", - (long) current_gdbarch->in_solib_call_trampoline - /*IN_SOLIB_CALL_TRAMPOLINE ()*/); -#endif #ifdef INTEGER_TO_ADDRESS fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1356,10 +1361,17 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->integer_to_address /*INTEGER_TO_ADDRESS ()*/); #endif +#ifdef IN_SOLIB_CALL_TRAMPOLINE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "IN_SOLIB_CALL_TRAMPOLINE(pc, name)", + XSTRING (IN_SOLIB_CALL_TRAMPOLINE (pc, name))); if (GDB_MULTI_ARCH) fprintf_unfiltered (file, - "gdbarch_dump: in_function_epilogue_p = 0x%08lx\n", - (long) current_gdbarch->in_function_epilogue_p); + "gdbarch_dump: IN_SOLIB_CALL_TRAMPOLINE = 0x%08lx\n", + (long) current_gdbarch->in_solib_call_trampoline + /*IN_SOLIB_CALL_TRAMPOLINE ()*/); +#endif #ifdef MAX_REGISTER_RAW_SIZE fprintf_unfiltered (file, "gdbarch_dump: MAX_REGISTER_RAW_SIZE # %s\n", @@ -1493,6 +1505,20 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->prepare_to_proceed /*PREPARE_TO_PROCEED ()*/); #endif +#ifdef PRINT_FLOAT_INFO +#if GDB_MULTI_ARCH + /* Macro might contain `[{}]' when not multi-arch */ + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "PRINT_FLOAT_INFO()", + XSTRING (PRINT_FLOAT_INFO ())); +#endif + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: PRINT_FLOAT_INFO = 0x%08lx\n", + (long) current_gdbarch->print_float_info + /*PRINT_FLOAT_INFO ()*/); +#endif #ifdef PROLOGUE_FRAMELESS_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2119,14 +2145,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->use_struct_convention /*USE_STRUCT_CONVENTION ()*/); #endif - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: register_read = 0x%08lx\n", - (long) current_gdbarch->register_read); - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: register_write = 0x%08lx\n", - (long) current_gdbarch->register_write); if (current_gdbarch->dump_tdep != NULL) current_gdbarch->dump_tdep (current_gdbarch, file); } @@ -2916,6 +2934,24 @@ set_gdbarch_do_registers_info (struct gdbarch *gdbarch, gdbarch->do_registers_info = do_registers_info; } +void +gdbarch_print_float_info (struct gdbarch *gdbarch) +{ + if (gdbarch->print_float_info == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_print_float_info invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_print_float_info called\n"); + gdbarch->print_float_info (); +} + +void +set_gdbarch_print_float_info (struct gdbarch *gdbarch, + gdbarch_print_float_info_ftype print_float_info) +{ + gdbarch->print_float_info = print_float_info; +} + int gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index ae96dedee0f..ffde4df6f42 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -775,6 +775,23 @@ extern void set_gdbarch_do_registers_info (struct gdbarch *gdbarch, gdbarch_do_r #endif #endif +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (PRINT_FLOAT_INFO) +#define PRINT_FLOAT_INFO() (default_print_float_info ()) +#endif + +typedef void (gdbarch_print_float_info_ftype) (void); +extern void gdbarch_print_float_info (struct gdbarch *gdbarch); +extern void set_gdbarch_print_float_info (struct gdbarch *gdbarch, gdbarch_print_float_info_ftype *print_float_info); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PRINT_FLOAT_INFO) +#error "Non multi-arch definition of PRINT_FLOAT_INFO" +#endif +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PRINT_FLOAT_INFO) +#define PRINT_FLOAT_INFO() (gdbarch_print_float_info (current_gdbarch)) +#endif +#endif + /* MAP a GDB RAW register number onto a simulator register number. See also include/...-sim.h. */ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 5856a08f5d8..78cc24eabab 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -450,6 +450,7 @@ f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_r v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1 f:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0 f:2:DO_REGISTERS_INFO:void:do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs:::do_registers_info::0 +f:2:PRINT_FLOAT_INFO:void:print_float_info:void::::default_print_float_info::0 # MAP a GDB RAW register number onto a simulator register number. See # also include/...-sim.h. f:2:REGISTER_SIM_REGNO:int:register_sim_regno:int reg_nr:reg_nr:::default_register_sim_regno::0 diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 222053425a9..02384483822 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1846,11 +1846,7 @@ interrupt_target_command (char *args, int from_tty) static void float_info (char *addr_exp, int from_tty) { -#ifdef FLOAT_INFO - FLOAT_INFO; -#else - printf_filtered ("No floating point info available for this processor.\n"); -#endif + PRINT_FLOAT_INFO (); } /* ARGSUSED */ -- 2.30.2