gdb/51

Fernando Nasser fnasser@redhat.com
Mon May 7 09:48:00 GMT 2001


The following reply was made to PR gdb/51; it has been noted by GNATS.

From: Fernando Nasser <fnasser@redhat.com>
To: blizzard@mozilla.org, nobody@sources.redhat.com,
        gdb-gnats@sources.redhat.com, dr@netscape.com
Cc:  
Subject: Re: gdb/51
Date: Mon, 07 May 2001 12:44:01 -0400

 This is a multi-part message in MIME format.
 --------------1A7C8C870DB80CC1293AC435
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=51&database=gdb
 
 Can you please try the attached patch?
 
 The problem may not be even in GDB itself, but this change will
 circumvent it.
 
 I have opted to allow dereferencing a char*.  I will still ask in the
 Insight list if people like this idea (if not it can be disallowed again
 in the official sources).
 
 
 Please let me know if it solved your problem.
 
 Thanks.
 
 -- 
 Fernando Nasser
 Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
 --------------1A7C8C870DB80CC1293AC435
 Content-Type: text/plain; charset=us-ascii;
  name="VOIDTYPE.PATCH"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="VOIDTYPE.PATCH"
 
 Index: varobj.c
 ===================================================================
 RCS file: /cvs/src/src/gdb/varobj.c,v
 retrieving revision 1.17
 diff -c -p -r1.17 varobj.c
 *** varobj.c	2001/03/27 20:36:24	1.17
 --- varobj.c	2001/05/02 02:35:16
 *************** c_number_of_children (struct varobj *var
 *** 1761,1767 ****
       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. */
         switch (TYPE_CODE (target))
   	{
   	case TYPE_CODE_STRUCT:
 --- 1761,1773 ----
       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
 !          properly identify it: char* has TYPE_CODE == TYPE_CODE_INT and 
 !          TYPE_NAME == "char" */
 ! 
         switch (TYPE_CODE (target))
   	{
   	case TYPE_CODE_STRUCT:
 *************** c_number_of_children (struct varobj *var
 *** 1770,1786 ****
   	  break;
   
   	case TYPE_CODE_FUNC:
   	  children = 0;
   	  break;
   
   	default:
 ! 	  /* Don't dereference char* or void*. */
 ! 	  if (TYPE_NAME (target) != NULL
 ! 	      && (STREQ (TYPE_NAME (target), "char")
 ! 		  || STREQ (TYPE_NAME (target), "void")))
 ! 	    children = 0;
 ! 	  else
 ! 	    children = 1;
   	}
         break;
   
 --- 1776,1787 ----
   	  break;
   
   	case TYPE_CODE_FUNC:
 + 	case TYPE_CODE_VOID:
   	  children = 0;
   	  break;
   
   	default:
 ! 	  children = 1;
   	}
         break;
   
 
 --------------1A7C8C870DB80CC1293AC435--
 



More information about the Gdb-prs mailing list