platform/upstream/binutils.git
10 years agoFix references to file_mips_isa missed in previous patch.
mfortune [Thu, 8 May 2014 21:07:49 +0000 (22:07 +0100)]
Fix references to file_mips_isa missed in previous patch.

gas/
* config/tc-mips.c (md_parse_option): Update missed file_mips_isa
references.

10 years agoConsolidate file_mips_xxx variables.
mfortune [Wed, 7 May 2014 22:33:47 +0000 (23:33 +0100)]
Consolidate file_mips_xxx variables.

gas/
* config/tc-mips.c (mips_set_options): Rename fp32 field to fp.
Update fp32 == 0 to fp == 64 and fp32 == 1 to fp != 64 throughout.
(file_mips_gp32, file_mips_fp32, file_mips_soft_float,
file_mips_single_float, file_mips_isa, file_mips_arch): Merge into
one struct...
(file_mips_opts): Here. New static global. Update throughout.
(mips_opts): Update defaults for gp32 and fp.

10 years agolibiberty/ 2014-05-08 Gary Benson <gbenson@redhat.com>
gary [Thu, 8 May 2014 09:13:44 +0000 (09:13 +0000)]
libiberty/ 2014-05-08 Gary Benson <gbenson@redhat.com>

* cp-demangle.c (struct d_component_stack): New structure.
(struct d_print_info): New field component_stack.
(d_print_init): Initialize the above.
(d_print_comp_inner): Renamed from d_print_comp.
Do not restore template stack if it would cause a loop.
(d_print_comp): New function.
* testsuite/demangle-expected: New test cases.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210205 138bc75d-0d04-0410-961f-82ee72b054a4

10 years agoPR sanitizer/56781 lto-plugin/ * Makefile.am (CFLAGS, LDFLAGS): Filter out -fsanitize...
jakub [Thu, 17 Apr 2014 12:25:25 +0000 (12:25 +0000)]
PR sanitizer/56781 lto-plugin/ * Makefile.am (CFLAGS, LDFLAGS): Filter out -fsanitize=address. (liblto_plugin_la_LIBADD, liblto_plugin_la_LDFLAGS, liblto_plugin_la_DEPENDENCIES): Prefer ../libiberty/noasan/libiberty.a over ../libiberty/pic/libiberty.a if the former exists. * Makefile.in: Regenerated. libiberty/ * maint-tool: Also emit rule for noasan/ subdirectory. * configure.ac (NOASANFLAG): Set and substitute. * Makefile.in: Regenerated. (NOASANFLAG): Set. (all, $(TARGETLIB), mostlyclean): Handle noasan subdir like pic subdir. (stamp-noasandir): New goal. * configure: Regenerated.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209476 138bc75d-0d04-0410-961f-82ee72b054a4

10 years ago2014-04-01 Richard Biener <rguenther@suse.de>
rguenth [Tue, 1 Apr 2014 07:45:48 +0000 (07:45 +0000)]
2014-04-01 Richard Biener <rguenther@suse.de>

libiberty/
* simple-object.c (simple_object_internal_write): Handle
EINTR and short writes.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208972 138bc75d-0d04-0410-961f-82ee72b054a4

10 years ago2014-03-28 Richard Biener <rguenther@suse.de>
rguenth [Fri, 28 Mar 2014 14:05:49 +0000 (14:05 +0000)]
2014-03-28 Richard Biener <rguenther@suse.de>

libiberty/
* simple-object.c (simple_object_internal_read): Handle
EINTR and short reads.

lto-plugin/
* lto-plugin.c (process_symtab): Handle EINTR and short reads.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208898 138bc75d-0d04-0410-961f-82ee72b054a4

10 years agoPR sanitizer/56781 * Makefile.def: Set bootstrap=true; for host fixincludes. * config...
jakub [Wed, 26 Mar 2014 09:19:44 +0000 (09:19 +0000)]
PR sanitizer/56781 * Makefile.def: Set bootstrap=true; for host fixincludes. * configure.ac: Don't bootstrap host fixincludes unless --with-build-config=bootstrap-{a,ub}san. * Makefile.in: Regenerated. * configure: Regenerated.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208842 138bc75d-0d04-0410-961f-82ee72b054a4

10 years ago* configure.ac: Move BUILD_CONFIG set up earlier. Add --enable-vtable-verify option...
jakub [Fri, 21 Mar 2014 07:16:06 +0000 (07:16 +0000)]
* configure.ac: Move BUILD_CONFIG set up earlier. Add --enable-vtable-verify option parsing. Don't add target-libsanitizer to bootstrap_target_libs unless --with-build-config=bootstrap-asan or --with-build-config=bootstrap-ubsan. Don't add target-libvtv to bootstrap_target_libs unless --enable-vtable-verify. * configure: Regenerated.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208745 138bc75d-0d04-0410-961f-82ee72b054a4

10 years ago* regex.c (bzero) [!_LIBC]: Cast the call to memcpy to (void).
uros [Thu, 13 Mar 2014 22:04:07 +0000 (22:04 +0000)]
* regex.c (bzero) [!_LIBC]: Cast the call to memcpy to (void).

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208558 138bc75d-0d04-0410-961f-82ee72b054a4

10 years ago* regex.c (bzero) [!_LIBC]: Define without coma expression. (regerror): Cast the...
uros [Thu, 13 Mar 2014 18:34:47 +0000 (18:34 +0000)]
* regex.c (bzero) [!_LIBC]: Define without coma expression. (regerror): Cast the call to memcpy to (void) to avoid unused value warnings.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208553 138bc75d-0d04-0410-961f-82ee72b054a4

10 years agoPR bootstrap/58572 * Makefile.tpl (POSTSTAGE1_CXX_EXPORT): Use -isystem instead of...
jakub [Fri, 7 Mar 2014 12:58:27 +0000 (12:58 +0000)]
PR bootstrap/58572 * Makefile.tpl (POSTSTAGE1_CXX_EXPORT): Use -isystem instead of -I for libstdc++-v3 includes if $(LEAN). * Makefile.in: Regenerated.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208400 138bc75d-0d04-0410-961f-82ee72b054a4

10 years agoTILE-Gx big endian support.
walt [Mon, 24 Feb 2014 15:08:00 +0000 (15:08 +0000)]
TILE-Gx big endian support.

/:
* configure.ac (tilepro-*-*) Change to tilepro*-*-*.
(tilegx-*-*): Change to tilegx*-*-*.
* configure: Regenerate.

contrib/:
* config-list.mk (LIST): Add tilegxbe-linux-gnu.

libcpp/:
* configure.ac: Change "tilepro" triplet to "tilepro*".
* configure: Regenerate.

libgcc/:
* config.host: Support "tilegx*" and "tilepro*" triplets.
* config/tilegx/sfp-machine32.h (__BYTE_ORDER): Handle big endian.
* config/tilegx/sfp-machine64.h (__BYTE_ORDER): Handle big endian.

gcc/:
* config.gcc (tilepro-*-*): Change to tilepro*-*-*.
(tilegx-*-linux*): Change to tilegx*-*-linux*; Support tilegxbe
triplet.
* common/config/tilegx/tilegx-common.c
(TARGET_DEFAULT_TARGET_FLAGS): Define.
* config/tilegx/linux.h (ASM_SPEC): Add endian_spec.
(LINK_SPEC): Ditto.
* config/tilegx/sync.md (atomic_test_and_set): Handle big endian.
* config/tilegx/tilegx.c (tilegx_return_in_msb): New.
(tilegx_gimplify_va_arg_expr): Handle big endian.
(tilegx_expand_unaligned_load): Ditto.
(tilegx_expand_unaligned_store): Ditto.
(TARGET_RETURN_IN_MSB): New.
* config/tilegx/tilegx.h (TARGET_DEFAULT): New.
(TARGET_ENDIAN_DEFAULT): New.
(TARGET_BIG_ENDIAN): Handle big endian.
(BYTES_BIG_ENDIAN): Ditto.
(WORDS_BIG_ENDIAN): Ditto.
(FLOAT_WORDS_BIG_ENDIAN): Ditto.
(ENDIAN_SPEC): New.
(EXTRA_SPECS): New.
* config/tilegx/tilegx.md (extv): Handle big endian.
(extzv): Ditto.
(insn_st<n>): Ditto.
(insn_st<n>_add<bitsuffix>): Ditto.
(insn_stnt<n>): Ditto.
(insn_stnt<n>_add<bitsuffix>):Ditto.
(vec_interleave_highv8qi): Handle big endian.
(vec_interleave_highv8qi_be): New.
(vec_interleave_highv8qi_le): New.
(insn_v1int_h): Handle big endian.
(vec_interleave_lowv8qi): Handle big endian.
(vec_interleave_lowv8qi_be): New.
(vec_interleave_lowv8qi_le): New.
(insn_v1int_l): Handle big endian.
(vec_interleave_highv4hi): Handle big endian.
(vec_interleave_highv4hi_be): New.
(vec_interleave_highv4hi_le): New.
(insn_v2int_h): Handle big endian.
(vec_interleave_lowv4hi): Handle big endian.
(vec_interleave_lowv4hi_be): New.
(vec_interleave_lowv4hi_le): New.
(insn_v2int_l): Handle big endian.
(vec_interleave_highv2si): Handle big endian.
(vec_interleave_highv2si_be): New.
(vec_interleave_highv2si_le): New.
(insn_v4int_h): Handle big endian.
(vec_interleave_lowv2si): Handle big endian.
(vec_interleave_lowv2si_be): New.
(vec_interleave_lowv2si_le): New.
(insn_v4int_l): Handle big endian.
* config/tilegx/tilegx.opt (mbig-endian): New option.
(mlittle-endian): New option.
* doc/install.texi: Document tilegxbe-linux.
* doc/invoke.texi: Document -mbig-endian and -mlittle-endian.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208069 138bc75d-0d04-0410-961f-82ee72b054a4

10 years agoAvoid "'dc' may be uninitialized" warning.
tschwinge [Tue, 28 Jan 2014 19:06:44 +0000 (19:06 +0000)]
Avoid "'dc' may be uninitialized" warning.

libiberty/
* cp-demangle.c (d_demangle_callback): Put an abort call in place,
to help the compiler.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207200 138bc75d-0d04-0410-961f-82ee72b054a4

10 years agoPR c/59871 c/ * c-typeck.c (build_compound_expr): Warn even for right-hand operand...
mpolacek [Thu, 23 Jan 2014 19:04:29 +0000 (19:04 +0000)]
PR c/59871 c/ * c-typeck.c (build_compound_expr): Warn even for right-hand operand of a comma expression. (emit_side_effect_warnings): Likewise. libdecnumber/ * decNumberLocal.h (UBFROMUS, UBFROMUI): Remove last argument. testsuite/ * gcc.dg/20020220-2.c: Adjust dg-warning message. * gcc.dg/pr59871.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207002 138bc75d-0d04-0410-961f-82ee72b054a4

10 years agorename "set debugvarobj" to "set debug varobj"
Tom Tromey [Tue, 29 Apr 2014 14:27:31 +0000 (08:27 -0600)]
rename "set debugvarobj" to "set debug varobj"

I think "set debugvarobj" has the wrong name.
It ought to be "set debug varobj", like gdb's other debug settings.

This patch makes the change.

