This is the mail archive of the gdb-patches@sources.redhat.com 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]

[PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children


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
  
  


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