Re: [PATCH v3] of [PATCH v2 42/47] gdb_test_multiple: Anchor prompt match if -lbl

Pedro Alves
2025-06-06T13:54:15Z

On 2025-06-06 10:58, Tom de Vries wrote:

> Hi Pedro,
>
> [ FWIW, the way this patch is posted doesn't work well with patchwork:
> ...
> $ git-pw patch apply 113744
> Failed to apply patch:
> Applying: of [PATCH v2 42/47] gdb_test_multiple: Anchor prompt match if -lbl
> error: No valid patches in input (allow with "--allow-empty")
> error: could not build fake ancestor
> hint: Use 'git am --show-current-patch=diff' to see the failed patch
> Patch failed at 0001 of [PATCH v2 42/47] gdb_test_multiple: Anchor prompt match if -lbl
> When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".
>

Odd.

> $ git am --show-current-patch=diff
> --- 8< ---
> $
> ...
>
> I managed to apply it by saving the email in thunderbird and using git am, though that drops the commit message. ]

Copy/pasting to a new .patch file after the "--- 8< ---" line would have preserved it.

>
>> --- 8< ---
>>  From 93ce02b9ad0aefefc5f71b6c5d23f565f3f2e87a Mon Sep 17 00:00:00 2001
>> From: Pedro Alves <pedro@palves.net>
>> Date: Thu, 5 Jun 2025 18:09:44 +0100
>> Subject: [PATCH] gdb_test_multiple: Anchor prompt match if -lbl
>>
>> The testcase added by this patch has a gdb_test_multiple call that
>> wants to match different lines of output that all have a common
>> prefix, and do different actions on each.  Instead of a single regular
>> expression with alternatives, its clearer code if the different
>
> its -> it's

Fixed.

>> By adding the anchor to the prompt regexp, then we avoid that problem.
>>
>
> Should "then" be dropped in this line?

Indeed, done.

>
>> However, the same expect output buffer contents will still match the
>> built-in prompt match.  That is what is fixed by this patch.  It makes
>> it so that if -lbl is specified, the built-in prompt regexp has a
>> leading anchor.
>>
>
> Thanks for doing this.
>
> LGTM.
>
> Approved-By: Tom de Vries <tdevries@suse.de>
>
> FWIW, I propose to apply this independently from the patch series, since AFAICT it's unrelated.
>

Thanks. I've merged it now. It used to be needed by the testcase added later in the series,
but since it has its own independent testcase, it stands alone even better.

I've merged it now with the trivial fixes.

Thanks,
Pedro Alves