[committed][gdb/testsuite] Fix gdb.reverse/solib-{precsave,reverse}.exp with gcc-8

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[committed][gdb/testsuite] Fix gdb.reverse/solib-{precsave,reverse}.exp with gcc-8

Tom de Vries
Hi,

With gcc-8, we have the following FAILs, which are not there for gcc-7:
...
FAIL: gdb.reverse/solib-precsave.exp: reverse-step into solib function one
FAIL: gdb.reverse/solib-precsave.exp: reverse-step within solib function one
FAIL: gdb.reverse/solib-precsave.exp: reverse-step back to main one
FAIL: gdb.reverse/solib-precsave.exp: reverse-step into solib function two
FAIL: gdb.reverse/solib-precsave.exp: reverse-step within solib function two
FAIL: gdb.reverse/solib-precsave.exp: reverse-step back to main two
FAIL: gdb.reverse/solib-precsave.exp: run until end part two
FAIL: gdb.reverse/solib-precsave.exp: reverse-next over solib function one
FAIL: gdb.reverse/solib-reverse.exp: reverse-step into solib function one
FAIL: gdb.reverse/solib-reverse.exp: reverse-step within solib function one
FAIL: gdb.reverse/solib-reverse.exp: reverse-step back to main one
FAIL: gdb.reverse/solib-reverse.exp: reverse-step into solib function two
FAIL: gdb.reverse/solib-reverse.exp: reverse-step within solib function two
FAIL: gdb.reverse/solib-reverse.exp: reverse-step back to main two
FAIL: gdb.reverse/solib-reverse.exp: run until end part two
FAIL: gdb.reverse/solib-reverse.exp: reverse-next over solib function one
...

Looking at the first FAIL for gdb.reverse/solib-precsave.exp, we have:
...
 (gdb) PASS: reverse-next first shr1
 reverse-next^M
 40        b[0] = 6;   b[1] = 9;     /* generic statement, end part two */^M
 (gdb) PASS: reverse-next generic
 reverse-step^M
-shr2 (x=17) at gdb.reverse/shr2.c:23^M
-23      }^M
-(gdb) PASS: reverse-step into solib function one
+38        b[1] = shr2(17);              /* middle part two */^M
+(gdb) FAIL: reverse-step into solib function one
...

There's a difference in line number info for line 38, where for gcc-7 we have:
...
Line number    Starting address    View    Stmt
         38            0x4005c6               x
...
and for gcc-8:
...
         38            0x4005c1               x
         38            0x4005cb               x
...
which explains why we don't step directly into "solib function one".

Fix this by recognizing the extra "recommended breakpoint location" and
issuing an additional reverse-next/step.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix gdb.reverse/solib-{precsave,reverse}.exp with gcc-8

gdb/testsuite/ChangeLog:

2020-07-21  Tom de Vries  <[hidden email]>

        * gdb.reverse/solib-precsave.exp: Handle additional "recommended
        breakpoint locations".
        * gdb.reverse/solib-reverse.exp: Same.

---
 gdb/testsuite/gdb.reverse/solib-precsave.exp | 30 +++++++++++++++++++++++++---
 gdb/testsuite/gdb.reverse/solib-reverse.exp  | 30 +++++++++++++++++++++++++---
 2 files changed, 54 insertions(+), 6 deletions(-)

diff --git a/gdb/testsuite/gdb.reverse/solib-precsave.exp b/gdb/testsuite/gdb.reverse/solib-precsave.exp
index cd44007816..8d57e7951e 100644
--- a/gdb/testsuite/gdb.reverse/solib-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/solib-precsave.exp
@@ -148,11 +148,27 @@ gdb_test "reverse-next" " generic statement.*" "reverse-next generic"
 # Test reverse-step into debuggable solib function
 #
 
