Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Fix variable objects for references to pointers
Date: Thu, 14 Dec 2006 04:58:00 -0000	[thread overview]
Message-ID: <17792.55489.274138.854508@kahikatea.snap.net.nz> (raw)


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


             reply	other threads:[~2006-12-14  4:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-14  4:58 Nick Roberts [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17792.55489.274138.854508@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox