Fix skip.exp test failure observed with gcc-9.2.0
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Sun, 15 Dec 2019 10:05:47 +0000 (11:05 +0100)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 17 Dec 2019 16:10:25 +0000 (11:10 -0500)
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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/skip.exp

index 1f4f28dac406e96158c5d990ba2b68dd2cd3063e..01f6fdf37b2e992eb919478352deb62cf6c85fb8 100644 (file)
@@ -1,3 +1,7 @@
+2019-12-17  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * gdb.base/skip.exp: Fix test failure observed with gcc-9.2.0.
+
 2019-12-17  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        * gdb.base/skip.exp: Whitespace fix.
index 6b74f51135e7b3aa83b389fb62f198066eafaa8e..d6994d5fdc80f339c95ef4bcd3107c630ed2c1b8 100644 (file)
@@ -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"
 }
This page took 0.030739 seconds and 4 git commands to generate.