This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: PATCH: tests for MI commands
> Thanks. The tests themselves look roughly fine, but:
>
> > * gdb.mi/mi-var-child.exp: Adapt tests for extra elements and use
> > them for tests for "-var-update --no-values" and
> > "-var-update --all-values".
> > Add test for "-var-list-children --simple-values.
>
> Missing quote mark.
OK.
>
> > *************** do_children_tests (void)
> > *** 227,232 ****
> > --- 227,234 ----
> > struct_declarations.long_array[9] = 1234;
> >
> > weird->func_ptr = nothing;
> > + struct_declarations.long_array[10] = 3456;
> > + struct_declarations.long_array[11] = 5678;
> >
> > /* Struct/pointer/array tests */
> > a0 = '0';
> >
>
> You had a bunch of changes that only were needed because you added
> initializations between weird->func_ptr = nothing and a0 = '0'; why not
> put them above it, with the others? There might be some problem with
> that I haven't seen...
The test c_variable-5.8 uses "-var-update *" so I have to change the values of
the added array elements after this test to get a fresh changelist. The
testfile currently stops at "weird->func_ptr = nothing" so it seemed
convenient to add these tests after it. I'm not sure that it would be
simpler, but I can put them above if you prefer.
> > ! # Step over "weird->func_ptr = nothing;"
> > ! set line_dct_a0_0 [gdb_get_line_number "a0 = '0';"]
> > mi_step_to do_children_tests {} {.*var-cmd.c} \
> > ! $line_dct_a0_0 "step \$line_dct_a0_0"
>
> > --- 833,842 ----
>
> > ! # Step over weird->func_ptr = nothing;
> > mi_step_to do_children_tests {} {.*var-cmd.c} \
> > ! [expr $line_dct_nothing + 1] "step \$line_dct_nothing + 1"
>
> Please don't do math on line numbers; gdb_get_line_number helps make
> test cases more robust against changes in the test source.
I was trying to copy existing practice. The testfile seems to use
gdb_get_line_number to get to test blocks and step from there e.g:
# Step over "struct_declarations.integer = 123;"
mi_step_to do_children_tests {} {.*var-cmd.c} \
[expr $line_dct_123 + 1] "step \$line_dct_123 + 1"
The lines:
set line_dct_a0_0 [gdb_get_line_number "a0 = '0';"]
mi_step_to do_children_tests {} {.*var-cmd.c} \
$line_dct_a0_0 "step \$line_dct_a0_0"
are still present but occur later in the file by the comment:
# Step over struct_declarations.long_array[11] = 5678;
Is this acceptable or do you want me to use gdb_get_line_number for each
test?
> > + # Step overstruct_declarations.long_array[10] = 3456;
>
> > + "update all vars struct_declarations.long_array.10 changed, don't print values."
>
> Missing space; extra space.
OK
Nick