[patch+8.1] Fix -D_GLIBCXX_DEBUG gdb-add-index regression

Message ID cd1a0a8e-6b5e-ed16-e170-ebb2abddefab@ericsson.com
State New, archived
Headers

Commit Message

Simon Marchi April 12, 2018, 7:21 p.m. UTC
  Hi Jan,

Sorry I missed this patch, but found out about it from your bug report.

On 2018-02-04 02:37 PM, Jan Kratochvil wrote:
> Hi,
> 
> gdb: Out-of-bounds vector access while running gdb-add-index
> https://bugzilla.redhat.com/show_bug.cgi?id=1540559
> 
> Fedora Rawhide started to use -D_GLIBCXX_DEBUG which made gdb-add-index
> failing.
> 
> /usr/include/c++/7/debug/safe_iterator.h:270:
> Error: attempt to dereference a past-the-end iterator.
> Objects involved in the operation:
>     iterator "this" @ 0x0x7fffffffcb90 {
>       type = __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<unsigned char*, std::__cxx1998::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > >, std::__debug::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > > (mutable iterator);
>       state = past-the-end;
>       references sequence with type 'std::__debug::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > >' @ 0x0x7fffffffcc50
>     }
> 
> /usr/include/c++/7/debug/vector:417:
> Error: attempt to subscript container with out-of-bounds index 556, but
> container only holds 556 elements.
> Objects involved in the operation:
>     sequence "this" @ 0x0x2e87af8 {
>       type = std::__debug::vector<partial_symbol*, std::allocator<partial_symbol*> >;
>     }
> 
> I do not know if anyone regression-tests GDB with -D_GLIBCXX_DEBUG,
> I have just checked -D_GLIBCXX_DEBUG run against gdb-add-index.

I didn't know about this before you reported those bugs.  I've added it to my
build, and suggested to Sergio that we add it to the buildbot.

> The two -D_GLIBCXX_DEBUG regressions were made by:
> 
> commit bc8f2430e08cc2a520db49a42686e0529be4a3bc
> Author: Jan Kratochvil <jan.kratochvil@redhat.com>
> Date:   Mon Jun 12 16:29:53 2017 +0100
>     Code cleanup: C++ify .gdb_index producer
> 
> commit af5bf4ada48ff65b6658be1fab8f9c8f8ab5f319
> Author: Simon Marchi <simon.marchi@ericsson.com>
> Date:   Sat Oct 14 08:06:29 2017 -0400
>     Replace psymbol_allocation_list with std::vector
> 
> No regressions on {x86_64,x86_64-m32,i686}-fedorarawhide-linux-gnu.
> 
> OK for check-in?

