Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* PATCH: tests for MI commands
@ 2005-07-20  4:51 Nick Roberts
  2005-07-24 21:19 ` Daniel Jacobowitz
  0 siblings, 1 reply; 25+ messages in thread
From: Nick Roberts @ 2005-07-20  4:51 UTC (permalink / raw)
  To: gdb-patches


This patch provides tests for the recent changes to -var-update and
-var-list-children.  I have also revised the test for stack-list-locals
so that it properly tests the --simple-values option.

There is no test for "-var-update --simple-values" as I could not get it
to behave differently for "-var-update --all-values".  I think this is
because the changelist only consists of simple types; if it is complex
its `value' is deemed not have changed.

Nick


2005-07-20  Nick Roberts  <nickrob@snap.net.nz>

	* gdb.mi/var-cmd.c: Give long_array in _struct_decl 12 elements.
	(do_children_tests): Assign values to the extra elements.

	* 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.

	* gdb.mi/basics.c (callee4): Add integer array D[3]...

	* gdb.mi/mi-stack.exp (test_stack_locals_listing): ...to test
	"-stack-list-locals --simple-values".  Improve doc strings and
	comments.


*** gdb.mi/var-cmd.c.~1.3.~	2004-09-28 23:54:51.000000000 +1200
--- gdb.mi/var-cmd.c	2005-07-20 16:20:40.000000000 +1200
***************
*** 1,4 ****
! /* Copyright 1999, 2004 Free Software Foundation, Inc.
  
     This file is part of GDB.
  
--- 1,4 ----
! /* Copyright 1999, 2004, 2005 Free Software Foundation, Inc.
  
     This file is part of GDB.
  
*************** typedef struct _struct_decl {
*** 51,57 ****
    char *char_ptr;
    long  long_int;
    int  **int_ptr_ptr;
!   long  long_array[10];
  
    void (*func_ptr) (void);
    struct _struct_decl (*func_ptr_struct) (int, char *, long);
--- 51,57 ----
    char *char_ptr;
    long  long_int;
    int  **int_ptr_ptr;
!   long  long_array[12];
  
    void (*func_ptr) (void);
    struct _struct_decl (*func_ptr_struct) (int, char *, long);
*************** 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';

*** gdb.mi/mi-var-child.exp.~1.17~	2005-07-15 15:03:03.000000000 +1200
--- gdb.mi/mi-var-child.exp	2005-07-20 16:21:52.000000000 +1200
***************
*** 1,4 ****
! # Copyright 1999, 2000, 2001, 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
--- 1,4 ----
! # Copyright 1999, 2000, 2001, 2002, 2004, 2005 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
*************** mi_gdb_test "-var-create struct_declarat
*** 59,65 ****
  # STABS doesn't give us argument types for the func ptr structs, but
  # Dwarf 2 does.
  mi_gdb_test "-var-list-children struct_declarations" \
! 	"\\^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 \{\\.\\.\\.\}\"\}\\\]" \
  	"get children of struct_declarations"
  
  #gdbtk_test c_variable-4.3 {children of struct_declarations} {
--- 59,65 ----
  # STABS doesn't give us argument types for the func ptr structs, but
  # Dwarf 2 does.
  mi_gdb_test "-var-list-children struct_declarations" \
! 	"\\^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=\"12\",type=\"long int \\\[12\\\]\"\},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 \{\\.\\.\\.\}\"\}\\\]" \
  	"get children of struct_declarations"
  
  #gdbtk_test c_variable-4.3 {children of struct_declarations} {
*************** mi_gdb_test "-var-info-num-children stru
*** 140,152 ****
  # Test: c_variable-4.15
  # Desc: children of struct_declarations.long_array
  mi_gdb_test "-var-list-children struct_declarations.long_array" \
! 	"\\^done,numchild=\"10\",children=\\\[child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\}\\\]" \
  	"get children of struct_declarations.long_array"
  
  # Test: c_variable-4.16
  # Desc: number of children of struct_declarations.long_array
  mi_gdb_test "-var-info-num-children struct_declarations.long_array" \
! 	"\\^done,numchild=\"10\"" \
  	"get number of children of struct_declarations.long_array"
  
  # Test: c_variable-4.17
--- 140,152 ----
  # Test: c_variable-4.15
  # Desc: children of struct_declarations.long_array
  mi_gdb_test "-var-list-children struct_declarations.long_array" \
! 	"\\^done,numchild=\"12\",children=\\\[child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.10\",exp=\"10\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.11\",exp=\"11\",numchild=\"0\",type=\"long int\"\}\\\]" \
  	"get children of struct_declarations.long_array"
  
  # Test: c_variable-4.16
  # Desc: number of children of struct_declarations.long_array
  mi_gdb_test "-var-info-num-children struct_declarations.long_array" \
! 	"\\^done,numchild=\"12\"" \
  	"get number of children of struct_declarations.long_array"
  
  # Test: c_variable-4.17
*************** mi_gdb_test "-var-create weird * weird" 
*** 565,571 ****
  # Test: c_variable-4.82
  # Desc: children of weird
  mi_gdb_test "-var-list-children weird" \
! 	"\\^done,numchild=\"11\",children=\\\[child=\{name=\"weird.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"weird.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child=\{name=\"weird.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"weird.long_int\",exp=\"long_int\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"\},child=\{name=\"weird.long_array\",exp=\"long_array\",numchild=\"10\",type=\"long int \\\[10\\\]\"\},child=\{name=\"weird.func_ptr\",exp=\"func_ptr\",numchild=\"0\",type=\"void \\(\\*\\)\\((void)?\\)\"\},child=\{name=\"weird.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"weird.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"weird.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"weird.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\\\]" \
  	"get children of weird"
  
  # Test: c_variable-4.83
--- 565,571 ----
  # Test: c_variable-4.82
  # Desc: children of weird
  mi_gdb_test "-var-list-children weird" \
! 	"\\^done,numchild=\"11\",children=\\\[child=\{name=\"weird.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"weird.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child=\{name=\"weird.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"weird.long_int\",exp=\"long_int\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"\},child=\{name=\"weird.long_array\",exp=\"long_array\",numchild=\"12\",type=\"long int \\\[12\\\]\"\},child=\{name=\"weird.func_ptr\",exp=\"func_ptr\",numchild=\"0\",type=\"void \\(\\*\\)\\((void)?\\)\"\},child=\{name=\"weird.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"weird.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"weird.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"weird.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\\\]" \
  	"get children of weird"
  
  # Test: c_variable-4.83
*************** mi_gdb_test "-var-info-num-children weir
*** 578,593 ****
  # Test: c_variable-4.84
  # Desc: children of weird->long_array
  mi_gdb_test "-var-list-children weird.long_array" \
! 	"\\^done,numchild=\"10\",children=\\\[child=\{name=\"weird.long_array.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\}\\\]" \
  	"get children of weird.long_array"
  #gdbtk_test c_variable-4.84 {children of weird->long_array} {
  #  get_children weird.long_array
! #} {0 1 2 3 4 5 6 7 8 9}
  
  # Test: c_variable-4.85
  # Desc: number of children of weird.long_array
  mi_gdb_test "-var-info-num-children weird.long_array" \
! 	"\\^done,numchild=\"10\"" \
  	"get number of children of weird.long_array"
  
  # Test: c_variable-4.86
--- 578,593 ----
  # Test: c_variable-4.84
  # Desc: children of weird->long_array
  mi_gdb_test "-var-list-children weird.long_array" \
! 	"\\^done,numchild=\"12\",children=\\\[child=\{name=\"weird.long_array.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.10\",exp=\"10\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.11\",exp=\"11\",numchild=\"0\",type=\"long int\"\}\\\]" \
  	"get children of weird.long_array"
  #gdbtk_test c_variable-4.84 {children of weird->long_array} {
  #  get_children weird.long_array
! #} {0 1 2 3 4 5 6 7 8 9 10 11}
  
  # Test: c_variable-4.85
  # Desc: number of children of weird.long_array
  mi_gdb_test "-var-info-num-children weird.long_array" \
! 	"\\^done,numchild=\"12\"" \
  	"get number of children of weird.long_array"
  
  # Test: c_variable-4.86
*************** mi_gdb_test "-var-show-attributes struct
*** 736,742 ****
  	"is struct_declarations editable"
  
  mi_gdb_test "-var-delete weird" \
! 	"\\^done,ndeleted=\"24\"" \
  	"delete var weird"
  
  #####                         #####
--- 736,742 ----
  	"is struct_declarations editable"
  
  mi_gdb_test "-var-delete weird" \
! 	"\\^done,ndeleted=\"26\"" \
  	"delete var weird"
  
  #####                         #####
*************** mi_gdb_test "-var-update *" \
*** 833,846 ****
  	"\\^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_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"
  
  # Test: c_variable-5.9
  # Desc: check that func_ptr changed
--- 833,842 ----
  	"\\^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"
  
  
! # 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"
  
  # Test: c_variable-5.9
  # Desc: check that func_ptr changed
*************** mi_gdb_test "-var-update *" \
*** 848,856 ****
  	"\\^done,changelist=\\\[\{name=\"struct_declarations.func_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
  	"update all vars struct_declarations.func_ptr changed"
  
  # Delete all variables
  mi_gdb_test "-var-delete struct_declarations" \
! 	"\\^done,ndeleted=\"65\"" \
  	"delete var struct_declarations"
  
  mi_gdb_test "-var-delete weird->int_ptr_ptr" \
--- 844,877 ----
  	"\\^done,changelist=\\\[\{name=\"struct_declarations.func_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
  	"update all vars struct_declarations.func_ptr changed"
  
+ # Step overstruct_declarations.long_array[10] = 3456;
+ mi_step_to do_children_tests {} {.*var-cmd.c} \
+     [expr $line_dct_nothing + 2] "step \$line_dct_nothing + 2"
+ 
+ mi_gdb_test "-var-update --no-values *" \
+ 	"\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.10\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
+  "update  all vars struct_declarations.long_array.10 changed, don't print values."
+ 
+ # Step over struct_declarations.long_array[11] = 5678;
+ 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"
+ 
+ mi_gdb_test "-var-update --all-values *" \
+ 	"\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.11\",value=\"5678\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
+  "update all vars struct_declarations.long_array.11 changed, print values."
+ 
+ mi_gdb_test "-var-list-children --all-values struct_declarations.long_array" \
+         "\\^done,numchild=\"12\",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\"\},child=\{name=\"struct_declarations.long_array.10\",exp=\"10\",numchild=\"0\",value=\"3456\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.11\",exp=\"11\",numchild=\"0\",value=\"5678\",type=\"long int\"\}\\\]" \
+                 "listing of names and values of children"
+ 
+ mi_gdb_test "-var-list-children --simple-values struct_declarations" \
+         "\\^done,numchild=\"11\",children=\\\[child=\{name=\"struct_declarations.integer\",exp=\"integer\",numchild=\"0\",value=\"123\",type=\"int\"\},child=\{name=\"struct_declarations.character\",exp=\"character\",numchild=\"0\",value=\"0 '\\\\\\\\0'\",type=\"char\"\},child=\{name=\"struct_declarations.char_ptr\",exp=\"char_ptr\",numchild=\"1\",value=\"$hex \\\\\"hello\\\\\"\",type=\"char \\*\"\},child=\{name=\"struct_declarations.long_int\",exp=\"long_int\",numchild=\"0\",value=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",value=\"$hex\",type=\"int \\*\\*\"\},child=\{name=\"struct_declarations.long_array\",exp=\"long_array\",numchild=\"12\",type=\"long int \\\[12\\\]\"\},child=\{name=\"struct_declarations.func_ptr\",exp=\"func_ptr\",numchild=\"0\",value=\"$hex <nothing>\",type=\"void \\(\\*\\)\\(void\\)\"\},child=\{name=\"struct_declarations.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",value=\"0\",type=\"struct _struct_decl \\(\\*\\)\\(int, char \\*, long int\\)\"\},child=\{name=\"struct_declarations.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",value=\"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 \{...\}\"\}\\\]" \
+   "listing of children, simple types: names, type and values, complex types: names and types"
+ 
  # Delete all variables
  mi_gdb_test "-var-delete struct_declarations" \
! 	"\\^done,ndeleted=\"67\"" \
  	"delete var struct_declarations"
  
  mi_gdb_test "-var-delete weird->int_ptr_ptr" \

*** gdb.mi/mi-stack.exp.~1.16.~	2005-06-19 18:49:18.000000000 +1200
--- gdb.mi/mi-stack.exp	2005-07-20 16:20:07.000000000 +1200
*************** proc test_stack_locals_listing {} {
*** 152,170 ****
  
      # Obtain lists for locals for the stack frames
      # Tests:
!     # -stack-list-locals 0
!     # -stack-list-locals 1
!     # -stack-list-locals 2
      # -stack-list-arguments 
  
      mi_gdb_test "232-stack-list-locals 0" \
! 	    "232\\^done,locals=\\\[name=\"A\",name=\"B\",name=\"C\"\\\]" \
!                 "stack locals listing 0"
  
  set line_callee4_return_0 [gdb_get_line_number "return 0;"]
  
! # step until A, B, C, have some reasonable values.
! send_gdb "-exec-next 3\n"
  gdb_expect {
      -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_callee4_return_0\"\}\r\n$mi_gdb_prompt$" {
  	pass "next's in callee4"
--- 152,170 ----
  
      # Obtain lists for locals for the stack frames
      # Tests:
!     # -stack-list-locals 0 (--no-values)
!     # -stack-list-locals 1 (--all-values)
!     # -stack-list-locals 2 (--simple-values)
      # -stack-list-arguments 
  
      mi_gdb_test "232-stack-list-locals 0" \
!   "232\\^done,locals=\\\[name=\"A\",name=\"B\",name=\"C\",name=\"D\"\\\]" \
!                 "stack locals listing of names"
  
  set line_callee4_return_0 [gdb_get_line_number "return 0;"]
  
! # step until A, B, C, D have some reasonable values.
! send_gdb "-exec-next 4\n"
  gdb_expect {
      -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_callee4_return_0\"\}\r\n$mi_gdb_prompt$" {
  	pass "next's in callee4"
*************** gdb_expect {
*** 173,184 ****
  }
  
      mi_gdb_test "232-stack-list-locals 1" \
! 	    "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.*\"" \
--- 173,184 ----
  }
  
      mi_gdb_test "232-stack-list-locals 1" \
!     "232\\^done,locals=\\\[\{name=\"A\",value=\"1\"\},\{name=\"B\",value=\"2\"\},\{name=\"C\",value=\"3\"\},\{name=\"D\",value=\"\\{0, 1, 2\\}\"\}\\\]" \
!                 "stack locals listing of names and values"
  
      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\"\},\{name=\"D\",type=\"int \\\[3\\\]\"\}\\\]" \
!   "stack locals listing, simple types: names and values, complex type: names and types"
  
      mi_gdb_test "234-stack-list-locals" \
  	    "234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \

*** gdb.mi/var-cmd.c.~1.3.~	2004-09-28 23:54:51.000000000 +1200
--- gdb.mi/var-cmd.c	2005-07-20 16:20:40.000000000 +1200
***************
*** 1,4 ****
! /* Copyright 1999, 2004 Free Software Foundation, Inc.
  
     This file is part of GDB.
  
--- 1,4 ----
! /* Copyright 1999, 2004, 2005 Free Software Foundation, Inc.
  
     This file is part of GDB.
  
*************** typedef struct _struct_decl {
*** 51,57 ****
    char *char_ptr;
    long  long_int;
    int  **int_ptr_ptr;
!   long  long_array[10];
  
    void (*func_ptr) (void);
    struct _struct_decl (*func_ptr_struct) (int, char *, long);
--- 51,57 ----
    char *char_ptr;
    long  long_int;
    int  **int_ptr_ptr;
!   long  long_array[12];
  
    void (*func_ptr) (void);
    struct _struct_decl (*func_ptr_struct) (int, char *, long);
*************** 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';

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-20  4:51 PATCH: tests for MI commands Nick Roberts
@ 2005-07-24 21:19 ` Daniel Jacobowitz
  2005-07-26 23:31   ` Nick Roberts
  0 siblings, 1 reply; 25+ messages in thread
From: Daniel Jacobowitz @ 2005-07-24 21:19 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches

On Wed, Jul 20, 2005 at 04:51:03PM +1200, Nick Roberts wrote:
> 
> This patch provides tests for the recent changes to -var-update and
> -var-list-children.  I have also revised the test for stack-list-locals
> so that it properly tests the --simple-values option.
> 
> There is no test for "-var-update --simple-values" as I could not get it
> to behave differently for "-var-update --all-values".  I think this is
> because the changelist only consists of simple types; if it is complex
> its `value' is deemed not have changed.

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.

> *************** 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...

> ! # 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.

> + # Step overstruct_declarations.long_array[10] = 3456;

> +  "update  all vars struct_declarations.long_array.10 changed, don't print values."

Missing space; extra space.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-24 21:19 ` Daniel Jacobowitz
@ 2005-07-26 23:31   ` Nick Roberts
  2005-07-27  0:27     ` Daniel Jacobowitz
  0 siblings, 1 reply; 25+ messages in thread
From: Nick Roberts @ 2005-07-26 23:31 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

 > 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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-26 23:31   ` Nick Roberts
@ 2005-07-27  0:27     ` Daniel Jacobowitz
  2005-07-27  3:04       ` Nick Roberts
  0 siblings, 1 reply; 25+ messages in thread
From: Daniel Jacobowitz @ 2005-07-27  0:27 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches

On Wed, Jul 27, 2005 at 11:32:49AM +1200, Nick Roberts wrote:
>  > 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.

Nah, the way you have it is fine, since there's a convincing reason.

>  > > ! # 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?

It's OK.  With the spacing/quoting fixes, go ahead and check it in.

In general this is horrid practice, but you aren't really introducing
new uses.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-27  0:27     ` Daniel Jacobowitz
@ 2005-07-27  3:04       ` Nick Roberts
  2005-07-27  3:55         ` Daniel Jacobowitz
  0 siblings, 1 reply; 25+ messages in thread
From: Nick Roberts @ 2005-07-27  3:04 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches


> It's OK.  With the spacing/quoting fixes, go ahead and check it in.

Committed (with full log for each file).

Nick


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-27  3:04       ` Nick Roberts
@ 2005-07-27  3:55         ` Daniel Jacobowitz
  2005-07-27 11:46           ` Nick Roberts
  2005-07-29  7:32           ` Nick Roberts
  0 siblings, 2 replies; 25+ messages in thread
From: Daniel Jacobowitz @ 2005-07-27  3:55 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches

On Wed, Jul 27, 2005 at 02:34:11PM +1200, Nick Roberts wrote:
> 
> > It's OK.  With the spacing/quoting fixes, go ahead and check it in.
> 
> Committed (with full log for each file).

You've broken many of the other tests using the source files you've
modified.  Please, run the entire GDB testsuite before committing
patches - as testsuites go it really doesn't take very long.

My test results are a wreck since I've recently started using GCC 4.0
to run tests - GDB does a Whole Lot Worse than it did for 3.x.  But it
looks like these failures are related to your change:

+FAIL: gdb.mi/mi-var-child.exp: listing of children, simple types: names, type and values, complex types: names and types
+FAIL: gdb.mi/mi-var-display.exp: get children local variable weird
+FAIL: gdb.mi/mi2-stack.exp: stack locals listing 0
+FAIL: gdb.mi/mi2-stack.exp: next in callee4 (timeout)
+FAIL: gdb.mi/mi2-stack.exp: stack locals listing 1
+FAIL: gdb.mi/mi2-var-child.exp: get children of struct_declarations
+FAIL: gdb.mi/mi2-var-child.exp: get children of struct_declarations.long_array
+FAIL: gdb.mi/mi2-var-child.exp: get number of children of struct_declarations.long_array
+FAIL: gdb.mi/mi2-var-child.exp: get children of weird
+FAIL: gdb.mi/mi2-var-child.exp: get children of weird.long_array
+FAIL: gdb.mi/mi2-var-child.exp: get number of children of weird.long_array
+FAIL: gdb.mi/mi2-var-child.exp: delete var weird
+FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_a0_0 (stopped at wrong place)
+FAIL: gdb.mi/mi2-var-child.exp: delete var struct_declarations
+FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_snp0 + 1 (stopped at wrong place)
+FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_snp0 + 2 (stopped at wrong place)
+ERROR: Got interactive prompt.
+UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->char_ptr (and 0.char_ptr) changed
+FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_snp0 + 3 (timeout)
+ERROR: Got interactive prompt.
+UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->next->char_ptr (and 1.char_ptr) changed
+ERROR: Couldn't send -var-update * to GDB.
+UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->next->next->char_ptr (and 2.char_ptr) chang ed
+FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_snp0 + 5 (timeout)
+ERROR: Couldn't send -var-update * to GDB.
+UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->long_ptr (and 0.long_ptr) changed
+FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_snp0 + 6 (timeout)
+ERROR: Couldn't send -var-update * to GDB.
+UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->next->long_ptr (and 1.long_ptr) changed
+FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_snp0 + 7 (timeout)
+ERROR: Couldn't send -var-update * to GDB.
+UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->next->next->long_ptr (and 2.long_ptr) changed
+FAIL: gdb.mi/mi2-var-display.exp: get children local variable weird

Please fix them - I think the easiest thing to do is to revert the
changes to the affected source files and switch those two modified
tests to using new source files.

As a side note, the trick to getting the CVS logs to come out right is
not just to use the same commit message for every file, but to commit
them together in a single invocation of cvs.  See the mailing list
archives for gdb-cvs to see the difference.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-27  3:55         ` Daniel Jacobowitz
@ 2005-07-27 11:46           ` Nick Roberts
  2005-07-27 12:50             ` Bob Rossi
                               ` (2 more replies)
  2005-07-29  7:32           ` Nick Roberts
  1 sibling, 3 replies; 25+ messages in thread
From: Nick Roberts @ 2005-07-27 11:46 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz writes:
 >                                                            ...But it
 > looks like these failures are related to your change:
 > 
 > +FAIL: gdb.mi/mi-var-child.exp: listing of children, simple types: names, type and values, complex types: names and types

I don't get this failure (this is one file I did test!).

 > +FAIL: gdb.mi/mi-var-display.exp: get children local variable weird

I think this test should be removed as there was an identical test in
mi-var-child.exp (which I have now modified for 12 elements).

 > +FAIL: gdb.mi/mi2-stack.exp: stack locals listing 0
 > +FAIL: gdb.mi/mi2-stack.exp: next in callee4 (timeout)
 > +FAIL: gdb.mi/mi2-stack.exp: stack locals listing 1
 > +FAIL: gdb.mi/mi2-var-child.exp: get children of struct_declarations
 > +FAIL: gdb.mi/mi2-var-child.exp: get children of struct_declarations.long_array
 > +FAIL: gdb.mi/mi2-var-child.exp: get number of children of struct_declarations.long_array
 > +FAIL: gdb.mi/mi2-var-child.exp: get children of weird
 > +FAIL: gdb.mi/mi2-var-child.exp: get children of weird.long_array
 > +FAIL: gdb.mi/mi2-var-child.exp: get number of children of weird.long_array
 > +FAIL: gdb.mi/mi2-var-child.exp: delete var weird
 > +FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_a0_0 (stopped at wrong place)
 > +FAIL: gdb.mi/mi2-var-child.exp: delete var struct_declarations
 > +FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_snp0 + 1 (stopped at wrong place)
 > +FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_snp0 + 2 (stopped at wrong place)
 > +ERROR: Got interactive prompt.
 > +UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->char_ptr (and 0.char_ptr) changed
 > +FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_snp0 + 3 (timeout)
 > +ERROR: Got interactive prompt.
 > +UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->next->char_ptr (and 1.char_ptr) changed
 > +ERROR: Couldn't send -var-update * to GDB.
 > +UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->next->next->char_ptr (and 2.char_ptr) chang ed
 > +FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_snp0 + 5 (timeout)
 > +ERROR: Couldn't send -var-update * to GDB.
 > +UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->long_ptr (and 0.long_ptr) changed
 > +FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_snp0 + 6 (timeout)
 > +ERROR: Couldn't send -var-update * to GDB.
 > +UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->next->long_ptr (and 1.long_ptr) changed
 > +FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_snp0 + 7 (timeout)
 > +ERROR: Couldn't send -var-update * to GDB.
 > +UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->next->next->long_ptr (and 2.long_ptr) changed
 > +FAIL: gdb.mi/mi2-var-display.exp: get children local variable weird
 >
 > Please fix them - I think the easiest thing to do is to revert the
 > changes to the affected source files and switch those two modified
 > tests to using new source files.

Given the scarce resources for this unpaid work I ask you again to consider
removing the mi2-*.exp files and just test the current version of MI.  The
reality is that they serve no useful purpose (mi-*.exp tests would still
pass if GDB was invoked with "-i=mi2") and they require effort that could
be better spent on other things.

 > As a side note, the trick to getting the CVS logs to come out right is
 > not just to use the same commit message for every file, but to commit
 > them together in a single invocation of cvs.  See the mailing list
 > archives for gdb-cvs to see the difference.

I can see the difference in the archive but not the CVS logs.  I commit using
VC in Emacs which seems to require separate commits but I'll work out how to
do this as one commit for next time.

Nick


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-27 11:46           ` Nick Roberts
@ 2005-07-27 12:50             ` Bob Rossi
  2005-07-27 20:52               ` Nick Roberts
  2005-07-27 21:03             ` Mark Kettenis
  2005-07-27 21:25             ` Mark Kettenis
  2 siblings, 1 reply; 25+ messages in thread
From: Bob Rossi @ 2005-07-27 12:50 UTC (permalink / raw)
  To: Nick Roberts; +Cc: Daniel Jacobowitz, gdb-patches

>  > +FAIL: gdb.mi/mi2-var-display.exp: get children local variable weird
>  >
>  > Please fix them - I think the easiest thing to do is to revert the
>  > changes to the affected source files and switch those two modified
>  > tests to using new source files.
> 
> Given the scarce resources for this unpaid work I ask you again to consider
> removing the mi2-*.exp files and just test the current version of MI.  The
> reality is that they serve no useful purpose (mi-*.exp tests would still
> pass if GDB was invoked with "-i=mi2") and they require effort that could
> be better spent on other things.

Nick, I don't fully agree that the mi2- tests serve no useful purpose.
The mi2- tests make sure that the MI2 protocol is completly tested (MI2 
works no less then what the mi2- tests say they do), and the mi- tests 
make sure that the current development MI protocol is being tested. I 
think it's important to keep both tests for this reason. Do you still
think they should be removed after this explanation?

For instance, it's possible that a command works differently between the
2 versions (don't know if this currently even happens).

Thanks,
Bob Rossi


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-27 12:50             ` Bob Rossi
@ 2005-07-27 20:52               ` Nick Roberts
  2005-07-27 21:49                 ` Daniel Jacobowitz
  0 siblings, 1 reply; 25+ messages in thread
From: Nick Roberts @ 2005-07-27 20:52 UTC (permalink / raw)
  To: Bob Rossi; +Cc: Daniel Jacobowitz, gdb-patches

 > Nick, I don't fully agree that the mi2- tests serve no useful purpose.
 > The mi2- tests make sure that the MI2 protocol is completly tested (MI2 
 > works no less then what the mi2- tests say they do), and the mi- tests 
 > make sure that the current development MI protocol is being tested. I 
 > think it's important to keep both tests for this reason. Do you still
 > think they should be removed after this explanation?

I think that we should either remove them (my preference) or rewrite parts of
GDB so that the different MI levels act as independent interpreters (which
currently I am certainly not going to offer to do).  If they were independent
then clearly changing the behaviour of the current level, as I have just done,
wouldn't break the tests for level 2.

 > For instance, it's possible that a command works differently between the
 > 2 versions (don't know if this currently even happens).

There is very little difference between -i=mi and -i=mi2.  The format of the
prologue that GDB prints out is one example.  This is a nonsense to pretend
that we are supporting different levels.  MI has been a project in progress
for five years now.  While companies might support backend development to port
GDB to different architectures, presumably frontend development gets less
support.  I think we need to be realistic, supporting one level properly is an
ambitious target.

Nick


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-27 11:46           ` Nick Roberts
  2005-07-27 12:50             ` Bob Rossi
@ 2005-07-27 21:03             ` Mark Kettenis
  2005-07-27 22:23               ` Nick Roberts
  2005-07-27 21:25             ` Mark Kettenis
  2 siblings, 1 reply; 25+ messages in thread
From: Mark Kettenis @ 2005-07-27 21:03 UTC (permalink / raw)
  To: nickrob; +Cc: drow, gdb-patches

   From: Nick Roberts <nickrob@snap.net.nz>
   Date: Wed, 27 Jul 2005 23:47:49 +1200

   Given the scarce resources for this unpaid work I ask you again to consider
   removing the mi2-*.exp files and just test the current version of MI.  The
   reality is that they serve no useful purpose (mi-*.exp tests would still
   pass if GDB was invoked with "-i=mi2") and they require effort that could
   be better spent on other things.

We can discuss this *after* you either:

a) Fixed the test failures.

b) Backed out your patch.

You promised not to do this again, and yet you did.

Bad Nick, no cookie!

Mark


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-27 11:46           ` Nick Roberts
  2005-07-27 12:50             ` Bob Rossi
  2005-07-27 21:03             ` Mark Kettenis
@ 2005-07-27 21:25             ` Mark Kettenis
  2 siblings, 0 replies; 25+ messages in thread
From: Mark Kettenis @ 2005-07-27 21:25 UTC (permalink / raw)
  To: nickrob; +Cc: drow, gdb-patches

   From: Nick Roberts <nickrob@snap.net.nz>
   Date: Wed, 27 Jul 2005 23:47:49 +1200

   Daniel Jacobowitz writes:
    >                                                            ...But it
    > looks like these failures are related to your change:
    > 
    > +FAIL: gdb.mi/mi-var-child.exp: listing of children, simple types: names, type and values, complex types: names and types

   I don't get this failure (this is one file I did test!).

The problem is that in var-cmd.c:do_children_tests(), the member
struct_declarations.character is uninitialized.  So you in the output
you get whatever random value was on the stack.  In your case this
apparently was 0, but in my case it was -44.  The proper thing to do
is probably change var-cmd.c to properly initialize the member.  But
my naive attempt at doing this caused a lot of other failures.  Since
I don't really understand what this mi stuff is doing, can you please
look into it?

Mark


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-27 20:52               ` Nick Roberts
@ 2005-07-27 21:49                 ` Daniel Jacobowitz
  2005-07-27 22:09                   ` Nick Roberts
  0 siblings, 1 reply; 25+ messages in thread
From: Daniel Jacobowitz @ 2005-07-27 21:49 UTC (permalink / raw)
  To: Nick Roberts; +Cc: Bob Rossi, gdb-patches

On Thu, Jul 28, 2005 at 08:52:03AM +1200, Nick Roberts wrote:
> I think that we should either remove them (my preference) or rewrite parts of
> GDB so that the different MI levels act as independent interpreters (which
> currently I am certainly not going to offer to do).  If they were independent
> then clearly changing the behaviour of the current level, as I have just done,
> wouldn't break the tests for level 2.

Incorrect.  Please read again my description of how you broke the mi2
tests.  It has nothing to do with your changes to the MI output and
everything to do with your changes to the test cases.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-27 21:49                 ` Daniel Jacobowitz
@ 2005-07-27 22:09                   ` Nick Roberts
  0 siblings, 0 replies; 25+ messages in thread
From: Nick Roberts @ 2005-07-27 22:09 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Bob Rossi, gdb-patches

 > > I think that we should either remove them (my preference) or rewrite
 > > parts of GDB so that the different MI levels act as independent
 > > interpreters (which currently I am certainly not going to offer to do).
 > > If they were independent then clearly changing the behaviour of the
 > > current level, as I have just done, wouldn't break the tests for level 2.
 > 
 > Incorrect.  Please read again my description of how you broke the mi2
 > tests.  It has nothing to do with your changes to the MI output and
 > everything to do with your changes to the test cases.

Yes, you're right, I was too eager and my analysis is wrong for this case.  My
original point, that separate mi2 tests are not worthwhile, still stands,
however.

Nick


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-27 21:03             ` Mark Kettenis
@ 2005-07-27 22:23               ` Nick Roberts
  2005-07-28  0:08                 ` Paul Gilliam
                                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Nick Roberts @ 2005-07-27 22:23 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: drow, gdb-patches

 >    Given the scarce resources for this unpaid work I ask you again to
 >    consider removing the mi2-*.exp files and just test the current version
 >    of MI.  The reality is that they serve no useful purpose (mi-*.exp tests
 >    would still pass if GDB was invoked with "-i=mi2") and they require
 >    effort that could be better spent on other things.
 > 
 > We can discuss this *after* you either:
 > a) Fixed the test failures.
 > 
 > b) Backed out your patch.

I'd like to do a) by removing the mi2-*.exp files ;-).  There doesn't seem
much point in making a load of changes if we are going to just remove the
files afterwards.

 > You promised not to do this again, and yet you did.

Let's remember that the testsuite is there to prevent regressions in GDB and
not as an end in itself.  Presumably the focus should be on having the right
tests in the suite and not just on ensuring that everything passes.

Nick


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-27 22:23               ` Nick Roberts
@ 2005-07-28  0:08                 ` Paul Gilliam
  2005-07-28  0:18                 ` Stan Shebs
  2005-07-28  0:21                 ` Daniel Jacobowitz
  2 siblings, 0 replies; 25+ messages in thread
From: Paul Gilliam @ 2005-07-28  0:08 UTC (permalink / raw)
  To: gdb-patches; +Cc: Nick Roberts, Mark Kettenis, drow

On Wednesday 27 July 2005 15:25, Nick Roberts wrote:
> Let's remember that the testsuite is there to prevent regressions in GDB and
> not as an end in itself.  Presumably the focus should be on having the right
> tests in the suite and not just on ensuring that everything passes.
> 
> Nick
> 
> 

No.  Although regression testing is a major use for the testsuite is is not the only one.

Some use the testsuite to compare gdb on different architectures.

Some use it to validate new features.

Some use it to learn tcl  (no, just kidding 8-)

-=# Paul #=-


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-27 22:23               ` Nick Roberts
  2005-07-28  0:08                 ` Paul Gilliam
@ 2005-07-28  0:18                 ` Stan Shebs
  2005-07-28  0:21                 ` Daniel Jacobowitz
  2 siblings, 0 replies; 25+ messages in thread
From: Stan Shebs @ 2005-07-28  0:18 UTC (permalink / raw)
  To: Nick Roberts; +Cc: Mark Kettenis, drow, gdb-patches

Nick Roberts wrote:

> >    Given the scarce resources for this unpaid work I ask you again to
> >    consider removing the mi2-*.exp files and just test the current version
> >    of MI.  The reality is that they serve no useful purpose (mi-*.exp tests
> >    would still pass if GDB was invoked with "-i=mi2") and they require
> >    effort that could be better spent on other things.
> > 
> > We can discuss this *after* you either:
> > a) Fixed the test failures.
> > 
> > b) Backed out your patch.
>
>I'd like to do a) by removing the mi2-*.exp files ;-).  There doesn't seem
>much point in making a load of changes if we are going to just remove the
>files afterwards.
>
> > You promised not to do this again, and yet you did.
>
>Let's remember that the testsuite is there to prevent regressions in GDB and
>not as an end in itself.  Presumably the focus should be on having the right
>tests in the suite and not just on ensuring that everything passes.
>
Also remember that you're not the only person working on GDB. :-)
If I'm testing my patch and a bunch of MI tests start failing all
of a sudden, how do I tell the difference between some terrible
bug that I introduced and somebody else leaving some tests broken?
It wastes everybody's time as they try to figure out whether they're
at fault for the breakage. So the rule is that every change should
leave the testsuite results in the same state or better, and yes,
sometimes it means fixing things that you're pretty certain are
going away soon.

The crafty strategize this by submitting the patch to delete the
unwanted tests first, then voila, the code patch just happens
not to cause any visible regressions!

Stan




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-27 22:23               ` Nick Roberts
  2005-07-28  0:08                 ` Paul Gilliam
  2005-07-28  0:18                 ` Stan Shebs
@ 2005-07-28  0:21                 ` Daniel Jacobowitz
  2005-07-28  1:39                   ` Nick Roberts
  2 siblings, 1 reply; 25+ messages in thread
From: Daniel Jacobowitz @ 2005-07-28  0:21 UTC (permalink / raw)
  To: Nick Roberts; +Cc: Mark Kettenis, gdb-patches

On Thu, Jul 28, 2005 at 10:25:48AM +1200, Nick Roberts wrote:
>  >    Given the scarce resources for this unpaid work I ask you again to
>  >    consider removing the mi2-*.exp files and just test the current version
>  >    of MI.  The reality is that they serve no useful purpose (mi-*.exp tests
>  >    would still pass if GDB was invoked with "-i=mi2") and they require
>  >    effort that could be better spent on other things.
>  > 
>  > We can discuss this *after* you either:
>  > a) Fixed the test failures.
>  > 
>  > b) Backed out your patch.
> 
> I'd like to do a) by removing the mi2-*.exp files ;-).  There doesn't seem
> much point in making a load of changes if we are going to just remove the
> files afterwards.

Obviously this is not uncontroversial, so it is not appropriate as a
short term solution.

>  > You promised not to do this again, and yet you did.
> 
> Let's remember that the testsuite is there to prevent regressions in GDB and
> not as an end in itself.  Presumably the focus should be on having the right
> tests in the suite and not just on ensuring that everything passes.

I will echo everyone else's comments here - in particular Stan's.  Lots
of people run the testsuite, either manually during development or in
automated test harnesses, and in either case there's someone who has to
look into the new failures when they appear.  Leaving things broken is
a problem.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-28  0:21                 ` Daniel Jacobowitz
@ 2005-07-28  1:39                   ` Nick Roberts
  2005-07-31 22:11                     ` Daniel Jacobowitz
  0 siblings, 1 reply; 25+ messages in thread
From: Nick Roberts @ 2005-07-28  1:39 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Mark Kettenis, gdb-patches

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 5432 bytes --]

 ...
 > >  > We can discuss this *after* you either:
 > >  > a) Fixed the test failures.
 > >  > 
 > >  > b) Backed out your patch.
 > > 
 > > I'd like to do a) by removing the mi2-*.exp files ;-).  There doesn't seem
 > > much point in making a load of changes if we are going to just remove the
 > > files afterwards.
 > 
 > Obviously this is not uncontroversial, so it is not appropriate as a
 > short term solution.

Its not that controversial as remove in CVS just means move to the Attic
directory: nothing is lost and it can always be recovered, if necessary.

 ...
 > > Let's remember that the testsuite is there to prevent regressions in GDB
 > > and not as an end in itself.  Presumably the focus should be on having
 > > the right tests in the suite and not just on ensuring that everything
 > > passes.
 > 
 > I will echo everyone else's comments here - in particular Stan's.  Lots
 > of people run the testsuite, either manually during development or in
 > automated test harnesses, and in either case there's someone who has to
 > look into the new failures when they appear.  Leaving things broken is
 > a problem.

I never intended to leave things broken.  You have asked me to fix the
failures, and I will, but I'm not sure if that means submit further patches to
the mailing list or commit appropriate fixes.  Based on Mark Kettenis' e-mail,
I attach a simple fix for mi-var-child.exp.  Does it work in your case?  I
also suggested removing the duplicate test for in mi-var-display.exp (which
presumably existed before mi-var-child.exp was created).  Can I commit these
changes?

Nick

2005-07-28  Nick Roberts  <nickrob@snap.net.nz>

	* gdb.mi/mi-var-child.exp: Allow struct_declarations.character to be
	uninitialized.

*** gdb.mi/mi-var-child.exp.~1.18.~	2005-07-27 14:12:06.000000000 +1200
--- gdb.mi/mi-var-child.exp	2005-07-28 13:29:35.000000000 +1200
*************** mi_gdb_test "-var-list-children --all-va
*** 866,872 ****
                  "listing of names and values of children"
  
  mi_gdb_test "-var-list-children --simple-values struct_declarations" \
!         "\\^done,numchild=\"11\",children=\\\[child=\{name=\"struct_declarations.integer\",exp=\"integer\",numchild=\"0\",value=\"123\",type=\"int\"\},child=\{name=\"struct_declarations.character\",exp=\"character\",numchild=\"0\",value=\"0 '\\\\\\\\0'\",type=\"char\"\},child=\{name=\"struct_declarations.char_ptr\",exp=\"char_ptr\",numchild=\"1\",value=\"$hex \\\\\"hello\\\\\"\",type=\"char \\*\"\},child=\{name=\"struct_declarations.long_int\",exp=\"long_int\",numchild=\"0\",value=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",value=\"$hex\",type=\"int \\*\\*\"\},child=\{name=\"struct_declarations.long_array\",exp=\"long_array\",numchild=\"12\",type=\"long int \\\[12\\\]\"\},child=\{name=\"struct_declarations.func_ptr\",exp=\"func_ptr\",numchild=\"0\",value=\"$hex <nothing>\",type=\"void \\(\\*\\)\\(void\\)\"\},child=\{name=\"struct_declarations.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",value=\"0\",type=\"struct _struct_decl \\(\\*\\)\\(int, char \\*, long int\\)\"\},child=\{name=\"struct_declarations.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",value=\"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 \{...\}\"\}\\\]" \
    "listing of children, simple types: names, type and values, complex types: names and types"
  
  # Delete all variables
--- 866,872 ----
                  "listing of names and values of children"
  
  mi_gdb_test "-var-list-children --simple-values struct_declarations" \
!         "\\^done,numchild=\"11\",children=\\\[child=\{name=\"struct_declarations.integer\",exp=\"integer\",numchild=\"0\",value=\"123\",type=\"int\"\},child=\{name=\"struct_declarations.character\",exp=\"character\",numchild=\"0\",value=\"0 '\\\\\\\\$decimal'\",type=\"char\"\},child=\{name=\"struct_declarations.char_ptr\",exp=\"char_ptr\",numchild=\"1\",value=\"$hex \\\\\"hello\\\\\"\",type=\"char \\*\"\},child=\{name=\"struct_declarations.long_int\",exp=\"long_int\",numchild=\"0\",value=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",value=\"$hex\",type=\"int \\*\\*\"\},child=\{name=\"struct_declarations.long_array\",exp=\"long_array\",numchild=\"12\",type=\"long int \\\[12\\\]\"\},child=\{name=\"struct_declarations.func_ptr\",exp=\"func_ptr\",numchild=\"0\",value=\"$hex <nothing>\",type=\"void \\(\\*\\)\\(void\\)\"\},child=\{name=\"struct_declarations.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",value=\"0\",type=\"struct _struct_decl \\(\\*\\)\\(int, char \\*, long int\\)\"\},child=\{name=\"struct_declarations.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",value=\"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 \{...\}\"\}\\\]" \
    "listing of children, simple types: names, type and values, complex types: names and types"
  
  # Delete all variables\x16º&Öéj×!zÊÞ¶êçãMüÖX¬µªÜ†\a[¥«\…ë

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-27  3:55         ` Daniel Jacobowitz
  2005-07-27 11:46           ` Nick Roberts
@ 2005-07-29  7:32           ` Nick Roberts
  2005-07-31 21:25             ` Daniel Jacobowitz
  1 sibling, 1 reply; 25+ messages in thread
From: Nick Roberts @ 2005-07-29  7:32 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz writes:
 > You've broken many of the other tests using the source files you've
 > modified.  Please, run the entire GDB testsuite before committing
 > patches - as testsuites go it really doesn't take very long.

 ...
 > +UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->next->long_ptr (and 1.long_ptr) changed
 > +FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_snp0 + 7 (timeout)
 > +ERROR: Couldn't send -var-update * to GDB.
 > +UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->next->next->long_ptr (and 2.long_ptr) changed
 > 
 > Please fix them - I think the easiest thing to do is to revert the
 > changes to the affected source files and switch those two modified
 > tests to using new source files.

I would rather copy my changes to mi-stack.exp and mi-var-child.exp over to
mi2-stack.exp and mi2-var-child.exp.  Creating new files mi-var-cmd.c,
mi-basics.c etc seems more complicated.  Is this an acceptable short term
solution?

Nick


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-29  7:32           ` Nick Roberts
@ 2005-07-31 21:25             ` Daniel Jacobowitz
  2005-07-31 23:32               ` Nick Roberts
  0 siblings, 1 reply; 25+ messages in thread
From: Daniel Jacobowitz @ 2005-07-31 21:25 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches

I apologize for the delay.  I meant to do this Friday.

On Fri, Jul 29, 2005 at 07:29:56PM +1200, Nick Roberts wrote:
> Daniel Jacobowitz writes:
>  > You've broken many of the other tests using the source files you've
>  > modified.  Please, run the entire GDB testsuite before committing
>  > patches - as testsuites go it really doesn't take very long.
> 
>  ...
>  > +UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->next->long_ptr (and 1.long_ptr) changed
>  > +FAIL: gdb.mi/mi2-var-child.exp: step $line_dct_snp0 + 7 (timeout)
>  > +ERROR: Couldn't send -var-update * to GDB.
>  > +UNRESOLVED: gdb.mi/mi2-var-child.exp: update all vars psnp->next->next->long_ptr (and 2.long_ptr) changed
>  > 
>  > Please fix them - I think the easiest thing to do is to revert the
>  > changes to the affected source files and switch those two modified
>  > tests to using new source files.
> 
> I would rather copy my changes to mi-stack.exp and mi-var-child.exp over to
> mi2-stack.exp and mi2-var-child.exp.  Creating new files mi-var-cmd.c,
> mi-basics.c etc seems more complicated.  Is this an acceptable short term
> solution?

It's not complicated at all.  Please see the attached patch, which I've
checked in.  It would be even simpler than this if folks had used
${srcfile} to begin with.

Tested on i686-pc-linux-gnu, where it resolves 18 FAILs and assorted
ERRORs.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

2005-07-31  Daniel Jacobowitz  <dan@codesourcery.com>

	* gdb.mi/basics.c, gdb.mi/var-cmd.c: Revert last change.
	* gdb.mi/mi-stack.c: New file, based on gdb.mi/basics.c.
	* gdb.mi/mi-var-child.c: New file, based on gdb.mi/var-cmd.c.
	* gdb.mi/mi-stack.exp: Update to use mi-stack.c as a source file.
	* gdb.mi/mi-var-child.exp: Update to use mi-var-child.c as a source
	file.

Index: gdb.mi/basics.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/basics.c,v
retrieving revision 1.6
diff -u -p -r1.6 basics.c
--- gdb.mi/basics.c	27 Jul 2005 02:20:17 -0000	1.6
+++ gdb.mi/basics.c	31 Jul 2005 21:20:52 -0000
@@ -1,4 +1,4 @@
-/* Copyright 1999, 2000, 2004, 2005
+/* Copyright 1999, 2000, 2004
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -30,7 +30,6 @@ int callee4 (void)
   int A=1;
   int B=2;
   int C;
-  int D[3] = {0, 1 ,2};
 
   C = A + B;
   return 0;
Index: gdb.mi/mi-stack.c
===================================================================
RCS file: gdb.mi/mi-stack.c
diff -N gdb.mi/mi-stack.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb.mi/mi-stack.c	31 Jul 2005 21:20:52 -0000
@@ -0,0 +1,68 @@
+/* Copyright 1999, 2000, 2004, 2005
+   Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   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
+   the Free Software Foundation; either version 2 of the License, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/*
+ *	This simple program that passes different types of arguments
+ *      on function calls.  Useful to test printing frames, stepping, etc.
+ */
+
+#include <stdio.h>
+
+int callee4 (void)
+{
+  int A=1;
+  int B=2;
+  int C;
+  int D[3] = {0, 1, 2};
+
+  C = A + B;
+  return 0;
+}
+callee3 (char *strarg)
+{
+  callee4 ();
+}
+
+callee2 (int intarg, char *strarg)
+{
+  callee3 (strarg);
+}
+
+callee1 (int intarg, char *strarg, double fltarg)
+{
+  callee2 (intarg, strarg);
+}
+
+main ()
+{
+  callee1 (2, "A string argument.", 3.5);
+  callee1 (2, "A string argument.", 3.5);
+
+  printf ("Hello, World!");
+
+  return 0;
+}
+
+/*
+Local variables: 
+change-log-default-name: "ChangeLog-mi"
+End: 
+*/
+
Index: gdb.mi/mi-stack.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-stack.exp,v
retrieving revision 1.17
diff -u -p -r1.17 mi-stack.exp
--- gdb.mi/mi-stack.exp	27 Jul 2005 02:20:45 -0000	1.17
+++ gdb.mi/mi-stack.exp	31 Jul 2005 21:20:53 -0000
@@ -31,7 +31,7 @@ if [mi_gdb_start] {
     continue
 }
 
