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]

RFA: handle zero-length types in value_from_register


2004-01-27  Jim Blandy  <jimb@redhat.com>

	* findvar.c (value_from_register): If the type has no length, just
	return an acceptable value --- don't report an internal error.

Index: gdb/findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.66
diff -c -r1.66 findvar.c
*** gdb/findvar.c	30 Sep 2003 19:12:18 -0000	1.66
--- gdb/findvar.c	27 Jan 2004 05:28:52 -0000
***************
*** 617,623 ****
    struct value *v = allocate_value (type);
    CHECK_TYPEDEF (type);
  
!   if (CONVERT_REGISTER_P (regnum, type))
      {
        /* The ISA/ABI need to something weird when obtaining the
           specified value from this register.  It might need to
--- 617,641 ----
    struct value *v = allocate_value (type);
    CHECK_TYPEDEF (type);
  
!   if (TYPE_LENGTH (type) == 0)
!     {
!       /* It doesn't matter much what we return for this: since the
!          length is zero, it could be anything.  But if allowed to see
!          a zero-length type, the register-finding loop below will set
!          neither mem_stor nor reg_stor, and then report an internal
!          error.  
! 
!          Zero-length types can legitimately arise from declarations
!          like 'struct {}'.  GDB also creates them when it finds bogus
!          debugging information (for example, TYPE_CODE_UNDEF has a
!          length of zero).
! 
!          We'll just attribute the value to the original register.  */
!       VALUE_LVAL (v) = lval_register;
!       VALUE_ADDRESS (v) = regnum;
!       VALUE_REGNO (v) = regnum;
!     }
!   else if (CONVERT_REGISTER_P (regnum, type))
      {
        /* The ISA/ABI need to something weird when obtaining the
           specified value from this register.  It might need to


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