Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Multi-arching FLOAT_INFO
@ 2002-02-04  6:43 Richard Earnshaw
  2002-02-04  8:33 ` Andrew Cagney
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Earnshaw @ 2002-02-04  6:43 UTC (permalink / raw)
  To: gdb; +Cc: Richard.Earnshaw


So it turns out that multi-arching FLOAT_INFO may not be completely 
trivial either.  Only two ports really make use of this: ARM and i386.  
The ARM code is straight-forward, but the code on the i386 is largely 
disabled.  Indeed, the largest problem is i386b-nat.c which contains a 
large chunk of code that is surrounded in "#ifdef FLOAT_INFO".  This file 
seems to only be used on BSD4.4 systems (FreeBSD, NetBSD and OpenBSD all 
seem to use their own nat files -- I'm not sure what BSDi uses).

Since adding FLOAT_INFO to gdbarch will mean that it is now 
unconditionally defined the question is - how to handle this chunk of 
code.  I've no idea (and no way of testing) whether it will even compile 
cleanly.

Does anyone even use a system that relies on this file now?

Suggestions welcome.

R.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Multi-arching FLOAT_INFO
  2002-02-04  6:43 Multi-arching FLOAT_INFO Richard Earnshaw
@ 2002-02-04  8:33 ` Andrew Cagney
  2002-02-05  2:34   ` Richard Earnshaw
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cagney @ 2002-02-04  8:33 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: gdb

> So it turns out that multi-arching FLOAT_INFO may not be completely 
> trivial either.  Only two ports really make use of this: ARM and i386.  
> The ARM code is straight-forward, but the code on the i386 is largely 
> disabled.  Indeed, the largest problem is i386b-nat.c which contains a 
> large chunk of code that is surrounded in "#ifdef FLOAT_INFO".  This file 
> seems to only be used on BSD4.4 systems (FreeBSD, NetBSD and OpenBSD all 
> seem to use their own nat files -- I'm not sure what BSDi uses).
> 
> Since adding FLOAT_INFO to gdbarch will mean that it is now 
> unconditionally defined the question is - how to handle this chunk of 
> code.  I've no idea (and no way of testing) whether it will even compile 
> cleanly.
> 
> Does anyone even use a system that relies on this file now?
> 
> Suggestions welcome.


Have a look at REGISTER_NAME() vs REGISTER_NAMES and 
legacy_register_name.  There is no reason for you fixing anything other 
than the arm.

As for FLOAT_INFO, file a bug report indicating that it is deprecated. 
I'll also ARI it.

Andrew


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Multi-arching FLOAT_INFO
  2002-02-04  8:33 ` Andrew Cagney
@ 2002-02-05  2:34   ` Richard Earnshaw
  2002-02-05  7:41     ` Andrew Cagney
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Earnshaw @ 2002-02-05  2:34 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Richard.Earnshaw, gdb

[-- Attachment #1: Type: text/plain, Size: 710 bytes --]

> 
> Have a look at REGISTER_NAME() vs REGISTER_NAMES and 
> legacy_register_name.  There is no reason for you fixing anything other 
> than the arm.
> 
> As for FLOAT_INFO, file a bug report indicating that it is deprecated. 
> I'll also ARI it.

Something like this then...

	* gdbarch.sh (DO_FLOAT_INFO): Add rule.
	* gdbarch.c gdbarch.h: Regenerate.
	* arch-utils.c (default_float_info): New function.
	* arch-utils.h (default_float_info): Prototype it.
	* infcmd.c (float_info): Call DO_FLOAT_INFO.
	* doc/gdbint.texinfo (FLOAT_INFO): Mark as deprecated.
	(DO_FLOAT_INFO): Document it.

	* arm-tdep.c (arm_float_info): Add comment.
	* config/arm/tm-arm.h (FLOAT_INFO): Delete.
	(DO_FLOAT_INFO): Define.



[-- Attachment #2: gdb-finfo.patch --]
[-- Type: text/x-patch , Size: 11479 bytes --]

Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.48
diff -p -r1.48 arch-utils.c
*** arch-utils.c	2002/01/29 03:51:14	1.48
--- arch-utils.c	2002/02/05 10:25:19
*************** default_double_format (struct gdbarch *g
*** 225,230 ****
--- 225,243 ----
      }
  }
  
+ void
+ default_float_info (void)
+ {
+ #ifdef FLOAT_INFO
+ #if GDB_MULTI_ARCH
+ #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
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.27
diff -p -r1.27 arch-utils.h
*** arch-utils.h	2001/12/19 14:14:52	1.27
--- arch-utils.h	2002/02/05 10:25:19
*************** extern int generic_in_solib_call_trampol
*** 138,143 ****
--- 138,145 ----
  
  extern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc);
  
+ extern void default_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);
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.32
diff -p -r1.32 arm-tdep.c
*** arm-tdep.c	2002/02/04 11:55:35	1.32
--- arm-tdep.c	2002/02/05 10:25:20
*************** print_fpu_flags (int flags)
*** 1559,1564 ****
--- 1559,1566 ----
    putchar ('\n');
  }
  
