* {commit: gdb/mi] -stack-list-locals and -var-list-children
@ 2004-01-20 1:27 Nick Roberts
2004-01-20 5:49 ` Daniel Jacobowitz
0 siblings, 1 reply; 6+ messages in thread
From: Nick Roberts @ 2004-01-20 1:27 UTC (permalink / raw)
To: gdb-patches
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 15524 bytes --]
I've comitted the patches below. Testcases don't work for me but I've kept the
status quo so they should work for others. Diff's have been made with Emacs
backup files - sorry, should have made the patches before committing, done
off-line - 64k modem, family to feed etc. I hope they work... Well they
compile anyway.
Nick http://www.nick.uklinux.net
2004-01-20 Nick Roberts <nick at nick dot uklinux dot net>
* mi/mi-cmds.h (enum print_values): Add definition.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_locals): Print the name,
type and value for simple data types and just the name and type
for complex ones, if required.
* mi/mi-cmd-var.c (mi_cmd_var_list_children): Print the values of the
children, if required.
2004-01-19 Nick Roberts <nick at nick dot uklinux dot net>
* gdb.texinfo (GDB/MI Stack Manipulation): Describe extension to
-stack-list-locals.
(GDB/MI Variable Objects): Describe extension to
-var-list-children.
2004-01-20 Nick Roberts <nick at nick dot uklinux dot net>
* gdb.mi/mi-stack.exp (test_stack_locals_listing): Test for
case "-stack-list-locals 2".
* gdb.mi/mi-var-child.exp: Test for case
"-var-list-children --all-values NAME".
*** /home/nick/gdb/gdb/mi/mi-cmds.h~ 2003-08-05 00:18:50.000000000 +0100
--- /home/nick/gdb/gdb/mi/mi-cmds.h 2004-01-19 23:25:52.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
*** /home/nick/gdb/gdb/mi/mi-cmd-stack.c~ 2003-06-12 00:29:49.000000000 +0100
--- /home/nick/gdb/gdb/mi/mi-cmd-stack.c 2004-01-19 23:27:51.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 ("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;
}
}
}
*** /home/nick/gdb/gdb/mi/mi-cmd-stack.c~ 2003-06-12 00:29:49.000000000 +0100
--- /home/nick/gdb/gdb/mi/mi-cmd-stack.c 2004-01-19 23:27:51.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 ("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;
}
}
}
*** /home/nick/gdb/gdb/doc/gdb.texinfo~ 2004-01-19 23:11:48.000000000 +0000
--- /home/nick/gdb/gdb/doc/gdb.texinfo 2004-01-19 23:25:02.000000000 +0000
***************
*** 17206,17213 ****
@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
--- 17206,17219 ----
@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
***************
*** 17220,17228 ****
-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
--- 17226,17237 ----
-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
***************
*** 18166,18179 ****
@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
--- 18175,18200 ----
@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
*** /home/nick/gdb/gdb/testsuite/gdb.mi/mi-stack.exp~ 2002-11-05 15:43:18.000000000 +0000
--- /home/nick/gdb/gdb/testsuite/gdb.mi/mi-stack.exp 2004-01-19 23:14:32.000000000 +0000
***************
*** 149,154 ****
--- 149,155 ----
# Tests:
# -stack-list-locals 0
# -stack-list-locals 1
+ # -stack-list-locals 2
# -stack-list-arguments
mi_gdb_test "232-stack-list-locals 0" \
***************
*** 168,173 ****
--- 169,178 ----
"232\\^done,locals=\\\[\{name=\"A\",value=\"1\"\},\{name=\"B\",value=\"2\"\},\{name=\"C\",value=\"3\"\}\\\]" \
"stack locals listing 1"
+ mi_gdb_test "232-stack-list-locals 2" \
+ "232\\^done,locals=\\\[\{name=\"A\",type=\"int\",value=\"1\"\},\{name=\"B\",type=\"int\",value=\"2\"\},\{name=\"C\",type=\"int\",value=\"3\"\}\\\]" \
+ "stack locals listing 2"
+
mi_gdb_test "234-stack-list-locals" \
"234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
"stack locals listing wrong"
*** /home/nick/gdb/gdb/testsuite/gdb.mi/mi-var-child.exp~ 2004-01-19 23:15:54.000000000 +0000
--- /home/nick/gdb/gdb/testsuite/gdb.mi/mi-var-child.exp 2004-01-20 00:01:51.000000000 +0000
***************
*** 827,832 ****
--- 827,836 ----
set line 208
mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line"
+ mi_gdb_test "-var-list-children --all-values struct_declarations.long_array" \
+ "\\^done,numchild=\"10\",children=\\\[child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",value=\"1234\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",value=\"2345\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",value=\"3456\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",value=\"4567\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",value=\"5678\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",value=\"6789\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",value=\"7890\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",value=\"8901\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",value=\"9012\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",value=\"1234\",type=\"long int\"\}\\\]" \
+ "listing of names and values of children"
+
# Test: c_variable-5.8
# Desc: check that long_array[3-9] changed
mi_gdb_test "-var-update *" \
\x16º&Öéj×!zÊÞ¶êçßM9öX¬µªÜ\a[¥«\
ë
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: {commit: gdb/mi] -stack-list-locals and -var-list-children
2004-01-20 1:27 {commit: gdb/mi] -stack-list-locals and -var-list-children Nick Roberts
@ 2004-01-20 5:49 ` Daniel Jacobowitz
2004-01-23 17:05 ` Daniel Jacobowitz
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2004-01-20 5:49 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb-patches
On Tue, Jan 20, 2004 at 01:18:52AM +0000, Nick Roberts wrote:
>
> I've comitted the patches below. Testcases don't work for me but I've kept the
> status quo so they should work for others. Diff's have been made with Emacs
> backup files - sorry, should have made the patches before committing, done
> off-line - 64k modem, family to feed etc. I hope they work... Well they
> compile anyway.
No, you've added a failing testcase:
-var-list-children --all-values struct_declarations.long_array
^done,numchild="10",children=[child={name="struct_declarations.long_array.0",exp="0",numchild="0",value=
"1234",type="long
int"},child={name="struct_declarations.long_array.1",exp="1",numchild="0",value="2345"
,type="long
int"},child={name="struct_declarations.long_array.2",exp="2",numchild="0",value="3456",type=
"long
int"},child={name="struct_declarations.long_array.3",exp="3",numchild="0",value="28281",type="long
int"},child={name="struct_declarations.long_array.4",exp="4",numchild="0",value="0",type="long
int"},ch
ild={name="struct_declarations.long_array.5",exp="5",numchild="0",value="0",type="long
int"},child={name
="struct_declarations.long_array.6",exp="6",numchild="0",value="0",type="long
int"},child={name="struct_
declarations.long_array.7",exp="7",numchild="0",value="0",type="long
int"},child={name="struct_declarati
ons.long_array.8",exp="8",numchild="0",value="0",type="long
int"},child={name="struct_declarations.long_
array.9",exp="9",numchild="0",value="0",type="long int"}]
(gdb)
FAIL: gdb.mi/mi-var-child.exp: listing of names and values of children
I'll look at the problem in the morning.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: {commit: gdb/mi] -stack-list-locals and -var-list-children
2004-01-20 5:49 ` Daniel Jacobowitz
@ 2004-01-23 17:05 ` Daniel Jacobowitz
2004-01-23 21:27 ` Nick Roberts
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2004-01-23 17:05 UTC (permalink / raw)
To: Nick Roberts, gdb-patches
On Tue, Jan 20, 2004 at 12:49:32AM -0500, Daniel Jacobowitz wrote:
> On Tue, Jan 20, 2004 at 01:18:52AM +0000, Nick Roberts wrote:
> >
> > I've comitted the patches below. Testcases don't work for me but I've kept the
> > status quo so they should work for others. Diff's have been made with Emacs
> > backup files - sorry, should have made the patches before committing, done
> > off-line - 64k modem, family to feed etc. I hope they work... Well they
> > compile anyway.
>
> No, you've added a failing testcase:
>
> -var-list-children --all-values struct_declarations.long_array
> ^done,numchild="10",children=[child={name="struct_declarations.long_array.0",exp="0",numchild="0",value=
> "1234",type="long
> int"},child={name="struct_declarations.long_array.1",exp="1",numchild="0",value="2345"
> ,type="long
> int"},child={name="struct_declarations.long_array.2",exp="2",numchild="0",value="3456",type=
> "long
> int"},child={name="struct_declarations.long_array.3",exp="3",numchild="0",value="28281",type="long
> int"},child={name="struct_declarations.long_array.4",exp="4",numchild="0",value="0",type="long
> int"},ch
> ild={name="struct_declarations.long_array.5",exp="5",numchild="0",value="0",type="long
> int"},child={name
> ="struct_declarations.long_array.6",exp="6",numchild="0",value="0",type="long
> int"},child={name="struct_
> declarations.long_array.7",exp="7",numchild="0",value="0",type="long
> int"},child={name="struct_declarati
> ons.long_array.8",exp="8",numchild="0",value="0",type="long
> int"},child={name="struct_declarations.long_
> array.9",exp="9",numchild="0",value="0",type="long int"}]
> (gdb)
> FAIL: gdb.mi/mi-var-child.exp: listing of names and values of children
>
> I'll look at the problem in the morning.
I believe that this is a problem in the patch, not in the testcase. If
I step to the same PC in a non-MI GDB, the values are correct, but
above only the first few are initialized.
If I execute this silly little command sequence:
b do_children_tests
b 208
run
-var-create struct_declarations * struct_declarations
-var-list-children struct_declarations
-var-list-children --all-values struct_declarations.long_array
continue
-var-list-children --all-values struct_declarations.long_array
print struct_declarations.long_array
I get this output:
~"GNU gdb 2004-01-23-cvs\n"
~"Copyright 2004 Free Software Foundation, Inc.\n"
~"GDB is free software, covered by the GNU General Public License, and you are\n"
~"welcome to change it and/or distribute copies of it under certain conditions.\n"
~"Type \"show copying\" to see the conditions.\n"
~"There is absolutely no warranty for GDB. Type \"show warranty\" for details.\n"
~"This GDB was configured as \"i686-pc-linux-gnu\"..."
~"Using host libthread_db library \"/lib/tls/i686/cmov/libthread_db.so.1\".\n"
~"\n"
(gdb)
&"b do_children_tests\n"
^done
(gdb)
&"b 208\n"
^done
(gdb)
&"run\n"
^done,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x080484d0",func="do_children_tests",args=[],file="/opt/src/gdb/src/gdb/testsuite/gdb.mi/var-cmd.c",line="190"}
(gdb)
^done,name="struct_declarations",numchild="11",type="struct _struct_decl"
(gdb)
^done,numchild="11",children=[child={name="struct_declarations.integer",exp="integer",numchild="0",type="int"},child={name="struct_declarations.character",exp="character",numchild="0",type="char"},child={name="struct_declarations.char_ptr",exp="char_ptr",numchild="1",type="char *"},child={name="struct_declarations.long_int",exp="long_int",numchild="0",type="long int"},child={name="struct_declarations.int_ptr_ptr",exp="int_ptr_ptr",numchild="1",type="int **"},child={name="struct_declarations.long_array",exp="long_array",numchild="10",type="long int [10]"},child={name="struct_declarations.func_ptr",exp="func_ptr",numchild="0",type="void (*)(void)"},child={name="struct_declarations.func_ptr_struct",exp="func_ptr_struct",numchild="0",type="struct _struct_decl (*)(int, char *, long int)"},child={name="struct_declarations.func_ptr_ptr",exp="func_ptr_ptr",numchild="0",type="struct _struct_decl *(*)(int, char *, long int)"},child={name="struct_declarations.u1",exp="u1",numchild="4",type="union {...}"},child={name="struct_declarations.s2",exp="s2",numchild="4",type="struct {...}"}]
(gdb)
^done,numchild="10",children=[child={name="struct_declarations.long_array.0",exp="0",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.1",exp="1",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.2",exp="2",numchild="0",value="1986358784",type="long int"},child={name="struct_declarations.long_array.3",exp="3",numchild="0",value="28281",type="long int"},child={name="struct_declarations.long_array.4",exp="4",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.5",exp="5",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.6",exp="6",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.7",exp="7",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.8",exp="8",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.9",exp="9",numchild="0",value="0",type="long int"}]
(gdb)
&"continue\n"
^done,reason="breakpoint-hit",bkptno="2",thread-id="0",frame={addr="0x08048573",func="do_children_tests",args=[],file="/opt/src/gdb/src/gdb/testsuite/gdb.mi/var-cmd.c",line="208"}
(gdb)
^done,numchild="10",children=[child={name="struct_declarations.long_array.0",exp="0",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.1",exp="1",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.2",exp="2",numchild="0",value="1986358784",type="long int"},child={name="struct_declarations.long_array.3",exp="3",numchild="0",value="28281",type="long int"},child={name="struct_declarations.long_array.4",exp="4",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.5",exp="5",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.6",exp="6",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.7",exp="7",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.8",exp="8",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.9",exp="9",numchild="0",value="0",type="long int"}]
(gdb)
&"print struct_declarations.long_array\n"
~"$1 = {"
~"1234, "
~"2345, "
~"3456, "
~"4567, "
~"5678, "
~"6789, "
~"7890, "
~"8901, "
~"9012, "
~"1234}\n"
^done
(gdb)
Note that the varobj is out of date.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: {commit: gdb/mi] -stack-list-locals and -var-list-children
2004-01-23 17:05 ` Daniel Jacobowitz
@ 2004-01-23 21:27 ` Nick Roberts
2004-01-23 22:46 ` Daniel Jacobowitz
0 siblings, 1 reply; 6+ messages in thread
From: Nick Roberts @ 2004-01-23 21:27 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
> Note that the varobj is out of date.
If my test is moved after Test: c_variable-5.8 does that work? Assuming the
answer is yes, does this count as an obvious fix or does it need approval?
Nick
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: {commit: gdb/mi] -stack-list-locals and -var-list-children
2004-01-23 21:27 ` Nick Roberts
@ 2004-01-23 22:46 ` Daniel Jacobowitz
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2004-01-23 22:46 UTC (permalink / raw)
To: gdb-patches
On Fri, Jan 23, 2004 at 09:19:04PM +0000, Nick Roberts wrote:
>
> > Note that the varobj is out of date.
>
> If my test is moved after Test: c_variable-5.8 does that work? Assuming the
> answer is yes, does this count as an obvious fix or does it need approval?
That does work. I've checked this in; note you forgot copyright dates.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2004-01-23 Daniel Jacobowitz <drow@mvista.com>
* gdb.mi/mi-var-child.exp: Update copyright year. Move new test
after -var-update.
Index: testsuite//gdb.mi/mi-var-child.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-child.exp,v
retrieving revision 1.14
diff -u -p -r1.14 mi-var-child.exp
--- testsuite//gdb.mi/mi-var-child.exp 20 Jan 2004 00:54:04 -0000 1.14
+++ testsuite//gdb.mi/mi-var-child.exp 23 Jan 2004 22:44:26 -0000
@@ -1,4 +1,4 @@
-# Copyright (C) 1999, 2000, 2002 Free Software Foundation
+# Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation
# This Program Is Free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -827,16 +827,15 @@ mi_gdb_test "-var-update *" \
set line 208
mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line"
-mi_gdb_test "-var-list-children --all-values struct_declarations.long_array" \
- "\\^done,numchild=\"10\",children=\\\[child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",value=\"1234\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",value=\"2345\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",value=\"3456\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",value=\"4567\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",value=\"5678\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",value=\"6789\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",value=\"7890\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",value=\"8901\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",value=\"9012\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",value=\"1234\",type=\"long int\"\}\\\]" \
- "listing of names and values of children"
-
# Test: c_variable-5.8
# Desc: check that long_array[3-9] changed
mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.3\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.4\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.5\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.6\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.7\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.8\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.9\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
"update all vars struct_declarations.long_array.3-9 changed"
+mi_gdb_test "-var-list-children --all-values struct_declarations.long_array" \
+ "\\^done,numchild=\"10\",children=\\\[child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",value=\"1234\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",value=\"2345\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",value=\"3456\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",value=\"4567\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",value=\"5678\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",value=\"6789\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",value=\"7890\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",value=\"8901\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",value=\"9012\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",value=\"1234\",type=\"long int\"\}\\\]" \
+ "listing of names and values of children"
# Step over "weird->func_ptr = nothing;"
set line 211
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1074880622.7069.ezmlm@sources.redhat.com>]
* Re: {commit: gdb/mi] -stack-list-locals and -var-list-children
[not found] <1074880622.7069.ezmlm@sources.redhat.com>
@ 2004-01-23 19:02 ` Jim Ingham
0 siblings, 0 replies; 6+ messages in thread
From: Jim Ingham @ 2004-01-23 19:02 UTC (permalink / raw)
To: gdb-patches
Daniel,
>
> I believe that this is a problem in the patch, not in the testcase. If
> I step to the same PC in a non-MI GDB, the values are correct, but
> above only the first few are initialized.
>
> If I execute this silly little command sequence:
>
> b do_children_tests
> b 208
> run
> -var-create struct_declarations * struct_declarations
> -var-list-children struct_declarations
> -var-list-children --all-values struct_declarations.long_array
> continue
> -var-list-children --all-values struct_declarations.long_array
> print struct_declarations.long_array
>
>
> I get this output:
> ~"GNU gdb 2004-01-23-cvs\n"
> ~"Copyright 2004 Free Software Foundation, Inc.\n"
> ~"GDB is free software, covered by the GNU General Public License, and
> you are\n"
> ~"welcome to change it and/or distribute copies of it under certain
> conditions.\n"
> ~"Type \"show copying\" to see the conditions.\n"
> ~"There is absolutely no warranty for GDB. Type \"show warranty\" for
> details.\n"
> ~"This GDB was configured as \"i686-pc-linux-gnu\"..."
> ~"Using host libthread_db library
> \"/lib/tls/i686/cmov/libthread_db.so.1\".\n"
> ~"\n"
> (gdb)
> &"b do_children_tests\n"
> ^done
> (gdb)
> &"b 208\n"
> ^done
> (gdb)
> &"run\n"
> ^done,reason="breakpoint-hit",bkptno="1",thread-
> id="0",frame={addr="0x080484d0",func="do_children_tests",args=[],file="
> /opt/src/gdb/src/gdb/testsuite/gdb.mi/var-cmd.c",line="190"}
> (gdb)
> ^done,name="struct_declarations",numchild="11",type="struct
> _struct_decl"
> (gdb)
> ^done,numchild="11",children=[child={name="struct_declarations.integer"
> ,exp="integer",numchild="0",type="int"},child={name="struct_declaration
> s.character",exp="character",numchild="0",type="char"},child={name="str
> uct_declarations.char_ptr",exp="char_ptr",numchild="1",type="char
> *"},child={name="struct_declarations.long_int",exp="long_int",numchild=
> "0",type="long
> int"},child={name="struct_declarations.int_ptr_ptr",exp="int_ptr_ptr",n
> umchild="1",type="int
> **"},child={name="struct_declarations.long_array",exp="long_array",numc
> hild="10",type="long int
> [10]"},child={name="struct_declarations.func_ptr",exp="func_ptr",numchi
> ld="0",type="void
> (*)(void)"},child={name="struct_declarations.func_ptr_struct",exp="func
> _ptr_struct",numchild="0",type="struct _struct_decl (*)(int, char *,
> long
> int)"},child={name="struct_declarations.func_ptr_ptr",exp="func_ptr_ptr
> ",numchild="0",type="struct _struct_decl *(*)(int, char *, long
> int)"},child={name="struct_declarations.u1",exp="u1",numchild="4",type=
> "union
> {...}"},child={name="struct_declarations.s2",exp="s2",numchild="4",type
> ="struct {...}"}]
> (gdb)
> ^done,numchild="10",children=[child={name="struct_declarations.long_arr
> ay.0",exp="0",numchild="0",value="0",type="long
> int"},child={name="struct_declarations.long_array.1",exp="1",numchild="
> 0",value="0",type="long
> int"},child={name="struct_declarations.long_array.2",exp="2",numchild="
> 0",value="1986358784",type="long
> int"},child={name="struct_declarations.long_array.3",exp="3",numchild="
> 0",value="28281",type="long
> int"},child={name="struct_declarations.long_array.4",exp="4",numchild="
> 0",value="0",type="long
> int"},child={name="struct_declarations.long_array.5",exp="5",numchild="
> 0",value="0",type="long
> int"},child={name="struct_declarations.long_array.6",exp="6",numchild="
> 0",value="0",type="long
> int"},child={name="struct_declarations.long_array.7",exp="7",numchild="
> 0",value="0",type="long
> int"},child={name="struct_declarations.long_array.8",exp="8",numchild="
> 0",value="0",type="long
> int"},child={name="struct_declarations.long_array.9",exp="9",numchild="
> 0",value="0",type="long int"}]
> (gdb)
> &"continue\n"
> ^done,reason="breakpoint-hit",bkptno="2",thread-
> id="0",frame={addr="0x08048573",func="do_children_tests",args=[],file="
> /opt/src/gdb/src/gdb/testsuite/gdb.mi/var-cmd.c",line="208"}
> (gdb)
> ^done,numchild="10",children=[child={name="struct_declarations.long_arr
> ay.0",exp="0",numchild="0",value="0",type="long
> int"},child={name="struct_declarations.long_array.1",exp="1",numchild="
> 0",value="0",type="long
> int"},child={name="struct_declarations.long_array.2",exp="2",numchild="
> 0",value="1986358784",type="long
> int"},child={name="struct_declarations.long_array.3",exp="3",numchild="
> 0",value="28281",type="long
> int"},child={name="struct_declarations.long_array.4",exp="4",numchild="
> 0",value="0",type="long
> int"},child={name="struct_declarations.long_array.5",exp="5",numchild="
> 0",value="0",type="long
> int"},child={name="struct_declarations.long_array.6",exp="6",numchild="
> 0",value="0",type="long
> int"},child={name="struct_declarations.long_array.7",exp="7",numchild="
> 0",value="0",type="long
> int"},child={name="struct_declarations.long_array.8",exp="8",numchild="
> 0",value="0",type="long
> int"},child={name="struct_declarations.long_array.9",exp="9",numchild="
> 0",value="0",type="long int"}]
> (gdb)
> &"print struct_declarations.long_array\n"
> ~"$1 = {"
> ~"1234, "
> ~"2345, "
> ~"3456, "
> ~"4567, "
> ~"5678, "
> ~"6789, "
> ~"7890, "
> ~"8901, "
> ~"9012, "
> ~"1234}\n"
> ^done
> (gdb)
>
>
> Note that the varobj is out of date.
>
>
This is intended behavior. After continuing the target, you need to
explicitly call -var-update then -var-evaluate-expression (or
var-list-children) before you get new values. That way, if you want to
you can use varobj's to store historic values - like the $ variables in
gdb - or use them to represent the variables, depending on whether you
update them or not. This is the way it is described in the manual.
Jim
--
Jim Ingham jingham@apple.com
Developer Tools
Apple Computer
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-01-23 22:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-20 1:27 {commit: gdb/mi] -stack-list-locals and -var-list-children Nick Roberts
2004-01-20 5:49 ` Daniel Jacobowitz
2004-01-23 17:05 ` Daniel Jacobowitz
2004-01-23 21:27 ` Nick Roberts
2004-01-23 22:46 ` Daniel Jacobowitz
[not found] <1074880622.7069.ezmlm@sources.redhat.com>
2004-01-23 19:02 ` Jim Ingham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox