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: [testsuite patch] Fix false FAIL in stap-probe.exp


On Sunday, September 11 2016, Jan Kratochvil wrote:

> Hi,
>
> gcc-6.2.1-1.fc26.x86_64
>
>     # Set a breakpoint with multiple probe locations.
>     gdb_test "break -pstap test:two" \
>         "Breakpoint \[0-9\]+ at $hex.*2 locations.*" \
>         "set multi-location probe breakpoint (probe two)"
> break -pstap test:two^M
> Breakpoint 2 at 0x4004e0^M
> (gdb) FAIL: gdb.base/stap-probe.exp: without semaphore, optimized: set multi-location probe breakpoint (probe two)
>
>     # Set a breakpoint with multiple probe locations.
>     # In this scenario, we may expect more than 2 locations because of
>     # the optimizations (inlining, loop unrolling, etc).
>     gdb_test "break -pstap test:two" \
>         "Breakpoint .* at $hex.*\[0-9\]+ locations.*" \
>         "set multi-location probe breakpoint (probe two)"
> break -pstap test:two^M
> Breakpoint 2 at 0x4004e0^M
> (gdb) FAIL: gdb.base/stap-probe.exp: with semaphore, optimized: set multi-location probe breakpoint (probe two)
>
> OK for check-in?

Thanks for the patch.  While it does fix the problem, I'd prefer a
"compiler-agnostic" patch.  The problem is that m1 and m2 (the two
functions where probe 'two' is being defined) are exactly the same, so
they get optimized by GCC's ICF pass.  Since the contents of each
function are irrelevant (as long as there's a probe 'two' inside them),
I think declaring a dummy variable in one of the functions (probably
volatile) would solve the issue.  WDYT?

> Jan
>
> gdb/testsuite/ChangeLog
> 2016-09-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* gdb.base/stap-probe.exp (stap_test_no_debuginfo): Try to use
> 	-fno-ipa-icf.
>
> diff --git a/gdb/testsuite/gdb.base/stap-probe.exp b/gdb/testsuite/gdb.base/stap-probe.exp
> index df46e80..9258926 100644
> --- a/gdb/testsuite/gdb.base/stap-probe.exp
> +++ b/gdb/testsuite/gdb.base/stap-probe.exp
> @@ -97,8 +97,11 @@ proc stap_test_no_debuginfo {exec_name {arg ""}} {
>      global testfile hex
>  
>      if {[prepare_for_testing ${testfile}.exp ${exec_name} ${testfile}.c \
> -	   {$arg nodebug optimize=-O2}]} {
> -	return -1
> +	   {$arg nodebug optimize=-O2 "additional_flags=-fno-ipa-icf"}]} {
> +	if {[prepare_for_testing ${testfile}.exp ${exec_name} ${testfile}.c \
> +	       {$arg nodebug optimize=-O2}]} {
> +	    return -1
> +	}
>      }
>  
>      if {[runto "-pstap test:user"]} {
>

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/


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