This is the mail archive of the gdb-patches@sourceware.cygnus.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]

[PATCH]: minor code simplification



Checked in this minor cleanup...

2000-05-24  Michael Snyder  <msnyder@seadog.cygnus.com>

        * findvar.c (value_from_register): Factor code, simplify logic.

Index: findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.10
diff -c -r1.10 findvar.c
*** findvar.c	2000/05/02 09:36:56	1.10
--- findvar.c	2000/05/24 17:23:42
***************
*** 1703,1727 ****
      }
  
    if (GDB_TARGET_IS_D10V
!       && TYPE_CODE (type) == TYPE_CODE_PTR
!       && TYPE_TARGET_TYPE (type)
!       && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC))
      {
-       /* pointer to function */
        unsigned long num;
        unsigned short snum;
!       snum = (unsigned short) extract_unsigned_integer (VALUE_CONTENTS_RAW (v), 2);
!       num = D10V_MAKE_IADDR (snum);
!       store_address (VALUE_CONTENTS_RAW (v), 4, num);
!     }
!   else if (GDB_TARGET_IS_D10V
! 	   && TYPE_CODE (type) == TYPE_CODE_PTR)
!     {
!       /* pointer to data */
!       unsigned long num;
!       unsigned short snum;
!       snum = (unsigned short) extract_unsigned_integer (VALUE_CONTENTS_RAW (v), 2);
!       num = D10V_MAKE_DADDR (snum);
        store_address (VALUE_CONTENTS_RAW (v), 4, num);
      }
  
--- 1704,1723 ----
      }
  
    if (GDB_TARGET_IS_D10V
!       && TYPE_CODE (type) == TYPE_CODE_PTR)
      {
        unsigned long num;
        unsigned short snum;
! 
!       snum = (unsigned short)
! 	extract_unsigned_integer (VALUE_CONTENTS_RAW (v), 2);
! 
!       if (TYPE_TARGET_TYPE (type)	  /* pointer to function */
! 	  && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC))
! 	num = D10V_MAKE_IADDR (snum);
!       else 				  /* pointer to data */
! 	num = D10V_MAKE_DADDR (snum);
! 
        store_address (VALUE_CONTENTS_RAW (v), 4, num);
      }
  

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