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