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

Carl Love via Gdb-patches
2023-03-09T21:43:01Z

On Thu, 2023-03-09 at 12:03 -0700, Tom Tromey wrote:
> > > > > > "Carl" == Carl Love via Gdb-patches <
> > > > > > gdb-patches@sourceware.org> writes:
>
> Carl> Procedure proc_step_until from test gdb.reverse/step-indirect-
> call-thunk.exp
>
> The "proc_" in there seems incorrect.

Ah, yea. Good catch. Fixed that.

>
> Carl> # Step until the pattern REGEXP is found. Step at most
> Carl> # MAX_STEPS times, but stop stepping once REGEXP is found.
> Carl> -#
> Carl> +# CURRENT matches current location
> Carl> # If REGEXP is found then a single pass is emitted, otherwise,
> after
> Carl> # MAX_STEPS steps, a single fail is emitted.
> Carl> #
> Carl> # TEST_NAME is the name used in the pass/fail calls.
>
> Carl> -proc gdb_step_until { regexp {test_name ""} {max_steps 10} } {
> Carl> +proc gdb_step_until { regexp {test_name ""} {current ""} \
> Carl> + { max_steps 10 } } {
> Carl> + if { $current == "" } {
> Carl> + set current "\}"
> Carl> + }
> Carl> + if { $test_name == "" } {
> Carl> + set test_name "stepping until regexp"
> Carl> + }
>
> I think you can just supply these as defaults directly in the proc
> definition.

True, I guess I was just keeping with the original "style". But yea,
better to do these as defaults. Changed to use defaults in this
function and similarly in the the new proceedure gdb_step_until.
>
> Carl> +# Do repeated stepping COMMANDs in order to reach TARGET from
> CURRENT
> Carl> +#
> Carl> +# COMMAND is a stepping command
> Carl> +# CURRENT is a string matching the current location
> Carl> +# TARGET is a string matching the target location
> Carl> +# TEST is the test name
> Carl> +# MAX_STEPS is number of steps attempted before fail is
> emitted
> Carl> +#
> Carl> +# The function issues repeated COMMANDs as long as the
> location matches
> Carl> +# CURRENT up to a maximum of 100 steps.
>
> s/100/MAX_STEPS
OK, changed.
>
> Carl> +#
> Carl> +# TEST passes if the resulting location matches TARGET and
> fails
> Carl> +# otherwise.
> Carl> +#
> Carl> +proc repeat_cmd_until { command current target test_name
> {max_steps 100} } {
>
> The docs refer to "TEST" but should use "TEST_NAME".

yup, thanks. Changed.

Will post version 2. Thanks for the review.

Carl