I chose not to install deprecated aliases, since this is only a debug
setting; but if someone feels strongly about it I will add them.

Built and regtested on x86-64 Fedora 20.

2014-04-29  Tom Tromey  <tromey@redhat.com>

* varobj.c (_initialize_varobj): Rename to "set debug varobj" and
"show debug varobj".

2014-04-29  Tom Tromey  <tromey@redhat.com>

* gdb.texinfo (Debugging Output): Rename to "set debug varobj" and
"show debug varobj".

10 years agoImplement CONVERT_SYMBOLIC_ATTRIBUTE for MIPS.
mfortune [Wed, 7 May 2014 21:37:00 +0000 (22:37 +0100)]
Implement CONVERT_SYMBOLIC_ATTRIBUTE for MIPS.

gas/
* config/tc-mips.c (streq): Define.
(mips_convert_symbolic_attribute): New function.
* config/tc-mips.h (CONVERT_SYMBOLIC_ATTRIBUTE): Define.
(mips_convert_symbolic_attribute): New prototype

gas/testsuite/
* gas/mips/attr-gnu-abi-fp-1.s: New.
* gas/mips/attr-gnu-abi-fp-1.d: New.
* gas/mips/attr-gnu-abi-msa-1.s: New.
* gas/mips/attr-gnu-abi-msa-1.d: New.
* gas/mips/mips.exp: Add new tests.

10 years agoAdd bfd/ChangeLog entry missing in commit.
Hans-Peter Nilsson [Thu, 8 May 2014 10:47:52 +0000 (12:47 +0200)]
Add bfd/ChangeLog entry missing in commit.
* mmo.c: Update URLs in documentation comments.

10 years agoAdd support for emulating the MSP430 hardware multiply feature.
Nick Clifton [Thu, 8 May 2014 07:53:16 +0000 (08:53 +0100)]
Add support for emulating the MSP430 hardware multiply feature.

* msp430-sim.c (sim_open): Do not allocate memory over the
hardware multiply registers.
(get_op): Add support for reads from the hardware multiply
registers.
(put_op): Add support for writes to the hardware multiply
registers.
(msp430_step_once): Add support for the RETI instruction used by
the CPUX architecture.

10 years agoor1k: add support for l.swa/l.lwa atomic instructions
Stefan Kristiansson [Thu, 8 May 2014 05:53:09 +0000 (08:53 +0300)]
or1k: add support for l.swa/l.lwa atomic instructions

This adds support for the load-link/store-conditional
l.lwa/l.swa atomic instructions.
The support is added in such way, that the cpu description not
only describes the mnemonics, but also the functionality.

A couple of fixes to typos in nearby/related code are also snuck
into this.

cpu/
* or1korbis.cpu (h-atomic-reserve): New hardware.
(h-atomic-address): Likewise.
(insn-opcode): Add opcodes for LWA and SWA.
(atomic-reserve): New operand.
(atomic-address): Likewise.
(l-lwa, l-swa): New instructions.
(l-lbs): Fix typo in comment.
(store-insn): Clear atomic reserve on store to atomic-address.
Fix register names in fmt field.

opcodes/
* or1k-desc.c: Regenerated.
* or1k-desc.h: Likewise.
* or1k-opc.c: Likewise.
* or1k-opc.h: Likewise.
* or1k-opinst.c: Likewise.

10 years agodaily update
Alan Modra [Thu, 8 May 2014 00:00:41 +0000 (09:30 +0930)]
daily update

10 years agommo.c: Update URLs in documentation comments.
Hans-Peter Nilsson [Wed, 7 May 2014 22:48:19 +0000 (00:48 +0200)]
mmo.c: Update URLs in documentation comments.

10 years agoUse signed data type for R_XTENSA_DIFF* relocation offsets.
Volodymyr Arbatov [Mon, 6 May 2013 17:43:21 +0000 (09:43 -0800)]
Use signed data type for R_XTENSA_DIFF* relocation offsets.

R_XTENSA_DIFF relocation offsets are in fact signed. Treat them as such.
Add testcase that examines ld behaviour on R_XTENSA_DIFF relocation
changing sign during relaxation.

2014-05-02  Volodymyr Arbatov  <arbatov@cadence.com>
    David Weatherford  <weath@cadence.com>
    Max Filippov  <jcmvbkbc@gmail.com>

bfd/
  * elf32-xtensa.c (relax_section): treat R_XTENSA_DIFF* relocations as
  signed.

gas/
  * config/tc-xtensa.c (md_apply_fix): mark BFD_RELOC_XTENSA_DIFF*
  fixups as signed.

ld/testsuite/
  * ld-xtensa/diff_overflow.exp, * ld-xtensa/diff_overflow1.s,
  * ld-xtensa/diff_overflow2.s: Add test for DIFF* relocation
  signedness and overflow checking.

10 years agoAdd proper arm config for *-*-freebsd*.
Andreas Tobler [Wed, 7 May 2014 20:52:51 +0000 (22:52 +0200)]
Add proper arm config for *-*-freebsd*.

10 years agoaarch64: detect atomic sequences like other ll/sc architectures
Kyle McMartin [Wed, 30 Apr 2014 16:04:50 +0000 (12:04 -0400)]
aarch64: detect atomic sequences like other ll/sc architectures

gdb/Changelog:

        * aarch64-tdep.c (aarch64_software_single_step): New function.
        (aarch64_gdbarch_init): Handle single stepping of atomic sequences
        with aarch64_software_single_step.

gdb/testsuite/ChangeLog:

        * gdb.arch/aarch64-atomic-inst.c: New file.
        * gdb.arch/aarch64-atomic-inst.exp: New file.

10 years agoAdd MIPS r3 and r5 support.
Andrew Bennett [Fri, 2 May 2014 13:12:48 +0000 (14:12 +0100)]
Add MIPS r3 and r5 support.

This patch firstly adds support for mips32r3 mips32r5, mips64r3
and mips64r5.  Secondly it adds support for the eretnc instruction.

ChangeLog:

bfd/
* aoutx.h (NAME (aout, machine_type)): Add mips32r3, mips64r3,
mips32r5 and mips64r5.
* archures.c (bfd_architecture): Likewise.
* bfd-in2.h (bfd_architecture): Likewise.
* cpu-mips.c (arch_info_struct): Likewise.
* elfxx-mips.c (mips_set_isa_flags): Likewise.

gas/
* tc-mips.c (ISA_SUPPORTS_MIPS16E): Add mips32r3, mips32r5, mips64r3
and mips64r5.
(ISA_HAS_64BIT_FPRS): Likewise.
(ISA_HAS_ROR): Likewise.
(ISA_HAS_ODD_SINGLE_FPR): Likewise.
(ISA_HAS_MXHC1): Likewise.
(hilo_interlocks): Likewise.
(md_longopts): Likewise.
(ISA_HAS_64BIT_REGS): Add mips64r3 and mips64r5.
(ISA_HAS_DROR): Likewise.
(options): Add OPTION_MIPS32R3, OPTION_MIPS32R5, OPTION_MIPS64R3, and
OPTION_MIPS64R5.
(mips_isa_rev): Add support for mips32r3, mips32r5, mips64r3 and
mips64r5.
(md_parse_option): Likewise.
(s_mipsset): Likewise.
(mips_cpu_info_table): Add entries for mips32r3, mips32r5, mips64r3
and mips64r5.  Also change p5600 entry to be mips32r5.
* configure.in: Add support for mips32r3, mips32r5, mips64r3 and
mips64r5.
* configure: Regenerate.
* doc/c-mips.texi: Document the -mips32r3, -mips32r5, -mips64r3 and
-mips64r5 command line options.
* doc/as.texinfo: Likewise.

gas/testsuite/
* gas/mips/mips.exp: Add MIPS32r5 tests.  Also add the mips32r3,
mips32r5, mips64r3 and mips64r5 isas to the testsuite.
* gas/mips/r5.s: New test.
* gas/mips/r5.d: Likewise.

include/opcode/
* mips.h (INSN_ISA_MASK): Updated.
(INSN_ISA32R3): New define.
(INSN_ISA32R5): New define.
(INSN_ISA64R3): New define.
(INSN_ISA64R5): New define.
(INSN_ISA64, INSN_ISA64R2, INSN_ISA3_32, INSN_ISA3_32R2, INSN_ISA4_32
INSN_ISA4_32R2, INSN_ISA5_32R2): Renumbered.
(mips_isa_table): Add entries for mips32r3, mips32r5, mips64r3 and
mips64r5.
(INSN_UPTO32R3): New define.
(INSN_UPTO32R5): New define.
(INSN_UPTO64R3): New define.
(INSN_UPTO64R5): New define.
(ISA_MIPS32R3): New define.
(ISA_MIPS32R5): New define.
(ISA_MIPS64R3): New define.
(ISA_MIPS64R5): New define.
(CPU_MIPS32R3): New define.
(CPU_MIPS32R5): New define.
(CPU_MIPS64R3): New define.
(CPU_MIPS64R5): New define.

opcodes/
* mips-opc.c (mips_builtin_opcodes): Add MIPS32r5 eretnc instruction.
(I34): New define.
(I36): New define.
(I66): New define.
(I68): New define.
* mips-dis.c (mips_arch_choices): Add mips32r3, mips32r5, mips64r3 and
mips64r5.
(parse_mips_dis_option): Update MSA and virtualization support to
allow mips64r3 and mips64r5.

10 years agoFix an issue with "Rearrange MIPS INSN* masks" patch.
Andrew Bennett [Tue, 6 May 2014 14:43:13 +0000 (15:43 +0100)]
Fix an issue with "Rearrange MIPS INSN* masks" patch.

