Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix variable objects for references to pointers
@ 2006-12-14  4:58 Nick Roberts
  2006-12-14  6:03 ` Vladimir Prus
  2007-01-03 22:49 ` Daniel Jacobowitz
  0 siblings, 2 replies; 12+ messages in thread
From: Nick Roberts @ 2006-12-14  4:58 UTC (permalink / raw)
  To: gdb-patches


This is a RFA for the patch below to fix variable objects for references to
pointers as previously discussed.  I've moved the changes into get_type_deref,
as suggested by Vladimir, so that they appear in one rather than four places.

Currently get_type_deref dereferences once for a reference or a pointer.  All
this patch does is dereference twice in the case of a references to a pointer.


-- 
Nick                                           http://www.inet.net.nz/~nickrob


2006-12-14  Nick Roberts  <nickrob@snap.net.nz>

	* varobj.c (get_type_deref): Fix variable objects for references to
	pointers.


*** varobj.c	09 Dec 2006 10:59:12 +1300	1.65
--- varobj.c	14 Dec 2006 17:51:46 +1300	
*************** get_type (struct varobj *var)
*** 1535,1541 ****
    return type;
  }
  
! /* This returns the type of the variable, dereferencing pointers, too. */
  static struct type *
  get_type_deref (struct varobj *var)
  {
--- 1535,1542 ----
    return type;
  }
  
! /* This returns the type of the variable, dereferencing references, pointers
!    and references to pointers, too. */
  static struct type *
  get_type_deref (struct varobj *var)
  {
*************** get_type_deref (struct varobj *var)
*** 1543,1551 ****
  
    type = get_type (var);
  
!   if (type != NULL && (TYPE_CODE (type) == TYPE_CODE_PTR
! 		       || TYPE_CODE (type) == TYPE_CODE_REF))
!     type = get_target_type (type);
  
    return type;
  }
--- 1544,1556 ----
  
    type = get_type (var);
  
!   if (type)
!     {
!       if (TYPE_CODE (type) == TYPE_CODE_REF)
! 	type = get_target_type (type);
!       if (TYPE_CODE (type) == TYPE_CODE_PTR)
! 	type = get_target_type (type);
!     }
  
    return type;
  }
*************** c_number_of_children (struct varobj *var
*** 1848,1856 ****
        break;
  
      case TYPE_CODE_PTR:
!       /* This is where things get compilcated. All pointers have one child.
           Except, of course, for struct and union ptr, which we automagically
!          dereference for the user and function ptrs, which have no children.
           We also don't dereference void* as we don't know what to show.
           We can show char* so we allow it to be dereferenced.  If you decide
           to test for it, please mind that a little magic is necessary to
--- 1853,1861 ----
        break;
  
      case TYPE_CODE_PTR:
!       /* This is where things get complicated. All pointers have one child.
           Except, of course, for struct and union ptr, which we automagically
!          dereference for the user, and function ptrs, which have no children.
           We also don't dereference void* as we don't know what to show.
           We can show char* so we allow it to be dereferenced.  If you decide
           to test for it, please mind that a little magic is necessary to


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

end of thread, other threads:[~2007-01-04 22:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-14  4:58 [PATCH] Fix variable objects for references to pointers Nick Roberts
2006-12-14  6:03 ` Vladimir Prus
2006-12-14  9:53   ` Nick Roberts
2006-12-21 15:25     ` Vladimir Prus
2006-12-21 22:38       ` Nick Roberts
2007-01-03 22:55     ` Daniel Jacobowitz
2007-01-04  9:42       ` Nick Roberts
2007-01-04 11:56         ` Vladimir Prus
2007-01-04 14:09         ` Daniel Jacobowitz
2007-01-04 22:30           ` Nick Roberts
2007-01-04 22:33             ` Daniel Jacobowitz
2007-01-03 22:49 ` Daniel Jacobowitz

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