public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/29792] New: [gdb/testsuite, powerpc] FAIL: gdb.opt/solib-intra-step.exp: second-hit
@ 2022-11-16 14:56 vries at gcc dot gnu.org
  2022-11-16 15:04 ` [Bug testsuite/29792] " vries at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-11-16 14:56 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29792
           Summary: [gdb/testsuite, powerpc] FAIL:
                    gdb.opt/solib-intra-step.exp: second-hit
           Product: gdb
           Version: 12.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

On powerpc64le-linux, I ran into:
...
(gdb) PASS: gdb.opt/solib-intra-step.exp: first-hit
step^M
28      { /* first-retry */^M
(gdb) FAIL: gdb.opt/solib-intra-step.exp: second-hit
...

First let's do a stepping session:
...
$ ./build/gdb/gdb -q outputs/gdb.opt/solib-intra-step/solib-intra-step-main
Reading symbols from outputs/gdb.opt/solib-intra-step/solib-intra-step-main...
(gdb) start
Temporary breakpoint 1 at 0x10000718: file
/suse/tdevries/gdb/src/gdb/testsuite/gdb.opt/solib-intra-step-main.c, line 23.
Starting program:
/suse/tdevries/gdb/build/gdb/testsuite/outputs/gdb.opt/solib-intra-step/solib-intra-step-main 

Temporary breakpoint 1, main ()
    at /suse/tdevries/gdb/src/gdb/testsuite/gdb.opt/solib-intra-step-main.c:23
23        shlib_first ();
(gdb) step
shlib_first () at
/suse/tdevries/gdb/src/gdb/testsuite/gdb.opt/solib-intra-step-lib.c:29
29        shlib_second (0); /* first-hit */
(gdb) step
28      { /* first-retry */
(gdb) step
29        shlib_second (0); /* first-hit */
(gdb) step
shlib_second (dummy=0)
    at /suse/tdevries/gdb/src/gdb/testsuite/gdb.opt/solib-intra-step-lib.c:23
23        abort (); /* second-hit */
...

So the problem is that we arrive at line 29, then step back to 28, and again to
29 before stepping into shlib_second.

Looking at objdump output, shlib_first starts at 0x740, and with readline -wL,
we see:
...
CU: /suse/tdevries/gdb/src/gdb/testsuite/gdb.opt/solib-intra-step-lib.c:
File name                    Line number    Starting address    View    Stmt
solib-intra-step-lib.c                22               0x710               x
solib-intra-step-lib.c                23               0x724               x
solib-intra-step-lib.c                28               0x740               x
solib-intra-step-lib.c                29               0x74c               x
solib-intra-step-lib.c                28               0x750               x
solib-intra-step-lib.c                29               0x758               x
solib-intra-step-lib.c                30               0x760               x
solib-intra-step-lib.c                 -               0x77c
...

So, that makes sense.  When stepping into shlib_first, we skip the first entry
at 28 due to prologue skipping, then step to the entry at 28 and then back to
the entry at 29, which is where the call to shlib_second is.

GDB uses the line info available (which is weird because of optimization), and
does this correctly.

The test-case needs to be updated to handle this.

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

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

* [Bug testsuite/29792] [gdb/testsuite, powerpc] FAIL: gdb.opt/solib-intra-step.exp: second-hit
  2022-11-16 14:56 [Bug testsuite/29792] New: [gdb/testsuite, powerpc] FAIL: gdb.opt/solib-intra-step.exp: second-hit vries at gcc dot gnu.org
@ 2022-11-16 15:04 ` vries at gcc dot gnu.org
  2022-11-16 15:11 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-11-16 15:04 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/testsuite/gdb.opt/solib-intra-step.exp
b/gdb/testsuite/gdb.opt/solib-intra-step.exp
index 0acda6594c5..e803a7db14d 100644
--- a/gdb/testsuite/gdb.opt/solib-intra-step.exp
+++ b/gdb/testsuite/gdb.opt/solib-intra-step.exp
@@ -58,16 +58,35 @@ gdb_test_multiple "step" $test {
     }
 }