This fixes an issue with Mark Shinwell's "Rearrange MIPS INSN* masks" patch
(https://sourceware.org/ml/binutils/2007-11/msg00231.html).  In the patch
the pref instruction had its membership flags changed from I4|I32|G3 to
I4_32|G3.  Unfortunately G3 was defined as being I4, which made the actual
expanded flags as: I4|I32|I4 and therefore the membership flags should have
been I4_32.  Since the patch was committed G3 was redefined to be I4|EE.  This
fix just removes I4 from G3 making the expanded membership flags for pref as
I4_32|EE.

ChangeLog:

opcodes/
* mips-opc.c (G3): Remove I4.

10 years agoRelax the pattern in dwzbuildid.exp
Yao Qi [Tue, 6 May 2014 13:47:36 +0000 (21:47 +0800)]
Relax the pattern in dwzbuildid.exp

Hi,
I recently see the fail in dwzbuildid.exp below on some targets,

(gdb) print the_int
No symbol "the_int" in current context.
(gdb) FAIL: gdb.dwarf2/dwzbuildid.exp: mismatch: print the_int

Looks the pattern expects to see "No symbol table is loaded", which
is emitted in c-exp.y,

variable:       name_not_typename
....
                              if (msymbol.minsym != NULL)
                                write_exp_msymbol (pstate, msymbol);
                              else if (!have_full_symbols () && !have_partial_symbols ())
                                error (_("No symbol table is loaded.  Use the \"file\" command."));
                              else
                                error (_("No symbol \"%s\" in current context."),
                                       copy_name ($1.stoken));

it is expected to have no full symbols nor partial symbols, but something
brings full symbols or partial symbols in.  I added "maint info symtabs"
and "maint info psymtabs" in dwzbuildid.exp, and it shows symbols are from
ld.so, which has debug information.  Then, I reproduce the fail like this,

  $ make check RUNTESTFLAGS="CFLAGS_FOR_TARGET='-Wl,-rpath=${glibc_build}:${glibc_build}/math  -Wl,--dynamic-linker=${glibc_build}/elf/ld.so' dwzbuildid.exp"

${glibc_build} is the glibc build tree.  Debug information is not striped,
so the test fail.  However, if I strip debug information from libc.so, libm.so
and ld.so.  The test passes.

This patch is to relax the pattern to match the both cases that glibc build
has and has not debug information.

gdb/testsuite:

2014-05-07  Yao Qi  <yao@codesourcery.com>

* gdb.dwarf2/dwzbuildid.exp: Match output "No symbol "the_int" in
current context" too.

10 years agodaily update
Alan Modra [Wed, 7 May 2014 00:00:55 +0000 (09:30 +0930)]
daily update

10 years agoFix issue where first reserved word of GOT is not initialized if there
Cary Coutant [Tue, 6 May 2014 18:40:04 +0000 (11:40 -0700)]
Fix issue where first reserved word of GOT is not initialized if there
is no PLT.

gold/
PR gold/16900
* i386.cc (Output_data_got_plt_i386): New class.
(Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
parameter. Change all callers.
(Output_data_plt_i386::layout_): Remove.
(Output_data_plt_i386::got_plt_): Change type.
(Target_i386::got_plt_): Change type. Change all references.
(Target_i386::got_section): Create instance of new class.
(Output_data_got_plt_i386::do_write): New function.
* x86_64.cc (Output_data_got_plt_x86_64): New class.
(Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
parameter. Change all callers.
(Output_data_plt_x86_64::layout_): Remove.
(Output_data_plt_x86_64::got_plt_): Change type.
(Target_x86_64::got_plt_): Change type. Change all references.
(Target_x86_64::got_section): Create instance of new class.
(Output_data_got_plt_x86_64::do_write): New function.
(Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
(Target_x86_64<size>::init_got_plt_for_update): Create instance of new
class.

10 years agobfd/
Richard Sandiford [Tue, 6 May 2014 19:13:03 +0000 (20:13 +0100)]
bfd/
* elfxx-mips.h (elfxx-mips.h): Declare.
* elfxx-mips.c (mips_elf_merge_obj_attributes): Use it to report
Tag_GNU_MIPS_ABI_FP mismatches.
(_bfd_mips_fp_abi_string): New function.

10 years agodaily update
Alan Modra [Tue, 6 May 2014 00:00:39 +0000 (09:30 +0930)]
daily update

10 years agoDon't complain about the source language when we have pubnames/pubtypes info.
Cary Coutant [Fri, 2 May 2014 20:37:32 +0000 (13:37 -0700)]
Don't complain about the source language when we have pubnames/pubtypes info.

gold/
* gdb-index.cc (Gdb_index_info_reader): Don't complain about language
if we have pubnames/pubtypes.

10 years agoDocument the GDB 7.7.1 release in gdb/ChangeLog
Joel Brobecker [Mon, 5 May 2014 22:03:06 +0000 (15:03 -0700)]
Document the GDB 7.7.1 release in gdb/ChangeLog

gdb/ChangeLog:

GDB 7.7.1 released.

10 years agoProperly handle multiple opcode prefixes
H.J. Lu [Fri, 2 May 2014 18:22:04 +0000 (11:22 -0700)]
Properly handle multiple opcode prefixes

This patch updates multiple opcode prefix processing:

1. Always print prefix together with bad opcode.
2. Since the last seen segment register prefix is active, we only print
the active segment register in the memory operand.
3. The 0xf2 and 0xf3 prefixes take precedence over the 0x66 prefix as the
opcode prefix.  Also the last of the 0xf2 and 0xf3 prefixes wins.
4. Ignore invalid 0xf2/0xf3 prefixes if they aren't mandatory.

gas/testsuite/

PR binutils/16893
* gas/i386/katmai.d: Expect "gs" as prefix.

* gas/i386/long-1.s: Replace movapd with movss.
* gas/i386/x86-64-long-1.s: Likewise.
* gas/i386/long-1-intel.d: Updated.
* gas/i386/long-1.d: Likewise.
* gas/i386/x86-64-long-1-intel.d: Likewise.
* gas/i386/x86-64-long-1.d: Likewise.

* gas/i386/prefix.s: Add tests for multiple 0x66, 0x67, 0xf0,
0xf2 and 0xf3 prefixes.
* gas/i386/prefix.d: Updated.

opcodes/

PR binutils/16893
* i386-dis.c (twobyte_has_mandatory_prefix): New variable.
(end_codep): Likewise.
(mandatory_prefix): Likewise.
(active_seg_prefix): Likewise.
(ckprefix): Set active_seg_prefix to the active segment register
prefix.
(seg_prefix): Removed.
(get_valid_dis386): Use the last of PREFIX_REPNZ and PREFIX_REPZ
for prefix index.  Ignore the index if it is invalid and the
mandatory prefix isn't required.
(print_insn): Set mandatory_prefix if the PREFIX_XXX prefix is
mandatory.  Don't set PREFIX_REPZ/PREFIX_REPNZ/PREFIX_LOCK bits
in used_prefixes here.  Don't print unused prefixes.  Check
active_seg_prefix for the active segment register prefix.
Restore the DFLAG bit in sizeflag if the data size prefix is
unused.  Check the unused mandatory PREFIX_XXX prefixes
(append_seg): Only print the segment register which gets used.
(OP_E_memory): Check active_seg_prefix for the segment register
prefix.
(OP_OFF): Likewise.
(OP_OFF64): Likewise.
(OP_DSreg): Set active_seg_prefix to PREFIX_DS if it is unset.

10 years agoFix a dangling cleanup in linspec_parse_basic.
Keith Seitz [Mon, 5 May 2014 20:43:31 +0000 (13:43 -0700)]
Fix a dangling cleanup in linspec_parse_basic.

2014-05-05  Keith Seitz  <keiths@redhat.com>

* linespec.c (linespec_parse_basic): Run cleanups if a convenience
variable or history value is successfully parsed.

2014-05-05  Keith Seitz  <keiths@redhat.com>

* gdb.linespec/ls-dollar.exp: Add test for linespec
file:convenience_variable.

10 years agoPartially available/unavailable data in requested range
Yao Qi [Sat, 26 Apr 2014 02:14:52 +0000 (10:14 +0800)]
Partially available/unavailable data in requested range

In gdb.trace/unavailable.exp, an action is defined to collect
struct_b.struct_a.array[2] and struct_b.struct_a.array[100],

struct StructB
{
  int d, ef;
  StructA struct_a;
  int s:1;
  static StructA static_struct_a;
  const char *string;
};

and the other files are not collected.

When GDB examine traceframe collected by the action, "struct_b" is
unavailable completely, which is wrong.

(gdb) p struct_b
$1 = <unavailable>

When GDB reads 'struct_b', it will request to read memory at struct_b's address
of length LEN.  Since struct_b.d is not collected, no 'M' block
includes the first part of the desired range, so tfile_xfer_partial returns
TARGET_XFER_UNAVAILABLE and GDB thinks the whole requested range is unavailable.

In order to fix this problem, in the iteration to 'M' blocks, we record the
lowest address of blocks within the request range.  If it has, the requested
range isn't unavailable completely.  This applies to ctf too.  With this patch
applied, the result looks good and fails in unavailable.exp is fixed.

(gdb) p struct_b
$1 = {d = <unavailable>, ef = <unavailable>, struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable>,
<unavailable>, -1431655766, <unavailable> <repeats 97 times>, -1431655766, <unavailable> <repeats 9899 times>}, ptr = <unavailable>, bitfield = <unavailable>}, s = <unavailable>,   static static_struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable> <repeats 10000 times>}, ptr = <unavailable>,
bitfield = <unavailable>}, string = <unavailable>}

gdb:

2014-05-05  Yao Qi  <yao@codesourcery.com>
    Pedro Alves  <palves@redhat.com>

* tracefile-tfile.c (tfile_xfer_partial): Record the lowest
address of blocks that intersects the requested range.  Trim
LEN up to LOW_ADDR_AVAILABLE if read from executable read-only
sections.
* ctf.c (ctf_xfer_partial): Likewise.

gdb/testsuite:

2014-05-05  Yao Qi  <yao@codesourcery.com>

* gdb.trace/unavailable.exp (gdb_collect_args_test): Save
traceframes into tfile and ctf trace files.  Read data from
trace file and test collected data.
(gdb_collect_locals_test): Likewise.
(gdb_unavailable_registers_test): Likewise.
(gdb_unavailable_floats): Likewise.
(gdb_collect_globals_test): Likewise.
(top-level): Append "ctf" to trace_file_targets if GDB
supports.

10 years agoShow new created display
Yao Qi [Sat, 26 Apr 2014 00:47:33 +0000 (08:47 +0800)]
Show new created display

When I run refactored unavailable.exp, I find
command display behaves a little different on live inferior and on
examining traceframes.  In live inferior, when command "display argc"
is typed, the value of "argc" is shown.

(gdb) display argc
1: argc = 1 '\001'

however, on tfile target, when command "display argc" is typed, the
value of "argc" is not shown.

(gdb) tfind
Found trace frame 0, tracepoint 1
    at ../../../../git/gdb/testsuite/gdb.trace/unavailable.cc:198
198       i =  (int) argc + argi + argf + argd + argstruct.memberi + argarray[1];
(gdb) display argc

I also notice that on "core" target, the value of "argc" isn't shown
either.  This difference is caused by the code below in printcmd.c:display_command,

      if (from_tty && target_has_execution)
        do_one_display (new);

Looks the value of each display is shown if the target has execution.
Source code archaeology doesn't tell much about this requirement.
However, if we type command "display" then on "core" or "tfile"
target, the value of "argc" is still displayed,

for "core" target,
(gdb) display argc
(gdb) display
1: argc = 1 '\001'

for "tfile" target,
(gdb) display argc
(gdb) display
1: argc = <unavailable>

I feel that it is not necessary to have such "target has execution"
requirement to show the value of new created display.  Auto-display is
a feature to show the value of expression frequently, has nothing to
do with whether target has execution or not.  On the other hand, GDB
has the requirement for new created display, but command "display" can
still show them, this is an inconsistency, which should be fixed.

This patch is to remove the checking to target_has_execution from the
condition.

gdb:

2014-05-05  Yao Qi  <yao@codesourcery.com>

* printcmd.c (display_command): Remove the check to
target_has_execution.

10 years agoMove traceframe checking out of traceframe generation
Yao Qi [Fri, 25 Apr 2014 08:18:52 +0000 (16:18 +0800)]
Move traceframe checking out of traceframe generation

This patch moves traceframe checking code out of traceframe generation,
so that we can generation traceframe once, and do the checking in multiple
times (with target remote, tfile and ctf respectively).  This is a
pure refactor, not functional changes in unavailable.exp.

gdb/testsuite:

2014-05-05  Yao Qi  <yao@codesourcery.com>

