Re: [PATCH ] PowerPC: fix for gdb.reverse/finish-precsave.exp and gdb.reverse/finish-reverse.exp

Bruno Larsen via Gdb-patches
2023-02-20T16:49:18Z

On 20/02/2023 17:34, Carl Love wrote:
>>> + if (execution_direction == EXEC_REVERSE
>>> + && ecs->event_thread->control.proceed_to_finish)
>>> + {
>>> + /* We are executing the reverse-finish command. */
>>> + if (ecs->event_thread->stop_pc () >= ecs-
>>>> stop_func_alt_start
>>> + && ecs->event_thread->stop_pc () < ecs->stop_func_start
>>> + && ecs->stop_func_alt_start != ecs->stop_func_start)
>> This third condition seems redundant: if stop_pc is >= func_alt_start
>> *and* < func_start, then func_alt_start cannot be equal func_start.
> Yes, on Powerpc the third condition is redundant. However, on other
> platforms, specifically X86, the third condition is always false which
> ensures the if statement is false. This is important on the tests
> gdb.btrace/tailcall-only.exp and gdb.btrace/tailcall.exp which only run
> on X86. The tests call the up command which will satisfy conditions 1
> and 2 and thus do an "extra" step command resulting in a test failure.
> The third condition ensures that we never execute an additional
> reverse-step unless the platform supports multiple entry points and we
> are at the alternate entry point. I can see where this is not obvious
> at first glance. I added a comment to the if statement explaining the
> need for the apparent redundancy.
But it is always redundant, even on x86. If the stop_func_start is A,
there is no way the stop_pc can be simultaneously larger or equal to A,
and strictly smaller than A. The only way the third condition would make
a difference is if the second condition was `ecs->event_thread->stop_pc
() <= ecs->stop_func_start`

--
Cheers,
Bruno