-gdb_test "reverse-step" "${lib2src}.*" "reverse-step into solib function one"
+gdb_test_multiple "reverse-step" "reverse-step into solib function one" {
+    -re -wrap "middle part two.*" {
+ send_gdb "reverse-step\n"
+ exp_continue
+    }
+    -re -wrap "${lib2src}.*" {
+ pass $gdb_test_name
+    }
+}
 gdb_test "reverse-step" "return 2.x.*" "reverse-step within solib function one"
 gdb_test "reverse-step" " middle part two.*" "reverse-step back to main one"
 
-gdb_test "reverse-step" "${lib2src}.*" "reverse-step into solib function two"
+gdb_test_multiple "reverse-step" "reverse-step into solib function two" {
+    -re -wrap "begin part two.*" {
+ send_gdb "reverse-step\n"
+ exp_continue
+    }
+    -re -wrap "${lib2src}.*" {
+ pass $gdb_test_name
+    }
+}
 gdb_test "reverse-step" "return 2.x.*" "reverse-step within solib function two"
 gdb_test "reverse-step" " begin part two.*" "reverse-step back to main two"
 
@@ -163,4 +179,12 @@ gdb_test "reverse-step" " begin part two.*" "reverse-step back to main two"
 gdb_test "until $end_part_two" " end part two.*" "run until end part two"
 
 gdb_test "reverse-next" " middle part two.*" "reverse-next over solib function one"
-gdb_test "reverse-next" " begin part two.*" "reverse-next over solib function two"
+gdb_test_multiple "reverse-next" "reverse-next over solib function two" {
+    -re -wrap "middle part two.*" {
+ send_gdb "reverse-next\n"
+ exp_continue
+    }
+    -re -wrap " begin part two.*" {
+ pass $gdb_test_name
+    }
+}
diff --git a/gdb/testsuite/gdb.reverse/solib-reverse.exp b/gdb/testsuite/gdb.reverse/solib-reverse.exp
index 8ff62e2340..843aedc722 100644
--- a/gdb/testsuite/gdb.reverse/solib-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/solib-reverse.exp
@@ -122,11 +122,27 @@ gdb_test "reverse-next" " generic statement.*" "reverse-next generic"
 # Test reverse-step into debuggable solib function
 #
 
-gdb_test "reverse-step" "${lib2src}.*" "reverse-step into solib function one"
+gdb_test_multiple "reverse-step" "reverse-step into solib function one" {
+    -re -wrap "middle part two.*" {
+ send_gdb "reverse-step\n"
+ exp_continue
+    }
+    -re -wrap "${lib2src}.*" {
+ pass $gdb_test_name
+    }
+}
 gdb_test "reverse-step" "return 2.x.*" "reverse-step within solib function one"
 gdb_test "reverse-step" " middle part two.*" "reverse-step back to main one"
 
-gdb_test "reverse-step" "${lib2src}.*" "reverse-step into solib function two"
+gdb_test_multiple "reverse-step" "reverse-step into solib function two" {
+    -re -wrap "begin part two.*" {
+ send_gdb "reverse-step\n"
+ exp_continue
+    }
+    -re -wrap "${lib2src}.*" {
+ pass $gdb_test_name
+    }
+}
 gdb_test "reverse-step" "return 2.x.*" "reverse-step within solib function two"
 gdb_test "reverse-step" " begin part two.*" "reverse-step back to main two"
 
@@ -137,4 +153,12 @@ gdb_test "reverse-step" " begin part two.*" "reverse-step back to main two"
 gdb_test "until $end_part_two" " end part two.*" "run until end part two"
 
 gdb_test "reverse-next" " middle part two.*" "reverse-next over solib function one"
-gdb_test "reverse-next" " begin part two.*" "reverse-next over solib function two"
+gdb_test_multiple "reverse-next" "reverse-next over solib function two" {
+    -re -wrap "middle part two.*" {
+ send_gdb "reverse-next\n"
+ exp_continue
+    }
+    -re -wrap " begin part two.*" {
+ pass $gdb_test_name
+    }
+}