Blob Blame History Raw
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'.

### 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
--- 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


commit f389f6fef76d7cf8e8beb7061edff2155c284898
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Oct 5 21:56:46 2016 +0200

    testsuite: Fix recent GCC FAIL: gdb.arch/i386-signal.exp
    
    gcc-6.2.1-2.fc24.x86_64
    
    (gdb) backtrace 10^M
    (gdb) FAIL: gdb.arch/i386-signal.exp: backtrace 10
    
    (gdb) disas/s
    Dump of assembler code for function main:
    .../gdb/testsuite/gdb.arch/i386-signal.c:
    30      {
       0x000000000040057f <+0>:     push   %rbp
       0x0000000000400580 <+1>:     mov    %rsp,%rbp
    31        setup ();
       0x0000000000400583 <+4>:     callq  0x400590 <setup>
    => 0x0000000000400588 <+9>:     mov    $0x0,%eax
    32      }
       0x000000000040058d <+14>:    pop    %rbp
       0x000000000040058e <+15>:    retq
    End of assembler dump.
    
    The .exp patch is an obvious typo fix I think.  The regex was written to
    accept "ADDR in main" and I find it OK as checking .debug_line validity is not
    the purpose of this testfile.
    
    gcc-4.8.5-11.el7.x86_64 did not put the 'mov $0x0,%eax' instruction there at
    all so there was no problem with .debug_line.
    
    gdb/testsuite/ChangeLog
    2016-10-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* gdb.arch/i386-signal.exp (backtrace 10): Fix #2 typo.

### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,3 +1,7 @@
+2016-10-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.arch/i386-signal.exp (backtrace 10): Fix #2 typo.
+
 2016-10-05  Yao Qi  <yao.qi@linaro.org>
 
 	* lib/gdb.exp (support_complex_tests): Return zero if
--- a/gdb/testsuite/gdb.arch/i386-signal.exp
+++ b/gdb/testsuite/gdb.arch/i386-signal.exp
@@ -35,6 +35,6 @@ gdb_load ${binfile}
 
 runto func
 gdb_test "backtrace 10" \
-    "#0  ($hex in )?func.*\r\n#1  <signal handler called>\r\n#2  ($hex in)?main.*"
+    "#0  ($hex in )?func.*\r\n#1  <signal handler called>\r\n#2  ($hex in )?main.*"
 
 gdb_test "finish" "Run till exit from \#0  func.*<signal handler called>"


commit 20c2c024c1e89e402a57e8c3577fb9777709d9a4
Author: Carl E. Love <carll@oc4738070240.ibm.com>
Date:   Fri Aug 19 11:06:38 2016 -0700

    Fix missing files for ld when test suite not compiled in the source directory
    
    This patch fixes an issues with six test suite expect files that do not
    run correctly when the test suite is not built in the source directory.  The
    issue is these tests are not using the current "standard_testfile" call
    but rather using the older set command to initialize the "testfile",
    "srcfile" and "binprefix" variables or are missing the set for the
    "binprefix" variable.
    
    -----------------------------------------------
    
    gdb/testsuite/ChangeLog
    
    2016-08-19  Carl Love  <cel@us.ibm.com>
    
    	* gdb.arch/altivec-regs.exp: Use standard_testfile instead of
    	maintaining separate logic for constructing the output path.
    	* gdb.arch/powerpc-d128-regs.exp: Likewise.
    	* gdb.arch/ppc-dfp.exp: Likewise.
    	* gdb.arch/ppc-fp.exp: Likewise.
    	* gdb.arch/vsx-regs.exp: Likewise.
    	* gdb.arch/altivec-abi.exp: Likewise, plus added local variable
    	binprefix for generating the additional binary files.

### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,3 +1,14 @@
+2016-08-19  Carl Love  <cel@us.ibm.com>
+
+	* gdb.arch/altivec-regs.exp: Use standard_testfile instead of
+	maintaining separate logic for constructing the output path.
+	* gdb.arch/powerpc-d128-regs.exp: Likewise.
+	* gdb.arch/ppc-dfp.exp: Likewise.
+	* gdb.arch/ppc-fp.exp: Likewise.
+	* gdb.arch/vsx-regs.exp: Likewise.
+	* gdb.arch/altivec-abi.exp: Likewise, plus added local variable
+	binprefix for generating the additional binary files.
+
 2016-08-19  Pedro Alves  <palves@redhat.com>
 
 	* gdb.trace/mi-trace-frame-collected.exp
--- a/gdb/testsuite/gdb.arch/altivec-abi.exp
+++ b/gdb/testsuite/gdb.arch/altivec-abi.exp
@@ -26,9 +26,7 @@ if {![istarget "powerpc*"] || [skip_altivec_tests]} then {
     return
 }
 
-set testfile "altivec-abi"
-set binfile ${objdir}/${subdir}/${testfile}
-set srcfile ${testfile}.c
+standard_testfile
 
 if [get_compiler_info] {
     warning "get_compiler failed"
@@ -146,6 +144,8 @@ proc altivec_abi_tests { extra_flags force_abi } {
 }
 
 if [test_compiler_info gcc*] {
+    set binprefix ${binfile}
+
     with_test_prefix "default ABI, auto" {
 	altivec_abi_tests  "additional_flags=-maltivec" "auto"
     }
@@ -156,23 +156,23 @@ if [test_compiler_info gcc*] {
 	# On 64-bit GNU/Linux with GCC 4.1 and 4.2, -mabi=no-altivec
 	# was broken, so skip those tests there.
 	if { ![is_lp64_target] || ![test_compiler_info "gcc-4-\[12\]-*"] } {
-	    set binfile ${objdir}/${subdir}/${testfile}-ge-ge
+	    set binfile ${binprefix}-ge-ge
 	    with_test_prefix "generic ABI, forced" {
 		altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "generic"
 	    }
 
-	    set binfile ${objdir}/${subdir}/${testfile}-ge-auto
+	    set binfile ${binprefix}-ge-auto
 	    with_test_prefix "generic ABI, auto" {
 		altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "auto"
 	    }
 	}
 
-	set binfile ${objdir}/${subdir}/${testfile}-av-av
+	set binfile ${binprefix}-av-av
 	with_test_prefix "AltiVec ABI, forced" {
 	    altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "altivec"
 	}
 
-	set binfile ${objdir}/${subdir}/${testfile}-av-auto
+	set binfile ${binprefix}-av-auto
 	with_test_prefix "AltiVec ABI, auto" {
 	    altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "auto"
 	}
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -27,9 +27,7 @@ if {![istarget "powerpc*"] || [skip_altivec_tests]} then {
     return
 }
 
-set testfile "altivec-regs"
-set binfile ${objdir}/${subdir}/${testfile}
-set srcfile ${testfile}.c
+standard_testfile
 
 set compile_flags {debug nowarnings}
 if [get_compiler_info] {
--- a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
@@ -25,9 +25,7 @@ if ![istarget "powerpc64*-*"] then {
     return
 }
 
-set testfile "powerpc-d128-regs"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {quiet debug}] != "" } {
      untested powerpc-d128-regs.exp
--- a/gdb/testsuite/gdb.arch/ppc-dfp.exp
+++ b/gdb/testsuite/gdb.arch/ppc-dfp.exp
@@ -21,9 +21,7 @@ if ![istarget "powerpc*"] then {
     return
 }
 
-set testfile "ppc-dfp"
-set binfile ${objdir}/${subdir}/${testfile}
-set srcfile ${testfile}.c
+standard_testfile
 
 if [get_compiler_info] {
     warning "get_compiler failed"
--- a/gdb/testsuite/gdb.arch/ppc-fp.exp
+++ b/gdb/testsuite/gdb.arch/ppc-fp.exp
@@ -21,9 +21,7 @@ if ![istarget "powerpc*"] then {
     return
 }
 
-set testfile "ppc-fp"
-set binfile ${objdir}/${subdir}/${testfile}
-set srcfile ${testfile}.c
+standard_testfile
 
 if [get_compiler_info] {
     warning "get_compiler failed"
--- a/gdb/testsuite/gdb.arch/vsx-regs.exp
+++ b/gdb/testsuite/gdb.arch/vsx-regs.exp
@@ -24,9 +24,7 @@ if {![istarget "powerpc*"] || [skip_vsx_tests]} then {
     return
 }
 
-set testfile "vsx-regs"
-set binfile ${objdir}/${subdir}/${testfile}
-set srcfile ${testfile}.c
+standard_testfile
 
 set compile_flags {debug nowarnings quiet}
 if [get_compiler_info] {


http://sourceware.org/ml/gdb-patches/2016-10/msg00258.html
Subject: [testsuite obv] Use standard_output_file

From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Tue, 11 Oct 2016 16:43:58 +0200
Subject: [PATCH] testsuite: Use standard_output_file
Subject: [PATCH] testsuite: Use standard_output_file

gdb/testsuite/ChangeLog
2016-10-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.arch/powerpc-prologue.exp: Use standard_output_file.
	* gdb.arch/ppc64-symtab-cordic.exp: Likewise.
	* gdb.arch/vsx-regs.exp: Likewise.
---
 gdb/testsuite/ChangeLog                        | 6 ++++++
 gdb/testsuite/gdb.arch/powerpc-prologue.exp    | 2 +-
 gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp | 4 ++--
 gdb/testsuite/gdb.arch/vsx-regs.exp            | 2 +-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 9c7df29..b6ba0ec 100644
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,3 +1,9 @@
+2016-10-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.arch/powerpc-prologue.exp: Use standard_output_file
+	* gdb.arch/ppc64-symtab-cordic.exp: Likewise.
+	* gdb.arch/vsx-regs.exp: Likewise.
+
 2016-10-07  Yao Qi  <yao.qi@linaro.org>
 
 	* gdb.xml/tdesc-regs.exp: Set regdir to "arm/".
diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
index 341ae02..0c74d7e 100644
--- a/gdb/testsuite/gdb.arch/powerpc-prologue.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
@@ -24,7 +24,7 @@ if {[istarget *-*-aix*] || ![istarget "powerpc-*-*"]} then {
 
 set testfile "powerpc-prologue"
 set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+set binfile [standard_output_file ${testfile}]
 
 # Don't use "debug", so that we don't have line information for the assembly
 # fragments.
diff --git a/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp b/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
index c8cb429..3fdc490 100644
--- a/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
+++ b/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
@@ -21,9 +21,9 @@ if {![istarget "powerpc*"] || ![is_lp64_target]} {
 standard_testfile
 
 set kobz2file ${srcdir}/${subdir}/cordic.ko.bz2
-set kofile ${objdir}/${subdir}/cordic.ko
+set kofile [standard_output_file cordic.ko]
 set kodebugbz2file ${srcdir}/${subdir}/cordic.ko.debug.bz2
-set kodebugfile ${objdir}/${subdir}/cordic.ko.debug
+set kodebugfile [standard_output_file cordic.ko.debug]
 
 if {[catch "system \"bzip2 -dc ${kobz2file} >${kofile}\""] != 0} {
     untested "failed bzip2 for ${kobz2file}"
diff --git a/gdb/testsuite/gdb.arch/vsx-regs.exp b/gdb/testsuite/gdb.arch/vsx-regs.exp
index 307f12a..31e58e6 100644
--- a/gdb/testsuite/gdb.arch/vsx-regs.exp
+++ b/gdb/testsuite/gdb.arch/vsx-regs.exp
@@ -152,7 +152,7 @@ for {set i 0} {$i < 32} {incr i 1} {
 # later when loading the core file (i.e., different register values for different
 # vector register banks).
 
-set corefile "${objdir}/${subdir}/vsx-core.test"
+set corefile [standard_output_file vsx-core.test]
 set core_supported [gdb_gcore_cmd "$corefile" "Save a VSX-enabled corefile"]
 
 # Now run the F32~F63/VR0~VR31 tests.
-- 
2.7.4


http://sourceware.org/ml/gdb-patches/2016-10/msg00268.html
Subject: [testsuite obv] Fix gdb.arch/powerpc-prologue.c compilation

From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Tue, 11 Oct 2016 19:09:05 +0200
Subject: [PATCH] testsuite: Fix gdb.arch/powerpc-prologue.c compilation
Subject: [PATCH] testsuite: Fix gdb.arch/powerpc-prologue.c compilation

gcc-6.2.1

gdb compile failed, gdb/testsuite/gdb.arch/powerpc-prologue.c: In function 'main':
gdb/testsuite/gdb.arch/powerpc-prologue.c:32:3: warning: implicit declaration of function 'optimized_1' [-Wimplicit-function-declaration]
   optimized_1 ();
   ^~~~~~~~~~~

gdb/testsuite/ChangeLog
2016-10-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.arch/powerpc-prologue.c (optimized_1): New declaration.
---
 gdb/testsuite/ChangeLog                   | 4 ++++
 gdb/testsuite/gdb.arch/powerpc-prologue.c | 1 +
 2 files changed, 5 insertions(+)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index b6ba0ec..b4ccd4a 100644
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,5 +1,9 @@
 2016-10-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
+	* gdb.arch/powerpc-prologue.c (optimized_1): New declaration.
+
+2016-10-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
 	* gdb.arch/powerpc-prologue.exp: Use standard_output_file
 	* gdb.arch/ppc64-symtab-cordic.exp: Likewise.
 	* gdb.arch/vsx-regs.exp: Likewise.
diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue.c b/gdb/testsuite/gdb.arch/powerpc-prologue.c
index 6c10dfc..a1b8065 100644
--- a/gdb/testsuite/gdb.arch/powerpc-prologue.c
+++ b/gdb/testsuite/gdb.arch/powerpc-prologue.c
@@ -24,6 +24,7 @@
 #endif
 
 void gdb2029 (void);
+void optimized_1 (void);
 
 int
 main (void)
-- 
2.7.4



http://sourceware.org/ml/gdb-patches/2016-10/msg00613.html
Subject: [testsuite patch] Fix gcc_compiled for gcc 6 & 7


--IS0zKkzwUGydFO0o
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

OK for check-in?


Jan

--IS0zKkzwUGydFO0o
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline; filename=1

gdb/testsuite/ChangeLog
2016-10-20  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* lib/gdb.exp (get_compiler_info): Generalize gcc_compile regexp.

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 378eea0..7d9b198 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3290,12 +3290,8 @@ proc get_compiler_info {{arg ""}} {
     }
 
     # Set the legacy symbols.
-    set gcc_compiled     0
-    if { [regexp "^gcc-1-" "$compiler_info" ] } { set gcc_compiled 1 }
-    if { [regexp "^gcc-2-" "$compiler_info" ] } { set gcc_compiled 2 }
-    if { [regexp "^gcc-3-" "$compiler_info" ] } { set gcc_compiled 3 }
-    if { [regexp "^gcc-4-" "$compiler_info" ] } { set gcc_compiled 4 }
-    if { [regexp "^gcc-5-" "$compiler_info" ] } { set gcc_compiled 5 }
+    set gcc_compiled 0
+    regexp "^gcc-(\[0-9\]+)-" "$compiler_info" matchall gcc_compiled
 
     # Log what happened.
     verbose -log "get_compiler_info: $compiler_info"

--IS0zKkzwUGydFO0o--



commit 1b7e3d2fb7036ce6f9d74e32dc052518f5cd45b6
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Feb 3 09:04:21 2017 +0000

    Fix compile time warning messages when compiling binutils with gcc 7.0.1.
    
            PR 21096
    bfd     * coffcode.h (coff_write_object_contents): Enlarge size of
            s_name_buf in order to avoid compile time warning about possible
            integer truncation.
            * elf32-nds32.c (nds32_elf_ex9_import_table): Mask off lower
            32-bits of insn value before printing into buffer.
    
    opcodes * aarch64-opc.c (print_register_list): Ensure that the register
            list index will fir into the tb buffer.
            (print_register_offset_address): Likewise.
            * tic6x-dis.c (print_insn_tic6x): Increase size of func_unit_buf.

### a/bfd/ChangeLog
### b/bfd/ChangeLog
## -1,3 +1,12 @@
+2017-02-03  Nick Clifton  <nickc@redhat.com>
+
+	PR 21096
+	* coffcode.h (coff_write_object_contents): Enlarge size of
+	s_name_buf in order to avoid compile time warning about possible
+	integer truncation.
+	* elf32-nds32.c (nds32_elf_ex9_import_table): Mask off lower
+	32-bits of insn value before printing into buffer.
+
 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
 
 	* elfxx-mips.c (mips_elf_hash_sort_data): Add
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -3755,7 +3755,9 @@ coff_write_object_contents (bfd * abfd)
 		 NUL-terminated.  We use a temporary buffer so that we can still
 		 sprintf all eight chars without splatting a terminating NUL
 		 over the first byte of the following member (s_paddr).  */
-	      char s_name_buf[SCNNMLEN + 1];
+	      /* PR 21096: The +20 is to stop a bogus warning from gcc7 about
+		 a possible buffer overflow.  */
+	      char s_name_buf[SCNNMLEN + 1 + 20];
 
 	      /* An inherent limitation of the /nnnnnnn notation used to indicate
 		 the offset of the long name in the string table is that we
@@ -3770,9 +3772,10 @@ coff_write_object_contents (bfd * abfd)
 		  return FALSE;
 		}
 
-	      /* snprintf not strictly necessary now we've verified the value
-		 has less than eight ASCII digits, but never mind.  */
-	      snprintf (s_name_buf, SCNNMLEN + 1, "/%lu", (unsigned long) string_size);
+	      /* We do not need to use snprintf here as we have already verfied
+		 that string_size is not too big, plus we have an overlarge
+		 buffer, just in case.  */
+	      sprintf (s_name_buf, "/%lu", (unsigned long) string_size);
 	      /* Then strncpy takes care of any padding for us.  */
 	      strncpy (section.s_name, s_name_buf, SCNNMLEN);
 	      string_size += len + 1;
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -14949,7 +14949,6 @@ nds32_elf_ex9_import_table (struct bfd_link_info *info)
 {
   int num = 0;
   bfd_byte *contents;
-  unsigned long insn;
   FILE *ex9_import_file;
   int update_ex9_table;
   struct elf_nds32_link_hash_table *table;
@@ -14963,6 +14962,7 @@ nds32_elf_ex9_import_table (struct bfd_link_info *info)
   /* Read instructions from the input file and build the list.  */
   while (!feof (ex9_import_file))
     {
+      unsigned long insn;
       char *code;
       struct elf_nds32_insn_times_entry *ptr;
       size_t nread;
@@ -14973,7 +14973,7 @@ nds32_elf_ex9_import_table (struct bfd_link_info *info)
 	break;
       insn = bfd_getb32 (contents);
       code = bfd_malloc (sizeof (char) * 9);
-      snprintf (code, 9, "%08lx", insn);
+      snprintf (code, 9, "%08lx", (insn & 0xffffffff));
       ptr = bfd_malloc (sizeof (struct elf_nds32_insn_times_entry));
       ptr->string = code;
       ptr->order = num;
### a/opcodes/ChangeLog
### b/opcodes/ChangeLog
## -1,3 +1,11 @@
+2017-02-03  Nick Clifton  <nickc@redhat.com>
+
+	PR 21096
+	* aarch64-opc.c (print_register_list): Ensure that the register
+	list index will fir into the tb buffer.
+	(print_register_offset_address): Likewise.
+	* tic6x-dis.c (print_insn_tic6x): Increase size of func_unit_buf.
+
 2017-01-27  Alexis Deruell  <alexis.deruelle@gmail.com>
 
 	PR 21056
--- a/opcodes/aarch64-opc.c
+++ b/opcodes/aarch64-opc.c
@@ -2865,7 +2865,8 @@ print_register_list (char *buf, size_t size, const aarch64_opnd_info *opnd,
 
   /* Prepare the index if any.  */
   if (opnd->reglist.has_index)
-    snprintf (tb, 8, "[%" PRIi64 "]", opnd->reglist.index);
+    /* PR 21096: The %100 is to silence a warning about possible truncation.  */
+    snprintf (tb, 8, "[%" PRIi64 "]", (opnd->reglist.index % 100));
   else
     tb[0] = '\0';
 
@@ -2344,7 +2344,9 @@ print_register_offset_address (char *buf
   if (print_extend_p)
     {
       if (print_amount_p)
-	snprintf (tb, sizeof (tb), ",%s #%d", shift_name, opnd->shifter.amount);
+	snprintf (tb, sizeof (tb), ",%s #%d", shift_name,
+  /* PR 21096: The %100 is to silence a warning about possible truncation.  */
+		  (opnd->shifter.amount % 100));
       else
 	snprintf (tb, sizeof (tb), ",%s", shift_name);
     }
--- a/opcodes/tic6x-dis.c
+++ b/opcodes/tic6x-dis.c
@@ -316,7 +316,7 @@ print_insn_tic6x (bfd_vma addr, struct disassemble_info *info)
       const char *parallel;
       const char *cond = "";
       const char *func_unit;
-      char func_unit_buf[7];
+      char func_unit_buf[8];
       unsigned int func_unit_side = 0;
       unsigned int func_unit_data_side = 0;
       unsigned int func_unit_cross = 0;
@@ -703,8 +703,9 @@ print_insn_tic6x (bfd_vma addr, struct disassemble_info *info)
 	  if (opc->flags & TIC6X_FLAG_INSN16_BSIDE && func_unit_side == 1)
 	      func_unit_cross = 1;
 
-	  snprintf (func_unit_buf, 7, " .%c%u%s%s", func_unit_char,
-		    func_unit_side, (func_unit_cross ? "X" : ""), data_str);
+	  snprintf (func_unit_buf, sizeof func_unit_buf, " .%c%u%s%s",
+		    func_unit_char, func_unit_side,
+		    (func_unit_cross ? "X" : ""), data_str);
 	  func_unit = func_unit_buf;
 	}
 



commit db7b55faa1a11e632ddf57505c9bb64bc783471a
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Dec 16 10:59:36 2016 +0000

    Fix compile time warning building arm-dis.c

### a/opcodes/ChangeLog
### b/opcodes/ChangeLog
## -1,3 +1,8 @@
+2016-12-16  Nick Clifton  <nickc@redhat.com>
+
+	* arm-dis.c (print_insn_thumb32): Fix compile time warning
+	computing value_in_comment.
+
 2016-12-14  Maciej W. Rozycki  <macro@imgtec.com>
 
 	* mips-dis.c (mips_convert_abiflags_ases): New function.
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -5759,7 +5759,7 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given)
 		      if (off || !U)
 			{
 			  func (stream, ", #%c%u", U ? '+' : '-', off * 4);
-			  value_in_comment = off * 4 * U ? 1 : -1;
+			  value_in_comment = (off && U) ? 1 : -1;
 			}
 		      func (stream, "]");
 		      if (W)
@@ -5771,7 +5771,7 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given)
 		      if (W)
 			{
 			  func (stream, "#%c%u", U ? '+' : '-', off * 4);
-			  value_in_comment = off * 4 * U ? 1 : -1;
+			  value_in_comment = (off && U) ? 1 : -1;
 			}
 		      else
 			{



commit 97e64e5ab19dbf6a9babd711e8deec5545520954
Author: Yao Qi <yao.qi@linaro.org>
Date:   Fri Sep 23 17:27:26 2016 +0100

    Replace sprintf with xsnprintf in nat/linux-osdata.c
    
    I see the following build warning when I build GDB with GCC trunk.
    
    ../../binutils-gdb/gdb/nat/linux-osdata.c: In function ‘LONGEST linux_xfer_osdata_fds(gdb_byte*, ULONGEST, ULONGEST)’:
    ../../binutils-gdb/gdb/nat/linux-osdata.c:767:1: error: ‘%s’ directive writing between 0 and 255 bytes into a region of size 11 [-Werror=format-length=]
     linux_xfer_osdata_fds (gdb_byte *readbuf,
     ^~~~~~~~~~~~~~~~~~~~~
    ../../binutils-gdb/gdb/nat/linux-osdata.c:800:51: note: format output between 7 and 262 bytes into a destination of size 17
            sprintf (procentry, "/proc/%s", dp->d_name);
                                                       ^
    ../../binutils-gdb/gdb/nat/linux-osdata.c: In function ‘LONGEST linux_xfer_osdata_threads(gdb_byte*, ULONGEST, ULONGEST)’:
    ../../binutils-gdb/gdb/nat/linux-osdata.c:555:1: error: ‘%s’ directive writing between 0 and 255 bytes into a region of size 11 [-Werror=format-length=]
     linux_xfer_osdata_threads (gdb_byte *readbuf,
     ^~~~~~~~~~~~~~~~~~~~~~~~~
    ../../binutils-gdb/gdb/nat/linux-osdata.c:588:51: note: format output between 7 and 262 bytes into a destination of size 17
            sprintf (procentry, "/proc/%s", dp->d_name);
                                                       ^
    cc1plus: all warnings being treated as errors
    
    The warning is a false positive, but we can workaround it by replacing
    sprintf with xsnprintf.  On the other hand, it is always preferred to
    use xsnprintf.
    
    gdb:
    
    2016-09-23  Yao Qi  <yao.qi@linaro.org>
    
            * nat/linux-osdata.c (linux_xfer_osdata_threads): Replace
            sprintf with xsnprintf.
            (linux_xfer_osdata_fds): Likewise.

### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,9 @@
+2016-09-23  Yao Qi  <yao.qi@linaro.org>
+
+	* nat/linux-osdata.c (linux_xfer_osdata_threads): Replace
+	sprintf with xsnprintf.
+	(linux_xfer_osdata_fds): Likewise.
+
 2016-09-23  Pedro Alves  <palves@redhat.com>
 
 	* Makefile.in (SFILES): Add common/new-op.c.
--- a/gdb/nat/linux-osdata.c
+++ b/gdb/nat/linux-osdata.c
@@ -585,7 +585,8 @@ linux_xfer_osdata_threads (gdb_byte *readbuf,
 		  || NAMELEN (dp) > sizeof ("4294967295") - 1)
 		continue;
 
-	      sprintf (procentry, "/proc/%s", dp->d_name);
+	      xsnprintf (procentry, sizeof (procentry), "/proc/%s",
+			 dp->d_name);
 	      if (stat (procentry, &statbuf) == 0
 		  && S_ISDIR (statbuf.st_mode))
 		{
@@ -797,7 +798,8 @@ linux_xfer_osdata_fds (gdb_byte *readbuf,
 		  || NAMELEN (dp) > sizeof ("4294967295") - 1)
 		continue;
 
-	      sprintf (procentry, "/proc/%s", dp->d_name);
+	      xsnprintf (procentry, sizeof (procentry), "/proc/%s",
+			 dp->d_name);
 	      if (stat (procentry, &statbuf) == 0
 		  && S_ISDIR (statbuf.st_mode))
 		{



http://sourceware.org/ml/gdb-patches/2017-02/msg00226.html
Subject: [OB PATCH] Fix NULL pointer dereference

This commit fixes a segmentation fault on tab completion when
certain debuginfo is installed:

  https://bugzilla.redhat.com/show_bug.cgi?id=1398387

gdb/ChangeLog:

	* symtab.c (add_symtab_completions): Prevent NULL pointer
	dereference.
---
 gdb/ChangeLog | 5 +++++
 gdb/symtab.c  | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/gdb/symtab.c b/gdb/symtab.c
index 356f480..2c141e5 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -5163,6 +5163,9 @@ add_symtab_completions (struct compunit_symtab *cust,
   struct block_iterator iter;
   int i;
 
+  if (cust == NULL)
+    return;
+
   for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
     {
       QUIT;
-- 
1.8.3.1