Blame SOURCES/gdb-upstream.patch

7a6771
commit 2c29df25b7c2ff006b45afd80ee6dd734ebbd47c
7a6771
Author: Sergio Durigan Junior <sergiodj@redhat.com>
7a6771
Date:   Sun Sep 11 16:53:09 2016 -0400
7a6771
7a6771
    Fix false FAIL on gdb.base/stap-probe.exp, due to ICF optimization
7a6771
    
7a6771
    GCC 6's ICF optimization pass is making the declaration of 'm1' and
7a6771
    'm2', on gdb.base/stap-probe.c, to be unified.  However, this leads to
7a6771
    only one instance of the probe 'two' being created, which causes a
7a6771
    failure on the testsuite (which expects a multi-location breakpoint to
7a6771
    be inserted on the probe).
7a6771
    
7a6771
    This patch fixes this failure by declaring a dummy variable on 'm1',
7a6771
    and using it as an argument to m1's version of probe 'two'.  Since we
7a6771
    do not care about the contents of the functions nor about the
7a6771
    arguments of each probe 'two', this is OK.
7a6771
    
7a6771
    gdb/testsuite/ChangeLog:
7a6771
    2016-09-11  Sergio Durigan Junior  <sergiodj@redhat.com>
7a6771
    	    Jan Kratochvil  <jan.kratochvil@redhat.com>
7a6771
    
7a6771
    	* gdb.base/stap-probe.c (m1): New variable 'dummy', necessary to
7a6771
    	make m1's definition to be different from m2's.  Use 'dummy' as an
7a6771
    	argument for probe 'two'.
7a6771
7a6771
### a/gdb/testsuite/ChangeLog
7a6771
### b/gdb/testsuite/ChangeLog
7a6771
## -1,3 +1,10 @@
7a6771
+2016-09-11  Sergio Durigan Junior  <sergiodj@redhat.com>
7a6771
+	    Jan Kratochvil  <jan.kratochvil@redhat.com>
7a6771
+
7a6771
+	* gdb.base/stap-probe.c (m1): New variable 'dummy', necessary to
7a6771
+	make m1's definition to be different from m2's.  Use 'dummy' as an
7a6771
+	argument for probe 'two'.
7a6771
+
7a6771
 2016-09-10  Jon Beniston  <jon@beniston.com>
7a6771
 
7a6771
 	* lib/mi-support.exp (mi_gdb_target_load): Use target_sim_options
7a6771
--- a/gdb/testsuite/gdb.base/stap-probe.c
7a6771
+++ b/gdb/testsuite/gdb.base/stap-probe.c
7a6771
@@ -53,8 +53,13 @@ struct funcs
7a6771
 static void
7a6771
 m1 (void)
7a6771
 {
7a6771
+  /* m1 and m2 are equivalent, but because of some compiler
7a6771
+     optimizations we have to make each of them unique.  This is why
7a6771
+     we have this dummy variable here.  */
7a6771
+  volatile int dummy = 0;
7a6771
+
7a6771
   if (TEST2)
7a6771
-    STAP_PROBE (test, two);
7a6771
+    STAP_PROBE1 (test, two, dummy);
7a6771
 }
7a6771
 
7a6771
 static void
7a6771
7a6771
7a6771
commit f389f6fef76d7cf8e8beb7061edff2155c284898
7a6771
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
7a6771
Date:   Wed Oct 5 21:56:46 2016 +0200
7a6771
7a6771
    testsuite: Fix recent GCC FAIL: gdb.arch/i386-signal.exp
7a6771
    
7a6771
    gcc-6.2.1-2.fc24.x86_64
7a6771
    
7a6771
    (gdb) backtrace 10^M
7a6771
    (gdb) FAIL: gdb.arch/i386-signal.exp: backtrace 10
7a6771
    
7a6771
    (gdb) disas/s
7a6771
    Dump of assembler code for function main:
7a6771
    .../gdb/testsuite/gdb.arch/i386-signal.c:
7a6771
    30      {
7a6771
       0x000000000040057f <+0>:     push   %rbp
7a6771
       0x0000000000400580 <+1>:     mov    %rsp,%rbp
7a6771
    31        setup ();
7a6771
       0x0000000000400583 <+4>:     callq  0x400590 <setup>
7a6771
    => 0x0000000000400588 <+9>:     mov    $0x0,%eax
7a6771
    32      }