* gdb.trace/unavailable.exp (gdb_collect_args_test): Move some
code to ...
(gdb_collect_args_test_1): ... it.  New proc.
(gdb_collect_locals_test): Move some code to ...
(gdb_collect_locals_test_1): ... it.  New proc.
(gdb_unavailable_registers_test): Move some code to ...
(gdb_unavailable_registers_test_1): ... it.  New proc.
(gdb_unavailable_floats): Move some code to ...
(gdb_unavailable_floats_1): ... it.  New proc.

10 years agodaily update
Alan Modra [Mon, 5 May 2014 00:00:36 +0000 (09:30 +0930)]
daily update

10 years agodaily update
Alan Modra [Sun, 4 May 2014 00:00:37 +0000 (09:30 +0930)]
daily update

10 years agoGit sucks!
Mark Kettenis [Sat, 3 May 2014 20:43:16 +0000 (22:43 +0200)]
Git sucks!

10 years agoEnable rthreads support on OpenBSD/powerpc.
Mark Kettenis [Sat, 3 May 2014 20:36:44 +0000 (22:36 +0200)]
Enable rthreads support on OpenBSD/powerpc.

gdb/ChangeLog:

        * ppcobsd-nat.c: Include "obsd-nat.h".
        (_initialize_ppcobsd_nat): Call obsd_add_target instead of
        add_target.
        * config/powerpc/obsd.mh (NATDEPFILES): Add obsd-nat.o.

10 years agodaily update
Alan Modra [Sat, 3 May 2014 00:00:42 +0000 (09:30 +0930)]
daily update

10 years agoFix handling of __ehdr_start when it cannot be defined.
Cary Coutant [Wed, 2 Apr 2014 21:21:14 +0000 (14:21 -0700)]
Fix handling of __ehdr_start when it cannot be defined.

2014-05-02  Cary Coutant  <ccoutant@google.com>

