Re: Reverse-next bug test case

Pedro Alves
2023-02-01T14:38:07Z

On 2023-01-31 12:17 a.m., Carl Love wrote:
> +# The second reverse step should take us call of func2 ().
> +gdb_test "reverse-step" ".*func1 \\(\\); func2 \\(\\);.*" \
> + "reverse-step to line func1(); func2(), at call for func2 "
> +

From <https://sourceware.org/gdb/current/onlinedocs/gdb.html/Reverse-Execution.html> :

"Like the step command, reverse-step will only stop at the beginning of a source line. "

So when reverse-stepping is ongoing and execution internally stops at the call to func2, gdb
should realize it is not really at the beginning of a source line, and continue stepping.
That should take it inside func1, and stop there (at the beginning of a line), as it will have
reached a different line.

I would start by looking at making either of these pass:

$ make check TESTS="*/pedro_test.exp" RUNTESTFLAGS="CC_FOR_TARGET='gcc -gno-column-info'"

$ make check TESTS="*/pedro_test.exp" RUNTESTFLAGS="CC_FOR_TARGET=clang"

... as the misbehavior happens due to GDB misinterpreting multiple lines entries for the
same line when column info is emitted by current gcc. If you disable the column info, then gdb
should not stop in the middle of a line, and that's how gdb should always behave. (Making use
of column info is certainly interesting to support statement stepping, but that's orthogonal.)