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
Jan Kratochvil eed01b8
Jan Kratochvil eed01b8
Jan Kratochvil eed01b8
commit f389f6fef76d7cf8e8beb7061edff2155c284898
Jan Kratochvil eed01b8
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Jan Kratochvil eed01b8
Date:   Wed Oct 5 21:56:46 2016 +0200
Jan Kratochvil eed01b8
Jan Kratochvil eed01b8
    testsuite: Fix recent GCC FAIL: gdb.arch/i386-signal.exp
Jan Kratochvil eed01b8
    
Jan Kratochvil eed01b8
    gcc-6.2.1-2.fc24.x86_64
Jan Kratochvil eed01b8
    
Jan Kratochvil eed01b8
    (gdb) backtrace 10^M
Jan Kratochvil eed01b8
    (gdb) FAIL: gdb.arch/i386-signal.exp: backtrace 10
Jan Kratochvil eed01b8
    
Jan Kratochvil eed01b8
    (gdb) disas/s
Jan Kratochvil eed01b8
    Dump of assembler code for function main:
Jan Kratochvil eed01b8
    .../gdb/testsuite/gdb.arch/i386-signal.c:
Jan Kratochvil eed01b8
    30      {
Jan Kratochvil eed01b8
       0x000000000040057f <+0>:     push   %rbp
Jan Kratochvil eed01b8
       0x0000000000400580 <+1>:     mov    %rsp,%rbp
Jan Kratochvil eed01b8
    31        setup ();
Jan Kratochvil eed01b8
       0x0000000000400583 <+4>:     callq  0x400590 <setup>
Jan Kratochvil eed01b8
    => 0x0000000000400588 <+9>:     mov    $0x0,%eax
Jan Kratochvil eed01b8
    32      }
Jan Kratochvil eed01b8
       0x000000000040058d <+14>:    pop    %rbp
Jan Kratochvil eed01b8
       0x000000000040058e <+15>:    retq
Jan Kratochvil eed01b8
    End of assembler dump.
Jan Kratochvil eed01b8
    
Jan Kratochvil eed01b8
    The .exp patch is an obvious typo fix I think.  The regex was written to
Jan Kratochvil eed01b8
    accept "ADDR in main" and I find it OK as checking .debug_line validity is not
Jan Kratochvil eed01b8
    the purpose of this testfile.
Jan Kratochvil eed01b8
    
Jan Kratochvil eed01b8
    gcc-4.8.5-11.el7.x86_64 did not put the 'mov $0x0,%eax' instruction there at
Jan Kratochvil eed01b8
    all so there was no problem with .debug_line.
Jan Kratochvil eed01b8
    
Jan Kratochvil eed01b8
    gdb/testsuite/ChangeLog
Jan Kratochvil eed01b8
    2016-10-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan Kratochvil eed01b8
    
Jan Kratochvil eed01b8
    	* gdb.arch/i386-signal.exp (backtrace 10): Fix #2 typo.
Jan Kratochvil eed01b8
Jan Kratochvil eed01b8
### a/gdb/testsuite/ChangeLog
Jan Kratochvil eed01b8
### b/gdb/testsuite/ChangeLog
Jan Kratochvil eed01b8
## -1,3 +1,7 @@
Jan Kratochvil eed01b8
+2016-10-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan Kratochvil eed01b8
+
Jan Kratochvil eed01b8
+	* gdb.arch/i386-signal.exp (backtrace 10): Fix #2 typo.
Jan Kratochvil eed01b8
+
Jan Kratochvil eed01b8
 2016-10-05  Yao Qi  <yao.qi@linaro.org>
Jan Kratochvil eed01b8
 
Jan Kratochvil eed01b8
 	* lib/gdb.exp (support_complex_tests): Return zero if
Jan Kratochvil eed01b8
--- a/gdb/testsuite/gdb.arch/i386-signal.exp
Jan Kratochvil eed01b8
+++ b/gdb/testsuite/gdb.arch/i386-signal.exp
Jan Kratochvil eed01b8
@@ -35,6 +35,6 @@ gdb_load ${binfile}
Jan Kratochvil eed01b8
 
Jan Kratochvil eed01b8
 runto func
Jan Kratochvil eed01b8
 gdb_test "backtrace 10" \
Jan Kratochvil eed01b8
-    "#0  ($hex in )?func.*\r\n#1  <signal handler called>\r\n#2  ($hex in)?main.*"
Jan Kratochvil eed01b8
+    "#0  ($hex in )?func.*\r\n#1  <signal handler called>\r\n#2  ($hex in )?main.*"
Jan Kratochvil eed01b8
 
Jan Kratochvil eed01b8
 gdb_test "finish" "Run till exit from \#0  func.*<signal handler called>"