* defstd.cc (in_segment): Define __ehdr_start here...
* layout.cc (Layout::finalize): ...Instead of here.  Set the
output segment when known.
* resolve.cc (Symbol::override_base_with_special): Remember
the original binding.
* symtab.cc (Symbol::set_output_segment): New function.
(Symbol::set_undefined): New function.
* symtab.h (Symbol::is_weak_undefined): Check original undef
binding.
(Symbol::is_strong_undefined): New function.
(Symbol::set_output_segment): New function.
(Symbol::set_undefined): New function.
* target-reloc.h (is_strong_undefined): Remove.
(issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
Check for hidden undefs.
(relocate_section): Call Symbol::is_strong_undefined.

* testsuite/Makefile.am (ehdr_start_test_1)
(ehdr_start_test_2, ehdr_start_test_3)
(ehdr_start_test_4, ehdr_start_test_5): New test cases.
* testsuite/Makefile.in: Regenerate.
* testsuite/ehdr_start_def.cc: New source file.
* testsuite/ehdr_start_test.cc: New source file.
* testsuite/ehdr_start_test.t: New linker script.
* testsuite/ehdr_start_test_4.sh: New shell script.

10 years agoExtend recognized types of SDT probe's arguments
Sergio Durigan Junior [Fri, 2 May 2014 20:50:45 +0000 (17:50 -0300)]
Extend recognized types of SDT probe's arguments

This commit is actually an update to make the parser in
gdb/stap-probe.c be aware of all the possible prefixes that a probe
argument can have.  According to the section "Argument Format" in:

  <https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation>

The bitness of the arguments can be 8, 16, 32 or 64 bits, signed or
unsigned.  Currently GDB recognizes only 32 and 64-bit arguments.
This commit extends this.  It also provides a testcase, only for
x86_64 systems.

gdb/
2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

* stap-probe.c (enum stap_arg_bitness): New enums to represent 8
and 16-bit signed and unsigned arguments.  Update comment.
(stap_parse_probe_arguments): Extend code to handle such
arguments.  Use warning instead of complaint to notify about
unrecognized bitness.

gdb/testsuite/
2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

* gdb.arch/amd64-stap-optional-prefix.S (main): Add several
probes to test for bitness recognition.
* gdb.arch/amd64-stap-optional-prefix.exp
(test_probe_value_without_reg): New procedure.
Add code to test for different kinds of bitness.

10 years agoFix PR breakpoints/16889: gdb segfaults when printing ASM SDT arguments
Sergio Durigan Junior [Fri, 2 May 2014 20:45:35 +0000 (17:45 -0300)]
Fix PR breakpoints/16889: gdb segfaults when printing  ASM SDT arguments

This commit fixes PR breakpoints/16889, which is about a bug that
triggers when GDB tries to parse probes whose arguments do not contain
the initial (and optional) "N@" part.  For reference sake, the de
facto format is described here:

  <https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation>

Anyway, this PR actually uncovered two bugs (related) that were
happening while parsing the arguments.  The first one was that the
parser *was* catching *some* arguments that were missing the "N@"
part, but it wasn't correctly setting the argument's type.  This was
causing a NULL pointer being dereferenced, ouch...

The second bug uncovered was that the parser was not catching all of
the cases for a probe which did not provide the "N@" part.  The fix
for that was to simplify the check that the code was making to
identify non-prefixed probes.  The code is simpler and easier to read
now.

I am also providing a testcase for this bug, only for x86_64
architectures.

gdb/
2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

PR breakpoints/16889
* stap-probe.c (stap_parse_probe_arguments): Simplify
check for non-prefixed probes (i.e., probes whose
arguments do not start with "N@").  Always set the
argument type to a sane value.

gdb/testsuite/
2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

PR breakpoints/16889
* gdb.arch/amd64-stap-optional-prefix.S: New file.
* gdb.arch/amd64-stap-optional-prefix.exp: Likewise.

10 years agoMove fwait test with prefix to prefix.s
H.J. Lu [Fri, 2 May 2014 15:39:09 +0000 (08:39 -0700)]
Move fwait test with prefix to prefix.s

* gas/i386/opcode-intel.d: Undo the last change.
* gas/i386/opcode-suffix.d: Likewise.
* gas/i386/opcode.d: Likewise.
* gas/i386/opcode.s: Likewise.

* gas/i386/prefix.s: Add test for fwait with prefix.
* gas/i386/prefix.d: Updated.

10 years agoUse sigsetjmp/siglongjmp in opcodes
H.J. Lu [Fri, 2 May 2014 15:27:16 +0000 (08:27 -0700)]
Use sigsetjmp/siglongjmp in opcodes

sigsetjmp/siglongjmp without saving the signal mask is faster than
setjmp/longjmp on systems where the signal mask is saved.  This patch
uses sigsetjmp/siglongjmp without saving the signal mask if possible.

PR binutils/16886
* config.in: Regenerated.
* configure: Likewise.
* configure.in: Check if sigsetjmp is available.
* h8500-dis.c (private): Replace jmp_buf with OPCODES_SIGJMP_BUF.
(fetch_data): Replace longjmp with OPCODES_SIGLONGJMP.
(print_insn_h8500): Replace setjmp with OPCODES_SIGSETJMP.
* i386-dis.c (dis_private): Replace jmp_buf with OPCODES_SIGJMP_BUF.
(fetch_data): Replace longjmp with OPCODES_SIGLONGJMP.
(print_insn): Replace setjmp with OPCODES_SIGSETJMP.
* ns32k-dis.c (private): Replace jmp_buf with OPCODES_SIGJMP_BUF.
(fetch_data): Replace longjmp with OPCODES_SIGLONGJMP.
(print_insn_ns32k): Replace setjmp with OPCODES_SIGSETJMP.
* sysdep.h (OPCODES_SIGJMP_BUF): New macro.
(OPCODES_SIGSETJMP): Likewise.
(OPCODES_SIGLONGJMP): Likewise.
* vax-dis.c (private): Replace jmp_buf with OPCODES_SIGJMP_BUF.
(fetch_data): Replace longjmp with OPCODES_SIGLONGJMP.
(print_insn_vax): Replace setjmp with OPCODES_SIGSETJMP.
* xtensa-dis.c (dis_private): Replace jmp_buf with
OPCODES_SIGJMP_BUF.
(fetch_data): Replace longjmp with OPCODES_SIGLONGJMP.
(print_insn_xtensa): Replace setjmp with OPCODES_SIGSETJMP.
* z8k-dis.c(instr_data_s): Replace jmp_buf with OPCODES_SIGJMP_BUF.
(fetch_data): Replace longjmp with OPCODES_SIGLONGJMP.
(print_insn_z8k): Replace setjmp with OPCODES_SIGSETJMP.

10 years agoSort target vectors to suit renaming
Alan Modra [Fri, 2 May 2014 10:41:49 +0000 (20:11 +0930)]
Sort target vectors to suit renaming

* targets.c: Sort bfd_target vectors somewhat alphabetically.
* configure.in: Likewise.
* configure: Regenerate.

10 years agobfd target vector rationalisation
Alan Modra [Fri, 2 May 2014 10:39:40 +0000 (20:09 +0930)]
bfd target vector rationalisation

This renames the bfd targets to <cpu>_<format>_<other>_<endian>_vec.
So for example, bfd_elf32_ntradlittlemips_vec becomes
mips_elf32_ntrad_le_vec and hp300bsd_vec becomes m68k_aout_hp300bsd_vec.

bfd/
* aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-ns32k.c,
* aout-sparcle.c, * aout0.c, * aoutx.h, * armnetbsd.c, * bout.c,
* cf-i386lynx.c, * cf-sparclynx.c, * cisco-core.c, * coff-alpha.c,
* coff-apollo.c, * coff-arm.c, * coff-aux.c, * coff-go32.c,
* coff-h8300.c, * coff-h8500.c, * coff-i386.c, * coff-i860.c,
* coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mips.c,
* coff-rs6000.c, * coff-sh.c, * coff-sparc.c, * coff-stgo32.c,
* coff-svm68k.c, * coff-tic80.c, * coff-u68k.c, * coff-w65.c,
* coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c,
* coff64-rs6000.c, * config.bfd, * configure.com, * configure.in,
* demo64.c, * elf-m10200.c, * elf-m10300.c, * elf32-am33lin.c,
* elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c,
* elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c,
* elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c,
* elf32-fr30.c, * elf32-frv.c, * elf32-gen.c, * elf32-h8300.c,
* elf32-hppa.c, * elf32-i370.c, * elf32-i386.c, * elf32-i860.c,
* elf32-i960.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c,
* elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c,
* elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c,
* elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c,
* elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c,
* elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-rl78.c,
* elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-sh-symbian.c,
* elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c,
* elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilepro.c, * elf32-v850.c,
* elf32-vax.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xstormy16.c,
* elf32-xtensa.c, * elf64-alpha.c, * elf64-gen.c, * elf64-hppa.c,
* elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c,
* elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c,
* elf64-x86-64.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
* epoc-pe-arm.c, * epoc-pei-arm.c, * hp300bsd.c, * hp300hpux.c,
* hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386bsd.c,
* i386dynix.c, * i386freebsd.c, * i386linux.c, * i386lynx.c,
* i386mach3.c, * i386msdos.c, * i386netbsd.c, * i386os9k.c,
* irix-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c,
* m88kmach3.c, * m88kopenbsd.c, * mach-o-i386.c, * mach-o-x86-64.c,
* makefile.vms, * mipsbsd.c, * mmo.c, * netbsd-core.c, * newsos3.c,
* nlm32-alpha.c, * nlm32-i386.c, * nlm32-ppc.c, * nlm32-sparc.c,
* ns32knetbsd.c, * osf-core.c, * pc532-mach.c, * pe-arm-wince.c,
* pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-ppc.c,
* pe-sh.c, * pe-x86_64.c, * pei-arm-wince.c, * pei-arm.c,
* pei-i386.c, * pei-ia64.c, * pei-mcore.c, * pei-mips.c, * pei-ppc.c,
* pei-sh.c, * pei-x86_64.c, * ppcboot.c, * ptrace-core.c, * riscix.c,
* sco5-core.c, * som.c, * sparclinux.c, * sparclynx.c,
* sparcnetbsd.c, * sunos.c, * targets.c, * trad-core.c,
* vax1knetbsd.c, * vaxbsd.c, * vaxnetbsd.c, * versados.c,
* vms-alpha.c, * vms-lib.c: Rename bfd targets to
<cpu>_<format>_<other>_<endian>_vec.  Adjust associated MY macros
on aout targets.
* configure: Regenerate.
binutils/
* emul_aix.c: Update bfd target vector naming.
* testsuite/binutils-all/objcopy.exp: Likewise.
ld/
* emultempl/metagelf.em: Update bfd target vector naming.
* emultempl/nios2elf.em: Likewise.
* emultempl/spuelf.em: Likewise.
* emultempl/tic6xdsbt.em: Likewise.

10 years agodaily update
Alan Modra [Fri, 2 May 2014 00:00:38 +0000 (09:30 +0930)]
daily update

10 years agogdb_load: Fix latent bugs
Pedro Alves [Thu, 1 May 2014 23:59:31 +0000 (00:59 +0100)]
gdb_load: Fix latent bugs

In a test I was writting, I needed a procedure that would connect to
the target, and do "load", or equivalent.

Years ago, boards would override gdb_load to implement that.  Then
gdb_reload was added, and gdb_load was relaxed to allow boards avoid
the spawing and connecting to the target.  This sped up gdbserver
testing.  See
https://www.sourceware.org/ml/gdb-patches/2007-02/msg00318.html.

To actually spawn the target and load the executable on the target
side, gdb_reload was born:

 # gdb_reload -- load a file into the target.  Called before "running",
 # either the first time or after already starting the program once,
 # for remote targets.  Most files that override gdb_load should now
 # override this instead.

 proc gdb_reload { } {
     # For the benefit of existing configurations, default to gdb_load.
     # Specifying no file defaults to the executable currently being
     # debugged.
     return [gdb_load ""]
 }

Note the comment about specifying no file.  Indeed looking at
config/sid.exp, or config/monitor.exp, we see examples of that.

However, the default gdb_load itself doesn't handle the case of no
file specified.  When passed no file, it just calls gdb_file_cmd with
no file either, which ends up invocing the "file" command with no
argument, which means unloading the file and its symbols...  That
means calling gdb_reload when testing against native targets is
broken.  We don't see that today because the only call to gdb_reload
that exists today is guarded by target_info exists
gdb,do_reload_on_run.

The native-extended-gdbserver.exp board is likewise broken here.  When
[gdb_load ""] is called, the board sets the remote exec-file to "" ...

Tested on x86_64 Fedora 17, native, remote gdbserver and
extended-remote gdbserver.

testsuite/
2014-05-01  Pedro Alves  <palves@redhat.com>

* lib/gdb.exp (gdb_load): Extend comment.  Skip calling
gdb_file_cmd if no file is specified.
* boards/native-extended-gdbserver.exp (gdb_load): Use the
last_loaded_file to set the remote exec-file.

10 years agold/testsuite:
Hans-Peter Nilsson [Thu, 1 May 2014 22:31:58 +0000 (00:31 +0200)]
ld/testsuite:
* ld-mmix/sec-11.d, ld-mmix/sec-11.ld, ld-mmix/sec-10.s,
ld-mmix/sec-10.d, ld-mmix/b-offlocmis.s, ld-mmix/sec-12.d: New
tests.
* ld-mmix/b-offloc.s: Correct address in comment.

10 years ago * mmo.c (mmo File layout documentation): Add note about low bits
Hans-Peter Nilsson [Thu, 1 May 2014 22:30:42 +0000 (00:30 +0200)]
* mmo.c (mmo File layout documentation): Add note about low bits
of address.
(mmo_write_chunk): When handling data remainder, assert that
previous remaining data is flushed.
(mmo_write_loc_chunk): Only look for trailing and leading zeros
when dealing with an aligned VMA and for aligned lengths.  Don't skip
the last 32-bit-word of zeros.
(mmo_write_loc_chunk): Emit an error if the VMA is not aligned.
(mmo_scan) <case LOP_QUOTE>: Move re-alignment of vma before
emitting data, not after updating it.
<case LOP_LOC>: Call mmo_decide_section with aligned vma.

10 years ago * config.sub, config.guess: Import from upstream.
Richard Sandiford [Thu, 1 May 2014 20:49:01 +0000 (21:49 +0100)]
* config.sub, config.guess: Import from upstream.

10 years agoinclude/opcode/
Richard Sandiford [Thu, 1 May 2014 20:39:48 +0000 (21:39 +0100)]
include/opcode/
* mips.h (mips_isa_table): Avoid hard-coding INSN_ISA* values.

10 years agocompare-sections: New -r option.
David Taylor [Thu, 1 May 2014 17:09:43 +0000 (18:09 +0100)]
compare-sections: New -r option.

When connecting to a remote system, we use the compare-sections
command to verify that the box is running the code that we think it is
running.  Since the system is up and running and *NOT* 'freshly
downloaded without yet executing anything', read-write sections, of
course, differ from what they were in the executable file.

Comparing read-write sections takes time and more importantly the
MIS-MATCHED output is confusing to some users.

The compare-sections command compares all loadable sections including
read-write sections.  This patch gives the user the option to compare
just the loadable read-only sections.

gdb/
2014-05-01  David Taylor  <dtaylor@emc.com>

* remote.c (compare_sections_command): Add -r option to compare
all loadable read-only sections.

gdb/doc/
2014-05-01  David Taylor  <dtaylor@emc.com>

* gdb.texinfo (compare-sections): Document the new -r (read-only)
option.

10 years agoHandle prefixes before fwait
H.J. Lu [Thu, 1 May 2014 16:39:51 +0000 (09:39 -0700)]
Handle prefixes before fwait

0x9b (fwait) is both an instruction and an opcode prefix.  When 0x9b is
treated as an instruction, we need to handle any prefixes before it.
This patch handles it properly.

gas/testsuite/

PR binutils/16891
* gas/i386/opcode.s: Add test for fwait with prefix.
* gas/i386/opcode-intel.d: Updated.
* gas/i386/opcode-suffix.d: Likewise.
* gas/i386/opcode.d: Likewise.

opcodes/

PR binutils/16891
* i386-dis.c (print_insn): Handle prefixes before fwait.

10 years agoNew testsuite/boards/local-remote-host.exp board, now with editing on
Pedro Alves [Thu, 1 May 2014 16:25:52 +0000 (17:25 +0100)]
New testsuite/boards/local-remote-host.exp board, now with editing on

This adds a variant of local-remote-host-notty.exp that forces
pseudo-tty allocation, so that readline/editing is enabled.

 $ ssh localhost gdb -q
 (gdb) show editing
 Editing of command lines as they are typed is off.
 (gdb)

vs:

 $ ssh -t localhost gdb -q
 (gdb) show editing
 Editing of command lines as they are typed is on.

We now get, e.g.:

 Running ../../../src/gdb/testsuite/gdb.base/filesym.exp ...
 PASS: gdb.base/filesym.exp: complete on "filesy"
 PASS: gdb.base/filesym.exp: completion list for "filesym"
 PASS: gdb.base/filesym.exp: set breakpoint at filesym

gdb/testsuite/
2014-05-01  Pedro Alves  <palves@redhat.com>

        * boards/local-remote-host.exp: New file.

10 years agoRename testsuite/boards/local-remote-host.exp -> testsuite/boards/local-remote-host...
Pedro Alves [Thu, 1 May 2014 16:25:51 +0000 (17:25 +0100)]
Rename testsuite/boards/local-remote-host.exp -> testsuite/boards/local-remote-host-notty.exp

When testing with this board, stdin is not a tty, and so
readline/editing is disabled:

 $ ssh localhost gdb -q
 (gdb) show editing
 Editing of command lines as they are typed is off.
 (gdb)

Rename the file, to make room for a version of this board that forces a pseudo-tty.

gdb/testsuite/
2014-05-01  Pedro Alves  <palves@redhat.com>

* boards/local-remote-host.exp: Rename to ...
* boards/local-remote-host-notty.exp: ... this.

10 years ago2014-05-01 Steve Ellcey <sellcey@mips.com>
Steve Ellcey [Thu, 1 May 2014 16:09:33 +0000 (09:09 -0700)]
2014-05-01  Steve Ellcey  <sellcey@mips.com>

* include/longlong.h: Import latest version from GCC tree.

10 years agodaily update
Alan Modra [Thu, 1 May 2014 00:00:38 +0000 (09:30 +0930)]
daily update

10 years agoFixes a problem with the BFD library running out of memory because it mistakenly
Nick Clifton [Wed, 30 Apr 2014 16:04:04 +0000 (17:04 +0100)]
Fixes a problem with the BFD library running out of memory because it mistakenly
thought that an uncompressed .debug_str section was compressed.

* compress.c (bfd_is_section_compressed): When checking the
.debug_str section, also check the fifth byte in the section is
not part of a string.

* binutils-all/debug_str.s: New test.
* binutils-all/debug_str.d: New test control file.
* binutils-all/compress.exp: Run debug_str test.

10 years agoRemove unused arguments to few functions in dwarf2loc.c and gdbtypes.c.
Siva Chandra [Tue, 29 Apr 2014 12:27:14 +0000 (05:27 -0700)]
Remove unused arguments to few functions in dwarf2loc.c and gdbtypes.c.

gdb/ChangeLog:

* dwarf2loc.c (dwarf2_locexpr_baton_eval,
dwarf2_evaluate_property): Remove unused CORE_ADDR argument.
Update all callers.
* dwarf2loc.h (dwarf2_evaluate_property): Update signature.
* gdbtypes.c (resolve_dynamic_range, resolve_dynamic_array):
Remove unused CORE_ADDR argument.  Update all callers.

10 years agoDon't use vma to identify eh_frame personality function
Alan Modra [Wed, 30 Apr 2014 00:41:56 +0000 (10:11 +0930)]
Don't use vma to identify eh_frame personality function

This is all we should need to be able to run the eh_frame parts of
bfd_elf_discard_info before bfd_elf_size_dynamic_sections

* elf-eh-frame.c (struct cie.personality): Replace val with sym.
(find_merged_cie): Identify personality functions by (bfd_id,index)
pair when a local sym is used.

10 years agodaily update
Alan Modra [Wed, 30 Apr 2014 00:00:37 +0000 (09:30 +0930)]
daily update

10 years agoor1k: Do not override section for non-TLS symbols.
Christian Svensson [Mon, 28 Apr 2014 22:34:59 +0000 (00:34 +0200)]
or1k: Do not override section for non-TLS symbols.

Outgoing section for relocations was computed by setting a shared
pointer to which section should be used. For TLS this was overriden to
use .rela.got since they use GOT entries but since the pointer is per
section that whole section was relocated to .rela.got, even non-TLS
relocations.

* elf32-or1k.c: Fix a bug where non-TLS relocations would be forced
into .rela.got if it contained TLS relocations as well.

10 years agoFix remote connection to targets that don't support the QNonStop packet.
Pedro Alves [Tue, 29 Apr 2014 13:01:27 +0000 (14:01 +0100)]
Fix remote connection to targets that don't support the QNonStop packet.

... and others.  The recent patch that fixed several "set remote
foo-packet on/off" commands introduced a regression, observable when
connecting GDB to QEMU.  For instance:

        (gdb) set debug remote 1
        (gdb) tar rem :4444
        Remote debugging using :4444
        Sending packet: $qSupported:multiprocess+;qRelocInsn+#2a...Ack
        Packet received: PacketSize=1000;qXfer:features:read+
        Packet qSupported (supported-packets) is supported
        Sending packet: $Hgp0.0#ad...Ack
        Packet received: OK
        Sending packet: $qXfer:features:read:target.xml:0,ffb#79...Ack
        Packet received: [...]
        Sending packet: $qXfer:features:read:arm-core.xml:0,ffb#08...Ack
        Packet received: [...]
 !!! -> Sending packet: $QNonStop:0#8c...Ack
        Packet received:
        Remote refused setting all-stop mode with:

The "QNonStop" feature is associated with the PACKET_QNonStop packet,
with a default of PACKET_DISABLE, so GDB should not be sending the
packet at all.

The patch that introduced the regression decoupled packet_config's
'detect' and 'support' fields, making the former (an auto_boolean)
purely the associated "set remote foo-packet" command's variable.  In
the example above, the packet config's 'supported' field does end up
correctly set to PACKET_DISABLE.  However, nothing is presently
initializing packet configs that don't actually have a command
associated.  Those configs's 'detect' field then ends up set to
AUTO_BOOLEAN_TRUE, simply because that happens to be 0.  This forces
GDB to assume the packet is supported, irrespective of what the target
claims it supports, just like if the user had done "set remote
foo-packet on" (this being the associated command, if there was one).

Ideally, all packet configs would have a command associated.  While
that isn't true, make sure all packet configs are initialized, even if
no command is associated, and add an assertion that prevents adding
more packets/features without an associated command.

Tested on x86_64 Fedora 17, against pristine gdbserver, and against a
gdbserver with the QNonStop packet/feature disabled with a local hack.

gdb/
2014-04-29  Pedro Alves  <palves@redhat.com>

* remote.c (struct packet_config) <detect>: Extend comment.
(add_packet_config_cmd): Don't set the config's detect or support
fields here.
(init_all_packet_configs): Also initialize the config's 'detect'
field.
(reset_all_packet_configs_support): New function.
(remote_open_1): Call reset_all_packet_configs_support instead of
init_all_packet_configs.
(_initialize_remote): Initialize all packet configs.  Assert that
all packets have an associated command, except a few known
outliers.

10 years agodaily update
Alan Modra [Tue, 29 Apr 2014 00:00:42 +0000 (09:30 +0930)]
daily update

10 years agoAdd gdb.ada/dyn_arrayidx testcase.
Joel Brobecker [Sun, 20 Apr 2014 05:19:02 +0000 (22:19 -0700)]
Add gdb.ada/dyn_arrayidx testcase.

This add a testcases that verifies correct handling of dynamicity
for lower bounds of arrays.

gdb/testsuite/ChangeLog:

        * gdb.ada/dyn_arrayidx: New testcase.

10 years agodwarf2read.c::read_subrange_type: Handle dynamic lower bounds
Joel Brobecker [Sun, 20 Apr 2014 03:41:56 +0000 (20:41 -0700)]
dwarf2read.c::read_subrange_type: Handle dynamic lower bounds

Currently, read_subrange_type handles dynamicity only in the case of
the upper bound, and assumes that the lower bound is always static.
That's rooted in the fact that dynamicity was added to support C99
variable-length arrays, where the lower bound is always zero, and
therefore never dynamic.  But the lower bound can, in fact, be dynamic
in other languages such as Ada.

Consider for instance the following declaration in Ada...

    type Array_Type is array (L .. U) of Natural;

... where L and U are parameters of the function where the declaration
above was made, and whose value are 5 and 10.  Currently, the debugger
is able to print the value of the upper bound correctly, but not the
lower bound:

    (gdb) ptype array_type
    type = array (1 .. 10) of natural

After this patch, the debugger now prints:

    (gdb) ptype array_type
    type = array (5 .. 10) of natural

gdb/ChangeLog:

        * dwarf2read.c (read_subrange_type): Handle dynamic
        DW_AT_lower_bound attributes.

10 years agoImprove Ada dynamic range type handling.
Joel Brobecker [Sat, 19 Apr 2014 16:55:14 +0000 (09:55 -0700)]
Improve Ada dynamic range type handling.

Consider the following declaration in Ada...

   type Array_Type is array (L .. U) of Natural;

... where L and U are parameters of the function where the declaration
above was made. At the moment, GDB relies on descriptive types in order
to properly decode the array bounds. For instance, if L was 5, and U
was 10, we would see the following:

    (gdb) ptype array_type
    type = array (5 .. 10) of natural
    (gdb) maintenance set ada ignore-descriptive-types
    (gdb) ptype array_type
    type = array (1 .. 28544912) of natural

This patch enhances ada_discrete_type_{high,low}_bound to resolve
any dynamicity.  This is sufficient to fix the case of the upper bound.
For the lower bound, the dwarf2read module does not handle dynamic
lower bounds yet, but once it does, the lower bound should be correctly
handled as well [1].

gdb/ChangeLog:

        * ada-lang.c (ada_discrete_type_high_bound): Resolve the type's
        dynamic bounds before computing its upper bound.
        (ada_discrete_type_low_bound): Same as above with the lower bound.

[1]: The reason why we do not enhance dwarf2read to handle dynamic
lower bounds ahead of this patch is because it unveils some latent
issues such as this one.

10 years agoEnhance dwarfread.c::resolve_dynamic_type to resolve dynamic ranges
Joel Brobecker [Sat, 19 Apr 2014 16:40:53 +0000 (09:40 -0700)]
Enhance dwarfread.c::resolve_dynamic_type to resolve dynamic ranges

This change breaks down the resolve_dynamic_bounds function which
works only on arrays and its index range types into two functions,
one that resolves range types, and one that resolves arrays (using
the new routine to resolve the array's index range type). The
is_dynamic_type and resolve_dynamic_type function are then re-organized
to handle range types as well.

One small change worth mentioning is the fact that, now that range
types are resolved on their own (rather than in the limited context
of array index types), the resolved range types are created from
a copy of the dynamic range type, rather than from scratch (first
parameter of create_range_type). This allows us to preserve as many
original properties in the resolved type as possible (Eg. the type's
name).

This is preparation work that will help better support dynamic range
types for languages that allow the declaration of such types (Eg. Ada).

gdb/ChangeLog:

        * dwarf2read.c (is_dynamic_type): Return true for dynamic
        range types.  Adjust the array handling implementation to
        take advantage of this change.
        (resolve_dynamic_range): New function, mostly extracted from
        resolve_dynamic_bounds.
        (resolve_dynamic_array): New function, mostly extracted from
        resolve_dynamic_bounds.
        (resolve_dynamic_bounds): Delete.
        (resolve_dynamic_type): Reimplement.  Add handling of
        TYPE_CODE_RANGE types.

10 years agoUnnecessary XA type handling in ada_varobj_describe_simple_array_child
Joel Brobecker [Thu, 24 Apr 2014 16:09:11 +0000 (12:09 -0400)]
Unnecessary XA type handling in ada_varobj_describe_simple_array_child

ada-varobj.c::ada_varobj_describe_simple_array_child only ever gets
called after all GNAT encodings have been applied to (parent_value,
parent_type). So there is no point in redoing it partially by
checking for parallel XA types again.

gdb/ChangeLog:

* ada-varobj.c (ada_varobj_describe_simple_array_child): Remove
handling of parallel ___XA types.

10 years agoremove unnecessary second call to static_unwrap_type in ada_evaluate_subexp
Joel Brobecker [Tue, 18 Mar 2014 17:52:08 +0000 (10:52 -0700)]
remove unnecessary second call to static_unwrap_type in ada_evaluate_subexp

In ada-lang.c::ada_evaluate_subexp, case OP_VAR_VALUE, when noside
is EVAL_AVOID_SIDE_EFFECTS, the first thing we do is set type as
follow:

    type = static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol));