LGTM.  But that code has moved to dwarf-index-write.c, and I feel bad
because your patch was posted way before the move.  So I adjusted it
to save you a bit of time (please make sure I didn't mess up anything).


From 0f437317476d4eacf220c03f58baaf595a5c0cee Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Sun, 4 Feb 2018 20:37:54 +0100
Subject: [PATCH] Fix -D_GLIBCXX_DEBUG gdb-add-index regression

Hi,

gdb: Out-of-bounds vector access while running gdb-add-index
https://bugzilla.redhat.com/show_bug.cgi?id=1540559

Fedora Rawhide started to use -D_GLIBCXX_DEBUG which made gdb-add-index
failing.

/usr/include/c++/7/debug/safe_iterator.h:270:
Error: attempt to dereference a past-the-end iterator.
Objects involved in the operation:
    iterator "this" @ 0x0x7fffffffcb90 {
      type = __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<unsigned char*, std::__cxx1998::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > >, std::__debug::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > > (mutable iterator);
      state = past-the-end;
      references sequence with type 'std::__debug::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > >' @ 0x0x7fffffffcc50
    }

/usr/include/c++/7/debug/vector:417:
Error: attempt to subscript container with out-of-bounds index 556, but
container only holds 556 elements.
Objects involved in the operation:
    sequence "this" @ 0x0x2e87af8 {
      type = std::__debug::vector<partial_symbol*, std::allocator<partial_symbol*> >;
    }

I do not know if anyone regression-tests GDB with -D_GLIBCXX_DEBUG,
I have just checked -D_GLIBCXX_DEBUG run against gdb-add-index.

The two -D_GLIBCXX_DEBUG regressions were made by:

commit bc8f2430e08cc2a520db49a42686e0529be4a3bc
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Jun 12 16:29:53 2017 +0100
    Code cleanup: C++ify .gdb_index producer

commit af5bf4ada48ff65b6658be1fab8f9c8f8ab5f319
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Sat Oct 14 08:06:29 2017 -0400
    Replace psymbol_allocation_list with std::vector

No regressions on {x86_64,x86_64-m32,i686}-fedorarawhide-linux-gnu.

OK for check-in?

Jan

gdb/ChangeLog
2018-02-04  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* dwarf2read.c (data_buf::grow) (write_one_signatured_type)
	(recursively_write_psymbols) (debug_names::recursively_write_psymbols)
	(debug_names::write_one_signatured_type): Fix -D_GLIBCXX_DEBUG
	regression.
---
 gdb/dwarf-index-write.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
  

Comments

Sergio Durigan Junior April 12, 2018, 7:41 p.m. UTC | #1
On Thursday, April 12 2018, Simon Marchi wrote:

> On 2018-02-04 02:37 PM, Jan Kratochvil wrote:
>> 
>> I do not know if anyone regression-tests GDB with -D_GLIBCXX_DEBUG,
>> I have just checked -D_GLIBCXX_DEBUG run against gdb-add-index.
>
> I didn't know about this before you reported those bugs.  I've added it to my
> build, and suggested to Sergio that we add it to the buildbot.

I've just enabled this flag on all existing builders.

Thanks,
  
Jan Kratochvil April 12, 2018, 8:37 p.m. UTC | #2
On Thu, 12 Apr 2018 21:41:53 +0200, Sergio Durigan Junior wrote:
> I've just enabled this flag on all existing builders.

Which broke the buildbot as there is a typo:
	-D_GLIBCXX_DEBUG-m32


Jan
Unfortunately it seems that there is a breakage on GDB.

Commit title: 'Fix -D_GLIBCXX_DEBUG gdb-add-index regression'
Revision: b4be9bfdabb57f40656e72a50a8466af4f7bd37d

You can find more details below:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Buildslave:
	fedora-x86-64-4

Full Build URL:
	<http://gdb-build.sergiodj.net/builders/Fedora-i686/builds/9358>

Commit(s) tested:
	b4be9bfdabb57f40656e72a50a8466af4f7bd37d

Author(s) (in the same order as the commits):
	Jan Kratochvil <jan.kratochvil@redhat.com>

Subject:
	Fix -D_GLIBCXX_DEBUG gdb-add-index regression

Testsuite log (gdb.sum and gdb.log) URL(s):
	<http://gdb-build.sergiodj.net/results/Fedora-i686/b4/b4be9bfdabb57f40656e72a50a8466af4f7bd37d/>

*** Failed to compiled GDB.  ***
============================

+++ The full log is too big to be posted here.
+++ These are the last 100 lines of it.

  && rm -f $file && PATH=../src:$PATH /usr/bin/msgfmt -o $file ../../../binutils-gdb/bfd/po/id.po
file=`echo ../../../binutils-gdb/bfd/po/ja | sed 's,.*/,,'`.gmo \
  && rm -f $file && PATH=../src:$PATH /usr/bin/msgfmt -o $file ../../../binutils-gdb/bfd/po/ja.po
file=`echo ../../../binutils-gdb/bfd/po/ro | sed 's,.*/,,'`.gmo \
  && rm -f $file && PATH=../src:$PATH /usr/bin/msgfmt -o $file ../../../binutils-gdb/bfd/po/ro.po
file=`echo ../../../binutils-gdb/bfd/po/ru | sed 's,.*/,,'`.gmo \
  && rm -f $file && PATH=../src:$PATH /usr/bin/msgfmt -o $file ../../../binutils-gdb/bfd/po/ru.po
file=`echo ../../../binutils-gdb/bfd/po/rw | sed 's,.*/,,'`.gmo \
  && rm -f $file && PATH=../src:$PATH /usr/bin/msgfmt -o $file ../../../binutils-gdb/bfd/po/rw.po
file=`echo ../../../binutils-gdb/bfd/po/sr | sed 's,.*/,,'`.gmo \
  && rm -f $file && PATH=../src:$PATH /usr/bin/msgfmt -o $file ../../../binutils-gdb/bfd/po/sr.po
file=`echo ../../../binutils-gdb/bfd/po/sv | sed 's,.*/,,'`.gmo \
  && rm -f $file && PATH=../src:$PATH /usr/bin/msgfmt -o $file ../../../binutils-gdb/bfd/po/sv.po
file=`echo ../../../binutils-gdb/bfd/po/tr | sed 's,.*/,,'`.gmo \
  && rm -f $file && PATH=../src:$PATH /usr/bin/msgfmt -o $file ../../../binutils-gdb/bfd/po/tr.po
file=`echo ../../../binutils-gdb/bfd/po/uk | sed 's,.*/,,'`.gmo \
  && rm -f $file && PATH=../src:$PATH /usr/bin/msgfmt -o $file ../../../binutils-gdb/bfd/po/uk.po
file=`echo ../../../binutils-gdb/bfd/po/vi | sed 's,.*/,,'`.gmo \
  && rm -f $file && PATH=../src:$PATH /usr/bin/msgfmt -o $file ../../../binutils-gdb/bfd/po/vi.po
file=`echo ../../../binutils-gdb/bfd/po/zh_CN | sed 's,.*/,,'`.gmo \
  && rm -f $file && PATH=../src:$PATH /usr/bin/msgfmt -o $file ../../../binutils-gdb/bfd/po/zh_CN.po
make[4]: Leaving directory '/home/gdb-buildbot-2/fedora-x86-64-4/fedora-i686/build/bfd/po'
make[4]: Entering directory '/home/gdb-buildbot-2/fedora-x86-64-4/fedora-i686/build/bfd'
rm -f bfd-tmp.h
cp bfd-in3.h bfd-tmp.h
/bin/sh ../../binutils-gdb/bfd/../move-if-change bfd-tmp.h bfd.h
rm -f peigen.c
rm -f pex64igen.c
rm -f bfd-tmp.h
/usr/bin/sed -e s/XX/pe/g < ../../binutils-gdb/bfd/peXXigen.c > peigen.new
/usr/bin/sed -e s/XX/pex64/g < ../../binutils-gdb/bfd/peXXigen.c > pex64igen.new
touch stmp-bfd-h
rm -f elf32-aarch64.c
mv -f peigen.new peigen.c
mv -f pex64igen.new pex64igen.c
echo "#line 1 \"../../binutils-gdb/bfd/elfnn-aarch64.c\"" > elf32-aarch64.new
rm -f elf64-aarch64.c
/usr/bin/sed -e s/NN/32/g < ../../binutils-gdb/bfd/elfnn-aarch64.c >> elf32-aarch64.new
echo "#line 1 \"../../binutils-gdb/bfd/elfnn-aarch64.c\"" > elf64-aarch64.new
rm -f elf32-ia64.c
/usr/bin/sed -e s/NN/64/g < ../../binutils-gdb/bfd/elfnn-aarch64.c >> elf64-aarch64.new
/usr/bin/sed -e s/NN/32/g < ../../binutils-gdb/bfd/elfnn-ia64.c > elf32-ia64.new
rm -f elf64-ia64.c
/usr/bin/sed -e s/NN/64/g < ../../binutils-gdb/bfd/elfnn-ia64.c > elf64-ia64.new
mv -f elf32-ia64.new elf32-ia64.c
mv -f elf32-aarch64.new elf32-aarch64.c
rm -f elf32-riscv.c
mv -f elf64-aarch64.new elf64-aarch64.c
mv -f elf64-ia64.new elf64-ia64.c
echo "#line 1 \"../../binutils-gdb/bfd/elfnn-riscv.c\"" > elf32-riscv.new
rm -f elf64-riscv.c
sed -e s/NN/32/g < ../../binutils-gdb/bfd/elfnn-riscv.c >> elf32-riscv.new
echo "#line 1 \"../../binutils-gdb/bfd/elfnn-riscv.c\"" > elf64-riscv.new
rm -f pepigen.c
sed -e s/NN/64/g < ../../binutils-gdb/bfd/elfnn-riscv.c >> elf64-riscv.new
/usr/bin/sed -e s/XX/pep/g < ../../binutils-gdb/bfd/peXXigen.c > pepigen.new
rm -f tofiles
f=""; \
for i in elf32-i386.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-properties.lo elf-eh-frame.lo dwarf1.lo dwarf2.lo i386linux.lo aout32.lo pei-i386.lo peigen.lo cofflink.lo coffgen.lo elf64-x86-64.lo elf64.lo pei-x86_64.lo pex64igen.lo elf64-gen.lo elf32-gen.lo plugin.lo elf32-aarch64.lo elf64-aarch64.lo elfxx-aarch64.lo aix5ppc-core.lo aout64.lo coff-alpha.lo coff-x86_64.lo coff64-rs6000.lo demo64.lo elf32-ia64.lo elf32-mips.lo elf32-score.lo elf32-score7.lo elf64-alpha.lo elf64-gen.lo elf64-hppa.lo elf64-ia64.lo elf64-ia64-vms.lo elfxx-ia64.lo elfn32-mips.lo elf64-mips.lo elfxx-mips.lo elf64-mmix.lo elf64-ppc.lo elf32-riscv.lo elf64-riscv.lo elfxx-riscv.lo elf64-s390.lo elf64-sh64.lo elf64-sparc.lo elf64-tilegx.lo elf64-x86-64.lo elfxx-x86.lo elf64.lo mach-o-aarch64.lo mach-o-x86-64.lo mmo.lo nlm32-alpha.lo nlm64.lo pe-x86_64.lo pei-ia64.lo pei-x86_64.lo pepigen.lo pex64igen.lo vms-alpha.lo aout-arm.lo aout-cris.lo
  aout-ns32k.lo aout-sparcle.lo aout-tic30.lo aout0.lo aout32.lo armnetbsd.lo cf-i386lynx.lo cf-sparclynx.lo coff-apollo.lo coff-arm.lo coff-aux.lo coff-go32.lo coff-h8300.lo coff-h8500.lo coff-i386.lo coff-m68k.lo coff-m88k.lo coff-mips.lo coff-rs6000.lo coff-sh.lo coff-sparc.lo coff-stgo32.lo coff-svm68k.lo coff-tic30.lo coff-tic4x.lo coff-tic54x.lo coff-tic80.lo coff-u68k.lo coff-w65.lo coff-we32k.lo coff-z80.lo coff-z8k.lo coffgen.lo cofflink.lo dwarf1.lo dwarf2.lo ecoff.lo ecofflink.lo elf-attrs.lo elf-eh-frame.lo elf-ifunc.lo elf-m10200.lo elf-m10300.lo elf-nacl.lo elf-properties.lo elf-strtab.lo elf-vxworks.lo elf.lo elf32-am33lin.lo elf32-arc.lo elf32-arm.lo elf32-avr.lo elf32-bfin.lo elf32-cr16.lo elf32-cr16c.lo elf32-cris.lo elf32-crx.lo elf32-d10v.lo elf32-d30v.lo elf32-dlx.lo elf32-epiphany.lo elf32-fr30.lo elf32-frv.lo elf32-ft32.lo elf32-gen.lo elf32-h8300.lo elf32-hppa.lo elf32-i370.lo elf32-i386.lo elfxx-x86.lo elf32-ip2k.lo elf32-iq2000.lo elf32-lm32.lo elf32-m32c.lo
  elf32-m32r.lo elf32-m68hc11.lo elf32-m68hc12.lo elf32-m68hc1x.lo elf32-m68k.lo elf32-m88k.lo elf32-mcore.lo elf32-mep.lo elf32-metag.lo elf32-microblaze.lo elf32-moxie.lo elf32-msp430.lo elf32-mt.lo elf32-nds32.lo elf32-nios2.lo elf32-or1k.lo elf32-pj.lo elf32-ppc.lo elf32-pru.lo elf32-rl78.lo elf32-rx.lo elf32-s390.lo elf32-sh-symbian.lo elf32-sh.lo elf32-sh64-com.lo elf32-sh64.lo elf32-sparc.lo elf32-spu.lo elf32-tic6x.lo elf32-tilegx.lo elf32-tilepro.lo elf32-v850.lo elf32-vax.lo elf32-visium.lo elf32-wasm32.lo elf32-xc16x.lo elf32-xgate.lo elf32-xstormy16.lo elf32-xtensa.lo elf32.lo elflink.lo elfxx-sparc.lo elfxx-tilegx.lo epoc-pe-arm.lo epoc-pei-arm.lo hp300bsd.lo hp300hpux.lo i386aout.lo i386bsd.lo i386dynix.lo i386freebsd.lo i386linux.lo i386lynx.lo i386mach3.lo i386msdos.lo i386netbsd.lo i386os9k.lo ieee.lo m68k4knetbsd.lo m68klinux.lo m68knetbsd.lo m88kmach3.lo m88kopenbsd.lo mach-o.lo mach-o-i386.lo mach-o-arm.lo mipsbsd.lo newsos3.lo nlm.lo nlm32-i386.lo nlm32-ppc.lo nl
 m32-sparc.lo nlm32.lo ns32knetbsd.lo oasys.lo pc532-mach.lo pdp11.lo pe-arm-wince.lo pe-arm.lo pe-i386.lo pe-mcore.lo pe-mips.lo pe-ppc.lo pe-sh.lo pef.lo pei-arm-wince.lo pei-arm.lo pei-i386.lo pei-mcore.lo pei-mips.lo pei-ppc.lo pei-sh.lo peigen.lo plugin.lo ppcboot.lo reloc16.lo riscix.lo som.lo sparclinux.lo sparclynx.lo sparcnetbsd.lo sunos.lo vax1knetbsd.lo vaxbsd.lo vaxnetbsd.lo versados.lo vms-lib.lo vms-misc.lo wasm-module.lo xcofflink.lo xsym.lo xtensa-isa.lo xtensa-modules.lo cpu-i386.lo cpu-iamcu.lo cpu-l1om.lo cpu-k1om.lo cpu-plugin.lo cpu-aarch64.lo cpu-alpha.lo cpu-arc.lo cpu-arm.lo cpu-avr.lo cpu-bfin.lo cpu-cr16.lo cpu-cr16c.lo cpu-cris.lo cpu-crx.lo cpu-d10v.lo cpu-d30v.lo cpu-dlx.lo cpu-epiphany.lo cpu-fr30.lo cpu-frv.lo cpu-ft32.lo cpu-h8300.lo cpu-h8500.lo cpu-hppa.lo cpu-i370.lo cpu-i386.lo cpu-iamcu.lo cpu-l1om.lo cpu-k1om.lo cpu-ia64.lo cpu-ip2k.lo cpu-iq2000.lo cpu-lm32.lo cpu-m10200.lo cpu-m10300.lo cpu-m32c.lo cpu-m32r.lo cpu-m68hc11.lo cpu-m68hc12.lo cpu-
 m9s12x.lo cpu-m9s12xg.lo cpu-m68k.lo cpu-m88k.lo cpu-mcore.lo cpu-mep.lo cpu-metag.lo cpu-microblaze.lo cpu-mips.lo cpu-mmix.lo cpu-moxie.lo cpu-msp430.lo cpu-mt.lo cpu-nds32.lo cpu-nios2.lo cpu-ns32k.lo cpu-or1k.lo cpu-pdp11.lo cpu-pj.lo cpu-plugin.lo cpu-powerpc.lo cpu-pru.lo cpu-rs6000.lo cpu-riscv.lo cpu-rl78.lo cpu-rx.lo cpu-s390.lo cpu-score.lo cpu-sh.lo cpu-sparc.lo cpu-spu.lo cpu-tic30.lo cpu-tic4x.lo cpu-tic54x.lo cpu-tic6x.lo cpu-tic80.lo cpu-tilegx.lo cpu-tilepro.lo cpu-v850.lo cpu-v850_rh850.lo cpu-vax.lo cpu-visium.lo cpu-w65.lo cpu-wasm32.lo cpu-we32k.lo cpu-xc16x.lo cpu-xgate.lo cpu-xstormy16.lo cpu-xtensa.lo cpu-z80.lo cpu-z8k.lo trad-core.lo archive64.lo ; do \
  case " $f " in \
    *" $i "*) ;; \
    *) f="$f $i" ;; \
  esac ; \