7a6771
       0x000000000040058d <+14>:    pop    %rbp
7a6771
       0x000000000040058e <+15>:    retq
7a6771
    End of assembler dump.
7a6771
    
7a6771
    The .exp patch is an obvious typo fix I think.  The regex was written to
7a6771
    accept "ADDR in main" and I find it OK as checking .debug_line validity is not
7a6771
    the purpose of this testfile.
7a6771
    
7a6771
    gcc-4.8.5-11.el7.x86_64 did not put the 'mov $0x0,%eax' instruction there at
7a6771
    all so there was no problem with .debug_line.
7a6771
    
7a6771
    gdb/testsuite/ChangeLog
7a6771
    2016-10-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
7a6771
    
7a6771
    	* gdb.arch/i386-signal.exp (backtrace 10): Fix #2 typo.
7a6771
7a6771
### a/gdb/testsuite/ChangeLog
7a6771
### b/gdb/testsuite/ChangeLog
7a6771
## -1,3 +1,7 @@
7a6771
+2016-10-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
7a6771
+
7a6771
+	* gdb.arch/i386-signal.exp (backtrace 10): Fix #2 typo.
7a6771
+
7a6771
 2016-10-05  Yao Qi  <yao.qi@linaro.org>
7a6771
 
7a6771
 	* lib/gdb.exp (support_complex_tests): Return zero if
7a6771
--- a/gdb/testsuite/gdb.arch/i386-signal.exp
7a6771
+++ b/gdb/testsuite/gdb.arch/i386-signal.exp
7a6771
@@ -35,6 +35,6 @@ gdb_load ${binfile}
7a6771
 
7a6771
 runto func
7a6771
 gdb_test "backtrace 10" \
7a6771
-    "#0  ($hex in )?func.*\r\n#1  <signal handler called>\r\n#2  ($hex in)?main.*"
7a6771
+    "#0  ($hex in )?func.*\r\n#1  <signal handler called>\r\n#2  ($hex in )?main.*"
7a6771
 
7a6771
 gdb_test "finish" "Run till exit from \#0  func.*<signal handler called>"
7a6771
7a6771
7a6771
commit 20c2c024c1e89e402a57e8c3577fb9777709d9a4
7a6771
Author: Carl E. Love <carll@oc4738070240.ibm.com>
7a6771
Date:   Fri Aug 19 11:06:38 2016 -0700
7a6771
7a6771
    Fix missing files for ld when test suite not compiled in the source directory
7a6771
    
7a6771
    This patch fixes an issues with six test suite expect files that do not
7a6771
    run correctly when the test suite is not built in the source directory.  The
7a6771
    issue is these tests are not using the current "standard_testfile" call
7a6771
    but rather using the older set command to initialize the "testfile",
7a6771
    "srcfile" and "binprefix" variables or are missing the set for the
7a6771
    "binprefix" variable.
7a6771
    
7a6771
    -----------------------------------------------
7a6771
    
7a6771
    gdb/testsuite/ChangeLog
7a6771
    
7a6771
    2016-08-19  Carl Love  <cel@us.ibm.com>
7a6771
    
7a6771
    	* gdb.arch/altivec-regs.exp: Use standard_testfile instead of
7a6771
    	maintaining separate logic for constructing the output path.
7a6771
    	* gdb.arch/powerpc-d128-regs.exp: Likewise.
7a6771
    	* gdb.arch/ppc-dfp.exp: Likewise.
7a6771
    	* gdb.arch/ppc-fp.exp: Likewise.
7a6771
    	* gdb.arch/vsx-regs.exp: Likewise.
7a6771
    	* gdb.arch/altivec-abi.exp: Likewise, plus added local variable
7a6771
    	binprefix for generating the additional binary files.
7a6771
7a6771
### a/gdb/testsuite/ChangeLog
7a6771
### b/gdb/testsuite/ChangeLog
7a6771
## -1,3 +1,14 @@
7a6771
+2016-08-19  Carl Love  <cel@us.ibm.com>
7a6771
+
7a6771
+	* gdb.arch/altivec-regs.exp: Use standard_testfile instead of
7a6771
+	maintaining separate logic for constructing the output path.
7a6771
+	* gdb.arch/powerpc-d128-regs.exp: Likewise.
7a6771
+	* gdb.arch/ppc-dfp.exp: Likewise.
7a6771
+	* gdb.arch/ppc-fp.exp: Likewise.
7a6771
+	* gdb.arch/vsx-regs.exp: Likewise.
7a6771
+	* gdb.arch/altivec-abi.exp: Likewise, plus added local variable
7a6771
+	binprefix for generating the additional binary files.
7a6771
+
7a6771
 2016-08-19  Pedro Alves  <palves@redhat.com>