Later on in the same block, we make the same call:

    return value_zero
      (to_static_fixed_type
       (static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol))),
       not_lval);

This patch removes the second call, since it should result in the same
type being returned, so no point in making that call again.

gdb/ChangeLog:

        * ada-lang.c (ada_evaluate_subexp) <OP_VAR_VALUE>: Remove
        unnecessary second call to static_unwrap_type.

10 years agoThis fixes a bootstrapping problem with gcc 4.9 in an x86 PE environment.
Nick Clifton [Mon, 28 Apr 2014 13:32:59 +0000 (14:32 +0100)]
This fixes a bootstrapping problem with gcc 4.9 in an x86 PE environment.
The problem was that references to weak function symbols were being
incorrectly biased by definition's offset.

PR gas/16858
* config/tc-i386.c (md_apply_fix): Do not adjust value of
pc-relative fixes against weak symbols.

10 years ago[gdbserver] Correctly generate i386-avx512.c
Yao Qi [Mon, 28 Apr 2014 10:56:06 +0000 (18:56 +0800)]
[gdbserver] Correctly generate i386-avx512.c

The makefile rule i386-avx512.c is to generate i386-avx512.c, but it
is written to i386-avx.c by mistake.  This patch is to fix this typo.

gdb/gdbserver:

2014-04-28  Yao Qi  <yao@codesourcery.com>

* Makefile.in (i386-avx512.c): Fix the typo of generated file
name.

10 years agoThis patch reworks the fix to avoid a compile time warning so that it will work
Nick Clifton [Mon, 28 Apr 2014 08:34:02 +0000 (09:34 +0100)]
This patch reworks the fix to avoid a compile time warning so that it will work
with later versions of gcc.

PR ld/16821
* peXXigen.c (_bfd_XXi_swap_sym_out): Rework fix to avoid compile
time warning.

10 years agodaily update
Alan Modra [Mon, 28 Apr 2014 00:00:57 +0000 (09:30 +0930)]
daily update

10 years agoMake "set disassemble-next-line on" can work with DUMMY_FRAME, SIGTRAMP_FRAME and...
Hui Zhu [Sun, 27 Apr 2014 14:23:43 +0000 (22:23 +0800)]
Make "set disassemble-next-line on" can work with DUMMY_FRAME, SIGTRAMP_FRAME and ARCH_FRAME

When GDB debug DUMMY_FRAME, SIGTRAMP_FRAME and ARCH_FRAME, even if
"set disassemble-next-line on", it will not output the asm code:
(gdb) set disassemble-next-line on
(gdb) si
<signal handler called>
(gdb)
<signal handler called>
(gdb)
<signal handler called>

