Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nick Roberts <nick@nick.uklinux.net>
To: gdb-patches@sources.redhat.com
Cc: David Carlton <carlton@kealia.com>
Subject: Re: [PATCH: gdb/mi] -stack-list-locals
Date: Wed, 17 Dec 2003 18:51:00 -0000	[thread overview]
Message-ID: <16352.41789.128223.708473@nick.uklinux.net> (raw)
In-Reply-To: <yf2smjkqimv.fsf@hawaii.kealia.com>


 > I actually suggested SYMBOL_NATURAL_NAME for the call to
 > lookup_symbol.  But it's not in the patch below - I think you left out
 > that bit of the patch?

Yes..Oops! I actually had the right macro in the patch but forgot to include
it.  I guess the moral is don't send in patches at 2 in the morning! Sorry
about that.

Take 2 on mi-cmd-stack.c:

1) Uses SYMBOL_NATURAL_NAME instead of DEPRECATED_SYMBOL_NAME for lookup_symbol
   (in mi-cmd-stack.c) as advised by David Carlton.

2) Shares syntax with earlier changes for -stack-list-locals.

    Nick                                         http://www.nick.uklinux.net



*** mi-cmd-stack.c.~1.19.~	2003-06-12 23:29:37.000000000 +0100
--- mi-cmd-stack.c	2003-12-16 23:14:00.000000000 +0000
***************
*** 29,34 ****
--- 29,35 ----
  #include "block.h"
  #include "stack.h"
  #include "dictionary.h"
+ #include "gdb_string.h"
  
  static void list_args_or_locals (int locals, int values, struct frame_info *fi);
  
***************
*** 137,146 ****
  enum mi_cmd_result
  mi_cmd_stack_list_locals (char *command, char **argv, int argc)
  {
    if (argc != 1)
      error ("mi_cmd_stack_list_locals: Usage: PRINT_VALUES");
  
!   list_args_or_locals (1, atoi (argv[0]), deprecated_selected_frame);
    return MI_CMD_DONE;
  }
  
--- 138,163 ----
  enum mi_cmd_result
  mi_cmd_stack_list_locals (char *command, char **argv, int argc)
  {
+   struct frame_info *frame;
+   enum print_values print_values;
+ 
    if (argc != 1)
      error ("mi_cmd_stack_list_locals: Usage: PRINT_VALUES");
  
!    frame = get_selected_frame ();
! 
!    if (strcmp (argv[0], "0") == 0
!        || strcmp (argv[0], "--no-values") == 0)
!      print_values = PRINT_NO_VALUES;
!    else if (strcmp (argv[0], "1") == 0 
! 	    || strcmp (argv[0], "--all-values") == 0)
!      print_values = PRINT_ALL_VALUES;
!    else if (strcmp (argv[0], "2") == 0
! 	    || strcmp (argv[0], "--simple-values") == 0)
!      print_values = PRINT_SIMPLE_VALUES;
!    else 
!      error ("mi_cmd_stack_list_locals: Unknown value for PRINT_VALUES: must be: 0 or \"--no-values\", 1 or \"--all-values\", 2 or \"--simple-values\"");
!   list_args_or_locals (1, print_values, frame);
    return MI_CMD_DONE;
  }
  
***************
*** 218,223 ****
--- 235,241 ----
    int nsyms;
    struct cleanup *cleanup_list;
    static struct ui_stream *stb = NULL;
+   struct type *type;
  
    stb = ui_out_stream_new (uiout);
  
***************
*** 268,291 ****
  	  if (print_me)
  	    {
  	      struct cleanup *cleanup_tuple = NULL;
! 	      if (values)
  		cleanup_tuple = 
  		  make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
! 	      ui_out_field_string (uiout, "name", DEPRECATED_SYMBOL_NAME (sym));
  
! 	      if (values)
! 		{
! 		  struct symbol *sym2;
! 		  if (!locals)
! 		    sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
! 					  block, VAR_DOMAIN,
! 					  (int *) NULL,
! 					  (struct symtab **) NULL);
! 		  else
  		    sym2 = sym;
  		  print_variable_value (sym2, fi, stb->stream);
  		  ui_out_field_stream (uiout, "value", stb);
  		  do_cleanups (cleanup_tuple);
  		}
  	    }
  	}
--- 286,324 ----
  	  if (print_me)
  	    {
  	      struct cleanup *cleanup_tuple = NULL;
! 	      if (values != PRINT_NO_VALUES)
  		cleanup_tuple = 
  		  make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
! 	      ui_out_field_string (uiout, "name", SYMBOL_PRINT_NAME (sym));
  
! 	      struct symbol *sym2;
! 	      if (!locals)
! 		sym2 = lookup_symbol (SYMBOL_NATURAL_NAME (sym),
! 				      block, VAR_DOMAIN,
! 				      (int *) NULL,
! 				      (struct symtab **) NULL);
! 	      else
  		    sym2 = sym;
+ 	      switch (values)
+ 		{
+ 		case PRINT_SIMPLE_VALUES:
+ 		  type = check_typedef (sym2->type);
+ 		  type_print (sym2->type, "", stb->stream, -1);
+ 		  ui_out_field_stream (uiout, "type", stb);
+ 		  if (TYPE_CODE (type) != TYPE_CODE_ARRAY &&
+ 		      TYPE_CODE (type) != TYPE_CODE_STRUCT &&
+ 		      TYPE_CODE (type) != TYPE_CODE_UNION)
+ 		    {
+ 		      print_variable_value (sym2, fi, stb->stream);
+ 		      ui_out_field_stream (uiout, "value", stb);
+ 		    }
+ 		  do_cleanups (cleanup_tuple);
+ 		  break;
+ 		case PRINT_ALL_VALUES:
  		  print_variable_value (sym2, fi, stb->stream);
  		  ui_out_field_stream (uiout, "value", stb);
  		  do_cleanups (cleanup_tuple);
+ 		  break;
  		}
  	    }
  	}


  reply	other threads:[~2003-12-17 18:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-23  0:16 RFC (gdb/mi): -stack-list-locals Nick Roberts
2003-11-26  0:48 ` Andrew Cagney
2003-12-02  3:14   ` RFC (gdb/mi): -stack-list-locals + PATCH Nick Roberts
2003-12-09  2:42     ` RFC (gdb/mi): -stack-list-locals + REVISED PATCH Nick Roberts
2003-12-10 17:56       ` Andrew Cagney
2003-12-10 22:26         ` Jason Molenda
2003-12-12 20:51         ` RFC (gdb/mi): -stack-list-locals Nick Roberts
2003-12-12 21:09           ` David Carlton
2003-12-17  2:29             ` [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children Nick Roberts
2003-12-17  2:32               ` David Carlton
2003-12-17 18:51                 ` Nick Roberts [this message]
2003-12-17 21:21                   ` [PATCH: gdb/mi] -stack-list-locals David Carlton
2003-12-17 18:05               ` [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children Eli Zaretskii
2004-01-05 21:43               ` Andrew Cagney
2004-01-06  0:14                 ` [PATCH: gdb/mi] -stack-list-locals testcase Nick Roberts
2004-01-06  1:07                   ` Andrew Cagney
2004-01-07 16:31                     ` Andrew Cagney
2004-01-07 17:34                       ` Mark Kettenis
2004-01-07 17:40                         ` Daniel Jacobowitz
2003-12-12 23:01           ` RFC (gdb/mi): -stack-list-locals Jason Molenda

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=16352.41789.128223.708473@nick.uklinux.net \
    --to=nick@nick.uklinux.net \
    --cc=carlton@kealia.com \
    --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