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
Subject: [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children
Date: Wed, 17 Dec 2003 02:29:00 -0000	[thread overview]
Message-ID: <16351.48550.8915.678388@nick.uklinux.net> (raw)
In-Reply-To: <yf2r7z9920a.fsf@hawaii.kealia.com>


This patch covers four files mi-cmds.h, mi-cmd-stack.c, mi-cmd-var.c
and gdb.texinfo and:

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

2) Uses a similar syntax to that suggested by Andrew Cagney for
   -var-list-children.

AC> I think the syntax should be: -var-list-children --print-values @var{name}

   I actually use --novalues and --all-values. This is to give some
   consistency with my changes to -stack-list-locals.


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



*** mi-cmds.h.~1.10.~	2003-10-24 22:30:52.000000000 +0100
--- mi-cmds.h	2003-12-10 20:09:22.000000000 +0000
***************
*** 48,53 ****
--- 48,59 ----
      MI_CMD_QUIET
    };
  
+ enum print_values {
+    PRINT_NO_VALUES,
+    PRINT_ALL_VALUES,
+    PRINT_SIMPLE_VALUES
+ };
+ 
  typedef enum mi_cmd_result (mi_cmd_argv_ftype) (char *command, char **argv, int argc);
  
  /* Older MI commands have this interface. Retained until all old
*** mi-cmd-var.c	2003-12-17 02:08:57.000000000 +0000
--- mi-cmd-var.c.~1.17~	2003-12-17 00:07:15.000000000 +0000
***************
*** 257,285 ****
    struct cleanup *cleanup_children;
    int numchild;
    char *type;
-   enum print_values print_values;
  
!   if (argc != 1 && argc != 2)
!     error ("mi_cmd_var_list_children: Usage: [PRINT_VALUES] NAME");
  
    /* Get varobj handle, if a valid var obj name was specified */
!   if (argc == 1) var = varobj_get_handle (argv[0]);
!   else var = varobj_get_handle (argv[1]);
    if (var == NULL)
      error ("mi_cmd_var_list_children: Variable object not found");
  
    numchild = varobj_list_children (var, &childlist);
    ui_out_field_int (uiout, "numchild", numchild);
-   if (argc == 2) 
-     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
-      error ("mi_cmd_var_list_children: Unknown value for PRINT_VALUES: must be: 0 or \"--no-values\", 1 or \"--all-values\"");
-   else print_values = PRINT_NO_VALUES;
  
    if (numchild <= 0)
      return MI_CMD_DONE;
--- 257,273 ----
    struct cleanup *cleanup_children;
    int numchild;
    char *type;
  
!   if (argc != 1)
!     error ("mi_cmd_var_list_children: Usage: NAME.");
  
    /* Get varobj handle, if a valid var obj name was specified */
!   var = varobj_get_handle (argv[0]);
    if (var == NULL)
      error ("mi_cmd_var_list_children: Variable object not found");
  
    numchild = varobj_list_children (var, &childlist);
    ui_out_field_int (uiout, "numchild", numchild);
  
    if (numchild <= 0)
      return MI_CMD_DONE;
***************
*** 296,303 ****
        ui_out_field_string (uiout, "name", varobj_get_objname (*cc));
        ui_out_field_string (uiout, "exp", varobj_get_expression (*cc));
        ui_out_field_int (uiout, "numchild", varobj_get_num_children (*cc));
-       if (print_values)
- 	ui_out_field_string (uiout, "value", varobj_get_value (*cc));
        type = varobj_get_type (*cc);
        /* C++ pseudo-variables (public, private, protected) do not have a type */
        if (type)
--- 284,289 ----
*** gdb.texinfo.~1.185~	2003-12-17 00:06:41.000000000 +0000
--- gdb.texinfo	2003-12-17 02:13:43.000000000 +0000
***************
*** 17202,17209 ****
  @end smallexample
  
  Display the local variable names for the current frame.  With an
! argument of 0 prints only the names of the variables, with argument of 1
! prints also their values.
  
  @subsubheading @value{GDBN} Command
  
--- 17202,17215 ----
  @end smallexample
  
  Display the local variable names for the current frame.  With an
! argument of 0 or @code{--no-values}, prints only the names of the variables.
! With argument of 1 or @code{--all-values}, prints also their values.  With
! argument of 2 or @code{--simple-values}, prints the name, type and value for
! simple data types and the name and type for arrays, structures and
! unions.  In this last case, the idea is that the user can see the
! value of simple data types immediately and he can create variable
! objects for other data types if he wishes to explore their values in
! more detail.
  
  @subsubheading @value{GDBN} Command
  
***************
*** 17216,17224 ****
  -stack-list-locals 0
  ^done,locals=[name="A",name="B",name="C"]
  (@value{GDBP})
! -stack-list-locals 1
  ^done,locals=[@{name="A",value="1"@},@{name="B",value="2"@},
!   @{name="C",value="3"@}]
  (@value{GDBP})
  @end smallexample
  
--- 17222,17233 ----
  -stack-list-locals 0
  ^done,locals=[name="A",name="B",name="C"]
  (@value{GDBP})
! -stack-list-locals --all-values
  ^done,locals=[@{name="A",value="1"@},@{name="B",value="2"@},
!   @{name="C",value="@{1, 2, 3@}"@}]
! -stack-list-locals --simple-values
! ^done,locals=[@{name="A",type="int",value="1"@},
!   @{name="B",type="int",value="2"@},@{name="C",type="int [3]"@}]
  (@value{GDBP})
  @end smallexample
  
***************
*** 18162,18175 ****
  @subsubheading Synopsis
  
  @smallexample
!  -var-list-children @var{name}
  @end smallexample
  
! Returns a list of the children of the specified variable object:
  
  @smallexample
   numchild=@var{n},children=[@{name=@var{name},
   numchild=@var{n},type=@var{type}@},@r{(repeats N times)}]
  @end smallexample
  
  
--- 18171,18196 ----
  @subsubheading Synopsis
  
  @smallexample
!  -var-list-children [@var{print-values}] @var{name}
  @end smallexample
  
! Returns a list of the children of the specified variable object.  With
! just the variable object name as an argument or with an optional
! preceding argument of 0 or @code{--no-values}, prints only the names of the
! variables.  With an optional preceding argument of 1 or @code{--all-values},
! also prints their values.
! 
! @subsubheading Example
  
  @smallexample
+ (@value{GDBP})
+  -var-list-children n
   numchild=@var{n},children=[@{name=@var{name},
   numchild=@var{n},type=@var{type}@},@r{(repeats N times)}]
+ (@value{GDBP})
+  -var-list-children --all-values n
+  numchild=@var{n},children=[@{name=@var{name},
+  numchild=@var{n},value=@var{value},type=@var{type}@},@r{(repeats N times)}]
  @end smallexample
  
  


  reply	other threads:[~2003-12-17  2:29 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             ` Nick Roberts [this message]
2003-12-17  2:32               ` [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children David Carlton
2003-12-17 18:51                 ` [PATCH: gdb/mi] -stack-list-locals Nick Roberts
2003-12-17 21:21                   ` 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=16351.48550.8915.678388@nick.uklinux.net \
    --to=nick@nick.uklinux.net \
    --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