* gdb.base/gdb1555.exp: Make expected output immune to formatting
authorJoel Brobecker <brobecker@gnat.com>
Sat, 18 Aug 2007 01:21:42 +0000 (01:21 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Sat, 18 Aug 2007 01:21:42 +0000 (01:21 +0000)
        changes inside gdb1555.c.
        * gdb.base/pending.exp: Likewise.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/gdb1555.exp
gdb/testsuite/gdb.base/pending.exp

index d4c3bdd..1106d0d 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-17  Joel Brobecker  <brobecker@adacore.com>
+
+       * gdb.base/gdb1555.exp: Make expected output immune to formatting
+       changes inside gdb1555.c.
+       * gdb.base/pending.exp: Likewise.
+
 2007-08-13  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * config/default.exp: New file.
index ea7d4df..7813bbf 100644 (file)
@@ -66,7 +66,7 @@ if ![runto_main] then {
 set name "Step into shared lib function"
 gdb_test_multiple "s" $name \
 {
-    -re "hithere2 \\(\\) at.*${libfile}.c:25\r\n25.*a = 21;.*$gdb_prompt $"  {
+    -re "hithere2 \\(\\) at.*${libfile}.c:\[0-9\]+\r\n\[0-9\]+.*a = 21;.*$gdb_prompt $"  {
        pass $name
     }
     -re "0x\[0-9a-f\]+ in .* \\(\\) from /lib/ld.so.1.*$gdb_prompt $" { 
@@ -78,7 +78,7 @@ gdb_test_multiple "s" $name \
 set name "Next while in a shared lib function"
 gdb_test_multiple "n" $name \
 {
-    -re "26.*return a;.*$gdb_prompt $" {
+    -re "\[0-9\]+.*return a;.*$gdb_prompt $" {
        pass $name
     }
     -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\nProgram exited normally.*$gdb_prompt $" { 
index 2c98f6e..c2363ab 100644 (file)
@@ -146,9 +146,10 @@ gdb_test "info break" \
 # Try a pending break for a line in a source file with a condition
 #
 
-gdb_test_multiple "break pendshr.c:26 if x > 3" "Set pending breakpoint 2" {
+set bp2_loc [gdb_get_line_number "y = x + 4" ${libfile}.c]
+gdb_test_multiple "break pendshr.c:$bp2_loc if x > 3" "Set pending breakpoint 2" {
      -re ".*Make breakpoint pending.*y or \\\[n\\\]. $" {
-           gdb_test "y" "Breakpoint.*pendshr.c:26.*pending." \
+           gdb_test "y" "Breakpoint.*pendshr.c:$bp2_loc.*pending." \
                "Set pending breakpoint 2"
      }
 }
@@ -159,7 +160,7 @@ gdb_test "info break" \
 \[\t \]+stop only if k == 1.*
 \[\t \]+print k.*
 \[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:$mainline.*
-\[0-9\]+\[\t \]+breakpoint     keep y.*PENDING.*pendshr.c:26 if x > 3.*" \
+\[0-9\]+\[\t \]+breakpoint     keep y.*PENDING.*pendshr.c:$bp2_loc if x > 3.*" \
 "multiple pending breakpoints"
 
 
@@ -167,9 +168,10 @@ gdb_test "info break" \
 # Try a pending break for a line in a source file with ignore count:
 #
 
-gdb_test_multiple "break pendshr.c:27" "Set pending breakpoint 3" {
+set bp3_loc [gdb_get_line_number "printf" ${libfile}.c]
+gdb_test_multiple "break pendshr.c:$bp3_loc" "Set pending breakpoint 3" {
      -re ".*Make breakpoint pending.*y or \\\[n\\\]. $" {
-           gdb_test "y" "Breakpoint.*pendshr.c:27.*pending." \
+           gdb_test "y" "Breakpoint.*pendshr.c:$bp3_loc.*pending." \
                "Set pending breakpoint 3"
      }
 }
@@ -183,8 +185,8 @@ gdb_test "info break" \
 \[\t \]+stop only if k == 1.*
 \[\t \]+print k.*
 \[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:$mainline.*
-\[0-9\]+\[\t \]+breakpoint     keep y.*PENDING.*pendshr.c:26 if x > 3.*
-\[0-9\]+\[\t \]+breakpoint     keep y.*PENDING.*pendshr.c:27.*ignore next 2 hits.*" \
+\[0-9\]+\[\t \]+breakpoint     keep y.*PENDING.*pendshr.c:$bp2_loc if x > 3.*
+\[0-9\]+\[\t \]+breakpoint     keep y.*PENDING.*pendshr.c:$bp3_loc.*ignore next 2 hits.*" \
 "multiple pending breakpoints 2"
 
 #
@@ -194,7 +196,7 @@ gdb_test "info break" \
 gdb_run_cmd
 gdb_test "" \
 "Breakpoint.*at.*
-Pending breakpoint \"pendshr.c:26 if x > 3\" resolved.*
+Pending breakpoint \"pendshr.c:$bp2_loc if x > 3\" resolved.*
 Breakpoint.*, main.*$mainline.*" \
 "running to main"
 
@@ -212,11 +214,11 @@ Pending breakpoint \"pendfunc1.* resolved.*" \
 #
 
 gdb_test "continue" \
-".*Breakpoint.*pendfunc1.*at.*pendshr.c:26.*4;" \
+".*Breakpoint.*pendfunc1.*at.*pendshr.c:$bp2_loc.*4;" \
 "continue to resolved breakpoint 2"
 
 gdb_test "continue" \
-".*Breakpoint.*pendfunc1.*at.*pendshr.c:26.*
+".*Breakpoint.*pendfunc1.*at.*pendshr.c:$bp2_loc.*
 \[$\]1 = 1." \
 "continue to resolved breakpoint 1"
 
@@ -230,7 +232,7 @@ gdb_test "disable 7" "" "Disable other breakpoints"
 gdb_test "disable 5" "" "Disable other breakpoints"
 
 gdb_test "continue" \
-       {.*Breakpoint.*pendfunc1.*\(x=3\) at.*pendshr.c:27.*printf.*;} \
+        ".*Breakpoint.*pendfunc1.*\\\(x=3\\\) at.*pendshr.c:$bp3_loc.*printf.*;" \
 "continue to resolved breakpoint 3"
 
 delete_breakpoints