Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: Vladimir Prus <vladimir@codesourcery.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: MI: -var-list-children --simple-values
Date: Wed, 15 Nov 2006 11:21:00 -0000	[thread overview]
Message-ID: <17754.63307.487745.34360@kahikatea.snap.net.nz> (raw)
In-Reply-To: <200611151250.11654.vladimir@codesourcery.com>

 >        -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);


       reply	other threads:[~2006-11-15 11:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200611151250.11654.vladimir@codesourcery.com>
2006-11-15 11:21 ` Nick Roberts [this message]
2006-11-15 11:50   ` Vladimir Prus
2006-11-15 14:44     ` Daniel Jacobowitz
2006-11-15 14:55       ` Vladimir Prus
2006-11-15 15:09         ` Daniel Jacobowitz
2006-11-15 16:29           ` Vladimir Prus
2006-11-15 20:29             ` Nick Roberts
2006-11-29  9:35               ` Vladimir Prus
2006-11-29  9:58                 ` Nick Roberts
2006-11-16 15:57             ` Daniel Jacobowitz
2006-11-15 19:55       ` Nick Roberts

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=17754.63307.487745.34360@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=gdb-patches@sources.redhat.com \
    --cc=vladimir@codesourcery.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