public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/29920] New: [gdb] FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1
@ 2022-12-20  8:58 vries at gcc dot gnu.org
  2022-12-20  9:14 ` [Bug gdb/29920] " vries at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-12-20  8:58 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29920

            Bug ID: 29920
           Summary: [gdb] FAIL: gdb.cp/step-and-next-inline.exp:
                    no_header: next step 1
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

On ubuntu 22.04.1 x86_64 with gcc 11.3.0, I run into:
...
(gdb) PASS: gdb.cp/step-and-next-inline.exp: no_header: step into get_alias_set
bt^M
#0  get_alias_set (t=t@entry=0x555555558018 <xx>) at
/home/vries/gdb/src/gdb/testsuite/gdb.cp/step-and-next-inline.cc:50^M
#1  0x0000555555555084 in main () at
/home/vries/gdb/src/gdb/testsuite/gdb.cp/step-and-next-inline.cc:64^M
((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
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug gdb/29920] [gdb] FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1
  2022-12-20  8:58 [Bug gdb/29920] New: [gdb] FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1 vries at gcc dot gnu.org
@ 2022-12-20  9:14 ` vries at gcc dot gnu.org
  2022-12-20  9:48 ` [Bug testsuite/29920] [gdb/testsuite] " vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-12-20  9:14 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29920

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Likewise with gcc 12.1.0, 10.4.0, 9.5.0, 8.4.0,

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug testsuite/29920] [gdb/testsuite] FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1
  2022-12-20  8:58 [Bug gdb/29920] New: [gdb] FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1 vries at gcc dot gnu.org
  2022-12-20  9:14 ` [Bug gdb/29920] " vries at gcc dot gnu.org
@ 2022-12-20  9:48 ` vries at gcc dot gnu.org
  2022-12-21  8:07 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-12-20  9:48 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29920

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|gdb                         |testsuite
            Summary|[gdb] FAIL:                 |[gdb/testsuite] FAIL:
                   |gdb.cp/step-and-next-inline |gdb.cp/step-and-next-inline
                   |.exp: no_header: next step  |.exp: no_header: next step
                   |1                           |1

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Fix:
...
diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.exp
b/gdb/testsuite/gdb.cp/step-and-next-inline.exp
index 8b2ad2766bc..36fac239e2f 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"

...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug testsuite/29920] [gdb/testsuite] FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1
  2022-12-20  8:58 [Bug gdb/29920] New: [gdb] FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1 vries at gcc dot gnu.org
  2022-12-20  9:14 ` [Bug gdb/29920] " vries at gcc dot gnu.org
  2022-12-20  9:48 ` [Bug testsuite/29920] [gdb/testsuite] " vries at gcc dot gnu.org
@ 2022-12-21  8:07 ` vries at gcc dot gnu.org
  2022-12-23  8:15 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-12-21  8:07 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29920

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Root cause: compilation defaults to -fcf-protection, which adds the endbr64:
...
0000000000001180 <_Z13get_alias_setP4tree>:
    1180:       f3 0f 1e fa             endbr64
    1184:       48 85 ff                test   %rdi,%rdi
...
which is the insn with line number 50 that we stop at:
...
11     50     0x0000000000001180 Y                    
12     50     0x0000000000001180                      
13     51     0x0000000000001184 Y                    
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug testsuite/29920] [gdb/testsuite] FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1
  2022-12-20  8:58 [Bug gdb/29920] New: [gdb] FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1 vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-12-21  8:07 ` vries at gcc dot gnu.org
@ 2022-12-23  8:15 ` vries at gcc dot gnu.org
  2022-12-30 13:00 ` cvs-commit at gcc dot gnu.org
  2022-12-30 13:02 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-12-23  8:15 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29920

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2022-December/195054.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug testsuite/29920] [gdb/testsuite] FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1
  2022-12-20  8:58 [Bug gdb/29920] New: [gdb] FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1 vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-12-23  8:15 ` vries at gcc dot gnu.org
@ 2022-12-30 13:00 ` cvs-commit at gcc dot gnu.org
  2022-12-30 13:02 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-30 13:00 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29920

--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b1b0f69cb4a2ccd421419f9703edfcc5c3032dc0

commit b1b0f69cb4a2ccd421419f9703edfcc5c3032dc0
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Dec 30 14:00:39 2022 +0100

    [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

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug testsuite/29920] [gdb/testsuite] FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1
  2022-12-20  8:58 [Bug gdb/29920] New: [gdb] FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1 vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-12-30 13:00 ` cvs-commit at gcc dot gnu.org
@ 2022-12-30 13:02 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-12-30 13:02 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29920

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |14.1

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed by commit above.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-12-30 13:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-20  8:58 [Bug gdb/29920] New: [gdb] FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1 vries at gcc dot gnu.org
2022-12-20  9:14 ` [Bug gdb/29920] " vries at gcc dot gnu.org
2022-12-20  9:48 ` [Bug testsuite/29920] [gdb/testsuite] " vries at gcc dot gnu.org
2022-12-21  8:07 ` vries at gcc dot gnu.org
2022-12-23  8:15 ` vries at gcc dot gnu.org
2022-12-30 13:00 ` cvs-commit at gcc dot gnu.org
2022-12-30 13:02 ` vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).