done ; \
echo $f > tofiles
mv -f pepigen.new pepigen.c
/bin/sh ./libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../binutils-gdb/bfd -DTRAD_CORE    -I. -I../../binutils-gdb/bfd -I../../binutils-gdb/bfd/../include  -DHAVE_all_vecs  -DBINDIR='"/usr/local/bin"'  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I../../binutils-gdb/bfd/../zlib -D_GLIBCXX_DEBUG-m32 -MT archive.lo -MD -MP -MF .deps/archive.Tpo -c -o archive.lo ../../binutils-gdb/bfd/archive.c
mv -f elf32-riscv.new elf32-riscv.c
mv -f elf64-riscv.new elf64-riscv.c
/bin/sh ./libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../binutils-gdb/bfd -DTRAD_CORE    -I. -I../../binutils-gdb/bfd -I../../binutils-gdb/bfd/../include  -DHAVE_all_vecs  -DBINDIR='"/usr/local/bin"'  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I../../binutils-gdb/bfd/../zlib -D_GLIBCXX_DEBUG-m32 -MT archures.lo -MD -MP -MF .deps/archures.Tpo -c -o archures.lo -DDEFAULT_VECTOR=i386_elf32_vec -DASSOCIATED_VECS='&i386_elf32_vec,&iamcu_elf32_vec,&i386_aout_linux_vec,&i386_pei_vec,&x86_64_elf64_vec,&x86_64_elf32_vec,&x86_64_pei_vec,&l1om_elf64_vec,&k1om_elf64_vec,&elf64_le_vec,&elf64_be_vec,&elf32_le_vec,&elf32_be_vec' ../../binutils-gdb/bfd/archures.c
/bin/sh ./libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../binutils-gdb/bfd -DTRAD_CORE    -I. -I../../binutils-gdb/bfd -I../../binutils-gdb/bfd/../include  -DHAVE_all_vecs  -DBINDIR='"/usr/local/bin"'  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I../../binutils-gdb/bfd/../zlib -D_GLIBCXX_DEBUG-m32 -MT bfd.lo -MD -MP -MF .deps/bfd.Tpo -c -o bfd.lo ../../binutils-gdb/bfd/bfd.c
/bin/sh ../../binutils-gdb/bfd/../move-if-change tofiles ofiles
touch stamp-ofiles
/bin/sh ./libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../binutils-gdb/bfd -DTRAD_CORE    -I. -I../../binutils-gdb/bfd -I../../binutils-gdb/bfd/../include  -DHAVE_all_vecs  -DBINDIR='"/usr/local/bin"'  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I../../binutils-gdb/bfd/../zlib -D_GLIBCXX_DEBUG-m32 -MT bfdio.lo -MD -MP -MF .deps/bfdio.Tpo -c -o bfdio.lo ../../binutils-gdb/bfd/bfdio.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../binutils-gdb/bfd -DTRAD_CORE -I. -I../../binutils-gdb/bfd -I../../binutils-gdb/bfd/../include -DHAVE_all_vecs -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I../../binutils-gdb/bfd/../zlib -D_GLIBCXX_DEBUG-m32 -MT archive.lo -MD -MP -MF .deps/archive.Tpo -c ../../binutils-gdb/bfd/archive.c -o archive.o
<command-line>:0:15: error: ISO C99 requires whitespace after the macro name [-Werror]
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../binutils-gdb/bfd -DTRAD_CORE -I. -I../../binutils-gdb/bfd -I../../binutils-gdb/bfd/../include -DHAVE_all_vecs -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I../../binutils-gdb/bfd/../zlib -D_GLIBCXX_DEBUG-m32 -MT bfd.lo -MD -MP -MF .deps/bfd.Tpo -c ../../binutils-gdb/bfd/bfd.c -o bfd.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../binutils-gdb/bfd -DTRAD_CORE -I. -I../../binutils-gdb/bfd -I../../binutils-gdb/bfd/../include -DHAVE_all_vecs -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I../../binutils-gdb/bfd/../zlib -D_GLIBCXX_DEBUG-m32 -MT archures.lo -MD -MP -MF .deps/archures.Tpo -c -DDEFAULT_VECTOR=i386_elf32_vec "-DASSOCIATED_VECS=&i386_elf32_vec,&iamcu_elf32_vec,&i386_aout_linux_vec,&i386_pei_vec,&x86_64_elf64_vec,&x86_64_elf32_vec,&x86_64_pei_vec,&l1om_elf64_vec,&k1om_elf64_vec,&elf64_le_vec,&elf64_be_vec,&elf32_le_vec,&elf32_be_vec" ../../binutils-gdb/bfd/archures.c -o archures.o
<command-line>:0:15: error: ISO C99 requires whitespace after the macro name [-Werror]
<command-line>:0:15: error: ISO C99 requires whitespace after the macro name [-Werror]
cc1: all warnings being treated as errors
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../binutils-gdb/bfd -DTRAD_CORE -I. -I../../binutils-gdb/bfd -I../../binutils-gdb/bfd/../include -DHAVE_all_vecs -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I../../binutils-gdb/bfd/../zlib -D_GLIBCXX_DEBUG-m32 -MT bfdio.lo -MD -MP -MF .deps/bfdio.Tpo -c ../../binutils-gdb/bfd/bfdio.c -o bfdio.o
make[4]: *** [Makefile:2049: archures.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
<command-line>:0:15: error: ISO C99 requires whitespace after the macro name [-Werror]
cc1: all warnings being treated as errors
cc1: all warnings being treated as errors
make[4]: *** [Makefile:1681: bfdio.lo] Error 1
make[4]: *** [Makefile:1681: bfd.lo] Error 1
cc1: all warnings being treated as errors
make[4]: *** [Makefile:1681: archive.lo] Error 1
make[3]: *** [Makefile:1724: all-recursive] Error 1
make[4]: Leaving directory '/home/gdb-buildbot-2/fedora-x86-64-4/fedora-i686/build/bfd'
make[3]: Leaving directory '/home/gdb-buildbot-2/fedora-x86-64-4/fedora-i686/build/bfd'
make[2]: *** [Makefile:1197: all] Error 2
make[1]: *** [Makefile:2689: all-bfd] Error 2
make: *** [Makefile:850: all] Error 2
make[2]: Leaving directory '/home/gdb-buildbot-2/fedora-x86-64-4/fedora-i686/build/bfd'
make[1]: Leaving directory '/home/gdb-buildbot-2/fedora-x86-64-4/fedora-i686/build'
============================
  
Jan Kratochvil April 12, 2018, 8:39 p.m. UTC | #3
On Thu, 12 Apr 2018 21:21:28 +0200, Simon Marchi wrote:
> LGTM.

master
	b4be9bfdabb57f40656e72a50a8466af4f7bd37d
gdb-8.1-branch
	55404da3795df1b5eff514ce9d0377b6a78e5904
CLOSED-FIXED
	https://sourceware.org/bugzilla/show_bug.cgi?id=23053


Jan
  
Sergio Durigan Junior April 12, 2018, 8:44 p.m. UTC | #4
On Thursday, April 12 2018, Jan Kratochvil wrote:

> On Thu, 12 Apr 2018 21:41:53 +0200, Sergio Durigan Junior wrote:
>> I've just enabled this flag on all existing builders.
>
> Which broke the buildbot as there is a typo:
> 	-D_GLIBCXX_DEBUG-m32

Sorry, forgot to add a whitespace when joining strings.  Should be fixed
now.

Thanks,
  

Patch

diff --git a/gdb/dwarf-index-write.c b/gdb/dwarf-index-write.c
index 4c596c2..a5e196d 100644
--- a/gdb/dwarf-index-write.c
+++ b/gdb/dwarf-index-write.c
@@ -154,7 +154,7 @@  private:
   gdb_byte *grow (size_t size)
   {
     m_vec.resize (m_vec.size () + size);
-    return &*m_vec.end () - size;
+    return &*(m_vec.end () - size);
   }

   gdb::byte_vector m_vec;
@@ -588,12 +588,14 @@  write_one_signatured_type (void **slot, void *d)

   write_psymbols (info->symtab,
 		  info->psyms_seen,
-		  &info->objfile->global_psymbols[psymtab->globals_offset],
+		  (info->objfile->global_psymbols.data ()
+		   + psymtab->globals_offset),
 		  psymtab->n_global_syms, info->cu_index,
 		  0);
   write_psymbols (info->symtab,
 		  info->psyms_seen,
-		  &info->objfile->static_psymbols[psymtab->statics_offset],
+		  (info->objfile->static_psymbols.data ()
+		   + psymtab->statics_offset),
 		  psymtab->n_static_syms, info->cu_index,
 		  1);

@@ -643,12 +645,12 @@  recursively_write_psymbols (struct objfile *objfile,

   write_psymbols (symtab,
 		  psyms_seen,
-		  &objfile->global_psymbols[psymtab->globals_offset],
+		  objfile->global_psymbols.data () + psymtab->globals_offset,
 		  psymtab->n_global_syms, cu_index,
 		  0);
   write_psymbols (symtab,
 		  psyms_seen,
-		  &objfile->static_psymbols[psymtab->statics_offset],
+		  objfile->static_psymbols.data () + psymtab->statics_offset,
 		  psymtab->n_static_syms, cu_index,
 		  1);
 }
@@ -839,10 +841,10 @@  public:
 				    psyms_seen, cu_index);

     write_psymbols (psyms_seen,
-		    &objfile->global_psymbols[psymtab->globals_offset],
+		    objfile->global_psymbols.data () + psymtab->globals_offset,
 		    psymtab->n_global_syms, cu_index, false, unit_kind::cu);
     write_psymbols (psyms_seen,
-		    &objfile->static_psymbols[psymtab->statics_offset],
+		    objfile->static_psymbols.data () + psymtab->statics_offset,
 		    psymtab->n_static_syms, cu_index, true, unit_kind::cu);
   }

@@ -1200,11 +1202,13 @@  private:
     struct partial_symtab *psymtab = entry->per_cu.v.psymtab;

     write_psymbols (info->psyms_seen,
-		    &info->objfile->global_psymbols[psymtab->globals_offset],
+		    (info->objfile->global_psymbols.data ()
+		     + psymtab->globals_offset),
 		    psymtab->n_global_syms, info->cu_index, false,
 		    unit_kind::tu);
     write_psymbols (info->psyms_seen,
-		    &info->objfile->static_psymbols[psymtab->statics_offset],
+		    (info->objfile->static_psymbols.data ()
+		     + psymtab->statics_offset),
 		    psymtab->n_static_syms, info->cu_index, true,
 		    unit_kind::tu);