7a6771
 
7a6771
 	* gdb.trace/mi-trace-frame-collected.exp
7a6771
--- a/gdb/testsuite/gdb.arch/altivec-abi.exp
7a6771
+++ b/gdb/testsuite/gdb.arch/altivec-abi.exp
7a6771
@@ -26,9 +26,7 @@ if {![istarget "powerpc*"] || [skip_altivec_tests]} then {
7a6771
     return
7a6771
 }
7a6771
 
7a6771
-set testfile "altivec-abi"
7a6771
-set binfile ${objdir}/${subdir}/${testfile}
7a6771
-set srcfile ${testfile}.c
7a6771
+standard_testfile
7a6771
 
7a6771
 if [get_compiler_info] {
7a6771
     warning "get_compiler failed"
7a6771
@@ -146,6 +144,8 @@ proc altivec_abi_tests { extra_flags force_abi } {
7a6771
 }
7a6771
 
7a6771
 if [test_compiler_info gcc*] {
7a6771
+    set binprefix ${binfile}
7a6771
+
7a6771
     with_test_prefix "default ABI, auto" {
7a6771
 	altivec_abi_tests  "additional_flags=-maltivec" "auto"
7a6771
     }
7a6771
@@ -156,23 +156,23 @@ if [test_compiler_info gcc*] {
7a6771
 	# On 64-bit GNU/Linux with GCC 4.1 and 4.2, -mabi=no-altivec
7a6771
 	# was broken, so skip those tests there.
7a6771
 	if { ![is_lp64_target] || ![test_compiler_info "gcc-4-\[12\]-*"] } {
7a6771
-	    set binfile ${objdir}/${subdir}/${testfile}-ge-ge
7a6771
+	    set binfile ${binprefix}-ge-ge
7a6771
 	    with_test_prefix "generic ABI, forced" {
7a6771
 		altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "generic"
7a6771
 	    }
7a6771
 
7a6771
-	    set binfile ${objdir}/${subdir}/${testfile}-ge-auto
7a6771
+	    set binfile ${binprefix}-ge-auto
7a6771
 	    with_test_prefix "generic ABI, auto" {
7a6771
 		altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "auto"
7a6771
 	    }
7a6771
 	}
7a6771
 
7a6771
-	set binfile ${objdir}/${subdir}/${testfile}-av-av
7a6771
+	set binfile ${binprefix}-av-av
7a6771
 	with_test_prefix "AltiVec ABI, forced" {
7a6771
 	    altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "altivec"
7a6771
 	}
7a6771
 
7a6771
-	set binfile ${objdir}/${subdir}/${testfile}-av-auto
7a6771
+	set binfile ${binprefix}-av-auto
7a6771
 	with_test_prefix "AltiVec ABI, auto" {
7a6771
 	    altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "auto"
7a6771
 	}
7a6771
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
7a6771
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
7a6771
@@ -27,9 +27,7 @@ if {![istarget "powerpc*"] || [skip_altivec_tests]} then {
7a6771
     return
7a6771
 }
7a6771
 
7a6771
-set testfile "altivec-regs"
7a6771
-set binfile ${objdir}/${subdir}/${testfile}
7a6771
-set srcfile ${testfile}.c
7a6771
+standard_testfile
7a6771
 
7a6771
 set compile_flags {debug nowarnings}
7a6771
 if [get_compiler_info] {
7a6771
--- a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
7a6771
+++ b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
7a6771
@@ -25,9 +25,7 @@ if ![istarget "powerpc64*-*"] then {
7a6771
     return
7a6771
 }
7a6771
 
7a6771
-set testfile "powerpc-d128-regs"
7a6771
-set srcfile ${testfile}.c
7a6771
-set binfile ${objdir}/${subdir}/${testfile}
7a6771
+standard_testfile
7a6771
 
7a6771
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {quiet debug}] != "" } {
7a6771
      untested powerpc-d128-regs.exp
7a6771
--- a/gdb/testsuite/gdb.arch/ppc-dfp.exp
7a6771
+++ b/gdb/testsuite/gdb.arch/ppc-dfp.exp
7a6771
@@ -21,9 +21,7 @@ if ![istarget "powerpc*"] then {
7a6771
     return
7a6771
 }
7a6771
 
7a6771
-set testfile "ppc-dfp"
7a6771
-set binfile ${objdir}/${subdir}/${testfile}
7a6771
-set srcfile ${testfile}.c
7a6771
+standard_testfile
7a6771
 
7a6771
 if [get_compiler_info] {
7a6771
     warning "get_compiler failed"
7a6771
--- a/gdb/testsuite/gdb.arch/ppc-fp.exp
7a6771
+++ b/gdb/testsuite/gdb.arch/ppc-fp.exp
7a6771
@@ -21,9 +21,7 @@ if ![istarget "powerpc*"] then {
7a6771
     return
7a6771
 }
7a6771
 
7a6771
-set testfile "ppc-fp"
7a6771
-set binfile ${objdir}/${subdir}/${testfile}
7a6771
-set srcfile ${testfile}.c
7a6771
+standard_testfile
7a6771
 
7a6771
 if [get_compiler_info] {
7a6771
     warning "get_compiler failed"
7a6771
--- a/gdb/testsuite/gdb.arch/vsx-regs.exp
7a6771
+++ b/gdb/testsuite/gdb.arch/vsx-regs.exp
7a6771
@@ -24,9 +24,7 @@ if {![istarget "powerpc*"] || [skip_vsx_tests]} then {
7a6771
     return
7a6771
 }
7a6771
 
7a6771
-set testfile "vsx-regs"
7a6771
-set binfile ${objdir}/${subdir}/${testfile}
7a6771
-set srcfile ${testfile}.c
7a6771
+standard_testfile
7a6771
 
7a6771
 set compile_flags {debug nowarnings quiet}
7a6771
 if [get_compiler_info] {
7a6771
7a6771
7a6771
http://sourceware.org/ml/gdb-patches/2016-10/msg00258.html
7a6771
Subject: [testsuite obv] Use standard_output_file
7a6771
7a6771
From: Jan Kratochvil <jan.kratochvil@redhat.com>
7a6771
Date: Tue, 11 Oct 2016 16:43:58 +0200
7a6771
Subject: [PATCH] testsuite: Use standard_output_file
7a6771
Subject: [PATCH] testsuite: Use standard_output_file
7a6771
7a6771
gdb/testsuite/ChangeLog
7a6771
2016-10-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
7a6771
7a6771
	* gdb.arch/powerpc-prologue.exp: Use standard_output_file.
7a6771
	* gdb.arch/ppc64-symtab-cordic.exp: Likewise.
7a6771
	* gdb.arch/vsx-regs.exp: Likewise.
7a6771
---
7a6771
 gdb/testsuite/ChangeLog                        | 6 ++++++
7a6771
 gdb/testsuite/gdb.arch/powerpc-prologue.exp    | 2 +-
7a6771
 gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp | 4 ++--
7a6771
 gdb/testsuite/gdb.arch/vsx-regs.exp            | 2 +-
7a6771
 4 files changed, 10 insertions(+), 4 deletions(-)
7a6771
7a6771
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
7a6771
index 9c7df29..b6ba0ec 100644
7a6771
### a/gdb/testsuite/ChangeLog
7a6771
### b/gdb/testsuite/ChangeLog
7a6771
## -1,3 +1,9 @@
7a6771
+2016-10-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
7a6771
+
7a6771
+	* gdb.arch/powerpc-prologue.exp: Use standard_output_file
7a6771
+	* gdb.arch/ppc64-symtab-cordic.exp: Likewise.
7a6771
+	* gdb.arch/vsx-regs.exp: Likewise.
7a6771
+
7a6771
 2016-10-07  Yao Qi  <yao.qi@linaro.org>
7a6771
 
7a6771
 	* gdb.xml/tdesc-regs.exp: Set regdir to "arm/".
7a6771
diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
7a6771
index 341ae02..0c74d7e 100644
7a6771
--- a/gdb/testsuite/gdb.arch/powerpc-prologue.exp
7a6771
+++ b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
7a6771
@@ -24,7 +24,7 @@ if {[istarget *-*-aix*] || ![istarget "powerpc-*-*"]} then {
7a6771
 
7a6771
 set testfile "powerpc-prologue"
7a6771
 set srcfile ${testfile}.c
7a6771
-set binfile ${objdir}/${subdir}/${testfile}
7a6771
+set binfile [standard_output_file ${testfile}]
7a6771
 
7a6771
 # Don't use "debug", so that we don't have line information for the assembly
7a6771
 # fragments.
7a6771
diff --git a/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp b/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
7a6771
index c8cb429..3fdc490 100644
7a6771
--- a/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
7a6771
+++ b/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
7a6771
@@ -21,9 +21,9 @@ if {![istarget "powerpc*"] || ![is_lp64_target]} {
7a6771
 standard_testfile
7a6771
 
7a6771
 set kobz2file ${srcdir}/${subdir}/cordic.ko.bz2
7a6771
-set kofile ${objdir}/${subdir}/cordic.ko
7a6771
+set kofile [standard_output_file cordic.ko]
7a6771
 set kodebugbz2file ${srcdir}/${subdir}/cordic.ko.debug.bz2
7a6771
-set kodebugfile ${objdir}/${subdir}/cordic.ko.debug
7a6771
+set kodebugfile [standard_output_file cordic.ko.debug]
7a6771
 
7a6771
 if {[catch "system \"bzip2 -dc ${kobz2file} >${kofile}\""] != 0} {
7a6771
     untested "failed bzip2 for ${kobz2file}"
7a6771
diff --git a/gdb/testsuite/gdb.arch/vsx-regs.exp b/gdb/testsuite/gdb.arch/vsx-regs.exp
7a6771
index 307f12a..31e58e6 100644
7a6771
--- a/gdb/testsuite/gdb.arch/vsx-regs.exp
7a6771
+++ b/gdb/testsuite/gdb.arch/vsx-regs.exp
7a6771
@@ -152,7 +152,7 @@ for {set i 0} {$i < 32} {incr i 1} {
7a6771
 # later when loading the core file (i.e., different register values for different
7a6771
 # vector register banks).
7a6771
 
7a6771
-set corefile "${objdir}/${subdir}/vsx-core.test"
7a6771
+set corefile [standard_output_file vsx-core.test]
7a6771
 set core_supported [gdb_gcore_cmd "$corefile" "Save a VSX-enabled corefile"]
7a6771
 
7a6771
 # Now run the F32~F63/VR0~VR31 tests.
7a6771
-- 
7a6771
2.7.4
7a6771
7a6771
7a6771
http://sourceware.org/ml/gdb-patches/2016-10/msg00268.html
7a6771
Subject: [testsuite obv] Fix gdb.arch/powerpc-prologue.c compilation
7a6771
7a6771
From: Jan Kratochvil <jan.kratochvil@redhat.com>
7a6771
Date: Tue, 11 Oct 2016 19:09:05 +0200
7a6771
Subject: [PATCH] testsuite: Fix gdb.arch/powerpc-prologue.c compilation
7a6771
Subject: [PATCH] testsuite: Fix gdb.arch/powerpc-prologue.c compilation
7a6771
7a6771
gcc-6.2.1
7a6771
7a6771
gdb compile failed, gdb/testsuite/gdb.arch/powerpc-prologue.c: In function 'main':
7a6771
gdb/testsuite/gdb.arch/powerpc-prologue.c:32:3: warning: implicit declaration of function 'optimized_1' [-Wimplicit-function-declaration]
7a6771
   optimized_1 ();
7a6771
   ^~~~~~~~~~~
7a6771
7a6771
gdb/testsuite/ChangeLog
7a6771
2016-10-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
7a6771
7a6771
	* gdb.arch/powerpc-prologue.c (optimized_1): New declaration.
7a6771
---
7a6771
 gdb/testsuite/ChangeLog                   | 4 ++++
7a6771
 gdb/testsuite/gdb.arch/powerpc-prologue.c | 1 +
7a6771
 2 files changed, 5 insertions(+)
7a6771
7a6771
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
7a6771
index b6ba0ec..b4ccd4a 100644
7a6771
### a/gdb/testsuite/ChangeLog
7a6771
### b/gdb/testsuite/ChangeLog
7a6771
## -1,5 +1,9 @@
7a6771
 2016-10-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
7a6771
 
7a6771
+	* gdb.arch/powerpc-prologue.c (optimized_1): New declaration.
7a6771
+
7a6771
+2016-10-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
7a6771
+
7a6771
 	* gdb.arch/powerpc-prologue.exp: Use standard_output_file
7a6771
 	* gdb.arch/ppc64-symtab-cordic.exp: Likewise.
7a6771
 	* gdb.arch/vsx-regs.exp: Likewise.
7a6771
diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue.c b/gdb/testsuite/gdb.arch/powerpc-prologue.c
7a6771
index 6c10dfc..a1b8065 100644
7a6771
--- a/gdb/testsuite/gdb.arch/powerpc-prologue.c
7a6771
+++ b/gdb/testsuite/gdb.arch/powerpc-prologue.c
7a6771
@@ -24,6 +24,7 @@
7a6771
 #endif
7a6771
 
7a6771
 void gdb2029 (void);
7a6771
+void optimized_1 (void);
7a6771
 
7a6771
 int
7a6771
 main (void)
7a6771
-- 
7a6771
2.7.4
99f0af
99f0af
99f0af
99f0af
http://sourceware.org/ml/gdb-patches/2016-10/msg00613.html
99f0af
Subject: [testsuite patch] Fix gcc_compiled for gcc 6 & 7
99f0af
99f0af
99f0af
--IS0zKkzwUGydFO0o
99f0af
Content-Type: text/plain; charset=us-ascii
99f0af
Content-Disposition: inline
99f0af
99f0af
Hi,
99f0af
99f0af
OK for check-in?
99f0af
99f0af
99f0af
Jan
99f0af
99f0af
--IS0zKkzwUGydFO0o
99f0af
Content-Type: text/plain; charset=us-ascii
99f0af
Content-Disposition: inline; filename=1
99f0af
99f0af
gdb/testsuite/ChangeLog
99f0af
2016-10-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
99f0af
99f0af
	* lib/gdb.exp (get_compiler_info): Generalize gcc_compile regexp.
99f0af
99f0af
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
99f0af
index 378eea0..7d9b198 100644
99f0af
--- a/gdb/testsuite/lib/gdb.exp
99f0af
+++ b/gdb/testsuite/lib/gdb.exp
99f0af
@@ -3290,12 +3290,8 @@ proc get_compiler_info {{arg ""}} {
99f0af
     }
99f0af
 
99f0af
     # Set the legacy symbols.
99f0af
-    set gcc_compiled     0
99f0af
-    if { [regexp "^gcc-1-" "$compiler_info" ] } { set gcc_compiled 1 }
99f0af
-    if { [regexp "^gcc-2-" "$compiler_info" ] } { set gcc_compiled 2 }
99f0af
-    if { [regexp "^gcc-3-" "$compiler_info" ] } { set gcc_compiled 3 }
99f0af
-    if { [regexp "^gcc-4-" "$compiler_info" ] } { set gcc_compiled 4 }
99f0af
-    if { [regexp "^gcc-5-" "$compiler_info" ] } { set gcc_compiled 5 }
99f0af
+    set gcc_compiled 0
99f0af
+    regexp "^gcc-(\[0-9\]+)-" "$compiler_info" matchall gcc_compiled
99f0af
 
99f0af
     # Log what happened.
99f0af
     verbose -log "get_compiler_info: $compiler_info"
99f0af
99f0af
--IS0zKkzwUGydFO0o--
99f0af
99f0af
99f0af
99f0af
http://sourceware.org/ml/gdb-patches/2017-02/msg00226.html
99f0af
Subject: [OB PATCH] Fix NULL pointer dereference
99f0af
99f0af
This commit fixes a segmentation fault on tab completion when
99f0af
certain debuginfo is installed:
99f0af
99f0af
  https://bugzilla.redhat.com/show_bug.cgi?id=1398387
99f0af
99f0af
gdb/ChangeLog:
99f0af
99f0af
	* symtab.c (add_symtab_completions): Prevent NULL pointer
99f0af
	dereference.
99f0af
---
99f0af
 gdb/ChangeLog | 5 +++++
99f0af
 gdb/symtab.c  | 3 +++
99f0af
 2 files changed, 8 insertions(+)
99f0af
99f0af
diff --git a/gdb/symtab.c b/gdb/symtab.c
99f0af
index 356f480..2c141e5 100644
99f0af
--- a/gdb/symtab.c
99f0af
+++ b/gdb/symtab.c
99f0af
@@ -5163,6 +5163,9 @@ add_symtab_completions (struct compunit_symtab *cust,
99f0af
   struct block_iterator iter;
99f0af
   int i;
99f0af
 
99f0af
+  if (cust == NULL)
99f0af
+    return;
99f0af
+
99f0af
   for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
99f0af
     {
99f0af
       QUIT;
99f0af
-- 
99f0af
1.8.3.1
99f0af
99f0af
99f0af
99f0af
commit 6e5d74e74756fafe59e8198c4cc462cf7c57e12c
99f0af
Author: Pedro Alves <palves@redhat.com>
99f0af
Date:   Wed Mar 8 11:41:35 2017 +0000
99f0af
99f0af
    Fix PR 21218: GDB dumps core when escaping newline in multi-line command
99f0af
    
99f0af
    With commit 3b12939dfc2399 ("Replace the sync_execution global with a
99f0af
    new enum prompt_state tristate"), GDB started aborting if you try
99f0af
    splitting an input line with a continuation char (backslash) while in
99f0af
    a multi-line command:
99f0af
    
99f0af
     (gdb) commands
99f0af
     Type commands for breakpoint(s) 1, one per line.
99f0af
     End with a line saying just "end".
99f0af
     >print \
99f0af
    
99f0af
     (gdb) 1      # note "(gdb)" incorrectly printed here.
99f0af
     >end
99f0af
    
99f0af
     readline: readline_callback_read_char() called with no handler!
99f0af
     $
99f0af
    
99f0af
    That abort is actually a symptom of an old problem introduced when
99f0af
    gdb_readline_wrapper was rewritten to use asynchronous readline, back
99f0af
    in 2007.  Note how the "(gdb)" prompt is printed above in the "(gdb)
99f0af
    1" line.  Clearly it shouldn't be there, but it already was before the
99f0af
    commit mentioned above.  Fixing that also fixes the readline abort
99f0af
    shown above.
99f0af
    
99f0af
    The problem starts when command_line_input passes a NULL prompt to
99f0af
    gdb_readline_wrapper when it finds previous incomplete input due to a
99f0af
    backslash, trying to fetch more input without printing another ">"
99f0af
    secondary prompt.  That itself should not be a problem, because
99f0af
    passing NULL to gdb_readline_wrapper has the same meaning as passing a
99f0af
    pointer to empty string, since gdb_readline_wrapper exposes the same
99f0af
    interface as 'readline(char *)'.  However, gdb_readline_wrapper passes
99f0af
    the prompt argument directly to display_gdb_prompt, and for the
99f0af
    latter, a NULL prompt argument has a different meaning - it requests
99f0af
    printing the primary prompt.
99f0af
    
99f0af
    Before commit 782a7b8ef9c096 (which rewrote gdb_readline_wrapper to
99f0af
    use asynchronous readline), GDB behaved like this:
99f0af
    
99f0af
     (gdb) commands
99f0af
     [....]
99f0af
     >print \
99f0af
     1
99f0af
     >end
99f0af
     (gdb)
99f0af
    
99f0af
    The above is what this commit restores GDB back to.
99f0af
    
99f0af
    New test included.
99f0af
    
99f0af
    gdb/ChangeLog:
99f0af
    2017-03-08  Pedro Alves  <palves@redhat.com>
99f0af
    
99f0af
            PR cli/21218
99f0af
            * top.c (gdb_readline_wrapper): Avoid passing NULL to
99f0af
            display_gdb_prompt.
99f0af
            (command_line_input): Add comment.
99f0af
    
99f0af
    gdb/testsuite/ChangeLog:
99f0af
    2017-03-08  Pedro Alves  <palves@redhat.com>
99f0af
                Jan Kratochvil  <jan.kratochvil@redhat.com>
99f0af
    
99f0af
            PR cli/21218
99f0af
            * gdb.base/commands.exp (backslash_in_multi_line_command_test):
99f0af
            New proc.
99f0af
            (top level): Call it.
99f0af
99f0af
### a/gdb/ChangeLog
99f0af
### b/gdb/ChangeLog
99f0af
## -1,5 +1,12 @@
99f0af
 2017-03-08  Pedro Alves  <palves@redhat.com>
99f0af
 
99f0af
+	PR cli/21218
99f0af
+	* top.c (gdb_readline_wrapper): Avoid passing NULL to
99f0af
+	display_gdb_prompt.
99f0af
+	(command_line_input): Add comment.
99f0af
+
99f0af
+2017-03-08  Pedro Alves  <palves@redhat.com>
99f0af
+
99f0af
 	PR tui/21216
99f0af
 	* tui/tui-file.c (tui_file::write): New.
99f0af
 	* tui/tui-file.h (tui_file): Override "write".
99f0af
### a/gdb/testsuite/ChangeLog
99f0af
### b/gdb/testsuite/ChangeLog
99f0af
## -1,4 +1,12 @@
99f0af
 2017-03-08  Pedro Alves  <palves@redhat.com>
99f0af
+	    Jan Kratochvil  <jan.kratochvil@redhat.com>
99f0af
+
99f0af
+	PR cli/21218
99f0af
+	* gdb.base/commands.exp (backslash_in_multi_line_command_test):
99f0af
+	New proc.
99f0af
+	(top level): Call it.
99f0af
+
99f0af
+2017-03-08  Pedro Alves  <palves@redhat.com>
99f0af
 
99f0af
 	PR tui/21216
99f0af
 	* gdb.tui/tui-nl-filtered-output.exp: New file.
99f0af
--- a/gdb/testsuite/gdb.base/commands.exp
99f0af
+++ b/gdb/testsuite/gdb.base/commands.exp
99f0af
@@ -759,6 +759,34 @@ proc redefine_backtrace_test {} {
99f0af
 	    "execute bt command in redefine_backtrace_test"
99f0af
 }
99f0af
 
99f0af
+# Test an input line split with a continuation character (backslash)
99f0af
+# while entering a multi-line command (in a secondary prompt).
99f0af
+
99f0af
+proc backslash_in_multi_line_command_test {} {
99f0af
+    gdb_breakpoint "main"
99f0af
+
99f0af
+    gdb_test_multiple "commands" "commands" {
99f0af
+	-re "End with a line saying just \"end\"\\.\r\n>$" {
99f0af
+	    pass "commands"
99f0af
+	}
99f0af
+    }
99f0af
+
99f0af
+    set test "input line split with backslash"
99f0af
+    send_gdb "print \\\nargc\n"
99f0af
+    gdb_test_multiple "" $test {
99f0af
+	-re "^print \\\\\r\nargc\r\n>$" {
99f0af
+	    pass $test
99f0af
+	}
99f0af
+    }
99f0af
+
99f0af
+    gdb_test_no_output "end"
99f0af
+
99f0af
+    # Input any command, just to be sure the readline state is sane.
99f0af
+    # In PR 21218, this would trigger the infamous:
99f0af
+    # readline: readline_callback_read_char() called with no handler!
99f0af
+    gdb_test "print 1" "" "run command"
99f0af
+}
99f0af
+
99f0af
 gdbvar_simple_if_test
99f0af
 gdbvar_simple_while_test
99f0af
 gdbvar_complex_if_while_test
99f0af
@@ -1027,5 +1055,6 @@ recursive_source_test
99f0af
 if_commands_test
99f0af
 error_clears_commands_left
99f0af
 redefine_hook_test
99f0af
+backslash_in_multi_line_command_test
99f0af
 # This one should come last, as it redefines "backtrace".
99f0af
 redefine_backtrace_test
99f0af
--- a/gdb/top.c
99f0af
+++ b/gdb/top.c
99f0af
@@ -1030,8 +1030,11 @@ gdb_readline_wrapper (const char *prompt)
99f0af
   if (cleanup->target_is_async_orig)
99f0af
     target_async (0);
99f0af
 
99f0af
-  /* Display our prompt and prevent double prompt display.  */
99f0af
-  display_gdb_prompt (prompt);
99f0af
+  /* Display our prompt and prevent double prompt display.  Don't pass
99f0af
+     down a NULL prompt, since that has special meaning for
99f0af
+     display_gdb_prompt -- it indicates a request to print the primary
99f0af
+     prompt, while we want a secondary prompt here.  */
99f0af
+  display_gdb_prompt (prompt != NULL ? prompt : "");
99f0af
   if (ui->command_editing)
99f0af
     rl_already_prompted = 1;
99f0af
 
99f0af
@@ -1307,6 +1310,9 @@ command_line_input (const char *prompt_arg, int repeat, char *annotation_suffix)
99f0af
       if (cmd != NULL)
99f0af
 	break;
99f0af
 
99f0af
+      /* Got partial input.  I.e., got a line that ends with a
99f0af
+	 continuation character (backslash).  Suppress printing the
99f0af
+	 prompt again.  */
99f0af
       prompt = NULL;
99f0af
     }
99f0af