+2004-08-17 Michael Chastain <mec.gnu@mindspring.com>
+
+ * 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 <kettenis@gnu.org>
* gdb.base/unload.c (main): Make local variable msg const.
-# 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
# 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.
"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
"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
"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
"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
"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)
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)
# 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.
# 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"
"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
# 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
"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
"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
"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
"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
# 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
"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
# 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
"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
"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
# 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
# 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
# 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
#
# 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
-# 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
# 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.
"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
"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
"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
"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
# 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,
# 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
# 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,
# 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
"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
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
"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
"\\^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
-# 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
# 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.
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)"}
##### #####
# 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 {
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$" {
-# 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
# 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.
"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
"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
"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
"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
"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)
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)
-# 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
# 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.
# 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"
"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
# 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
"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
"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
"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
"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
# 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
# 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
# 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
"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
"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
# 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
# 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
# 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
#
# 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
-# 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
# 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.
"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
"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
"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
"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
# 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,
# 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
# 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,
# 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
"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
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
"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
"\\^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
-# 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
# 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.
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)"}
##### #####
# 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 {
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$" {