+set in_second 0
 set test "second-hit"
 gdb_test_multiple "step" $test {
+    -re -wrap " first-retry .*" {
+       if { $in_second } {
+           fail $gdb_test_name
+       } else {
+           send_gdb "step\n"
+           exp_continue
+       }
+    }
+    -re -wrap " first-hit .*" {
+       if { $in_second } {
+           fail $gdb_test_name
+       } else {
+           send_gdb "step\n"
+           exp_continue
+       }
+    }
     -re -wrap " second-hit .*" {
        pass $gdb_test_name
     }
     -re -wrap " second-retry .*" {
+       set in_second 1
        send_gdb "step\n"
        exp_continue
     }
     -re -wrap "get_pc_thunk.*" {
+       set in_second 1
        send_gdb "step\n"
        exp_continue
     }
...

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

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

* [Bug testsuite/29792] [gdb/testsuite, powerpc] FAIL: gdb.opt/solib-intra-step.exp: second-hit
  2022-11-16 14:56 [Bug testsuite/29792] New: [gdb/testsuite, powerpc] FAIL: gdb.opt/solib-intra-step.exp: second-hit vries at gcc dot gnu.org
  2022-11-16 15:04 ` [Bug testsuite/29792] " vries at gcc dot gnu.org
@ 2022-11-16 15:11 ` vries at gcc dot gnu.org
  2022-11-16 15:14 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-11-16 15:11 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cel at us dot ibm.com,
                   |                            |ulrich.weigand at de dot ibm.com

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

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

* [Bug testsuite/29792] [gdb/testsuite, powerpc] FAIL: gdb.opt/solib-intra-step.exp: second-hit
  2022-11-16 14:56 [Bug testsuite/29792] New: [gdb/testsuite, powerpc] FAIL: gdb.opt/solib-intra-step.exp: second-hit vries at gcc dot gnu.org
  2022-11-16 15:04 ` [Bug testsuite/29792] " vries at gcc dot gnu.org
  2022-11-16 15:11 ` vries at gcc dot gnu.org
@ 2022-11-16 15:14 ` vries at gcc dot gnu.org
  2022-11-28 13:23 ` cvs-commit at gcc dot gnu.org
  2022-11-28 13:25 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-11-16 15:14 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
It's good to note that if we drop optimization of the solib to -O0, we have a
regular:
...
$ ./build/gdb/gdb -q outputs/gdb.opt/solib-intra-step/solib-intra-step-main
Reading symbols from outputs/gdb.opt/solib-intra-step/solib-intra-step-main...
(gdb) start
Temporary breakpoint 1 at 0x10000718: file
/suse/tdevries/gdb/src/gdb/testsuite/gdb.opt/solib-intra-step-main.c, line 23.
Starting program:
/suse/tdevries/gdb/build/gdb/testsuite/outputs/gdb.opt/solib-intra-step/solib-intra-step-main 

Temporary breakpoint 1, main ()
    at /suse/tdevries/gdb/src/gdb/testsuite/gdb.opt/solib-intra-step-main.c:23
23        shlib_first ();
(gdb) step
shlib_first () at
/suse/tdevries/gdb/src/gdb/testsuite/gdb.opt/solib-intra-step-lib.c:29
29        shlib_second (0); /* first-hit */
(gdb) step
shlib_second (dummy=0)
    at /suse/tdevries/gdb/src/gdb/testsuite/gdb.opt/solib-intra-step-lib.c:23
23        abort (); /* second-hit */
(gdb) step

Program received signal SIGABRT, Aborted.
0x00007ffff7c49838 in raise () from /lib64/libc.so.6
...

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

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

* [Bug testsuite/29792] [gdb/testsuite, powerpc] FAIL: gdb.opt/solib-intra-step.exp: second-hit
  2022-11-16 14:56 [Bug testsuite/29792] New: [gdb/testsuite, powerpc] FAIL: gdb.opt/solib-intra-step.exp: second-hit vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-11-16 15:14 ` vries at gcc dot gnu.org
@ 2022-11-28 13:23 ` cvs-commit at gcc dot gnu.org
  2022-11-28 13:25 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-28 13:23 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 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=76cd77dc729b03d6b33c683323594479e33a3f9a

commit 76cd77dc729b03d6b33c683323594479e33a3f9a
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Nov 28 14:23:34 2022 +0100

    [gdb/testsuite] Fix gdb.opt/solib-intra-step.exp for powerpc64le

    On powerpc64le-linux, I run into:
    ...
    (gdb) PASS: gdb.opt/solib-intra-step.exp: first-hit
    step^M
    28      { /* first-retry */^M
    (gdb) FAIL: gdb.opt/solib-intra-step.exp: second-hit
    ...

    It's a bit easier to understand what happens if we do a full stepping
session:
    ...
    Temporary breakpoint 1, main ()
        at solib-intra-step-main.c:23
    23        shlib_first ();
    (gdb) step
    shlib_first () at solib-intra-step-lib.c:29
    29        shlib_second (0); /* first-hit */
    (gdb) step
    28      { /* first-retry */
    (gdb) step
    29        shlib_second (0); /* first-hit */
    (gdb) step
    shlib_second (dummy=0)
        at solib-intra-step-lib.c:23
    23        abort (); /* second-hit */
    ...
    and compare that to the line info:
    ...
    CU: solib-intra-step-lib.c:
    File name                    Line number    Starting address    View   
Stmt
    solib-intra-step-lib.c                22               0x710              
x
    solib-intra-step-lib.c                23               0x724              
x
    solib-intra-step-lib.c                28               0x740              
x
    solib-intra-step-lib.c                29               0x74c              
x
    solib-intra-step-lib.c                28               0x750              
x
    solib-intra-step-lib.c                29               0x758              
x
    solib-intra-step-lib.c                30               0x760              
x
    solib-intra-step-lib.c                 -               0x77c
    ...

    So we step from line 29 to line 28, and back to line 29, which is behaviour
    that matches the line table.  The peculiar order is due to using
optimization.
    The problem is that the test-case doesn't expect this order.

    Fix this by allowing this order in the test-case.

    Tested on powerpc64le-linux.

    PR testsuite/29792
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29792

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

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

* [Bug testsuite/29792] [gdb/testsuite, powerpc] FAIL: gdb.opt/solib-intra-step.exp: second-hit
  2022-11-16 14:56 [Bug testsuite/29792] New: [gdb/testsuite, powerpc] FAIL: gdb.opt/solib-intra-step.exp: second-hit vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-11-28 13:23 ` cvs-commit at gcc dot gnu.org
@ 2022-11-28 13:25 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-11-28 13:25 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.1
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
            Version|12.1                        |HEAD

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed by commit in previous comment.

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

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

end of thread, other threads:[~2022-11-28 13:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-16 14:56 [Bug testsuite/29792] New: [gdb/testsuite, powerpc] FAIL: gdb.opt/solib-intra-step.exp: second-hit vries at gcc dot gnu.org
2022-11-16 15:04 ` [Bug testsuite/29792] " vries at gcc dot gnu.org
2022-11-16 15:11 ` vries at gcc dot gnu.org
2022-11-16 15:14 ` vries at gcc dot gnu.org
2022-11-28 13:23 ` cvs-commit at gcc dot gnu.org
2022-11-28 13:25 ` 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).