+ /* Print interesting information about the floating point processor
+    (if present) or emulator.  */
  void
  arm_float_info (void)
  {
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.101
diff -p -r1.101 gdbarch.c
*** gdbarch.c	2002/02/04 11:55:34	1.101
--- gdbarch.c	2002/02/05 10:25:20
*************** struct gdbarch
*** 177,182 ****
--- 177,183 ----
    int max_register_virtual_size;
    gdbarch_register_virtual_type_ftype *register_virtual_type;
    gdbarch_do_registers_info_ftype *do_registers_info;
+   gdbarch_do_float_info_ftype *do_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;
*************** struct gdbarch startup_gdbarch =
*** 342,347 ****
--- 343,349 ----
    0,
    0,
    0,
+   0,
    generic_get_saved_register,
    0,
    0,
*************** gdbarch_alloc (const struct gdbarch_info
*** 474,479 ****
--- 476,482 ----
    current_gdbarch->max_register_raw_size = -1;
    current_gdbarch->max_register_virtual_size = -1;
    current_gdbarch->do_registers_info = do_registers_info;
+   current_gdbarch->do_float_info = default_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;
*************** verify_gdbarch (struct gdbarch *gdbarch)
*** 623,628 ****
--- 626,632 ----
        && (gdbarch->register_virtual_type == 0))
      fprintf_unfiltered (log, "\n\tregister_virtual_type");
    /* Skip verify of do_registers_info, invalid_p == 0 */
+   /* Skip verify of do_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 */
*************** gdbarch_dump (struct gdbarch *gdbarch, s
*** 998,1003 ****
--- 1002,1021 ----
                        "gdbarch_dump: DECR_PC_AFTER_BREAK = %ld\n",
                        (long) DECR_PC_AFTER_BREAK);
  #endif
+ #ifdef DO_FLOAT_INFO
+ #if GDB_MULTI_ARCH
+   /* Macro might contain `[{}]' when not multi-arch */
+   fprintf_unfiltered (file,
+                       "gdbarch_dump: %s # %s\n",
+                       "DO_FLOAT_INFO()",
+                       XSTRING (DO_FLOAT_INFO ()));
+ #endif
+   if (GDB_MULTI_ARCH)
+     fprintf_unfiltered (file,
+                         "gdbarch_dump: DO_FLOAT_INFO = 0x%08lx\n",
+                         (long) current_gdbarch->do_float_info
+                         /*DO_FLOAT_INFO ()*/);
+ #endif
  #ifdef DO_REGISTERS_INFO
  #if GDB_MULTI_ARCH
    /* Macro might contain `[{}]' when not multi-arch */
*************** set_gdbarch_do_registers_info (struct gd
*** 2878,2883 ****
--- 2896,2919 ----
                                 gdbarch_do_registers_info_ftype do_registers_info)
  {
    gdbarch->do_registers_info = do_registers_info;
+ }
+ 
+ void
+ gdbarch_do_float_info (struct gdbarch *gdbarch)
+ {
+   if (gdbarch->do_float_info == 0)
+     internal_error (__FILE__, __LINE__,
+                     "gdbarch: gdbarch_do_float_info invalid");
+   if (gdbarch_debug >= 2)
+     fprintf_unfiltered (gdb_stdlog, "gdbarch_do_float_info called\n");
+   gdbarch->do_float_info ();
+ }
+ 
+ void
+ set_gdbarch_do_float_info (struct gdbarch *gdbarch,
+                            gdbarch_do_float_info_ftype do_float_info)
+ {
+   gdbarch->do_float_info = do_float_info;
  }
  
  int
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.76
diff -p -r1.76 gdbarch.h
*** gdbarch.h	2002/02/04 11:55:34	1.76
--- gdbarch.h	2002/02/05 10:25:20
*************** extern void set_gdbarch_do_registers_inf
*** 774,779 ****
--- 774,796 ----
  #endif
  #endif
  
+ /* Default (function) for non- multi-arch platforms. */
+ #if (!GDB_MULTI_ARCH) && !defined (DO_FLOAT_INFO)
+ #define DO_FLOAT_INFO() (default_float_info ())
+ #endif
+ 
+ typedef void (gdbarch_do_float_info_ftype) (void);
+ extern void gdbarch_do_float_info (struct gdbarch *gdbarch);
+ extern void set_gdbarch_do_float_info (struct gdbarch *gdbarch, gdbarch_do_float_info_ftype *do_float_info);
+ #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DO_FLOAT_INFO)
+ #error "Non multi-arch definition of DO_FLOAT_INFO"
+ #endif
+ #if GDB_MULTI_ARCH
+ #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DO_FLOAT_INFO)
+ #define DO_FLOAT_INFO() (gdbarch_do_float_info (current_gdbarch))
+ #endif
+ #endif
+ 
  /* MAP a GDB RAW register number onto a simulator register number.  See
     also include/...-sim.h. */
  
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.106
diff -p -r1.106 gdbarch.sh
*** gdbarch.sh	2002/02/04 11:55:34	1.106
--- gdbarch.sh	2002/02/05 10:25:20
*************** f:2:REGISTER_VIRTUAL_SIZE:int:register_v
*** 450,455 ****
--- 450,456 ----
  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:DO_FLOAT_INFO:void:do_float_info:void::::default_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
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.39
diff -p -r1.39 infcmd.c
*** infcmd.c	2002/01/29 03:08:25	1.39
--- infcmd.c	2002/02/05 10:25:21
*************** interrupt_target_command (char *args, in
*** 1846,1856 ****
  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
  }
  \f
  /* ARGSUSED */
--- 1846,1852 ----
  static void
  float_info (char *addr_exp, int from_tty)
  {
!   DO_FLOAT_INFO ();
  }
  \f
  /* ARGSUSED */
Index: config/arm/tm-arm.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/tm-arm.h,v
retrieving revision 1.21
diff -p -r1.21 tm-arm.h
*** tm-arm.h	2002/02/04 11:55:36	1.21
--- tm-arm.h	2002/02/05 10:25:21
*************** extern breakpoint_from_pc_fn arm_breakpo
*** 120,131 ****
  
  #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 (); }
  
  /* 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
--- 120,127 ----
  
  #define DECR_PC_AFTER_BREAK 0
  
! void arm_float_info (void);
! #define DO_FLOAT_INFO()	arm_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
Index: config/m68k/nm-apollo68b.h
===================================================================
RCS file: /cvs/src/src/gdb/config/m68k/nm-apollo68b.h,v
retrieving revision 1.2
diff -p -r1.2 nm-apollo68b.h
*** nm-apollo68b.h	2001/03/06 08:21:30	1.2
--- nm-apollo68b.h	2002/02/05 10:25:21
***************
*** 30,37 ****
  
  #define KERNEL_U_ADDR 0
  
- #undef FLOAT_INFO		/* No float info yet */
- 
  #define REGISTER_U_ADDR(addr, blockend, regno) \
  	(addr) = (6 + 4 * (regno))
  
--- 30,35 ----
Index: config/ns32k/nm-nbsd.h
===================================================================
RCS file: /cvs/src/src/gdb/config/ns32k/nm-nbsd.h,v
retrieving revision 1.3
diff -p -r1.3 nm-nbsd.h
*** nm-nbsd.h	2001/03/06 08:21:33	1.3
--- nm-nbsd.h	2002/02/05 10:25:21
***************
*** 26,32 ****
  #include "nm-nbsd.h"
  
  #if 0
! #define FLOAT_INFO	{ extern ns32k_float_info(); ns32k_float_info(); }
  #endif
  
  #define REGISTER_U_ADDR(addr, blockend, regno) \
--- 26,33 ----
  #include "nm-nbsd.h"
  
  #if 0
! extern ns32k_float_info()
! #define FLOAT_INFO()	ns32k_float_info ()
  #endif
  
  #define REGISTER_U_ADDR(addr, blockend, regno) \
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.63
diff -p -r1.63 gdbint.texinfo
*** gdbint.texinfo	2002/01/29 16:32:02	1.63
--- gdbint.texinfo	2002/02/05 10:25:22
*************** library in which breakpoints cannot be s
*** 2864,2869 ****
--- 2864,2874 ----
  @findex DO_REGISTERS_INFO
  If defined, use this to print the value of a register or all registers.
  
+ @item DO_FLOAT_INFO()
+ #findex DO_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,
*************** Predicate for @code{EXTRACT_STRUCT_VALUE
*** 2904,2911 ****
  
  @item FLOAT_INFO
  @findex FLOAT_INFO
! If defined, then the @samp{info float} command will print information about
! the processor's floating point unit.
  
  @item FP_REGNUM
  @findex FP_REGNUM
--- 2909,2915 ----
  
  @item FLOAT_INFO
  @findex FLOAT_INFO
! Deprecated in favor of @code{DO_FLOAT_INFO}.
  
  @item FP_REGNUM
  @findex FP_REGNUM

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Multi-arching FLOAT_INFO
  2002-02-05  2:34   ` Richard Earnshaw
@ 2002-02-05  7:41     ` Andrew Cagney
  2002-02-05  7:57       ` Richard Earnshaw
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cagney @ 2002-02-05  7:41 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: gdb

> + void
> + default_float_info (void)
> + {
> + #ifdef FLOAT_INFO
> + #if GDB_MULTI_ARCH
> + #error "FLOAT_INFO defined in multi-arch"


Suggest #if GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL

Otherwise it will break the build of someone elses partially 
multi-arched target.

> + #endif
> +   FLOAT_INFO;
> + #else
> +   printf_filtered ("No floating point info available for this processor.\n");
> + #endif
> + }


Otherwize yes.

Andrew


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Multi-arching FLOAT_INFO
  2002-02-05  7:41     ` Andrew Cagney
@ 2002-02-05  7:57       ` Richard Earnshaw
  2002-02-05  8:52         ` Andrew Cagney
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Earnshaw @ 2002-02-05  7:57 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Richard.Earnshaw, gdb

> > + void
> > + default_float_info (void)
> > + {
> > + #ifdef FLOAT_INFO
> > + #if GDB_MULTI_ARCH
> > + #error "FLOAT_INFO defined in multi-arch"
> 
> 
> Suggest #if GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL

But surely a multi-arch (even a partial multi-arch) should be using the 
new function, not the old one.  I thought it was ok to be using 
legacy-style definitions of multi-arch macros, but not to be using 
deprecated ones (hence the error).  If that is incorrect of course, I can 
easily change it as you suggest.


> Sorry, didn't notice.  Suggest PRINT_FLOAT_INFO. 
Sure.

R.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Multi-arching FLOAT_INFO
  2002-02-05  7:57       ` Richard Earnshaw
@ 2002-02-05  8:52         ` Andrew Cagney
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Cagney @ 2002-02-05  8:52 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: gdb

> + void
>> > + default_float_info (void)
>> > + {
>> > + #ifdef FLOAT_INFO
>> > + #if GDB_MULTI_ARCH
>> > + #error "FLOAT_INFO defined in multi-arch"
> 
>> 
>> 
>> Suggest #if GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL
> 
> 
> But surely a multi-arch (even a partial multi-arch) should be using the 
> new function, not the old one.  I thought it was ok to be using 
> legacy-style definitions of multi-arch macros, but not to be using 
> deprecated ones (hence the error).  If that is incorrect of course, I can 
> easily change it as you suggest.


It is a compromize.  GDB_MULTI_ARCH_TM and above do what you describe. 
GDB_MULTI_ARCH_PARTIAL is intentionally lax about what it allows, only 
barfing a build when absolutly necessary.  The intention is to make the 
steps necessary before adding #define GDB_MULTI_ARCH 
GDB_MULTI_ARCH_PARTIAL as minimal as possible.  Since you've fixed the 
frame stuff, can I suggest skipping to the step where the above is defined.

Andrew


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-02-05 16:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-04  6:43 Multi-arching FLOAT_INFO Richard Earnshaw
2002-02-04  8:33 ` Andrew Cagney
2002-02-05  2:34   ` Richard Earnshaw
2002-02-05  7:41     ` Andrew Cagney
2002-02-05  7:57       ` Richard Earnshaw
2002-02-05  8:52         ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox