This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] ARM: Fix use of MAX_REGISTER_RAW_SIZE in array decl.



This patch fixes the use of MAX_REGISTER_RAW_SIZE inside an array 
declaration.  Since this has now become a function, we are using a GCC 
extension to compile this.  In the cases fixed below we are in 
target-specific code, so we can fix this by defining a target-specific 
macro as a substitute and using that instead.

This also fixes one other buglet that I've spotted.  When setting the 
return value of a function that returns its result in the FPA reg f0, we 
were using MAX_REGISTER_RAW_SIZE for the copy, rather than 
FP_REGISTER_RAW_SIZE.  This wasn't really a problem, since the two have 
the same value, but it might make a difference someday in the future.

R.

2002-05-07  Richard Earnshaw  <rearnsha@arm.com>

	* arm-tdep.h (ARM_MAX_REGISTER_RAW_SIZE): Define.
	(ARM_MAX_REGISTER_VIRTUAL_SIZE): Define.
	* arm-tdep.c (arm_store_return_value): Use them.  
	Use FP_REGISTER_RAW_SIZE when setting the FPA return value.
	* remote-rdp.c (remote_rdp_fetch_register): Use
	ARM_MAX_REGISTER_RAW_SIZE.
	(remote_rdp_store_register): Likewise.

Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.57
diff -p -r1.57 arm-tdep.c
*** arm-tdep.c	1 May 2002 00:57:51 -0000	1.57
--- arm-tdep.c	7 May 2002 12:53:33 -0000
*************** arm_store_return_value (struct type *typ
*** 2336,2342 ****
    if (TYPE_CODE (type) == TYPE_CODE_FLT)
      {
        struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
!       char buf[MAX_REGISTER_RAW_SIZE];
  
        switch (tdep->fp_model)
  	{
--- 2336,2342 ----
    if (TYPE_CODE (type) == TYPE_CODE_FLT)
      {
        struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
!       char buf[ARM_MAX_REGISTER_RAW_SIZE];
  
        switch (tdep->fp_model)
  	{
*************** arm_store_return_value (struct type *typ
*** 2344,2350 ****
  
  	  convert_to_extended (valbuf, buf);
  	  write_register_bytes (REGISTER_BYTE (ARM_F0_REGNUM), buf,
! 				MAX_REGISTER_RAW_SIZE);
  	  break;
  
  	case ARM_FLOAT_SOFT:
--- 2344,2350 ----
  
  	  convert_to_extended (valbuf, buf);
  	  write_register_bytes (REGISTER_BYTE (ARM_F0_REGNUM), buf,
! 				FP_REGISTER_RAW_SIZE);
  	  break;
  
  	case ARM_FLOAT_SOFT:
Index: arm-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.h,v
retrieving revision 1.7
diff -p -r1.7 arm-tdep.h
*** arm-tdep.h	22 Apr 2002 22:46:40 -0000	1.7
--- arm-tdep.h	7 May 2002 12:53:33 -0000
*************** enum gdb_regnum {
*** 45,50 ****
--- 45,54 ----
    ARM_LAST_FP_ARG_REGNUM = ARM_F3_REGNUM
  };
  
+ /* Used in target-specific code when we need to know the size of the
+    largest type of register we need to handle.  */
+ #define ARM_MAX_REGISTER_RAW_SIZE	12
+ #define ARM_MAX_REGISTER_VIRTUAL_SIZE	8
  
  /* Size of integer registers.  */
  #define INT_REGISTER_RAW_SIZE		4
Index: remote-rdp.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-rdp.c,v
retrieving revision 1.25
diff -p -r1.25 remote-rdp.c
*** remote-rdp.c	5 May 2002 01:15:13 -0000	1.25
--- remote-rdp.c	7 May 2002 12:53:34 -0000
*************** remote_rdp_fetch_register (int regno)
*** 612,618 ****
      }
    else
      {
!       char buf[MAX_REGISTER_RAW_SIZE];
        if (regno < 15)
  	rdp_fetch_one_register (1 << regno, buf);
        else if (regno == ARM_PC_REGNUM)
--- 612,618 ----
      }
    else
      {
!       char buf[ARM_MAX_REGISTER_RAW_SIZE];
        if (regno < 15)
  	rdp_fetch_one_register (1 << regno, buf);
        else if (regno == ARM_PC_REGNUM)
*************** remote_rdp_store_register (int regno)
*** 642,648 ****
      }
    else
      {
!       char tmp[MAX_REGISTER_RAW_SIZE];
        read_register_gen (regno, tmp);
        if (regno < 15)
  	rdp_store_one_register (1 << regno, tmp);
--- 642,648 ----
      }
    else
      {
!       char tmp[ARM_MAX_REGISTER_RAW_SIZE];
        read_register_gen (regno, tmp);
        if (regno < 15)
  	rdp_store_one_register (1 << regno, tmp);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]