aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.mi/mi-simplerun.exp')
-rw-r--r--gdb/testsuite/gdb.mi/mi-simplerun.exp52
1 files changed, 34 insertions, 18 deletions
diff --git a/gdb/testsuite/gdb.mi/mi-simplerun.exp b/gdb/testsuite/gdb.mi/mi-simplerun.exp
index 15a1fca2d45..9e9385e9571 100644
--- a/gdb/testsuite/gdb.mi/mi-simplerun.exp
+++ b/gdb/testsuite/gdb.mi/mi-simplerun.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
#
@@ -53,6 +50,13 @@ proc test_breakpoints_creation_and_listing {} {
global srcfile
global hex
+ set line_callee4_head [gdb_get_line_number "callee4 ("]
+ set line_callee3_head [gdb_get_line_number "callee3 ("]
+ set line_callee2_head [gdb_get_line_number "callee2 ("]
+ set line_callee2_body [expr $line_callee2_head + 2]
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Insert some breakpoints and list them
# Also, disable some so they do not interfere with other tests
# Tests:
@@ -62,23 +66,23 @@ proc test_breakpoints_creation_and_listing {} {
# -break-info
mi_gdb_test "200-break-insert main" \
- "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
+ "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
"break-insert operation"
mi_gdb_test "201-break-insert basics.c:callee2" \
- "201\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"22\",times=\"0\"\}" \
+ "201\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"$line_callee2_body\",times=\"0\"\}" \
"insert breakpoint at basics.c:callee2"
- mi_gdb_test "202-break-insert basics.c:15" \
- "202\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"15\",times=\"0\"\}" \
- "insert breakpoint at basics.c:15 (callee3)"
+ mi_gdb_test "202-break-insert basics.c:$line_callee3_head" \
+ "202\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"$line_callee3_head\",times=\"0\"\}" \
+ "insert breakpoint at basics.c:\$line_callee3_head"
- mi_gdb_test "203-break-insert \"\\\"${srcfile}\\\":6\"" \
- "203\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"6\",times=\"0\"\}" \
- "insert breakpoint at \"<fullfilename>\":6 (callee4)"
+ mi_gdb_test "203-break-insert \"\\\"${srcfile}\\\":$line_callee4_head\"" \
+ "203\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_head\",times=\"0\"\}" \
+ "insert breakpoint at \"<fullfilename>\":\$line_callee4_head"
mi_gdb_test "204-break-list" \
- "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\]\}" \
+ "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
"list of breakpoints"
mi_gdb_test "205-break-disable 2 3 4" \
@@ -94,6 +98,9 @@ proc test_running_the_program {} {
global mi_gdb_prompt
global hex
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Run the program without args, then specify srgs and rerun the program
# Tests:
# -exec-run
@@ -104,7 +111,7 @@ proc test_running_the_program {} {
# The following is equivalent to a send_gdb "000-exec-run\n"
mi_run_cmd
gdb_expect {
- -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
+ -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_body\"\}\r\n$mi_gdb_prompt$" {
pass "run to main"
}
-re ".*$mi_gdb_prompt$" {
@@ -120,6 +127,15 @@ proc test_controlled_execution {} {
global mi_gdb_prompt
global hex
+ set line_callee4_head [gdb_get_line_number "callee4 ("]
+ set line_callee4_body [expr $line_callee4_head + 2]
+ set line_callee3_head [gdb_get_line_number "callee3 ("]
+ set line_callee3_close_brace [expr $line_callee3_head + 3]
+ set line_callee1_head [gdb_get_line_number "callee1 ("]
+ set line_callee1_body [expr $line_callee1_head + 2]
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Continue execution until a breakpoint is reached, step into calls, verifying
# if the arguments are correctly shown, continue to the end of a called
# function, step over a call (next).
@@ -129,24 +145,24 @@ proc test_controlled_execution {} {
# -exec-step
# -exec-finish
- mi_next_to "main" "" "basics.c" "33" "next at main"
+ mi_next_to "main" "" "basics.c" [expr $line_main_body + 1] "next at main"
# FIXME: A string argument is not printed right; should be fixed and
# we should look for the right thing here.
# NOTE: The ``\\\\\"'' is for \".
mi_step_to "callee1" \
"\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}" \
- "basics.c" "27" "step at main"
+ "basics.c" "$line_callee1_body" "step at main"
# FIXME: A string argument is not printed right; should be fixed and
# we should look for the right thing here.
mi_execute_to "exec-step 3" "end-stepping-range" "callee4" "" \
- "basics.c" "8" "" "step to callee4"
+ "basics.c" $line_callee4_body "" "step to callee4"
# FIXME: A string argument is not printed right; should be fixed and
# we should look for the right thing here.
# NOTE: The ``.'' is part of ``gdb-result-var="$1"''
- mi_finish_to "callee3" ".*" "basics.c" "18" ".1" "0" "exec-finish"
+ mi_finish_to "callee3" ".*" "basics.c" $line_callee3_close_brace ".1" "0" "exec-finish"
}
proc test_controlling_breakpoints {} {