60c662d
commit 2c29df25b7c2ff006b45afd80ee6dd734ebbd47c
60c662d
Author: Sergio Durigan Junior <sergiodj@redhat.com>
60c662d
Date:   Sun Sep 11 16:53:09 2016 -0400
60c662d
60c662d
    Fix false FAIL on gdb.base/stap-probe.exp, due to ICF optimization
60c662d
    
60c662d
    GCC 6's ICF optimization pass is making the declaration of 'm1' and
60c662d
    'm2', on gdb.base/stap-probe.c, to be unified.  However, this leads to
60c662d
    only one instance of the probe 'two' being created, which causes a
60c662d
    failure on the testsuite (which expects a multi-location breakpoint to
60c662d
    be inserted on the probe).
60c662d
    
60c662d
    This patch fixes this failure by declaring a dummy variable on 'm1',
60c662d
    and using it as an argument to m1's version of probe 'two'.  Since we
60c662d
    do not care about the contents of the functions nor about the
60c662d
    arguments of each probe 'two', this is OK.
60c662d
    
60c662d
    gdb/testsuite/ChangeLog:
60c662d
    2016-09-11  Sergio Durigan Junior  <sergiodj@redhat.com>
60c662d
    	    Jan Kratochvil  <jan.kratochvil@redhat.com>
60c662d
    
60c662d
    	* gdb.base/stap-probe.c (m1): New variable 'dummy', necessary to
60c662d
    	make m1's definition to be different from m2's.  Use 'dummy' as an
60c662d
    	argument for probe 'two'.
60c662d
60c662d
### a/gdb/testsuite/ChangeLog
60c662d
### b/gdb/testsuite/ChangeLog
60c662d
## -1,3 +1,10 @@
60c662d
+2016-09-11  Sergio Durigan Junior  <sergiodj@redhat.com>
60c662d
+	    Jan Kratochvil  <jan.kratochvil@redhat.com>
60c662d
+
60c662d
+	* gdb.base/stap-probe.c (m1): New variable 'dummy', necessary to
60c662d
+	make m1's definition to be different from m2's.  Use 'dummy' as an
60c662d
+	argument for probe 'two'.
60c662d
+
60c662d
 2016-09-10  Jon Beniston  <jon@beniston.com>
60c662d
 
60c662d
 	* lib/mi-support.exp (mi_gdb_target_load): Use target_sim_options
60c662d
--- a/gdb/testsuite/gdb.base/stap-probe.c
60c662d
+++ b/gdb/testsuite/gdb.base/stap-probe.c
60c662d
@@ -53,8 +53,13 @@ struct funcs
60c662d
 static void
60c662d
 m1 (void)
60c662d
 {
60c662d
+  /* m1 and m2 are equivalent, but because of some compiler
60c662d
+     optimizations we have to make each of them unique.  This is why
60c662d
+     we have this dummy variable here.  */
60c662d
+  volatile int dummy = 0;
60c662d
+
60c662d
   if (TEST2)
60c662d
-    STAP_PROBE (test, two);
60c662d
+    STAP_PROBE1 (test, two, dummy);
60c662d
 }
60c662d
 
60c662d
 static void