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

Re: MI: -var-list-children --simple-values


 >        -var-list-children --simple-values
 > 
 > is broken on mainline. Printing children of any C++ structure results in 
 > segfault. The problem is that C++ structures have "public" fake child
 > that has no type, so mi_print_value_p tries to access properties of  a NULL 
 > type.
 > 
 > This is easy to fix, but given that printing C++ structures is a mainstream 
 > use-case, and no IDE developer ever complained, this suggests that this 
 > feature is not used. Rather than carry it along, how about just removing it?

ISTR Daniel J wanted --simple-values for consistency with -stack-list-locals.
As it's easy to fix, I suggest doing that.  I also note a mistake in the error
message.  Both are fixed below.

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


*** mi-cmd-var.c	24 Dec 2005 07:57:46 +1300	1.23
--- mi-cmd-var.c	16 Nov 2006 00:09:09 +1300	
***************
*** 269,275 ****
    else
      error (_("Unknown value for PRINT_VALUES\n\
  Must be: 0 or \"%s\", 1 or \"%s\", 2 or \"%s\""),
! 	   mi_no_values, mi_simple_values, mi_all_values);
  }
  
  /* Return 1 if given the argument PRINT_VALUES we should display
--- 269,275 ----
    else
      error (_("Unknown value for PRINT_VALUES\n\
  Must be: 0 or \"%s\", 1 or \"%s\", 2 or \"%s\""),
! 	   mi_no_values, mi_all_values, mi_simple_values);
  }
  
  /* Return 1 if given the argument PRINT_VALUES we should display
***************
*** 278,286 ****
  static int
  mi_print_value_p (struct type *type, enum print_values print_values)
  {
-   if (type != NULL)
-     type = check_typedef (type);
- 
    if (print_values == PRINT_NO_VALUES)
      return 0;
  
--- 278,283 ----
***************
*** 290,295 ****
--- 287,298 ----
    /* For PRINT_SIMPLE_VALUES, only print the value if it has a type
       and that type is not a compound type.  */
  
+   if (type != NULL)
+     type = check_typedef (type);
+   else
+     /* For the "fake" variables. */
+     return 0;
+ 
    return (TYPE_CODE (type) != TYPE_CODE_ARRAY
  	  && TYPE_CODE (type) != TYPE_CODE_STRUCT
  	  && TYPE_CODE (type) != TYPE_CODE_UNION);


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