Index: gdb/testsuite/gdb.base/annota3.exp |
diff --git a/gdb/testsuite/gdb.base/annota3.exp b/gdb/testsuite/gdb.base/annota3.exp |
index 915facaccfc343e7dea4e910303dfabaca155cdd..246ff0b01f73a208dec29f430bcae162eadf3a7c 100644 |
--- a/gdb/testsuite/gdb.base/annota3.exp |
+++ b/gdb/testsuite/gdb.base/annota3.exp |
@@ -15,10 +15,6 @@ |
# This file was written by Elena Zannoni (ezannoni@cygnus.com) |
-if $tracelevel then { |
- strace $tracelevel |
-} |
- |
# are we on a target board? If so, don't run these tests. |
# note: this is necessary because we cannot use runto_main (which would |
@@ -49,15 +45,6 @@ gdb_start |
gdb_reinitialize_dir $srcdir/$subdir |
gdb_load ${binfile} |
-if [target_info exists gdb_stub] { |
- gdb_step_for_stub; |
-} |
- |
-# |
-# the line at which break main will put the breakpoint |
-# |
-set main_line 32 |
- |
# The commands we test here produce many lines of output; disable "press |
# <return> to continue" prompts. |
gdb_test_no_output "set height 0" |
@@ -65,8 +52,11 @@ gdb_test_no_output "set height 0" |
# |
# break at main |
# |
+ |
+set main_line [gdb_get_line_number "break main"] |
+ |
gdb_test "break main" \ |
- "Breakpoint.*at.* file .*$srcfile, line.*" \ |
+ "Breakpoint.*at.* file .*$srcfile, line $main_line\\." \ |
"breakpoint main" |
@@ -114,11 +104,10 @@ gdb_test_multiple "end" "end if construct" { |
# info break: |
# |
send_gdb "info break\n" |
-gdb_expect_list "breakpoint info" "$gdb_prompt$" { |
+gdb_expect_list "breakpoint info" "$gdb_prompt$" [concat { |
"\r\n\032\032post-prompt\r\n" |
- "Num Type Disp Enb Address +What\r\n" |
- "1 breakpoint keep y 0x\[0-9a-zA-Z\]+ +in main at .*annota3.c:32\r\n" |
-} |
+ "Num Type Disp Enb Address +What\r\n" } [list \ |
+ "1 breakpoint keep y 0x\[0-9a-zA-Z\]+ +in main at .*annota3.c:$main_line\r\n"]] |
# |
@@ -126,18 +115,18 @@ gdb_expect_list "breakpoint info" "$gdb_prompt$" { |
# |
#exp_internal 1 |
send_gdb "run\n" |
-gdb_expect_list "run until main breakpoint" "$gdb_prompt$" { |
+gdb_expect_list "run until main breakpoint" "$gdb_prompt$" [concat { |
"\r\n\032\032post-prompt\r\n" |
"Starting program: .*annota3(|\.exe) \r\n" |
"\r\n\032\032starting\r\n" |
"\r\n\032\032breakpoint 1\r\n" |
"\r\n" |
"Breakpoint 1, " |
- "\r\n\032\032frame-begin 0 0x\[0-9a-z\]+\r\n" |
- "main \\(\\) at .*annota3.c:32\r\n" |
- "\r\n\032\032source.*annota3.c:32:.*:beg:0x\[0-9a-z\]+\r\n" |
+ "\r\n\032\032frame-begin 0 0x\[0-9a-z\]+\r\n" } [list \ |
+ "main \\(\\) at .*annota3.c:$main_line\r\n"] [list \ |
+ "\r\n\032\032source.*annota3.c:$main_line:.*:beg:0x\[0-9a-z\]+\r\n"] { |
"\r\n\032\032stopped\r\n" |
-} |
+}] |
#exp_internal 0 |
#exit 0 |
@@ -278,10 +267,9 @@ gdb_expect_list "delete bp 3" "$gdb_prompt$" { |
# to test the annotate output for the display command. |
# |
send_gdb "break main\n" |
-gdb_expect_list "break at 28" "$gdb_prompt$" { |
- "\r\n\032\032post-prompt\r\n" |
- "Breakpoint 4 at 0x\[0-9a-z\]+: file .*annota3.c, line 32.\r\n" |
-} |
+gdb_expect_list "break at main" "$gdb_prompt$" [concat { |
+ "\r\n\032\032post-prompt\r\n" } [list \ |
+ "Breakpoint 4 at 0x\[0-9a-z\]+: file .*annota3.c, line $main_line.\r\n"]] |
# |
# display the value |
@@ -317,11 +305,13 @@ gdb_expect { |
# NOTE: breakpoints-invalid annotations have been removed from |
# level 3 but keep these tests for continuity and comparison |
# with annota1.exp. |
-send_gdb "break 46\n" |
-gdb_expect_list "break at 46" "$gdb_prompt$" { |
- "\r\n\032\032post-prompt\r\n" |
- "Breakpoint 5 at 0x\[0-9a-z\]+: file .*annota3.c, line 46.\r\n" |
-} |
+ |
+set value_inc_line [gdb_get_line_number "increment value"] |
+ |
+send_gdb "break $value_inc_line\n" |
+gdb_expect_list "break at value++" "$gdb_prompt$" [concat { |
+ "\r\n\032\032post-prompt\r\n" } [list \ |
+ "Breakpoint 5 at 0x\[0-9a-z\]+: file .*annota3.c, line $value_inc_line.\r\n"]] |
send_gdb "ignore 5 4\n" |
gdb_expect_list "ignore 5 4" "$gdb_prompt$" { |
@@ -331,17 +321,17 @@ gdb_expect_list "ignore 5 4" "$gdb_prompt$" { |
} |
send_gdb "continue\n" |
-gdb_expect_list "annotate ignore count change" "$gdb_prompt$" { |
+gdb_expect_list "annotate ignore count change" "$gdb_prompt$" [concat { |
"\r\n\032\032post-prompt\r\n" |
"\r\n\032\032breakpoint 5\r\n" |
"\r\n" |
"Breakpoint 5, " |
- "\r\n\032\032frame-begin 0 0x\[0-9a-z\]+\r\n" |
- "main \\(\\) at .*annota3.c:46\r\n" |
- "\r\n\032\032source .*annota3.c:46:\[0-9\]+:beg:0x\[0-9a-z\]+\r\n" |
+ "\r\n\032\032frame-begin 0 0x\[0-9a-z\]+\r\n" } [list \ |
+ "main \\(\\) at .*annota3.c:$value_inc_line\r\n"] [list \ |
+ "\r\n\032\032source .*annota3.c:$value_inc_line:\[0-9\]+:beg:0x\[0-9a-z\]+\r\n"] { |
"1: value = 11\r\n" |
"\r\n\032\032stopped\r\n" |
-} |
+}] |
# check that ignore command is working, or the above can provide |
# misleading assurance ... |
@@ -355,14 +345,16 @@ gdb_expect_list "next to exit loop" "$gdb_prompt$" { |
"\r\n\032\032stopped\r\n" |
} |
+set after_loop_line [gdb_get_line_number "after loop"] |
+ |
send_gdb "next\n" |
-gdb_expect_list "breakpoint ignore count" "$gdb_prompt$" { |
+gdb_expect_list "breakpoint ignore count" "$gdb_prompt$" [concat { |
"\r\n\032\032post-prompt\r\n" |
- "\r\n\032\032starting\r\n" |
- "\r\n\032\032source.*annota3.c:49:\[0-9\]+:beg:0x\[0-9a-z\]+\r\n" |
+ "\r\n\032\032starting\r\n" } [list \ |
+ "\r\n\032\032source.*annota3.c:$after_loop_line:\[0-9\]+:beg:0x\[0-9a-z\]+\r\n"] { |
"1: value = 12\r\n" |
"\r\n\032\032stopped\r\n" |
-} |
+}] |
# Get the inferior's PID for later. |