This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH, testsuite] Allow function arguments in bp print match in selftest_setup
- From: Tom de Vries <tdevries at suse dot de>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 14 Jun 2018 12:21:07 +0200
- Subject: Re: [PATCH, testsuite] Allow function arguments in bp print match in selftest_setup
- References: <20180612151500.xgw27odexd5fgyww@localhost.localdomain> <8f1dae31-ac6c-74e2-1851-ca885193aa89@redhat.com>
On Wed, Jun 13, 2018 at 01:56:38PM +0100, Pedro Alves wrote:
> On 06/12/2018 04:15 PM, Tom de Vries wrote:
> > Hi,
> >
> > atm selftest.exp fails for me.
> >
>
> [1]
>
> > One of the reasons is that setting the breakpoint on captured_main and running
> > to it gives us:
> > ...
> > Breakpoint 1, captured_main (data=data@entry=0x7fffffffdb80) at main.c:1144
> > ...
> > while the matching in selftest_setup only allows '()', like this:
> > ...
> > Breakpoint 1, captured_main () at main.c:1144
> > ...
> >
> > The patch fixes this by allowing for random strings inbetween the parentheses.
> >
> > Tested selftest.exp (with two other selftest.exp related fixes applied).
> >
> > OK for trunk?
>
> Yes, please push.
>
Done.
> [1] Funny, it passes for me (with the fix for stopping at captured_main),
> because the pattern below the one you're touching matches:
>
> -re "Starting program.*Breakpoint \[0-9\]+,.* at .*main.c:.*$function.*$gdb_prompt $" {
> # $function may be inlined, so the program stops at the line
> # calling $function.
> pass "$description"
> }
>
> and it only happens to match because captured_main calls
> captured_main_1 first thing, which coincidentally
> matches "$function.*":
>
> Breakpoint 1, captured_main (data=<optimized out>) at gdb/binutils-gdb/src/gdb/main.c:1147
> 1147 captured_main_1 (context);
>
> That would probably be better "$function .*", with a space,
Right, I observed that as well, and was thinking of this type of fix.
> but I
> think that even better, we should try removing the "may be inlined" case
> too now, because since ddfe970e6bec ("Don't elide all inlined frames") GDB
> presents the stop at the inline function instead of at the caller.
> Like below. Comments?
>
Agreed, that's a better solution.
Thanks,
- Tom
> From: Pedro Alves <palves@redhat.com>
> Date: 2018-06-13 13:44:16 +0100
>
> remove inline
> ---
>
> gdb/testsuite/lib/selftest-support.exp | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp
> index f7169e0955e..c05f3b119be 100644
> --- a/gdb/testsuite/lib/selftest-support.exp
> +++ b/gdb/testsuite/lib/selftest-support.exp
> @@ -94,11 +94,6 @@ proc selftest_setup { executable function } {
> -re "Starting program.*Breakpoint \[0-9\]+,.*$function \\(\\).*$gdb_prompt $" {
> xfail "$description (line numbers scrambled?)"
> }
> - -re "Starting program.*Breakpoint \[0-9\]+,.* at .*main.c:.*$function.*$gdb_prompt $" {
> - # $function may be inlined, so the program stops at the line
> - # calling $function.
> - pass "$description"
> - }
> -re "vfork: No more processes.*$gdb_prompt $" {
> fail "$description (out of virtual memory)"
> set timeout $oldtimeout
>
> Thanks,
> Pedro Alves