This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, testsuite] Allow function arguments in bp print match in selftest_setup


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.

[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, 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?

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]