From 469aff8eec9fab2c81b46eaf8939eee82423e293 Mon Sep 17 00:00:00 2001 From: Michael Chastain Date: Tue, 17 Aug 2004 09:38:29 +0000 Subject: [PATCH] 2004-08-17 Michael Chastain * gdb.mi/mi-var-block.exp: Use gdb_get_line_number. Remove reference to bug-gnu@prep.ai.mit.edu. * gdb.mi/mi-var-child.exp: Likewise. * gdb.mi/mi-var-cmd.exp: Likewise. * gdb.mi/mi-var-display.exp: Likewise. * gdb.mi/mi2-var-block.exp: Likewise. * gdb.mi/mi2-var-child.exp: Likewise. * gdb.mi/mi2-var-cmd.exp: Likewise. * gdb.mi/mi2-var-display.exp: Likewise. --- gdb/testsuite/ChangeLog | 12 ++++ gdb/testsuite/gdb.mi/mi-var-block.exp | 29 +++++---- gdb/testsuite/gdb.mi/mi-var-child.exp | 73 ++++++++++++----------- gdb/testsuite/gdb.mi/mi-var-cmd.exp | 38 ++++++------ gdb/testsuite/gdb.mi/mi-var-display.exp | 28 +++++---- gdb/testsuite/gdb.mi/mi2-var-block.exp | 29 +++++---- gdb/testsuite/gdb.mi/mi2-var-child.exp | 75 ++++++++++++------------ gdb/testsuite/gdb.mi/mi2-var-cmd.exp | 38 ++++++------ gdb/testsuite/gdb.mi/mi2-var-display.exp | 28 +++++---- 9 files changed, 201 insertions(+), 149 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 17f146c8e2..ebd2cd5987 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2004-08-17 Michael Chastain + + * gdb.mi/mi-var-block.exp: Use gdb_get_line_number. Remove + reference to bug-gnu@prep.ai.mit.edu. + * gdb.mi/mi-var-child.exp: Likewise. + * gdb.mi/mi-var-cmd.exp: Likewise. + * gdb.mi/mi-var-display.exp: Likewise. + * gdb.mi/mi2-var-block.exp: Likewise. + * gdb.mi/mi2-var-child.exp: Likewise. + * gdb.mi/mi2-var-cmd.exp: Likewise. + * gdb.mi/mi2-var-display.exp: Likewise. + 2004-08-15 Mark Kettenis * gdb.base/unload.c (main): Make local variable msg const. diff --git a/gdb/testsuite/gdb.mi/mi-var-block.exp b/gdb/testsuite/gdb.mi/mi-var-block.exp index 7931ce0ed1..db49456a63 100644 --- a/gdb/testsuite/gdb.mi/mi-var-block.exp +++ b/gdb/testsuite/gdb.mi/mi-var-block.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc. # # 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 @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # Test essential Machine interface (MI) operations # # Verify that, using the MI, we can create, update, delete variables. @@ -55,7 +52,9 @@ mi_gdb_test "-var-create foo * foo" \ "create local variable foo" # step to "foo = 123;" -mi_step_to "do_block_tests" "" "var-cmd.c" "158" "step at do_block_test" +mi_step_to "do_block_tests" "" "var-cmd.c" \ + [gdb_get_line_number "foo = 123;"] \ + "step at do_block_test" # Be paranoid and assume 3.2 created foo @@ -71,7 +70,9 @@ mi_gdb_test "-var-create foo * foo" \ "create local variable foo" # step to "foo2 = 123;" -mi_step_to "do_block_tests" "" "var-cmd.c" "161" "step at do_block_test" +mi_step_to "do_block_tests" "" "var-cmd.c" \ + [gdb_get_line_number "foo2 = 123;"] \ + "step at do_block_test" # Test: c_variable-3.4 # Desc: check foo, cb changed @@ -80,7 +81,9 @@ mi_gdb_test "-var-update *" \ "update all vars: cb foo changed" # step to "foo = 321;" -mi_step_to "do_block_tests" "" "var-cmd.c" "164" "step at do_block_test" +mi_step_to "do_block_tests" "" "var-cmd.c" \ + [gdb_get_line_number "foo = 321;"] \ + "step at do_block_test" # Test: c_variable-3.5 # Desc: create inner block foo @@ -89,7 +92,9 @@ mi_gdb_test "-var-create inner_foo * foo" \ "create local variable inner_foo" # step to "foo2 = 0;" -mi_step_to "do_block_tests" "" "var-cmd.c" "166" "step at do_block_test" +mi_step_to "do_block_tests" "" "var-cmd.c" \ + [gdb_get_line_number "foo2 = 0;"] \ + "step at do_block_test" # Test: c_variable-3.6 # Desc: create foo2 @@ -121,7 +126,9 @@ mi_gdb_test "-var-delete inner_foo" \ "delete var inner_foo" # step to "foo = 0;" -mi_step_to "do_block_tests" "" "var-cmd.c" "168" "step at do_block_test" +mi_step_to "do_block_tests" "" "var-cmd.c" \ + [gdb_get_line_number "foo = 0;"] \ + "step at do_block_test" # Test: c_variable-3.8 # Desc: check that foo2 out of scope (known gdb problem) @@ -132,7 +139,9 @@ mi_gdb_test "-var-update foo2" \ clear_xfail *-*-* # step to "cb = 21;" -mi_step_to "do_block_tests" "" "var-cmd.c" "171" "step at do_block_test" +mi_step_to "do_block_tests" "" "var-cmd.c" \ + [gdb_get_line_number "cb = 21;"] \ + "step at do_block_test" # Test: c_variable-3.9 # Desc: check that only cb is in scope (known gdb problem) diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp index cd4f7f6c2a..d0fb395765 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child.exp @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # Test essential Machine interface (MI) operations # # Verify that, using the MI, we can create, update, delete variables. @@ -555,8 +552,9 @@ mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr.*int_ptr_ptr # Step to "struct_declarations.integer = 123;" -set line 192 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step to line $line" +set line_dct_123 [gdb_get_line_number "struct_declarations.integer = 123;"] +mi_step_to do_children_tests {} {.*var-cmd.c} \ + $line_dct_123 "step to line \$line_dct_123" # Test: c_variable-4.81 # Desc: create local variable "weird" @@ -754,8 +752,8 @@ mi_gdb_test "-var-update *" \ "update all vars. None changed" # Step over "struct_declarations.integer = 123;" -set line 193 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_123 + 1] "step \$line_dct_123 + 1" # Test: c_variable-5.2 # Desc: check that integer changed @@ -767,8 +765,8 @@ mi_gdb_test "-var-update *" \ # weird->char_ptr = "hello"; # bar = 2121; # foo = &bar; -set line 196 -mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" +mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_123 + 4] {} "step \$line_dct_123 + 4" # Test: c_variable-5.3 # Desc: check that char_ptr changed @@ -777,8 +775,8 @@ mi_gdb_test "-var-update *" \ "update all vars struct_declarations.char_ptr" # Step over "struct_declarations.int_ptr_ptr = &foo;" -set line 197 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_123 + 5] "step \$line_dct_123 + 5" # Test: c_variable-5.4 # Desc: check that int_ptr_ptr and children changed @@ -787,8 +785,8 @@ mi_gdb_test "-var-update *" \ "update all vars int_ptr_ptr and children changed" # Step over "weird->long_array[0] = 1234;" -set line 198 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_123 + 6] "step \$line_dct_123 + 6" # Test: c_variable-5.5 # Desc: check that long_array[0] changed @@ -797,8 +795,8 @@ mi_gdb_test "-var-update *" \ "update all vars struct_declarations.long_array.0 changed" # Step over "struct_declarations.long_array[1] = 2345;" -set line 199 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_123 + 7] "step \$line_dct_123 + 7" # Test: c_variable-5.6 # Desc: check that long_array[1] changed @@ -807,8 +805,8 @@ mi_gdb_test "-var-update *" \ "update all vars struct_declarations.long_array.1 changed" # Step over "weird->long_array[2] = 3456;" -set line 200 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_123 + 8] "step \$line_dct_123 + 8" # Test: c_variable-5.7 # Desc: check that long_array[2] changed @@ -824,8 +822,10 @@ mi_gdb_test "-var-update *" \ # struct_declarations.long_array[7] = 8901; # weird->long_array[8] = 9012; # struct_declarations.long_array[9] = 1234; -set line 208 -mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" + +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} \ + $line_dct_nothing {} "step \$line_dct_nothing" # Test: c_variable-5.8 # Desc: check that long_array[3-9] changed @@ -838,8 +838,9 @@ mi_gdb_test "-var-list-children --all-values struct_declarations.long_array" \ "listing of names and values of children" # Step over "weird->func_ptr = nothing;" -set line 211 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +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 @@ -859,8 +860,10 @@ mi_gdb_test "-var-delete weird->int_ptr_ptr" \ # Step over all lines: # ... # psnp = &snp0; -set line 254 -mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" + +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} \ + [expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1" # Test: c_variable-5.10 # Desc: create psnp->char_ptr @@ -1130,8 +1133,8 @@ mi_gdb_test "-var-list-children psnp->ptrs.0.next.next.ptrs" \ "get children of psnp->ptrs.0.next.next.ptrs" # Step over "snp0.char_ptr = &b3;" -set line 255 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2" # Test: c_variable-5.47 # Desc: check that psnp->char_ptr (and [0].char_ptr) changed @@ -1140,8 +1143,8 @@ mi_gdb_test "-var-update *" \ "update all vars psnp->char_ptr (and 0.char_ptr) changed" # Step over "snp1.char_ptr = &c3;" -set line 256 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3" # Test: c_variable-5.48 # Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed @@ -1151,8 +1154,8 @@ mi_gdb_test "-var-update *" \ # Step over "snp2.char_ptr = &a3;" -set line 257 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4" # Test: c_variable-5.49 # Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed @@ -1162,8 +1165,8 @@ mi_gdb_test "-var-update *" \ # Step over "snp0.long_ptr = &y3;" -set line 258 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5" # Test: c_variable-5.50 # Desc: check that psnp->long_ptr (and [0].long_ptr) changed @@ -1173,8 +1176,8 @@ mi_gdb_test "-var-update *" \ # Step over "snp1.long_ptr = &x3;" -set line 259 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6" # Test: c_variable-5.51 # Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed @@ -1190,8 +1193,8 @@ clear_xfail *-*-* # # Step over "snp2.long_ptr = &z3;" -set line 260 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7" # Test: c_variable-5.52 # Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp index 79119ee2cb..adc4995146 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc. # # 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 @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # Test essential Machine interface (MI) operations # # Verify that, using the MI, we can create, update, delete variables. @@ -168,7 +165,8 @@ mi_gdb_test "-var-update *" \ "update all vars" # Step over "linteger = 1234;" -mi_step_to "do_locals_tests" "" "var-cmd.c" "107" "step at do_locals_test" +set line_dlt_linteger [gdb_get_line_number "lpinteger = &linteger;"] +mi_step_to "do_locals_tests" "" "var-cmd.c" $line_dlt_linteger "step at do_locals_test" # Test: c_variable-2.2 # Desc: check whether only linteger changed values @@ -177,7 +175,7 @@ mi_gdb_test "-var-update *" \ "update all vars: linteger changed" # Step over "lpinteger = &linteger;" -mi_step_to "do_locals_tests" "" "var-cmd.c" 108 "step at do_locals_tests (2)" +mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 1] "step at do_locals_tests (2)" # Test: c_variable-2.3 # Desc: check whether only lpinteger changed @@ -186,7 +184,7 @@ mi_gdb_test "-var-update *" \ "update all vars: lpinteger changed" # Step over "lcharacter = 'a';" -mi_step_to "do_locals_tests" "" "var-cmd.c" "109" "step at do_locals_tests (3)" +mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 2] "step at do_locals_tests (3)" # Test: c_variable-2.4 # Desc: check whether only lcharacter changed @@ -195,7 +193,7 @@ mi_gdb_test "-var-update *" \ "update all vars: lcharacter changed" # Step over "lpcharacter = &lcharacter;" -mi_step_to "do_locals_tests" "" "var-cmd.c" "110" "step at do_locals_tests (4)" +mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 3] "step at do_locals_tests (4)" # Test: c_variable-2.5 # Desc: check whether only lpcharacter changed @@ -216,7 +214,7 @@ mi_gdb_test "-var-update *" \ # lsimple.character = 'a'; mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" "119" "" "step at do_locals_tests (5)" + "var-cmd.c" [expr $line_dlt_linteger + 12] "" "step at do_locals_tests (5)" # Test: c_variable-2.6 # Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer, @@ -231,8 +229,10 @@ mi_gdb_test "-var-update *" \ # lpsimple = &lsimple; # func = nothing; +set line_dlt_4321 [gdb_get_line_number "linteger = 4321;"] + mi_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" "125" "" "step at do_locals_tests (6)" + "var-cmd.c" $line_dlt_4321 "" "step at do_locals_tests (6)" # Test: c_variable-2.7 # Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed @@ -251,7 +251,7 @@ mi_gdb_test "-var-update *" \ # lsimple.character = 'b'; mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" "133" "" "step at do_locals_tests (7)" + "var-cmd.c" [expr $line_dlt_4321 + 8] "" "step at do_locals_tests (7)" # Test: c_variable-2.8 # Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer, @@ -384,12 +384,14 @@ mi_gdb_test "-var-assign lsimple.integer 333" \ # End of assign tests ##### +set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"] + mi_gdb_test "-break-insert subroutine1" \ - "\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"146\",times=\"0\"\}" \ + "\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"$line_subroutine1_body\",times=\"0\"\}" \ "break-insert subroutine1" mi_continue_to "2" "subroutine1" \ "\{name=\"i\",value=\"4321\"\},\{name=\"l\",value=\"$hex\"\}" \ - "var-cmd.c" "146" "continue to subroutine1" + "var-cmd.c" $line_subroutine1_body "continue to subroutine1" # Test: c_variable-2.10 # Desc: create variable for locals i,l in subroutine1 @@ -408,7 +410,7 @@ mi_gdb_test "-var-create linteger * linteger" \ "create linteger" mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" "147" "step at subroutine1" + "var-cmd.c" [expr $line_subroutine1_body + 1] "step at subroutine1" # Test: c_variable-2.12 # Desc: change global_simple.integer @@ -424,7 +426,7 @@ mi_gdb_test "-var-update *" \ clear_xfail *-*-* mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" "148" "step at subroutine1 (2)" + "var-cmd.c" [expr $line_subroutine1_body + 2] "step at subroutine1 (2)" # Test: c_variable-2.13 # Desc: change subroutine1 local i @@ -433,7 +435,7 @@ mi_gdb_test "-var-update *" \ "update all vars: i changed" mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" "149" "step at subroutine1 (3)" + "var-cmd.c" [expr $line_subroutine1_body + 3] "step at subroutine1 (3)" # Test: c_variable-2.14 # Desc: change do_locals_tests local llong @@ -441,7 +443,9 @@ mi_gdb_test "-var-update *" \ "\\^done,changelist=\\\[\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \ "update all vars: llong changed" -mi_next_to "do_locals_tests" "" "var-cmd.c" "136" "next out of subroutine1" +set line_dlt_call_subroutine1 [gdb_get_line_number "subroutine1 (linteger, &llong);"] +mi_next_to "do_locals_tests" "" "var-cmd.c" \ + [expr $line_dlt_call_subroutine1 + 1] "next out of subroutine1" # Test: c_variable-2.15 # Desc: check for out of scope subroutine1 locals diff --git a/gdb/testsuite/gdb.mi/mi-var-display.exp b/gdb/testsuite/gdb.mi/mi-var-display.exp index 8f702aa3ad..a9576e1cb0 100644 --- a/gdb/testsuite/gdb.mi/mi-var-display.exp +++ b/gdb/testsuite/gdb.mi/mi-var-display.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. # # 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 @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # Test essential Machine interface (MI) operations # # Verify that, using the MI, we can create, update, delete variables. @@ -42,14 +39,16 @@ mi_delete_breakpoints mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -mi_gdb_test "200-break-insert 260" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"260\",times=\"0\"\}" \ +set line_dct_close_brace [expr [gdb_get_line_number "snp2.long_ptr = &z3;"] + 1] + +mi_gdb_test "200-break-insert $line_dct_close_brace" \ + "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"$line_dct_close_brace\",times=\"0\"\}" \ "break-insert operation" mi_run_cmd # The running part has been checked already by mi_run_cmd gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"260\"\}\r\n$mi_gdb_prompt$" { + -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"$line_dct_close_brace\"\}\r\n$mi_gdb_prompt$" { pass "run to do_children_tests" } -re ".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"} @@ -324,13 +323,16 @@ mi_gdb_test "-var-delete weird" \ ##### ##### # Stop in "do_special_tests" + +set line_dst_a_1 [gdb_get_line_number "a = 1;"] + mi_gdb_test "200-break-insert do_special_tests" \ - "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"282\",times=\"0\"\}" \ + "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"$line_dst_a_1\",times=\"0\"\}" \ "break-insert operation" send_gdb "-exec-continue\n" gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_special_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"282\"\}\r\n$mi_gdb_prompt$" { + -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_special_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"$line_dst_a_1\"\}\r\n$mi_gdb_prompt$" { pass "continue to do_special_tests" } timeout { @@ -583,15 +585,17 @@ gdb_expect { timeout { fail "print FP register (timeout)"} } +set line_incr_a_b_a [gdb_get_line_number "b = a;"] + mi_gdb_test "200-break-insert incr_a" \ - "200\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"incr_a\",file=\".*var-cmd.c\",line=\"85\",times=\"0\"\}" \ + "200\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"incr_a\",file=\".*var-cmd.c\",line=\"$line_incr_a_b_a\",times=\"0\"\}" \ "break-insert operation" send_gdb "-exec-continue\n" gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"2\.*\"\}\\\],file=\".*var-cmd.c\",line=\"85\"\}\r\n$mi_gdb_prompt$" { + -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"2\.*\"\}\\\],file=\".*var-cmd.c\",line=\"$line_incr_a_b_a\"\}\r\n$mi_gdb_prompt$" { pass "continue to incr_a" } - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"\.*\"\}\\\],file=\".*var-cmd.c\",line=\"8\[345\]\"\}\r\n$mi_gdb_prompt$" { + -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"\.*\"\}\\\],file=\".*var-cmd.c\",line=\"([expr $line_incr_a_b_a - 2]|[expr $line_incr_a_b_a - 1]|$line_incr_a_b_a)\"\}\r\n$mi_gdb_prompt$" { fail "continue to incr_a (compiler debug info incorrect)" } -re "\\^running\r\n${mi_gdb_prompt}.*\r\n$mi_gdb_prompt$" { diff --git a/gdb/testsuite/gdb.mi/mi2-var-block.exp b/gdb/testsuite/gdb.mi/mi2-var-block.exp index 2d3a04cfbb..474891030c 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-block.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-block.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. # # 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 @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # Test essential Machine interface (MI) operations # # Verify that, using the MI, we can create, update, delete variables. @@ -55,7 +52,9 @@ mi_gdb_test "-var-create foo * foo" \ "create local variable foo" # step to "foo = 123;" -mi_step_to "do_block_tests" "" "var-cmd.c" "158" "step at do_block_test" +mi_step_to "do_block_tests" "" "var-cmd.c" \ + [gdb_get_line_number "foo = 123;"] \ + "step at do_block_test" # Be paranoid and assume 3.2 created foo @@ -71,7 +70,9 @@ mi_gdb_test "-var-create foo * foo" \ "create local variable foo" # step to "foo2 = 123;" -mi_step_to "do_block_tests" "" "var-cmd.c" "161" "step at do_block_test" +mi_step_to "do_block_tests" "" "var-cmd.c" \ + [gdb_get_line_number "foo2 = 123;"] \ + "step at do_block_test" # Test: c_variable-3.4 # Desc: check foo, cb changed @@ -80,7 +81,9 @@ mi_gdb_test "-var-update *" \ "update all vars: cb foo changed" # step to "foo = 321;" -mi_step_to "do_block_tests" "" "var-cmd.c" "164" "step at do_block_test" +mi_step_to "do_block_tests" "" "var-cmd.c" \ + [gdb_get_line_number "foo = 321;"] \ + "step at do_block_test" # Test: c_variable-3.5 # Desc: create inner block foo @@ -89,7 +92,9 @@ mi_gdb_test "-var-create inner_foo * foo" \ "create local variable inner_foo" # step to "foo2 = 0;" -mi_step_to "do_block_tests" "" "var-cmd.c" "166" "step at do_block_test" +mi_step_to "do_block_tests" "" "var-cmd.c" \ + [gdb_get_line_number "foo2 = 0;"] \ + "step at do_block_test" # Test: c_variable-3.6 # Desc: create foo2 @@ -121,7 +126,9 @@ mi_gdb_test "-var-delete inner_foo" \ "delete var inner_foo" # step to "foo = 0;" -mi_step_to "do_block_tests" "" "var-cmd.c" "168" "step at do_block_test" +mi_step_to "do_block_tests" "" "var-cmd.c" \ + [gdb_get_line_number "foo = 0;"] \ + "step at do_block_test" # Test: c_variable-3.8 # Desc: check that foo2 out of scope (known gdb problem) @@ -132,7 +139,9 @@ mi_gdb_test "-var-update foo2" \ clear_xfail *-*-* # step to "cb = 21;" -mi_step_to "do_block_tests" "" "var-cmd.c" "171" "step at do_block_test" +mi_step_to "do_block_tests" "" "var-cmd.c" \ + [gdb_get_line_number "cb = 21;"] \ + "step at do_block_test" # Test: c_variable-3.9 # Desc: check that only cb is in scope (known gdb problem) diff --git a/gdb/testsuite/gdb.mi/mi2-var-child.exp b/gdb/testsuite/gdb.mi/mi2-var-child.exp index 9daf2aab67..be2dc84921 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-child.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation +# Copyright 1999, 2000, 2001, 2002, 2003, 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 @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # Test essential Machine interface (MI) operations # # Verify that, using the MI, we can create, update, delete variables. @@ -555,8 +552,9 @@ mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr.*int_ptr_ptr # Step to "struct_declarations.integer = 123;" -set line 192 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step to line $line" +set line_dct_123 [gdb_get_line_number "struct_declarations.integer = 123;"] +mi_step_to do_children_tests {} {.*var-cmd.c} \ + $line_dct_123 "step to line \$line_dct_123" # Test: c_variable-4.81 # Desc: create local variable "weird" @@ -754,8 +752,8 @@ mi_gdb_test "-var-update *" \ "update all vars. None changed" # Step over "struct_declarations.integer = 123;" -set line 193 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_123 + 1] "step \$line_dct_123 + 1" # Test: c_variable-5.2 # Desc: check that integer changed @@ -767,8 +765,8 @@ mi_gdb_test "-var-update *" \ # weird->char_ptr = "hello"; # bar = 2121; # foo = &bar; -set line 196 -mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" +mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_123 + 4] {} "step \$line_dct_123 + 4" # Test: c_variable-5.3 # Desc: check that char_ptr changed @@ -777,8 +775,8 @@ mi_gdb_test "-var-update *" \ "update all vars struct_declarations.char_ptr" # Step over "struct_declarations.int_ptr_ptr = &foo;" -set line 197 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_123 + 5] "step \$line_dct_123 + 5" # Test: c_variable-5.4 # Desc: check that int_ptr_ptr and children changed @@ -787,8 +785,8 @@ mi_gdb_test "-var-update *" \ "update all vars int_ptr_ptr and children changed" # Step over "weird->long_array[0] = 1234;" -set line 198 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_123 + 6] "step \$line_dct_123 + 6" # Test: c_variable-5.5 # Desc: check that long_array[0] changed @@ -797,8 +795,8 @@ mi_gdb_test "-var-update *" \ "update all vars struct_declarations.long_array.0 changed" # Step over "struct_declarations.long_array[1] = 2345;" -set line 199 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_123 + 7] "step \$line_dct_123 + 7" # Test: c_variable-5.6 # Desc: check that long_array[1] changed @@ -807,8 +805,8 @@ mi_gdb_test "-var-update *" \ "update all vars struct_declarations.long_array.1 changed" # Step over "weird->long_array[2] = 3456;" -set line 200 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_123 + 8] "step \$line_dct_123 + 8" # Test: c_variable-5.7 # Desc: check that long_array[2] changed @@ -824,8 +822,10 @@ mi_gdb_test "-var-update *" \ # struct_declarations.long_array[7] = 8901; # weird->long_array[8] = 9012; # struct_declarations.long_array[9] = 1234; -set line 208 -mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" + +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} \ + $line_dct_nothing {} "step \$line_dct_nothing" # Test: c_variable-5.8 # Desc: check that long_array[3-9] changed @@ -835,8 +835,9 @@ mi_gdb_test "-var-update *" \ # Step over "weird->func_ptr = nothing;" -set line 211 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +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 @@ -856,8 +857,10 @@ mi_gdb_test "-var-delete weird->int_ptr_ptr" \ # Step over all lines: # ... # psnp = &snp0; -set line 254 -mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" + +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} \ + [expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1" # Test: c_variable-5.10 # Desc: create psnp->char_ptr @@ -1127,8 +1130,8 @@ mi_gdb_test "-var-list-children psnp->ptrs.0.next.next.ptrs" \ "get children of psnp->ptrs.0.next.next.ptrs" # Step over "snp0.char_ptr = &b3;" -set line 255 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2" # Test: c_variable-5.47 # Desc: check that psnp->char_ptr (and [0].char_ptr) changed @@ -1137,8 +1140,8 @@ mi_gdb_test "-var-update *" \ "update all vars psnp->char_ptr (and 0.char_ptr) changed" # Step over "snp1.char_ptr = &c3;" -set line 256 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3" # Test: c_variable-5.48 # Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed @@ -1148,8 +1151,8 @@ mi_gdb_test "-var-update *" \ # Step over "snp2.char_ptr = &a3;" -set line 257 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4" # Test: c_variable-5.49 # Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed @@ -1159,8 +1162,8 @@ mi_gdb_test "-var-update *" \ # Step over "snp0.long_ptr = &y3;" -set line 258 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5" # Test: c_variable-5.50 # Desc: check that psnp->long_ptr (and [0].long_ptr) changed @@ -1170,8 +1173,8 @@ mi_gdb_test "-var-update *" \ # Step over "snp1.long_ptr = &x3;" -set line 259 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6" # Test: c_variable-5.51 # Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed @@ -1187,8 +1190,8 @@ clear_xfail *-*-* # # Step over "snp2.long_ptr = &z3;" -set line 260 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7" # Test: c_variable-5.52 # Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed diff --git a/gdb/testsuite/gdb.mi/mi2-var-cmd.exp b/gdb/testsuite/gdb.mi/mi2-var-cmd.exp index f9311f00cc..bbecda8d3c 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-cmd.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. # # 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 @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # Test essential Machine interface (MI) operations # # Verify that, using the MI, we can create, update, delete variables. @@ -168,7 +165,8 @@ mi_gdb_test "-var-update *" \ "update all vars" # Step over "linteger = 1234;" -mi_step_to "do_locals_tests" "" "var-cmd.c" "107" "step at do_locals_test" +set line_dlt_linteger [gdb_get_line_number "lpinteger = &linteger;"] +mi_step_to "do_locals_tests" "" "var-cmd.c" $line_dlt_linteger "step at do_locals_test" # Test: c_variable-2.2 # Desc: check whether only linteger changed values @@ -177,7 +175,7 @@ mi_gdb_test "-var-update *" \ "update all vars: linteger changed" # Step over "lpinteger = &linteger;" -mi_step_to "do_locals_tests" "" "var-cmd.c" 108 "step at do_locals_tests (2)" +mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 1] "step at do_locals_tests (2)" # Test: c_variable-2.3 # Desc: check whether only lpinteger changed @@ -186,7 +184,7 @@ mi_gdb_test "-var-update *" \ "update all vars: lpinteger changed" # Step over "lcharacter = 'a';" -mi_step_to "do_locals_tests" "" "var-cmd.c" "109" "step at do_locals_tests (3)" +mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 2] "step at do_locals_tests (3)" # Test: c_variable-2.4 # Desc: check whether only lcharacter changed @@ -195,7 +193,7 @@ mi_gdb_test "-var-update *" \ "update all vars: lcharacter changed" # Step over "lpcharacter = &lcharacter;" -mi_step_to "do_locals_tests" "" "var-cmd.c" "110" "step at do_locals_tests (4)" +mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 3] "step at do_locals_tests (4)" # Test: c_variable-2.5 # Desc: check whether only lpcharacter changed @@ -216,7 +214,7 @@ mi_gdb_test "-var-update *" \ # lsimple.character = 'a'; mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" "119" "" "step at do_locals_tests (5)" + "var-cmd.c" [expr $line_dlt_linteger + 12] "" "step at do_locals_tests (5)" # Test: c_variable-2.6 # Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer, @@ -231,8 +229,10 @@ mi_gdb_test "-var-update *" \ # lpsimple = &lsimple; # func = nothing; +set line_dlt_4321 [gdb_get_line_number "linteger = 4321;"] + mi_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" "125" "" "step at do_locals_tests (6)" + "var-cmd.c" $line_dlt_4321 "" "step at do_locals_tests (6)" # Test: c_variable-2.7 # Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed @@ -251,7 +251,7 @@ mi_gdb_test "-var-update *" \ # lsimple.character = 'b'; mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" "133" "" "step at do_locals_tests (7)" + "var-cmd.c" [expr $line_dlt_4321 + 8] "" "step at do_locals_tests (7)" # Test: c_variable-2.8 # Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer, @@ -384,12 +384,14 @@ mi_gdb_test "-var-assign lsimple.integer 333" \ # End of assign tests ##### +set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"] + mi_gdb_test "-break-insert subroutine1" \ - "\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"146\",times=\"0\"\}" \ + "\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"$line_subroutine1_body\",times=\"0\"\}" \ "break-insert subroutine1" mi_continue_to "2" "subroutine1" \ "\{name=\"i\",value=\"4321\"\},\{name=\"l\",value=\"$hex\"\}" \ - "var-cmd.c" "146" "continue to subroutine1" + "var-cmd.c" $line_subroutine1_body "continue to subroutine1" # Test: c_variable-2.10 # Desc: create variable for locals i,l in subroutine1 @@ -408,7 +410,7 @@ mi_gdb_test "-var-create linteger * linteger" \ "create linteger" mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" "147" "step at subroutine1" + "var-cmd.c" [expr $line_subroutine1_body + 1] "step at subroutine1" # Test: c_variable-2.12 # Desc: change global_simple.integer @@ -424,7 +426,7 @@ mi_gdb_test "-var-update *" \ clear_xfail *-*-* mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" "148" "step at subroutine1 (2)" + "var-cmd.c" [expr $line_subroutine1_body + 2] "step at subroutine1 (2)" # Test: c_variable-2.13 # Desc: change subroutine1 local i @@ -433,7 +435,7 @@ mi_gdb_test "-var-update *" \ "update all vars: i changed" mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" "149" "step at subroutine1 (3)" + "var-cmd.c" [expr $line_subroutine1_body + 3] "step at subroutine1 (3)" # Test: c_variable-2.14 # Desc: change do_locals_tests local llong @@ -441,7 +443,9 @@ mi_gdb_test "-var-update *" \ "\\^done,changelist=\\\[\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \ "update all vars: llong changed" -mi_next_to "do_locals_tests" "" "var-cmd.c" "136" "next out of subroutine1" +set line_dlt_call_subroutine1 [gdb_get_line_number "subroutine1 (linteger, &llong);"] +mi_next_to "do_locals_tests" "" "var-cmd.c" \ + [expr $line_dlt_call_subroutine1 + 1] "next out of subroutine1" # Test: c_variable-2.15 # Desc: check for out of scope subroutine1 locals diff --git a/gdb/testsuite/gdb.mi/mi2-var-display.exp b/gdb/testsuite/gdb.mi/mi2-var-display.exp index 9819821beb..090614c2ef 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-display.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-display.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. # # 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 @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # Test essential Machine interface (MI) operations # # Verify that, using the MI, we can create, update, delete variables. @@ -42,14 +39,16 @@ mi_delete_breakpoints mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -mi_gdb_test "200-break-insert 260" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"260\",times=\"0\"\}" \ +set line_dct_close_brace [expr [gdb_get_line_number "snp2.long_ptr = &z3;"] + 1] + +mi_gdb_test "200-break-insert $line_dct_close_brace" \ + "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"$line_dct_close_brace\",times=\"0\"\}" \ "break-insert operation" mi_run_cmd # The running part has been checked already by mi_run_cmd gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"260\"\}\r\n$mi_gdb_prompt$" { + -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"$line_dct_close_brace\"\}\r\n$mi_gdb_prompt$" { pass "run to do_children_tests" } -re ".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"} @@ -324,13 +323,16 @@ mi_gdb_test "-var-delete weird" \ ##### ##### # Stop in "do_special_tests" + +set line_dst_a_1 [gdb_get_line_number "a = 1;"] + mi_gdb_test "200-break-insert do_special_tests" \ - "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"282\",times=\"0\"\}" \ + "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"$line_dst_a_1\",times=\"0\"\}" \ "break-insert operation" send_gdb "-exec-continue\n" gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_special_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"282\"\}\r\n$mi_gdb_prompt$" { + -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_special_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"$line_dst_a_1\"\}\r\n$mi_gdb_prompt$" { pass "continue to do_special_tests" } timeout { @@ -583,15 +585,17 @@ gdb_expect { timeout { fail "print FP register (timeout)"} } +set line_incr_a_b_a [gdb_get_line_number "b = a;"] + mi_gdb_test "200-break-insert incr_a" \ - "200\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"incr_a\",file=\".*var-cmd.c\",line=\"85\",times=\"0\"\}" \ + "200\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"incr_a\",file=\".*var-cmd.c\",line=\"$line_incr_a_b_a\",times=\"0\"\}" \ "break-insert operation" send_gdb "-exec-continue\n" gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"2\.*\"\}\\\],file=\".*var-cmd.c\",line=\"85\"\}\r\n$mi_gdb_prompt$" { + -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"2\.*\"\}\\\],file=\".*var-cmd.c\",line=\"$line_incr_a_b_a\"\}\r\n$mi_gdb_prompt$" { pass "continue to incr_a" } - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"\.*\"\}\\\],file=\".*var-cmd.c\",line=\"8\[345\]\"\}\r\n$mi_gdb_prompt$" { + -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"\.*\"\}\\\],file=\".*var-cmd.c\",line=\"([expr $line_incr_a_b_a - 2]|[expr $line_incr_a_b_a - 1]|$line_incr_a_b_a)\"\}\r\n$mi_gdb_prompt$" { fail "continue to incr_a (compiler debug info incorrect)" } -re "\\^running\r\n${mi_gdb_prompt}.*\r\n$mi_gdb_prompt$" { -- 2.34.1