So make this patch make they can work together, it will become:
(gdb) si
<signal handler called>
=> 0xffffffff816bfb09 <int_with_check+0>: 65 48 8b 0c 25 c8 c7 00 00 mov    %gs:0xc7c8,%rcx
(gdb)
<signal handler called>
=> 0xffffffff816bfb12 <int_with_check+9>: 48 81 e9 d8 1f 00 00 sub    $0x1fd8,%rcx
(gdb)
<signal handler called>
=> 0xffffffff816bfb19 <int_with_check+16>: 8b 51 10 mov    0x10(%rcx),%edx

2014-04-27  Hui Zhu  <hui@codesourcery.com>

* stack.c (print_frame_info): Call do_gdb_disassembly with
DUMMY_FRAME, SIGTRAMP_FRAME and ARCH_FRAME.

10 years agodaily update
Alan Modra [Sun, 27 Apr 2014 00:00:59 +0000 (09:30 +0930)]
daily update

10 years ago* guile/scm-safe-call.c (scscm_eval_scheme_string): Fix comment.
Doug Evans [Sat, 26 Apr 2014 20:13:13 +0000 (13:13 -0700)]
* guile/scm-safe-call.c (scscm_eval_scheme_string): Fix comment.

10 years agoRegenerate files for openrisk -> or1k change
Alan Modra [Sat, 26 Apr 2014 13:30:09 +0000 (23:00 +0930)]
Regenerate files for openrisk -> or1k change

bfd/
* po/SRC-POTFILES.in: Regenerate.
* configure: Regenerate.
gas/
* po/POTFILES.in: Regenerate.
opcodes/
* po/POTFILES.in: Regenerate.

10 years agoCompute the function length instead of hard coding it
Yao Qi [Thu, 24 Apr 2014 08:51:33 +0000 (16:51 +0800)]
Compute the function length instead of hard coding it

In Dwarf::assemble in dwz.exp, 10 is hard-coded in it,

      subprogram {
  {name main}
  {low_pc main addr}
{high_pc "main + 10" addr}
      }

however, the length of main function varies on architectures.  The
hard-coded 10 here causes dwz.exp fails on some targets, such as
nios2.

This patch is to add some code to compute the length of function main,
which is similar to what we are doing in entry-values.exp.

gdb/testsuite:

2014-04-26  Yao Qi  <yao@codesourcery.com>

* gdb.dwarf2/dwz.exp: Compile main.c to object.  Restart GDB
and compute the length of function main.  Save it in
$main_length.
(Dwarf::assemble): Use $main_length instead of hard-coded 10.
(top-level): Use gdb_compile to compile objects into
executable and restart GDB.  Remove invocation to
prepare_for_testing.

10 years agodaily update
Alan Modra [Sat, 26 Apr 2014 00:00:55 +0000 (09:30 +0930)]
daily update

10 years agoAdd missing gdbserver/ChangeLog entry for previous commit.
Pedro Alves [Fri, 25 Apr 2014 18:22:27 +0000 (19:22 +0100)]
Add missing gdbserver/ChangeLog entry for previous commit.

2014-04-25  Pedro Alves  <palves@redhat.com>

PR server/16255
* linux-low.c (linux_attach_fail_reason_string): New function.
(linux_attach_lwp): Delete.
(linux_attach_lwp_1): Rename to ...
(linux_attach_lwp): ... this.  Take a ptid instead of a pid as
argument.  Remove "initial" parameter.  Return int instead of
void.  Don't error or warn here.
(linux_attach): Adjust to call linux_attach_lwp.  Call error on
failure to attach to the tgid.  Call warning when failing to
attach to an lwp.
* linux-low.h (linux_attach_lwp): Take a ptid instead of a pid as
argument.  Remove "initial" parameter.  Return int instead of
void.  Don't error or warn here.
(linux_attach_fail_reason_string): New declaration.
* thread-db.c (attach_thread): Adjust to linux_attach_lwp's
interface change.  Use linux_attach_fail_reason_string.

10 years agoPR server/16255: gdbserver cannot attach to a second inferior that is multi-threaded.
Pedro Alves [Fri, 25 Apr 2014 18:07:33 +0000 (19:07 +0100)]
PR server/16255: gdbserver cannot attach to a second inferior that is multi-threaded.

On Linux, we need to explicitly ptrace attach to all lwps of a
process.  Because GDB might not be connected yet when an attach is
requested, and thus it may not be possible to activate thread_db, as
that requires access to symbols (IOW, gdbserver --attach), a while ago
we make linux_attach loop over the lwps as listed by /proc/PID/task to
find the lwps to attach to.

linux_attach_lwp_1 has:

...
  if (initial)
    /* If lwp is the tgid, we handle adding existing threads later.
       Otherwise we just add lwp without bothering about any other
       threads.  */
    ptid = ptid_build (lwpid, lwpid, 0);
  else
    {
      /* Note that extracting the pid from the current inferior is
 safe, since we're always called in the context of the same
 process as this new thread.  */
      int pid = pid_of (current_inferior);
      ptid = ptid_build (pid, lwpid, 0);
    }

That "safe" comment referred to linux_attach_lwp being called by
thread-db.c.  But this was clearly missed when a new call to
linux_attach_lwp_1 was added to linux_attach.  As a result,
current_inferior will be set to some random process, and non-initial
lwps of the second inferior get assigned the pid of the wrong
inferior.  E.g., in the case of attaching to two inferiors, for the
second inferior (and so on), non-initial lwps of the second inferior
get assigned the pid of the first inferior.  This doesn't trigger on
the first inferior, when current_inferior is NULL, add_thread switches
the current inferior to the newly added thread.

Rather than making linux_attach switch current_inferior temporarily
(thus avoiding further reliance on global state), or making
linux_attach_lwp_1 get the tgid from /proc, which add extra syscalls,
and will be wrong in case of the user having originally attached
directly to a non-tgid lwp, and then that lwp spawning new clones (the
ptid.pid field of further new clones should be the same as the
original lwp's pid, which is not the tgid), we note that callers of
linux_attach_lwp/linux_attach_lwp_1 always have the right pid handy
already, so they can pass it down along with the lwpid.

The only other reason for the "initial" parameter is to error out
instead of warn in case of attach failure, when we're first attaching
to a process.  There are only three callers of
linux_attach_lwp/linux_attach_lwp_1, and each wants to print a
different warn/error string, so we can just move the error/warn out of
linux_attach_lwp_1 to the callers, thus getting rid of the "initial"
parameter.

There really nothing gdbserver-specific about attaching to two
threaded processes, so this adds a new test under gdb.multi/.  The
test passes cleanly against the native GNU/Linux target, but
fails/triggers the bug against GDBserver (before the patch), with the
native-extended-remote board (as plain remote doesn't support
multi-process).

Tested on x86_64 Fedora 17, with the native-extended-gdbserver board.

gdb/gdbserver/
2014-04-25  Pedro Alves  <palves@redhat.com>

PR server/16255
* linux-low.c (linux_attach_fail_reason_string): New function.
(linux_attach_lwp): Delete.
(linux_attach_lwp_1): Rename to ...
(linux_attach_lwp): ... this.  Take a ptid instead of a pid as
argument.  Remove "initial" parameter.  Return int instead of
void.  Don't error or warn here.
(linux_attach): Adjust to call linux_attach_lwp.  Call error on
failure to attach to the tgid.  Call warning when failing to
attach to an lwp.
* linux-low.h (linux_attach_lwp): Take a ptid instead of a pid as
argument.  Remove "initial" parameter.  Return int instead of
void.  Don't error or warn here.
(linux_attach_fail_reason_string): New declaration.
* thread-db.c (attach_thread): Adjust to linux_attach_lwp's
interface change.  Use linux_attach_fail_reason_string.

gdb/
2014-04-25  Pedro Alves  <palves@redhat.com>

PR server/16255
* common/linux-ptrace.c (linux_ptrace_attach_warnings): Rename to ...
(linux_ptrace_attach_fail_reason): ... this.  Remove "warning: "
and newline from built string.
* common/linux-ptrace.h (linux_ptrace_attach_warnings): Rename to ...
(linux_ptrace_attach_fail_reason): ... this.
* linux-nat.c (linux_nat_attach): Adjust to use
linux_ptrace_attach_fail_reason.

gdb/testsuite/
2014-04-25  Simon Marchi  <simon.marchi@ericsson.com>
    Pedro Alves  <palves@redhat.com>

PR server/16255
* gdb.multi/multi-attach.c: New file.
* gdb.multi/multi-attach.exp: New file.

10 years agoFix several "set remote foo-packet on/off" commands.
Pedro Alves [Fri, 25 Apr 2014 17:07:02 +0000 (18:07 +0100)]
Fix several "set remote foo-packet on/off" commands.

For several RSP packets, there's a corresponding "set remote
foo-packet on/off/auto" command that one can use do bypass
auto-detection of support for the packet or feature.  However, I
noticed that setting several of these commands to 'on' or 'off'
doesn't actually have any effect.  These are, at least:

 set remote breakpoint-commands-packet
 set remote conditional-breakpoints-packet
 set remote fast-tracepoints-packet
 set remote static-tracepoints-packet
 set remote install-in-trace-packet

These are commands that control a remote protocol feature that doesn't
have a corresponding regular packet, and because of that we cache the
knowledge of the remote side support as returned by the qSupported
packet in the remote_state object.

E.g., in the case of the 'set remote breakpoint-commands-packet'
command, whether the feature is supported is recorded in the
'breakpoint_commands' field of the remote_state object.

Whether to bypass packet support auto-detection or not is controlled
by the 'detect' field of the corresponding packet's packet_config
structure.  That field is the variable associated directly with the
"set remote foo-packet" command.  Actual remote stub support for the
packet (or feature) is recorded in the 'support' field of the same
structure.

However, when the user toggles the command, the 'support' field is
also correspondingly updated to PACKET_ENABLE/DISABLE/SUPPORT_UNKNOWN,
discarding the knowledge of whether the target actually supports the
feature.  If one toggles back to 'auto', it's no big issue for real
packets, as they'll just end up re-probed the next time they might be
necessary.  But features whose support is only reported through
qSupported don't get their corresponding (manually added/maintained)
fields in remote_state objected updated.  As we lost the actual status
of the target support for the feature, GDB would need to probe the
qSupported features again, which GDB doesn't do.

But we can avoid that extra traffic, and clean things up, IMO.
Instead of going in that direction, this patch completely decouples
struct packet_config's 'detect' and 'support' fields.  E.g., when the
user does "set remote foo-packet off", instead of setting the packet
config's 'support' field to PACKET_DISABLE, the 'support' field is not
touched at all anymore.  That is, we end up respecting this simple
table:

| packet_config->detect | packet_config->support | should use packet/feature? |
|-----------------------+------------------------+----------------------------|
| auto                  | PACKET_ENABLE          | PACKET_ENABLE              |
| auto                  | PACKET_DISABLE         | PACKET_DISABLE             |
| auto                  | PACKET_UNKNOWN         | PACKET_UNKNOWN             |
| yes                   | don't care             | PACKET_ENABLE              |
| no                    | don't care             | PACKET_DISABLE             |

This is implemented by the new packet_support function.  With that, we
need to update this pattern throughout:

  if (remote_protocol_packets[PACKET_foo].support == PACKET_DISABLE)

to do this instead:

  if (packet_support (PACKET_qAttached) == PACKET_DISABLE)

where as mentioned, the packet_support function takes struct
packet_config's 'detect' field into account, like in the table above.

As when the packet is force-disabled or force-enabled, the 'support'
field is just ignored, if the command is set back to auto, we'll
resume respecting whatever the target said it supports.  IOW, the end
result is that the 'support' field always represents whether the
target actually supports the packet or not.

After all that, the manually maintained breakpoint_commands and
equivalent fields of struct remote_state can then be eliminated, with
references replaced by checking the result of calling the
packet_support function on the corresponding packet or feature.  This
required adding new PACKET_foo enum values for several features that
didn't have it yet.  (The patch does not add corresponding "set remote
foo-packet" style commands though, focusing only on bug fixing and
laying the groundwork).