-set testfile "basics"
+set testfile "mi-stack"
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
@@ -58,7 +58,7 @@ proc test_stack_frame_listing {} {
     # -stack-info-frame
 
     mi_gdb_test "231-stack-list-frames" \
-	    "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_callee4_body\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
+	    "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_callee4_body\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
                 "stack frame listing"
     mi_gdb_test "232-stack-list-frames 1 1" \
 	    "232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
@@ -72,7 +72,7 @@ proc test_stack_frame_listing {} {
 	    "stack frame listing wrong"
 
     mi_gdb_test "235-stack-info-frame" \
-            "235\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_callee4_body\"\}" \
+            "235\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_callee4_body\"\}" \
 	       "selected frame listing"
 }
 
@@ -166,7 +166,7 @@ set line_callee4_return_0 [gdb_get_line_
 # step until A, B, C, D have some reasonable values.
 send_gdb "-exec-next 4\n"
 gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_callee4_return_0\"\}\r\n$mi_gdb_prompt$" {
+    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_callee4_return_0\"\}\r\n$mi_gdb_prompt$" {
 	pass "next's in callee4"
     }
     timeout { fail "next in callee4 (timeout)" }
Index: gdb.mi/mi-var-child.c
===================================================================
RCS file: gdb.mi/mi-var-child.c
diff -N gdb.mi/mi-var-child.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb.mi/mi-var-child.c	31 Jul 2005 21:20:53 -0000
@@ -0,0 +1,319 @@
+/* Copyright 1999, 2004, 2005 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   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
+   the Free Software Foundation; either version 2 of the License, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <stdlib.h>
+
+struct _simple_struct {
+  int integer;
+  unsigned int unsigned_integer;
+  char character;
+  signed char signed_character;
+  char *char_ptr;
+  int array_of_10[10];
+};
+
+typedef struct _simple_struct simpleton;
+
+simpleton global_simple;
+
+enum foo {
+  bar = 1,
+  baz
+};
+
+typedef enum foo efoo;
+
+union named_union
+{
+  int integer;
+  char *char_ptr;
+};
+
+typedef struct _struct_decl {
+  int   integer;
+  char  character;
+  char *char_ptr;
+  long  long_int;
+  int  **int_ptr_ptr;
+  long  long_array[12];
+
+  void (*func_ptr) (void);
+  struct _struct_decl (*func_ptr_struct) (int, char *, long);
+  struct _struct_decl *(*func_ptr_ptr) (int, char *, long);
+  union {
+    int   a;
+    char *b;
+    long  c;
+    enum foo d;
+  } u1;
+
+  struct {
+    union {
+      struct {
+        int d;
+        char e[10];
+        int *(*func) (void);
+        efoo foo;
+      } u1s1;
+
+      long f;
+      struct {
+        char array_ptr[2];
+        int (*func) (int, char *);
+      } u1s2;
+    } u2;
+
+    int g;
+    char h;
+    long i[10];
+  } s2;
+} weird_struct;
+
+struct _struct_n_pointer {
+  char ****char_ptr;
+  long ****long_ptr;
+  struct _struct_n_pointer *ptrs[3];
+  struct _struct_n_pointer *next;
+};
+
+void do_locals_tests (void);
+void do_block_tests (void);
+void subroutine1 (int, long *);
+void nothing (void);
+void do_children_tests (void);
+void do_special_tests (void);
+void incr_a (char);
+
+void incr_a (char a)
+{
+  int b;
+  b = a;
+}
+
+void
+do_locals_tests ()
+{
+  int linteger;
+  int *lpinteger;
+  char lcharacter;
+  char *lpcharacter;
+  long llong;
+  long *lplong;
+  float lfloat;
+  float *lpfloat;
+  double ldouble;
+  double *lpdouble;
+  struct _simple_struct lsimple;
+  struct _simple_struct *lpsimple;
+  void (*func) (void);
+
+  /* Simple assignments */
+  linteger = 1234;
+  lpinteger = &linteger;
+  lcharacter = 'a';
+  lpcharacter = &lcharacter;
+  llong = 2121L;
+  lplong = &llong;
+  lfloat = 2.1;
+  lpfloat = &lfloat;
+  ldouble = 2.718281828459045;
+  lpdouble = &ldouble;
+  lsimple.integer = 1234;
+  lsimple.unsigned_integer = 255;
+  lsimple.character = 'a';
+  lsimple.signed_character = 21;
+  lsimple.char_ptr = &lcharacter;
+  lpsimple = &lsimple;
+  func = nothing;
+
+  /* Check pointers */
+  linteger = 4321;
+  lcharacter = 'b';
+  llong = 1212L;
+  lfloat = 1.2;
+  ldouble = 5.498548281828172;
+  lsimple.integer = 255;
+  lsimple.unsigned_integer = 4321;
+  lsimple.character = 'b';
+  lsimple.signed_character = 0;
+
+  subroutine1 (linteger, &llong);
+}
+
+void
+nothing ()
+{
+}
+
+void
+subroutine1 (int i, long *l)
+{
+  global_simple.integer = i + 3;
+  i = 212;
+  *l = 12;
+}
+
+void
+do_block_tests ()
+{
+  int cb = 12;
+
+  {
+    int foo;
+    foo = 123;
+    {
+      int foo2;
+      foo2 = 123;
+      {
+        int foo;
+        foo = 321;
+      }
+      foo2 = 0;
+    }
+    foo = 0;
+  }
+
+  cb = 21;
+}
+
+void
+do_children_tests (void)
+{
+  weird_struct *weird;
+  struct _struct_n_pointer *psnp;
+  struct _struct_n_pointer snp0, snp1, snp2;
+  char a0, *a1, **a2, ***a3;
+  char b0, *b1, **b2, ***b3;
+  char c0, *c1, **c2, ***c3;
+  long z0, *z1, **z2, ***z3;
+  long y0, *y1, **y2, ***y3;
+  long x0, *x1, **x2, ***x3;
+  int *foo;
+  int bar;
+
+  struct _struct_decl struct_declarations;
+  weird = &struct_declarations;
+
+  struct_declarations.integer = 123;
+  weird->char_ptr = "hello";
+  bar = 2121;
+  foo = &bar;
+  struct_declarations.int_ptr_ptr = &foo;
+  weird->long_array[0] = 1234;
+  struct_declarations.long_array[1] = 2345;
+  weird->long_array[2] = 3456;
+  struct_declarations.long_array[3] = 4567;
+  weird->long_array[4] = 5678;
+  struct_declarations.long_array[5] = 6789;
+  weird->long_array[6] = 7890;
+  struct_declarations.long_array[7] = 8901;
+  weird->long_array[8] = 9012;
+  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';
+  a1 = &a0;
+  a2 = &a1;
+  a3 = &a2;
+  b0 = '1';
+  b1 = &b0;
+  b2 = &b1;
+  b3 = &b2;
+  c0 = '2';
+  c1 = &c0;
+  c2 = &c1;
+  c3 = &c2;
+  z0 = 0xdead + 0;
+  z1 = &z0;
+  z2 = &z1;
+  z3 = &z2;
+  y0 = 0xdead + 1;
+  y1 = &y0;
+  y2 = &y1;
+  y3 = &y2;
+  x0 = 0xdead + 2;
+  x1 = &x0;
+  x2 = &x1;
+  x3 = &x2;
+  snp0.char_ptr = &a3;
+  snp0.long_ptr = &z3;
+  snp0.ptrs[0] = &snp0;
+  snp0.ptrs[1] = &snp1;
+  snp0.ptrs[2] = &snp2;
+  snp0.next = &snp1;
+  snp1.char_ptr = &b3;
+  snp1.long_ptr = &y3;
+  snp1.ptrs[0] = &snp0;
+  snp1.ptrs[1] = &snp1;
+  snp1.ptrs[2] = &snp2;
+  snp1.next = &snp2;
+  snp2.char_ptr = &c3;
+  snp2.long_ptr = &x3;
+  snp2.ptrs[0] = &snp0;
+  snp2.ptrs[1] = &snp1;
+  snp2.ptrs[2] = &snp2;
+  snp2.next = 0x0;
+  psnp = &snp0;
+  snp0.char_ptr = &b3;
+  snp1.char_ptr = &c3;
+  snp2.char_ptr = &a3;
+  snp0.long_ptr = &y3;
+  snp1.long_ptr = &x3;
+  snp2.long_ptr = &z3;
+}
+
+void
+do_special_tests (void)
+{
+  union named_union u;
+  union {
+    int a;
+    char b;
+    long c;
+  } anonu;
+  struct _simple_struct s;
+  struct {
+    int a;
+    char b;
+    long c;
+  } anons;
+  enum foo e;
+  enum { A, B, C } anone;
+  int array[21];
+  int a;
+
+  a = 1;   
+  incr_a(2);
+}
+
+int
+main (int argc, char *argv [])
+{
+  do_locals_tests ();
+  do_block_tests ();
+  do_children_tests ();
+  do_special_tests ();
+  exit (0);
+}
+
+  
Index: gdb.mi/mi-var-child.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-child.exp,v
retrieving revision 1.18
diff -u -p -r1.18 mi-var-child.exp
--- gdb.mi/mi-var-child.exp	27 Jul 2005 02:21:01 -0000	1.18
+++ gdb.mi/mi-var-child.exp	31 Jul 2005 21:20:53 -0000
@@ -28,7 +28,7 @@ if [mi_gdb_start] {
     continue
 }
 
-set testfile "var-cmd"
+set testfile "mi-var-child"
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
@@ -553,7 +553,7 @@ mi_gdb_test "-var-info-num-children stru
 
 # Step to "struct_declarations.integer = 123;"
 set line_dct_123 [gdb_get_line_number "struct_declarations.integer = 123;"]
-mi_step_to do_children_tests {} {.*var-cmd.c} \
+mi_step_to do_children_tests {} ".*${srcfile}" \
       $line_dct_123 "step to line \$line_dct_123"
 
 # Test: c_variable-4.81
@@ -752,7 +752,7 @@ mi_gdb_test "-var-update *" \
 	"update all vars. None changed"
 
 # Step over "struct_declarations.integer = 123;"
-mi_step_to do_children_tests {} {.*var-cmd.c} \
+mi_step_to do_children_tests {} ".*${srcfile}" \
     [expr $line_dct_123 + 1] "step \$line_dct_123 + 1"
 
 # Test: c_variable-5.2
@@ -765,7 +765,7 @@ mi_gdb_test "-var-update *" \
 #    weird->char_ptr = "hello";
 #    bar = 2121;
 #    foo = &bar;
-mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
+mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} ".*${srcfile}" \
     [expr $line_dct_123 + 4] {} "step \$line_dct_123 + 4"
 
 # Test: c_variable-5.3
@@ -775,7 +775,7 @@ mi_gdb_test "-var-update *" \
 	"update all vars struct_declarations.char_ptr"
 
 # Step over "struct_declarations.int_ptr_ptr = &foo;"
-mi_step_to do_children_tests {} {.*var-cmd.c} \
+mi_step_to do_children_tests {} ".*${srcfile}" \
     [expr $line_dct_123 + 5] "step \$line_dct_123 + 5"
 
 # Test: c_variable-5.4
@@ -785,7 +785,7 @@ mi_gdb_test "-var-update *" \
 	"update all vars int_ptr_ptr and children changed"
 
 # Step over "weird->long_array[0] = 1234;"
-mi_step_to do_children_tests {} {.*var-cmd.c} \
+mi_step_to do_children_tests {} ".*${srcfile}" \
     [expr $line_dct_123 + 6] "step \$line_dct_123 + 6"
 
 # Test: c_variable-5.5
@@ -795,7 +795,7 @@ mi_gdb_test "-var-update *" \
 	"update all vars struct_declarations.long_array.0 changed"
 
 # Step over "struct_declarations.long_array[1] = 2345;"
-mi_step_to do_children_tests {} {.*var-cmd.c} \
+mi_step_to do_children_tests {} ".*${srcfile}" \
     [expr $line_dct_123 + 7] "step \$line_dct_123 + 7"
 
 # Test: c_variable-5.6
@@ -805,7 +805,7 @@ mi_gdb_test "-var-update *" \
 	"update all vars struct_declarations.long_array.1 changed"
 
 # Step over "weird->long_array[2] = 3456;"
-mi_step_to do_children_tests {} {.*var-cmd.c} \
+mi_step_to do_children_tests {} ".*${srcfile}" \
     [expr $line_dct_123 + 8] "step \$line_dct_123 + 8"
 
 # Test: c_variable-5.7
@@ -824,7 +824,7 @@ mi_gdb_test "-var-update *" \
 #    struct_declarations.long_array[9] = 1234;
 
 set line_dct_nothing [gdb_get_line_number "weird->func_ptr = nothing;"]
-mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
+mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} ".*${srcfile}" \
     $line_dct_nothing {} "step \$line_dct_nothing"
 
 # Test: c_variable-5.8
