From: Bernd Edlinger Date: Sun, 15 Dec 2019 10:05:47 +0000 (+0100) Subject: Fix skip.exp test failure observed with gcc-9.2.0 X-Git-Url: http://git.efficios.com/?p=deliverable%2Fbinutils-gdb.git;a=commitdiff_plain;h=5024637fac653914d471808288dc3221bc7ec089 Fix skip.exp test failure observed with gcc-9.2.0 We need to step a second time with this gcc version. The first step jumps back to main before entering foo. Previously the control flow was from bar directly to foo. Further ananlysis suggests, that this change in behavior started with gcc-8.1.0 when -gcolumn-info was enabled by default. The option -gcolumn-info was first implemented in gcc-7.1.0 but default-disabled, so you can get the altered behavior already with gcc-7 if you manually enable -gcolumn-info. Previously there was just one point where line 30 (of skip.c) started: [0x00000032] Advance Line by 27 to 28 [0x00000034] Copy [0x00000035] Special opcode 63: advance Address by 4 to 0x4004cb and Line by 2 to 30 [0x00000036] Advance PC by constant 17 to 0x4004dc [0x00000037] Special opcode 7: advance Address by 0 to 0x4004dc and Line by 2 to 32 But with -gcolumn-info enabled, we have line 30 three times with different column: [0x00000034] Advance Line by 27 to 28 [0x00000036] Copy [0x00000037] Set column to 9 [0x00000039] Special opcode 63: advance Address by 4 to 0x4004c6 and Line by 2 to 30 [0x0000003a] Set column to 17 [0x0000003c] Special opcode 75: advance Address by 5 to 0x4004cb and Line by 0 to 30 [0x0000003d] Set column to 3 [0x0000003f] Special opcode 75: advance Address by 5 to 0x4004d0 and Line by 0 to 30 [0x00000040] Special opcode 105: advance Address by 7 to 0x4004d7 and Line by 2 to 32 That could probably be filtered in dwarf2read.c to keep the old behavior, but the new behavior makes still sense, even if we cannot really make use of the column in the line number info for now. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1f4f28dac4..01f6fdf37b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-12-17 Bernd Edlinger + + * gdb.base/skip.exp: Fix test failure observed with gcc-9.2.0. + 2019-12-17 Bernd Edlinger * gdb.base/skip.exp: Whitespace fix. diff --git a/gdb/testsuite/gdb.base/skip.exp b/gdb/testsuite/gdb.base/skip.exp index 6b74f51135..d6994d5fdc 100644 --- a/gdb/testsuite/gdb.base/skip.exp +++ b/gdb/testsuite/gdb.base/skip.exp @@ -141,9 +141,11 @@ with_test_prefix "step after disabling 3" { } gdb_test "step" "bar \\(\\) at.*" "step 1" - gdb_test "step" ".*" "step 2"; # Return from foo() - gdb_test "step" "foo \\(\\) at.*" "step 3" - gdb_test "step" ".*" "step 4"; # Return from bar() + gdb_test "step" ".*" "step 2"; # Return from bar() + # With gcc 9.2.0 we jump once back to main before entering foo here. + # If that happens try to step a second time. + gdb_test "step" "foo \\(\\) at.*" "step 3" "main \\(\\) at .*" "step" + gdb_test "step" ".*" "step 4"; # Return from foo() gdb_test "step" "main \\(\\) at.*" "step 5" } @@ -261,7 +263,9 @@ with_test_prefix "step using -fu for baz" { gdb_test_no_output "skip enable 7" gdb_test "step" "bar \\(\\) at.*" "step 1" gdb_test "step" ".*" "step 2"; # Return from bar() - gdb_test "step" "foo \\(\\) at.*" "step 3" + # With gcc 9.2.0 we jump once back to main before entering foo here. + # If that happens try to step a second time. + gdb_test "step" "foo \\(\\) at.*" "step 3" "main \\(\\) at.*" "step" gdb_test "step" ".*" "step 4"; # Return from foo() gdb_test "step" "main \\(\\) at.*" "step 5" } @@ -276,7 +280,9 @@ with_test_prefix "step using -rfu for baz" { gdb_test_no_output "skip enable 8" gdb_test "step" "bar \\(\\) at.*" "step 1" gdb_test "step" ".*" "step 2"; # Return from bar() - gdb_test "step" "foo \\(\\) at.*" "step 3" + # With gcc 9.2.0 we jump once back to main before entering foo here. + # If that happens try to step a second time. + gdb_test "step" "foo \\(\\) at.*" "step 3" "main \\(\\) at.*" "step" gdb_test "step" ".*" "step 4"; # Return from foo() gdb_test "step" "main \\(\\) at.*" "step 5" }