From 6d3d6e4ba779dc08b134cd1a09b055dbd88dbf8a Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 21 Jul 2020 16:22:34 +0200 Subject: [PATCH] [gdb/testsuite] Fix gdb.reverse/solib-{precsave,reverse}.exp with gcc-8 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. gdb/testsuite/ChangeLog: 2020-07-21 Tom de Vries * gdb.reverse/solib-precsave.exp: Handle additional "recommended breakpoint locations". * gdb.reverse/solib-reverse.exp: Same. --- gdb/testsuite/ChangeLog | 6 ++++ gdb/testsuite/gdb.reverse/solib-precsave.exp | 30 ++++++++++++++++++-- gdb/testsuite/gdb.reverse/solib-reverse.exp | 30 ++++++++++++++++++-- 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index b67ad738518..804df0264b5 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2020-07-21 Tom de Vries + + * gdb.reverse/solib-precsave.exp: Handle additional "recommended + breakpoint locations". + * gdb.reverse/solib-reverse.exp: Same. + 2020-07-21 Tom de Vries * gdb.reverse/step-reverse.c (callee): Merge statements. diff --git a/gdb/testsuite/gdb.reverse/solib-precsave.exp b/gdb/testsuite/gdb.reverse/solib-precsave.exp index cd440078167..8d57e7951e2 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 8ff62e23405..843aedc722a 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 + } +} -- 2.30.2