@@ -835,7 +835,7 @@ mi_gdb_test "-var-update *" \
 
 
 # Step over "weird->func_ptr = nothing";
-mi_step_to do_children_tests {} {.*var-cmd.c} \
+mi_step_to do_children_tests {} ".*${srcfile}" \
     [expr $line_dct_nothing + 1] "step \$line_dct_nothing + 1"
 
 # Test: c_variable-5.9
@@ -845,7 +845,7 @@ mi_gdb_test "-var-update *" \
 	"update all vars struct_declarations.func_ptr changed"
 
 # Step over "struct_declarations.long_array[10] = 3456";
-mi_step_to do_children_tests {} {.*var-cmd.c} \
+mi_step_to do_children_tests {} ".*${srcfile}" \
     [expr $line_dct_nothing + 2] "step \$line_dct_nothing + 2"
 
 mi_gdb_test "-var-update --no-values *" \
@@ -854,7 +854,7 @@ mi_gdb_test "-var-update --no-values *" 
 
 # Step over "struct_declarations.long_array[11] = 5678";
 set line_dct_a0_0 [gdb_get_line_number "a0 = '0';"]
-mi_step_to  do_children_tests {} {.*var-cmd.c} \
+mi_step_to  do_children_tests {} ".*${srcfile}" \
     $line_dct_a0_0 "step \$line_dct_a0_0"
 
 mi_gdb_test "-var-update --all-values *" \
