Skip to content

Commit

Permalink
Fix skip.exp test failure observed with gcc-9.2.0
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bernd-edlinger authored and simark committed Dec 17, 2019
1 parent b63634b commit 5024637
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 4 additions & 0 deletions gdb/testsuite/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2019-12-17 Bernd Edlinger <[email protected]>

* gdb.base/skip.exp: Fix test failure observed with gcc-9.2.0.

2019-12-17 Bernd Edlinger <[email protected]>

* gdb.base/skip.exp: Whitespace fix.
Expand Down
16 changes: 11 additions & 5 deletions gdb/testsuite/gdb.base/skip.exp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down Expand Up @@ -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"
}
Expand All @@ -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"
}
Expand Down

0 comments on commit 5024637

Please sign in to comment.