Tested on x86_64 Fedora 17, native GDBserver.  The new tests all fail
without this patch.

gdb/
2014-04-25  Pedro Alves  <palves@redhat.com>

* remote.c (struct remote_state): Remove multi_process_aware,
non_stop_aware, cond_tracepoints, cond_breakpoints,
breakpoint_commands, fast_tracepoints, static_tracepoints,
install_in_trace, disconnected_tracing,
enable_disable_tracepoints, string_tracing, and
augmented_libraries_svr4_read fields.
(remote_multi_process_p): Move further below in the file.
(struct packet_config): Add comments.
(update_packet_config): Delete function.
(show_packet_config_cmd): Use packet_config_support.
(add_packet_config_cmd): Use NULL as set callback.
(packet_ok): "set remote foo-packet"-style commands no longer
change config->supported -- adjust.
(PACKET_ConditionalTracepoints, PACKET_ConditionalBreakpoints)
(PACKET_BreakpointCommands, PACKET_FastTracepoints)
(PACKET_StaticTracepoints, PACKET_InstallInTrace): Add comments.
(PACKET_QNonStop, PACKET_multiprocess_feature)
(PACKET_EnableDisableTracepoints_feature, PACKET_tracenz_feature)
(PACKET_DisconnectedTracing_feature)
(PACKET_augmented_libraries_svr4_read_feature): New enum values.
(set_remote_protocol_packet_cmd): Delete function.
(packet_config_support, packet_support): New functions.
(set_remote_protocol_Z_packet_cmd): Don't call
update_packet_config.
(remote_query_attached, remote_pass_signals)
(remote_program_signals, remote_threads_info)
(remote_threads_extra_info, remote_start_remote): Use
packet_support.
(remote_start_remote): Use packet_config_support and
packet_support.
(init_all_packet_configs): Set all packets to unknown support,
instead of calling update_packet_config.
(remote_check_symbols): Use packet_support.
(remote_supported_packet): Unconditionally set the packet config's
support status.
(remote_multi_process_feature, remote_non_stop_feature)
(remote_cond_tracepoint_feature, remote_cond_breakpoint_feature)
(remote_breakpoint_commands_feature)
(remote_fast_tracepoint_feature, remote_static_tracepoint_feature)
(remote_install_in_trace_feature)
(remote_disconnected_tracing_feature)
(remote_enable_disable_tracepoint_feature)
(remote_string_tracing_feature)
(remote_augmented_libraries_svr4_read_feature): Delete functions.
(remote_protocol_features): Adjust to use remote_supported_packet
for "augmented-libraries-svr4-read", "multiprocess", "QNonStop",
"ConditionalTracepoints", "ConditionalBreakpoints",
"BreakpointCommands", "FastTracepoints", "StaticTracepoints",
"InstallInTrace", "DisconnectedTracing", "DisconnectedTracing",
"EnableDisableTracepoints", and "tracenz".
(remote_query_supported): Use packet_support.
(remote_open_1): Adjust.
(extended_remote_attach_1): Use packet_support.  Switch on the
result of packet_ok instead of checking whether the packet ended
up disabled.
(remote_vcont_resume): Use packet_support.
(remote_resume, remote_stop_ns, fetch_register_using_p)
(remote_prepare_to_store, store_register_using_P)
(check_binary_download, remote_write_bytes): Use packet_support.
(remote_vkill): Use packet_support.  Switch on the result of
packet_ok instead of checking whether the packet ended up
disabled.
(extended_remote_supports_disable_randomization): Use
packet_support.
(extended_remote_run): Switch on the result of packet_ok instead
of checking whether the packet ended up disabled.
(remote_insert_breakpoint, remote_remove_breakpoint)
(remote_insert_watchpoint, remote_remove_watchpoint)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Use
packet_support.
(remote_search_memory): Use packet_config_support.
(remote_get_thread_local_address, remote_get_tib_address)
(remote_hostio_send_command, remote_can_execute_reverse): Use
packet_support.
(remote_supports_cond_tracepoints)
(remote_supports_cond_breakpoints)
(remote_supports_fast_tracepoints)
(remote_supports_static_tracepoints)
(remote_supports_install_in_trace)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands): Rewrite, checking whether
the packet config says the feature is enabled or disabled.
(remote_download_tracepoint, remote_trace_set_readonly_regions)
(remote_get_trace_status): Use packet_support.
(remote_set_disconnected_tracing): Adjust to check whether the
feature is enabled with packet_support.
(remote_set_trace_buffer_size, remote_use_agent)
(remote_can_use_agent, remote_supports_btrace): Use
packet_support.
(remote_enable_btrace, remote_disable_btrace, remote_read_btrace):
Use packet_config_support.
(remote_augmented_libraries_svr4_read): Rewrite, checking whether
the packet config says the feature is enabled or disabled.
(set_range_stepping): Use packet_support.

gdb/testsuite/
2014-04-25  Pedro Alves  <palves@redhat.com>

* gdb.base/cond-eval-mode.exp (warning): Move trailing \r\n to
user.
(top level): Test that "set remote conditional-breakpoints-packet
off" works as intended.
* gdb.base/dprintf.exp: Test that "set remote
breakpoint-commands-packet off" works as intended.
* gdb.trace/change-loc.exp (tracepoint_install_in_trace_disabled):
New function.
(top level): Call it.
* gdb.trace/ftrace.exp (test_fast_tracepoints): Test that "set
remote fast-tracepoints-packet off" works as intended.
* gdb.trace/qtro.exp (gdb_is_target_remote): Moved ...
* lib/gdb.exp (gdb_is_target_remote): ... here.

10 years agoThis fixes a compile time warning which is being treated as an error. Older
Nick Clifton [Fri, 25 Apr 2014 16:00:20 +0000 (17:00 +0100)]
This fixes a compile time warning which is being treated as an error.  Older
versions of gcc complain about part of a conditional expression always
evaluating to false because of the size of the operands involved, even when
the entire expression is already known to be false.

* peXXigen.c (_bfd_XXi_swap_sym_out): Another fix for building on
a 342-bit host.  This time for older versions of gcc.

10 years agodocument "quit" command's argument
Tom Tromey [Fri, 25 Apr 2014 15:43:47 +0000 (09:43 -0600)]
document "quit" command's argument

2014-04-25  Tom Tromey  <tromey@redhat.com>

* cli/cli-cmds.c (_initialize_cli_cmds): Document "quit" command's
argument.

10 years agonews: mention support for C99 variable length arrays
Sanimir Agovic [Tue, 22 Apr 2014 14:26:33 +0000 (15:26 +0100)]
news: mention support for C99 variable length arrays

* NEWS: Mention support for C99 variable length arrays.

10 years agoEnsure unreferenced static symbols aren't omitted by clang (either marking them __att...
David Blaikie [Fri, 11 Apr 2014 06:45:28 +0000 (23:45 -0700)]
Ensure unreferenced static symbols aren't omitted by clang (either marking them __attribute__((used)) or making them non-static)

gdb/testsuite/
       * gdb.base/catch-syscall.c: Make unreferenced statics non-static to
       ensure clang would not discard them.
       * gdb.base/gdbvars.c: Ditto.
       * gdb.base/memattr.c: Ditto.
       * gdb.base/whatis.c: Ditto.
       * gdb.python/py-prettyprint.c: Ditto.
       * gdb.trace/actions.c: Ditto.
       * gdb.cp/ptype-cv-cp.cc: Mark unused global const int as used to
       ensure clang would not discard it.

10 years agoCause clang to emit the definition of a type used only by pointer
David Blaikie [Fri, 25 Apr 2014 05:16:29 +0000 (22:16 -0700)]
Cause clang to emit the definition of a type used only by pointer

gdb/testsuite/
* gdb.stabs/gdb11479.c (tag_dummy_enum): introduce a variable to cause
clang to emit the full definition of type required by the test
* gdb.stabs/gdb11479.exp (do_test): correct a typo in a test message

10 years agoReturn by value to coax Clang into emitting the full definition of a test type.
David Blaikie [Sun, 13 Apr 2014 07:48:45 +0000 (00:48 -0700)]
Return by value to coax Clang into emitting the full definition of a test type.

gdb/testsuite/
* gdb.cp/pr10728-x.cc: Return by value instead of pointer to coax
Clang into emitting the definition of the type.
* gdb.cp/pr10728-x.h: Ditto.
* gdb.cp/pr10728-y.cc: Ditto.

10 years agoXFAIL under Clang tests using labels
David Blaikie [Sun, 13 Apr 2014 18:42:02 +0000 (11:42 -0700)]
XFAIL under Clang tests using labels

gdb/testsuite/
* gdb.base/label.exp: XFAIL label related tests under Clang.
* gdb.cp/cplabel.exp: Ditto.
* gdb.linespec/ls-errs.exp: Refactor tests to execute directly
and XFAIL under Clang those using labels.

10 years agoRemove unused labels in dwarf assembler
Yao Qi [Thu, 24 Apr 2014 10:46:22 +0000 (18:46 +0800)]
Remove unused labels in dwarf assembler

I happen to see that 'double_label' isn't used in dwz.exp dwarf assembler.
Similarly, partial_label and double_label aren't used in dwzbuildid.exp.
This patch is to remove them.

gdb/testsuite:

2014-04-25  Yao Qi  <yao@codesourcery.com>

* gdb.dwarf2/dwz.exp (Dwarf::assemble): Remove unused
double_label.
* gdb.dwarf2/dwzbuildid.exp (Dwarf::assemble): Remove
partial_label and double_label.

10 years agodaily update
Alan Modra [Fri, 25 Apr 2014 00:00:56 +0000 (09:30 +0930)]
daily update

10 years agoAdd maintainers for OR1K.
Christian Svensson [Thu, 24 Apr 2014 22:40:41 +0000 (00:40 +0200)]
Add maintainers for OR1K.

* MAINTAINERS: Add myself and Stefan as OR1K maintainers.

10 years agoFix and XFAIL test due to GCC PR55641, passes with clang
David Blaikie [Sun, 13 Apr 2014 07:38:47 +0000 (00:38 -0700)]
Fix and XFAIL test due to GCC PR55641, passes with clang

gdb/testsuite/
* gdb.python/lib-types.exp: Fix test and xfail under gcc due to gcc/55641.

10 years agoada-lang.c: Expand standard_exc's introductory comment.
Joel Brobecker [Thu, 24 Apr 2014 20:16:38 +0000 (13:16 -0700)]
ada-lang.c: Expand standard_exc's introductory comment.

This patch expands standard_exc's introductory comment to explain
why this table does not include Numeric_Error.

gdb/ChangeLog:

        * ada-lang.c (standard_exc): Expand introductory comment.