This is the mail archive of the gdb-cvs@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]

[binutils-gdb] Fix false FAIL on gdb.base/stap-probe.exp, due to ICF optimization


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2c29df25b7c2ff006b45afd80ee6dd734ebbd47c

commit 2c29df25b7c2ff006b45afd80ee6dd734ebbd47c
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Sun Sep 11 16:53:09 2016 -0400

    Fix false FAIL on gdb.base/stap-probe.exp, due to ICF optimization
    
    GCC 6's ICF optimization pass is making the declaration of 'm1' and
    'm2', on gdb.base/stap-probe.c, to be unified.  However, this leads to
    only one instance of the probe 'two' being created, which causes a
    failure on the testsuite (which expects a multi-location breakpoint to
    be inserted on the probe).
    
    This patch fixes this failure by declaring a dummy variable on 'm1',
    and using it as an argument to m1's version of probe 'two'.  Since we
    do not care about the contents of the functions nor about the
    arguments of each probe 'two', this is OK.
    
    gdb/testsuite/ChangeLog:
    2016-09-11  Sergio Durigan Junior  <sergiodj@redhat.com>
    	    Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* gdb.base/stap-probe.c (m1): New variable 'dummy', necessary to
    	make m1's definition to be different from m2's.  Use 'dummy' as an
    	argument for probe 'two'.

Diff:
---
 gdb/testsuite/ChangeLog             | 7 +++++++
 gdb/testsuite/gdb.base/stap-probe.c | 7 ++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 1ed9a21..c63ea72 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2016-09-11  Sergio Durigan Junior  <sergiodj@redhat.com>
+	    Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.base/stap-probe.c (m1): New variable 'dummy', necessary to
+	make m1's definition to be different from m2's.  Use 'dummy' as an
+	argument for probe 'two'.
+
 2016-09-10  Jon Beniston  <jon@beniston.com>
 
 	* lib/mi-support.exp (mi_gdb_target_load): Use target_sim_options
diff --git a/gdb/testsuite/gdb.base/stap-probe.c b/gdb/testsuite/gdb.base/stap-probe.c
index b728548..5a77435 100644
--- a/gdb/testsuite/gdb.base/stap-probe.c
+++ b/gdb/testsuite/gdb.base/stap-probe.c
@@ -53,8 +53,13 @@ struct funcs
 static void
 m1 (void)
 {
+  /* m1 and m2 are equivalent, but because of some compiler
+     optimizations we have to make each of them unique.  This is why
+     we have this dummy variable here.  */
+  volatile int dummy = 0;
+
   if (TEST2)
-    STAP_PROBE (test, two);
+    STAP_PROBE1 (test, two, dummy);
 }
 
 static void


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