@@ -883,7 +883,7 @@ mi_gdb_test "-var-delete weird->int_ptr_
 #   psnp = &snp0;
 
 set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"]
-mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
+mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} ".*${srcfile}" \
     [expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1"
 
 # Test: c_variable-5.10
@@ -1154,7 +1154,7 @@ mi_gdb_test "-var-list-children psnp->pt
 	"get children of psnp->ptrs.0.next.next.ptrs"
 
 #  Step over "snp0.char_ptr = &b3;"
-mi_step_to do_children_tests {} {.*var-cmd.c} \
+mi_step_to do_children_tests {} ".*${srcfile}" \
     [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2"
 
 # Test: c_variable-5.47
@@ -1164,7 +1164,7 @@ mi_gdb_test "-var-update *" \
 	"update all vars psnp->char_ptr (and 0.char_ptr) changed"
 
 #  Step over "snp1.char_ptr = &c3;"
-mi_step_to do_children_tests {} {.*var-cmd.c} \
+mi_step_to do_children_tests {} ".*${srcfile}" \
     [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3"
 
 # Test: c_variable-5.48
@@ -1175,7 +1175,7 @@ mi_gdb_test "-var-update *" \
 
 
 #  Step over "snp2.char_ptr = &a3;"
-mi_step_to do_children_tests {} {.*var-cmd.c} \
+mi_step_to do_children_tests {} ".*${srcfile}" \
     [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4"
 
 # Test: c_variable-5.49
@@ -1186,7 +1186,7 @@ mi_gdb_test "-var-update *" \
 
 
 #  Step over "snp0.long_ptr = &y3;"
-mi_step_to do_children_tests {} {.*var-cmd.c} \
+mi_step_to do_children_tests {} ".*${srcfile}" \
     [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5"
 
 # Test: c_variable-5.50
@@ -1197,7 +1197,7 @@ mi_gdb_test "-var-update *" \
 
 
 #  Step over "snp1.long_ptr = &x3;"
-mi_step_to do_children_tests {} {.*var-cmd.c} \
+mi_step_to do_children_tests {} ".*${srcfile}" \
     [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6"
 
 # Test: c_variable-5.51
@@ -1214,7 +1214,7 @@ clear_xfail *-*-*
 #
 
 #  Step over "snp2.long_ptr = &z3;"
-mi_step_to do_children_tests {} {.*var-cmd.c} \
+mi_step_to do_children_tests {} ".*${srcfile}" \
     [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7"
 
 # Test: c_variable-5.52
Index: gdb.mi/var-cmd.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/var-cmd.c,v
retrieving revision 1.4
diff -u -p -r1.4 var-cmd.c
--- gdb.mi/var-cmd.c	27 Jul 2005 02:21:16 -0000	1.4
+++ gdb.mi/var-cmd.c	31 Jul 2005 21:20:53 -0000
@@ -1,4 +1,4 @@
-/* Copyright 1999, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright 1999, 2004 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -51,7 +51,7 @@ typedef struct _struct_decl {
   char *char_ptr;
   long  long_int;
   int  **int_ptr_ptr;
-  long  long_array[12];
+  long  long_array[10];
 
   void (*func_ptr) (void);
   struct _struct_decl (*func_ptr_struct) (int, char *, long);
@@ -227,8 +227,6 @@ do_children_tests (void)
   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';


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-28  1:39                   ` Nick Roberts
@ 2005-07-31 22:11                     ` Daniel Jacobowitz
  2005-07-31 23:32                       ` Nick Roberts
  0 siblings, 1 reply; 25+ messages in thread
From: Daniel Jacobowitz @ 2005-07-31 22:11 UTC (permalink / raw)
  To: Nick Roberts; +Cc: Mark Kettenis, gdb-patches

Again, sorry for not getting back to you on Thursday.

On Thu, Jul 28, 2005 at 01:40:46PM +1200, Nick Roberts wrote:
> I never intended to leave things broken.  You have asked me to fix the
> failures, and I will, but I'm not sure if that means submit further patches to
> the mailing list or commit appropriate fixes.  Based on Mark Kettenis' e-mail,

Submit patches, please.

> I attach a simple fix for mi-var-child.exp.  Does it work in your case?  I

> 2005-07-28  Nick Roberts  <nickrob@snap.net.nz>
> 
> 	* gdb.mi/mi-var-child.exp: Allow struct_declarations.character to be
> 	uninitialized.

First of all, it won't work.  You added:
  value=\"0 '\\\\\\\\$decimal'\"
which still has 0 in it :-)

Second, I get a value of 0 here, but the test still fails. 
func_ptr_struct and func_ptr_ptr aren't initialized either.  Chasing
uninitialized members is going to leave the tests script a bit of a
mess.

Initializing the whole structure proved to be a bit of a pain - these
tests are ridiculously tricky to edit.  But here it is.  Tested on
i686-pc-linux-gnu and committed.  I hope this will be more useful if we
add any additional value-related tests.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

2005-07-31  Daniel Jacobowitz  <dan@codesourcery.com>

	* gdb.mi/mi-var-child.c (do_children_tests): Initialize
	struct_declarations.
	* gdb.mi/mi-var-child.exp: Step over the initialization of
	struct_declarations.

Index: gdb.mi/mi-var-child.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-child.c,v
retrieving revision 1.1
diff -u -p -r1.1 mi-var-child.c
--- gdb.mi/mi-var-child.c	31 Jul 2005 21:24:25 -0000	1.1
+++ gdb.mi/mi-var-child.c	31 Jul 2005 22:04:14 -0000
@@ -208,6 +208,7 @@ do_children_tests (void)
   int bar;
 
   struct _struct_decl struct_declarations;
+  memset (&struct_declarations, 0, sizeof (struct_declarations));
   weird = &struct_declarations;
 
   struct_declarations.integer = 123;
Index: gdb.mi/mi-var-child.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-child.exp,v
retrieving revision 1.19
diff -u -p -r1.19 mi-var-child.exp
--- gdb.mi/mi-var-child.exp	31 Jul 2005 21:24:25 -0000	1.19
+++ gdb.mi/mi-var-child.exp	31 Jul 2005 22:04:14 -0000
@@ -47,6 +47,10 @@ mi_runto do_children_tests
 #                #
 #####        #####
 
+# Step past the initialization of struct_declarations.
+set line_weird [gdb_get_line_number "weird = &struct_declarations;"]
+mi_execute_to "exec-next" "end-stepping-range" do_children_tests {} ".*${srcfile}" \
+    [expr $line_weird] {} "step \$line_weird"
 
 # Test: c_variable-4.2
 # Desc: create variable "struct_declarations"


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-31 22:11                     ` Daniel Jacobowitz
@ 2005-07-31 23:32                       ` Nick Roberts
  2005-08-01  1:55                         ` Daniel Jacobowitz
  0 siblings, 1 reply; 25+ messages in thread
From: Nick Roberts @ 2005-07-31 23:32 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Mark Kettenis, gdb-patches

 > > I never intended to leave things broken.  You have asked me to fix the
 > > failures, and I will, but I'm not sure if that means submit further
 > > patches to the mailing list or commit appropriate fixes.  Based on Mark
 > > Kettenis' e-mail,
 > 
 > Submit patches, please.

OK.

 > > I attach a simple fix for mi-var-child.exp.  Does it work in your case?  I
 > 
 > > 2005-07-28  Nick Roberts  <nickrob@snap.net.nz>
 > > 
 > > 	* gdb.mi/mi-var-child.exp: Allow struct_declarations.character to be
 > > 	uninitialized.
 > 
 > First of all, it won't work.  You added:
 >   value=\"0 '\\\\\\\\$decimal'\"
 > which still has 0 in it :-)

Oops!

 > Second, I get a value of 0 here, but the test still fails. 
 > func_ptr_struct and func_ptr_ptr aren't initialized either.  Chasing
 > uninitialized members is going to leave the tests script a bit of a
 > mess.
 > 
 > Initializing the whole structure proved to be a bit of a pain - these
 > tests are ridiculously tricky to edit.  But here it is.  Tested on
 > i686-pc-linux-gnu and committed.  I hope this will be more useful if we
 > add any additional value-related tests.

I find the number of backslashes needed confusing (because of the read syntax
for strings?).  Your changes seem concise.  I'll test these too.
 
Thanks again.

Nick


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-31 21:25             ` Daniel Jacobowitz
@ 2005-07-31 23:32               ` Nick Roberts
  2005-08-01  1:57                 ` Daniel Jacobowitz
  0 siblings, 1 reply; 25+ messages in thread
From: Nick Roberts @ 2005-07-31 23:32 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

 > > I would rather copy my changes to mi-stack.exp and mi-var-child.exp over to
 > > mi2-stack.exp and mi2-var-child.exp.  Creating new files mi-var-cmd.c,
 > > mi-basics.c etc seems more complicated.  Is this an acceptable short term
 > > solution?
 > 
 > It's not complicated at all.  Please see the attached patch, which I've
 > checked in.  It would be even simpler than this if folks had used
 > ${srcfile} to begin with.

Well now some mi-*.exp files e.g mi-var-block.exp use var-cmd.c while
others, namely mi-var-child.exp, use mi-var-child.c.  Clearly, though if
you do the work its simpler (for me!).

 > Tested on i686-pc-linux-gnu, where it resolves 18 FAILs and assorted
 > ERRORs.

Thanks.  I'll test them on my other machine, but I'm sure they will work.  I
guess the idea is that mi2-*.exp tests shouldn't change although I'm still not
convinced that they are useful - perhaps we can discuss that later.

In future, I'll run the whole testsuite before submitting patches, to save you
and others hassle.

Nick


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-31 23:32                       ` Nick Roberts
@ 2005-08-01  1:55                         ` Daniel Jacobowitz
  0 siblings, 0 replies; 25+ messages in thread
From: Daniel Jacobowitz @ 2005-08-01  1:55 UTC (permalink / raw)
  To: Nick Roberts; +Cc: Mark Kettenis, gdb-patches

On Mon, Aug 01, 2005 at 11:33:41AM +1200, Nick Roberts wrote:
>  > Second, I get a value of 0 here, but the test still fails. 
>  > func_ptr_struct and func_ptr_ptr aren't initialized either.  Chasing
>  > uninitialized members is going to leave the tests script a bit of a
>  > mess.
>  > 
>  > Initializing the whole structure proved to be a bit of a pain - these
>  > tests are ridiculously tricky to edit.  But here it is.  Tested on
>  > i686-pc-linux-gnu and committed.  I hope this will be more useful if we
>  > add any additional value-related tests.
> 
> I find the number of backslashes needed confusing (because of the read syntax
> for strings?).  Your changes seem concise.  I'll test these too.
>  
> Thanks again.

No problem.  About the backslashes:

If you say "\\\\" in TCL, then the parser will reduce it to the literal
string <\\>.  Then the regular expression parser will collapse that
down to a pattern which matches <\>.  {\\} is the same as "\\\\"
because backslashes aren't special to TCL inside of braces.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: PATCH: tests for MI commands
  2005-07-31 23:32               ` Nick Roberts
@ 2005-08-01  1:57                 ` Daniel Jacobowitz
  0 siblings, 0 replies; 25+ messages in thread
From: Daniel Jacobowitz @ 2005-08-01  1:57 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches

On Mon, Aug 01, 2005 at 11:17:32AM +1200, Nick Roberts wrote:
>  > > I would rather copy my changes to mi-stack.exp and mi-var-child.exp over to
>  > > mi2-stack.exp and mi2-var-child.exp.  Creating new files mi-var-cmd.c,
>  > > mi-basics.c etc seems more complicated.  Is this an acceptable short term
>  > > solution?
>  > 
>  > It's not complicated at all.  Please see the attached patch, which I've
>  > checked in.  It would be even simpler than this if folks had used
>  > ${srcfile} to begin with.
> 
> Well now some mi-*.exp files e.g mi-var-block.exp use var-cmd.c while
> others, namely mi-var-child.exp, use mi-var-child.c.  Clearly, though if
> you do the work its simpler (for me!).

Every other test in the testsuite (well, not true.  All the recent ones
anyway!) has its own source file.  We've found this to be the best
option - because really, most of the time when you change a source file
in the testsuite, it's so that you can add or improve tests, not fix
bugs in the programs being tested.  So duplication is less problematic
than the lockstep tangle that we encountered here.  So that's the
general principle.

> 
>  > Tested on i686-pc-linux-gnu, where it resolves 18 FAILs and assorted
>  > ERRORs.
> 
> Thanks.  I'll test them on my other machine, but I'm sure they will work.  I
> guess the idea is that mi2-*.exp tests shouldn't change although I'm still not
> convinced that they are useful - perhaps we can discuss that later.

Yes, precisely.  I'm still a bit undecided on the issue of the
mi2-*.exp tests, but I think that either (A) they shouldn't change or
(B) they should be removed.  For now the course of inertia is (A).

> In future, I'll run the whole testsuite before submitting patches, to save you
> and others hassle.

Thank you!

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2005-08-01  1:57 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-20  4:51 PATCH: tests for MI commands Nick Roberts
2005-07-24 21:19 ` Daniel Jacobowitz
2005-07-26 23:31   ` Nick Roberts
2005-07-27  0:27     ` Daniel Jacobowitz
2005-07-27  3:04       ` Nick Roberts
2005-07-27  3:55         ` Daniel Jacobowitz
2005-07-27 11:46           ` Nick Roberts
2005-07-27 12:50             ` Bob Rossi
2005-07-27 20:52               ` Nick Roberts
2005-07-27 21:49                 ` Daniel Jacobowitz
2005-07-27 22:09                   ` Nick Roberts
2005-07-27 21:03             ` Mark Kettenis
2005-07-27 22:23               ` Nick Roberts
2005-07-28  0:08                 ` Paul Gilliam
2005-07-28  0:18                 ` Stan Shebs
2005-07-28  0:21                 ` Daniel Jacobowitz
2005-07-28  1:39                   ` Nick Roberts
2005-07-31 22:11                     ` Daniel Jacobowitz
2005-07-31 23:32                       ` Nick Roberts
2005-08-01  1:55                         ` Daniel Jacobowitz
2005-07-27 21:25             ` Mark Kettenis
2005-07-29  7:32           ` Nick Roberts
2005-07-31 21:25             ` Daniel Jacobowitz
2005-07-31 23:32               ` Nick Roberts
2005-08-01  1:57                 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox