From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 572CA3858D39; Wed, 4 Jan 2023 10:09:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 572CA3858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672826958; bh=cULAhOcyIC0W75y2d/Xl+ra49AFXRiFDrlDDSodXcpM=; h=From:To:Subject:Date:From; b=bVLm1awklyIFPQszJWSkuUey3QPnJiqeRlG7dzdB5pPF+H2V6e5tvKchxDOs4p8jp cEu2PjE8ID9Iq6Szaau2CpTg6A22zbiGW9LtY2aNT0NvbN0RpN9UHNzPHHx8Fi9ExR adOwn/w/bwjCO4wjQTwH/VwMiKxTEJyoF+zHwH/U= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug gdb/29962] New: FAIL: gdb.reverse/step-reverse.exp: reverse step into fn call Date: Wed, 04 Jan 2023 10:09:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29962 Bug ID: 29962 Summary: FAIL: gdb.reverse/step-reverse.exp: reverse step into fn call Product: gdb Version: unknown Status: NEW Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: vries at gcc dot gnu.org Target Milestone: --- [ Likewise for gdb.reverse/step-precsave.exp, which uses the same source fi= le. ] On ubuntu 20.04.5 x86_64 (using gcc 9.4.0), I run into: ... (gdb) PASS: gdb.reverse/step-reverse.exp: simple reverse stepi step^M 78 a[5] =3D a[3] - a[4]; /* FINISH TEST */^M (gdb) FAIL: gdb.reverse/step-reverse.exp: reverse step into fn call step^M ... The basic problem here is that the forward execution goes like: ... $ ./build/gdb/gdb -q -batch ./build/gdb/testsuite/outputs/gdb.reverse/step-reverse/step-reverse -ex "b = 78" -ex run -ex "set trace-commands on" -ex stepi -ex "stepi" -ex "stepi" -ex "stepi" -ex "stepi" Breakpoint 1 at 0x123b: file /home/vries/gdb/src/gdb/testsuite/gdb.reverse/step-reverse.c, line 78. Breakpoint 1, main () at /home/vries/gdb/src/gdb/testsuite/gdb.reverse/step-reverse.c:78 78 a[5] =3D a[3] - a[4]; /* FINISH TEST */ +stepi 78 a[5] =3D a[3] - a[4]; /* FINISH TEST */ +stepi 78 a[5] =3D a[3] - a[4]; /* FINISH TEST */ +stepi 0x0000555555555243 78 a[5] =3D a[3] - a[4]; /* FINISH TEST */ +stepi 78 a[5] =3D a[3] - a[4]; /* FINISH TEST */ +stepi 79 callee(); /* STEPI TEST */ $=20 ... because we have: ... INDEX LINE ADDRESS IS-STMT PROLOGUE-END=20 26 75 0x0000555555555231 Y=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 27 78 0x000055555555523b Y=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 28 78 0x000055555555523e Y=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 29 78 0x0000555555555241 Y=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 30 78 0x0000555555555245 Y=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 31 79 0x0000555555555248 Y=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 ... and when doing the backward execution, we stop at 0x0000555555555245 rather stepi-ing to 0x000055555555523b as is the intention. This simple test-case patch fixes it: ... diff --git a/gdb/testsuite/gdb.reverse/step-reverse.exp b/gdb/testsuite/gdb.reverse/step-reverse.exp index 27e4b175274..8ed4f6d0269 100644 --- a/gdb/testsuite/gdb.reverse/step-reverse.exp +++ b/gdb/testsuite/gdb.reverse/step-reverse.exp @@ -72,6 +72,8 @@ gdb_test_multiple "finish" "$test_message" { } } +set pc_finish_test [get_valueof /x {$pc} ""] + # stepi over flat code (no calls) set test_message "simple stepi" @@ -216,7 +218,13 @@ gdb_test_multiple "stepi" "$test_message" { exp_continue } -re "$stepi_location.* FINISH TEST.*$gdb_prompt $" { - pass "$test_message" + set pc [get_valueof /x {$pc} ""] + if { $pc !=3D $pc_finish_test } { + send_gdb "stepi\n" + exp_continue + } else { + pass "$test_message" + } } -re "STEP INTO THIS CALL.*$gdb_prompt $" { fail "$test_message (too far)" ... (though it introduces a duplicate for the get_valueof). OTOH, this can be fixed by: ... diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 851852404eb..0e6ee8fe04d 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -20205,11 +20205,6 @@ dwarf_record_line_p (struct dwarf2_cu *cu, return 1; if (line !=3D last_line) return 1; - /* Same line for the same file that we've seen already. - As a last check, for pr 17276, only record the line if the line - has never had a non-zero discriminator. */ - if (!line_has_non_zero_discriminator) - return 1; return 0; }=20 ... which gets us: ... 25 75 0x0000555555555231 Y=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 26 78 0x000055555555523b Y=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 27 79 0x0000555555555248 Y=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 ... and: ... Breakpoint 1, main () at step-reverse.c:78 78 a[5] =3D a[3] - a[4]; /* FINISH TEST */ +stepi 0x000055555555523e 78 a[5] =3D a[3] - a[4]; /* FINISH TEST */ +stepi 0x0000555555555241 78 a[5] =3D a[3] - a[4]; /* FINISH TEST */ +stepi 0x0000555555555243 78 a[5] =3D a[3] - a[4]; /* FINISH TEST */ +stepi 0x0000555555555245 78 a[5] =3D a[3] - a[4]; /* FINISH TEST */ +stepi 79 callee(); /* STEPI TEST */ ... So in that sense, it's similar to PR25911. --=20 You are receiving this mail because: You are on the CC list for the bug.=