aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/step-and-next-inline.exp
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2022-12-30 14:00:39 +0100
committerTom de Vries <tdevries@suse.de>2022-12-30 14:00:39 +0100
commitb1b0f69cb4a2ccd421419f9703edfcc5c3032dc0 (patch)
treeffe3eab19ebf929ed477515fd7339f0db5959fc0 /gdb/testsuite/gdb.cp/step-and-next-inline.exp
parentd8f52a9a9ccbf7411cf4ae487d2756826f5d0bd5 (diff)
downloadgdb-b1b0f69cb4a2ccd421419f9703edfcc5c3032dc0.zip
gdb-b1b0f69cb4a2ccd421419f9703edfcc5c3032dc0.tar.gz
gdb-b1b0f69cb4a2ccd421419f9703edfcc5c3032dc0.tar.bz2
[gdb/testsuite] Fix gdb.cp/step-and-next-inline.exp with -fcf-protection
On Ubuntu 22.04.1 x86_64, I run into: ... (gdb) PASS: gdb.cp/step-and-next-inline.exp: no_header: not in inline 1 next^M 51 if (t != NULL^M (gdb) FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1 ... This is due to -fcf-protection, which adds the endbr64 at the start of get_alias_set: ... 0000000000001180 <_Z13get_alias_setP4tree>: 1180: f3 0f 1e fa endbr64 1184: 48 85 ff test %rdi,%rdi ... so the extra insn gets an is-stmt line number entry: ... INDEX LINE ADDRESS IS-STMT PROLOGUE-END ... 11 50 0x0000000000001180 Y 12 50 0x0000000000001180 13 51 0x0000000000001184 Y 14 54 0x0000000000001184 ... and when stepping into get_alias_set we step to line 50: ... (gdb) PASS: gdb.cp/step-and-next-inline.exp: no_header: in main step^M get_alias_set (t=t@entry=0x555555558018 <xx>) at step-and-next-inline.cc:50^M 50 {^M ... In contrast, with -fcf-protection=none, we get: ... 0000000000001170 <_Z13get_alias_setP4tree>: 1170: 48 85 ff test %rdi,%rdi ... and: ... INDEX LINE ADDRESS IS-STMT PROLOGUE-END ... 11 50 0x0000000000001170 Y 12 51 0x0000000000001170 Y 13 54 0x0000000000001170 ... so when stepping into get_alias_set we step to line 51: ... (gdb) PASS: gdb.cp/step-and-next-inline.exp: no_header: in main step^M get_alias_set (t=t@entry=0x555555558018 <xx>) at step-and-next-inline.cc:51^M 51 if (t != NULL^M ... Fix this by rewriting the gdb_test issuing the step command to check which line the step lands on, and issuing an extra next if needed. Tested on x86_64-linux, both with and without -fcf-protection=none. PR testsuite/29920 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29920
Diffstat (limited to 'gdb/testsuite/gdb.cp/step-and-next-inline.exp')
-rw-r--r--gdb/testsuite/gdb.cp/step-and-next-inline.exp11
1 files changed, 10 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.exp b/gdb/testsuite/gdb.cp/step-and-next-inline.exp
index 8b2ad27..36fac23 100644
--- a/gdb/testsuite/gdb.cp/step-and-next-inline.exp
+++ b/gdb/testsuite/gdb.cp/step-and-next-inline.exp
@@ -60,7 +60,16 @@ proc do_test { use_header } {
}
gdb_test "bt" "\\s*\\#0\\s+main.*" "in main"
- gdb_test "step" ".*" "step into get_alias_set"
+ set line1 {\t\{}
+ set line2 {\t if \(t != NULL}
+ gdb_test_multiple "step" "step into get_alias_set" {
+ -re -wrap $line1 {
+ gdb_test "next" $line2 $gdb_test_name
+ }
+ -re -wrap $line2 {
+ pass $gdb_test_name
+ }
+ }
gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \
"not in inline 1"