binutils-gdb.git
9 years agosim: move sim-engine.o/sim-hrw.o to the common list
Mike Frysinger [Tue, 7 Apr 2015 03:40:00 +0000 (23:40 -0400)]
sim: move sim-engine.o/sim-hrw.o to the common list

This makes these two objects available to all sims by default.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 7 Apr 2015 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix the signature of a virtual method to match the one in the parent class.
Rafael Ávila de Espíndola [Mon, 6 Apr 2015 19:49:50 +0000 (15:49 -0400)]
Fix the signature of a virtual method to match the one in the parent class.

9 years agoAvoid a call to find by using the return value of insert.
Rafael Ávila de Espíndola [Mon, 6 Apr 2015 19:45:37 +0000 (15:45 -0400)]
Avoid a call to find by using the return value of insert.

9 years agoAvoid a copy constructor call.
Rafael Ávila de Espíndola [Mon, 6 Apr 2015 19:39:42 +0000 (15:39 -0400)]
Avoid a copy constructor call.

9 years agoRemove is_zlib_supported
H.J. Lu [Mon, 6 Apr 2015 19:19:13 +0000 (12:19 -0700)]
Remove is_zlib_supported

Since zlib is always supported, there is no need for is_zlib_supported.

binutils/testsuite/

* binutils-all/compress.exp: Remove is_zlib_supported check.
* binutils-all/objdump.exp: Likewise.
* binutils-all/readelf.exp (readelf_compressed_wa_test): Likewise.
* lib/utils-lib.exp (run_dump_test): Likewise.
* lib/binutils-common.exp (is_zlib_supported): Removed.

gas/testsuite/

* lib/gas-defs.exp (run_dump_test): Remove is_zlib_supported check.

ld/testsuite/

* ld-elf/compress.exp: Remove is_zlib_supported check.
Fail if --compress-debug-sections doesn't work.
* lib/ld-lib.exp (run_dump_test): Remove is_zlib_supported check.

9 years agox86: Use individual prefix control for each opcode.
Ilya Tocar [Mon, 6 Apr 2015 16:33:01 +0000 (19:33 +0300)]
x86: Use individual prefix control for each opcode.

2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
    H.J. Lu  <hongjiu.lu@intel.com>

* i386-dis-evex.h (evex_table): Fill prefix_requirement field.
* i386-dis.c (PREFIX_MANDATORY_REPZ, PREFIX_MANDATORY_REPNZ,
PREFIX_MANDATORY_DATA, PREFIX_MANDATORY_ADDR, PREFIX_MANDATORY_LOCK,
PREFIX_UD_SHIFT, PREFIX_UD_REPZ, REFIX_UD_REPNZ, PREFIX_UD_DATA,
PREFIX_UD_ADDR, PREFIX_UD_LOCK, PREFIX_OPTIONAL, PREFIX_MANDATORY):
Define.
(Bad_Opcode, FLOAT, DIS386, DIS386_PREFIX, THREE_BYTE_TABLE_PREFIX):
Fill prefix_requirement field.
(struct dis386): Add prefix_requirement field.
(dis386): Fill prefix_requirement field.
(dis386_twobyte): Ditto.
(twobyte_has_mandatory_prefix_: Remove.
(reg_table): Fill prefix_requirement field.
(prefix_table): Ditto.
(x86_64_table): Ditto.
(three_byte_table): Ditto.
(xop_table): Ditto.
(vex_table): Ditto.
(vex_len_table): Ditto.
(vex_w_table): Ditto.
(mod_table): Ditto.
(bad_opcode): Ditto.
(print_insn): Use prefix_requirement.
(FGRPd9_2, FGRPd9_4, FGRPd9_5, FGRPd9_6, FGRPd9_7, FGRPda_5, FGRPdb_4,
FGRPde_3, FGRPdf_4): Fill prefix_requirement field.
(float_reg): Ditto.

9 years agoUse bfd_putb64/bfd_getb64
H.J. Lu [Mon, 6 Apr 2015 16:01:43 +0000 (09:01 -0700)]
Use bfd_putb64/bfd_getb64

bfd/

* compress.c (get_uncompressed_size): Removed.
(bfd_compress_section_contents): Use bfd_putb64 to write
uncompressed section size.
(bfd_init_section_decompress_status): Replace
get_uncompressed_size with bfd_getb64.

gas/

* write.c (compress_debug): Use bfd_putb64 to write uncompressed
section size.

9 years agoRemove "/dev/null" from remote_exec
H.J. Lu [Mon, 6 Apr 2015 15:59:15 +0000 (08:59 -0700)]
Remove "/dev/null" from remote_exec

We should catch all errors/warnings from cmp.

* binutils-all/compress.exp (compression_used): Remove "/dev/null"
from remote_exec.

9 years agoAdd testcase for stub-method reading in stabs.
Doug Evans [Mon, 6 Apr 2015 15:59:58 +0000 (08:59 -0700)]
Add testcase for stub-method reading in stabs.

This patch is based on the testcase provided here:
https://sourceware.org/ml/gdb-patches/2015-02/msg00181.html

I've verified that it catches the internal error discovered here:
https://sourceware.org/ml/gdb-patches/2015-02/msg00139.html

gdb/testsuite/ChangeLog:

* lib/gdb.exp (clean_restart): Return result of gdb_load.
* gdb.pascal/stub-method.exp: New file.
* gdb.pascal/stub-method.pas: New file.

9 years ago* lib/pascal.exp (gpc_compile): Rename dest arg to destfile.
Doug Evans [Mon, 6 Apr 2015 15:45:06 +0000 (08:45 -0700)]
* lib/pascal.exp (gpc_compile): Rename dest arg to destfile.

The "dest" parameter to fpc_compile/gpc_compile is the name of
compilation destination file, not a board name.

This patch fixes this by using names consistent with
lib/future.exp:gdb_default_target_compile.

gdb/testsuite/ChangeLog:

* lib/pascal.exp (gpc_compile): Rename dest arg to destfile.
Fix dest parameter to board_info.
(fpc_compile): Ditto.
(gdb_compile_pascal): Rename dest arg to destfile.

9 years agosymtab.c (hash_symbol_entry): Hash STRUCT_DOMAIN symbols as VAR_DOMAIN.
Doug Evans [Mon, 6 Apr 2015 15:31:46 +0000 (08:31 -0700)]
symtab.c (hash_symbol_entry): Hash STRUCT_DOMAIN symbols as VAR_DOMAIN.

gdb/ChangeLog:

* symtab.c (hash_symbol_entry): Hash STRUCT_DOMAIN symbols as
VAR_DOMAIN.
(symbol_cache_lookup): Clarify use of bsc_ptr, slot_ptr parameters.
Include symbol domain in debugging output.

9 years agoFallback to stub-termcap.c on all hosts
Pedro Alves [Mon, 6 Apr 2015 11:35:18 +0000 (12:35 +0100)]
Fallback to stub-termcap.c on all hosts

Currently building gdb is impossible without an installed termcap or
curses library.  But, GDB already has a very minimal termcap in the
tree to handle this situation for Windows -- gdb/stub-termcap.c.  This
patch makes that the fallback for all hosts.

Testing this on GNU/Linux (by simply hacking away the termcap/curses
detection in gdb/configure.ac), we trip on:

 ../readline/libreadline.a(terminal.o): In function `_rl_init_terminal_io':
 /home/pedro/gdb/mygit/src/readline/terminal.c:527: undefined reference to `PC'
 /home/pedro/gdb/mygit/src/readline/terminal.c:528: undefined reference to `BC'
 /home/pedro/gdb/mygit/src/readline/terminal.c:529: undefined reference to `UP'
 /home/pedro/gdb/mygit/src/readline/terminal.c:538: undefined reference to `PC'
 /home/pedro/gdb/mygit/src/readline/terminal.c:539: undefined reference to `BC'
 /home/pedro/gdb/mygit/src/readline/terminal.c:540: undefined reference to `UP'

These are globals that are normally defined by termcap (or ncurses'
termcap emulation).

Now, we could just define replacements in stub-termcap.c, but
readline/terminal.c (at least the copy in our tree) has this:

 #if !defined (__linux__) && !defined (NCURSES_VERSION)
 #  if defined (__EMX__) || defined (NEED_EXTERN_PC)
 extern
 #  endif /* __EMX__ || NEED_EXTERN_PC */
 char PC, *BC, *UP;
 #endif /* !__linux__ && !NCURSES_VERSION */

which can result in readline defining the globals too.  That will
usually work out in C, given that "-fcommon" is usually the default
for C compilers, but that won't work for C++, or C with -fno-common
(link fails with "multiple definition" errors)...

Mirroring those #ifdef conditions in the stub termcap screams
"brittle" to me -- I can see them changing in latter readline
versions.

Work around that by simply using __attribute__((weak)).
Windows/PE/COFF's do support weak, but not on gcc 3.4 based toolchains
(4.8.x does work).  Given the file never needed the variables while it
was Windows-only, just continue not defining them there.  All other
supported hosts should support this.

gdb/ChangeLog:
2015-04-06  Pedro Alves  <palves@redhat.com>
    Bernd Edlinger  <bernd.edlinger@hotmail.de>

* configure.ac: Remove the mingw32-specific stub-termcap.o
fallback, and instead fallback to the stub termcap on all hosts.
* configure: Regenerate.
* stub-termcap.c [!__MINGW32__] (PC, BC, UP): Define as weak
symbols.

9 years ago[Gold,x86_64] Convert mov foo@GOTPCREL(%rip), %reg to lea foo(%rip), %reg
Ilya Tocar [Mon, 6 Apr 2015 09:37:34 +0000 (12:37 +0300)]
[Gold,x86_64] Convert mov foo@GOTPCREL(%rip), %reg to lea foo(%rip), %reg

2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>

PR gold/17641
* x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
(Target_x86_64::Scan::local): Don't create GOT entry, when we
can convert mov to lea.
(Target_x86_64::Scan::global): Ditto.
(Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
%reg to lea foo(%rip), %reg if possible.
* testsuite/Makefile.am (x86_64_mov_to_lea): New test.
* testsuite/x86_64_mov_to_lea1.s: New.
* testsuite/x86_64_mov_to_lea2.s: Ditto.
* testsuite/x86_64_mov_to_lea3.s: Ditto.
* testsuite/x86_64_mov_to_lea4.s: Ditto.
* testsuite/x86_64_mov_to_lea.sh: Ditto.
---

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 6 Apr 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAdd SHF_COMPRESSED support to readelf
H.J. Lu [Sun, 5 Apr 2015 16:20:02 +0000 (09:20 -0700)]
Add SHF_COMPRESSED support to readelf

This patch updates readelf to dump compression header with

readelf -S -W:

  [ 4] .debug_info PROGBITS  00000000 000038 00007d 00   C 0   0  1

readelf -t -W:

  [ 4] .debug_info
       PROGBITS        00000000 000038 00007d 00   0   0  1
       [00000800]: COMPRESSED
       ZLIB, 0000009d, 1

It also checks the compression header when decompressing the compressed
section.

* readelf.c (get_elf_section_flags): Support SHF_COMPRESSED.
(get_compression_header): New.
(process_section_headers): Dump compression header if needed.
(uncompress_section_contents): Don't free compressed_buffer here.
(load_specific_debug_section): Free the compressed buffer, update
the section buffer and the section size if uncompress is
successful.

9 years agoXfail the compressed debug sections
H.J. Lu [Sun, 5 Apr 2015 15:11:11 +0000 (08:11 -0700)]
Xfail the compressed debug sections

There is no need to generate compressed debug section if compressed
section size is the same as before compression.  We should xfail the
compressed debug section test if there are no compressed sections

binutils/testsuite/

* binutils-all/compress.exp (compression_used): New.
Xfail test if compression didn't make the section smaller.

gas/

2015-04-05  H.J. Lu  <hongjiu.lu@intel.com>

* write.c (compress_debug): Don't write the zlib header if
compressed section size is the same as before compression.

9 years agosim: moxie: fix running after nrun conversion
Mike Frysinger [Sun, 5 Apr 2015 08:37:44 +0000 (04:37 -0400)]
sim: moxie: fix running after nrun conversion

The nrun conversion was slightly incorrect in how it stopped when an
exception occurred.  We still set cpu.asregs.exception, but nothing
was checking it anymore.  Convert all of that to sim_engine_halt.

To keep things from regressing again, add a basic testsuite too.

9 years agosim: mn10300: add a basic testsuite
Mike Frysinger [Sun, 5 Apr 2015 07:52:08 +0000 (03:52 -0400)]
sim: mn10300: add a basic testsuite

9 years agosim: m68hc11: add a basic testsuite
Mike Frysinger [Sun, 5 Apr 2015 07:17:44 +0000 (03:17 -0400)]
sim: m68hc11: add a basic testsuite

9 years agosim: iq2000: add a basic testsuite
Mike Frysinger [Sun, 5 Apr 2015 06:28:44 +0000 (02:28 -0400)]
sim: iq2000: add a basic testsuite

9 years agosim: lm32: add a basic testsuite
Mike Frysinger [Sun, 5 Apr 2015 05:58:00 +0000 (01:58 -0400)]
sim: lm32: add a basic testsuite

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 5 Apr 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAlso preserve the SHF_COMPRESSED bit
H.J. Lu [Sat, 4 Apr 2015 15:01:54 +0000 (08:01 -0700)]
Also preserve the SHF_COMPRESSED bit

For objcopy and relocatable link, we should also preserve the
SHF_COMPRESSED bit if not decompress.

* elf.c (_bfd_elf_init_private_section_data): Also preserve the
SHF_COMPRESSED bit if not decompress.

9 years agoReplace uncompressed_size_buffer with compressed_size_buffer
H.J. Lu [Sat, 4 Apr 2015 14:52:55 +0000 (07:52 -0700)]
Replace uncompressed_size_buffer with compressed_size_buffer

9 years agoExtract get_uncompressed_size
H.J. Lu [Sat, 4 Apr 2015 14:49:35 +0000 (07:49 -0700)]
Extract get_uncompressed_size

* compress.c (get_uncompressed_size): New.  Extracted from ...
(bfd_init_section_decompress_status): This.  Use it.

9 years agoAdd a dw2-3.S test
H.J. Lu [Sat, 4 Apr 2015 14:18:17 +0000 (07:18 -0700)]
Add a dw2-3.S test

This patch adds a dw2-3.S test for upcoming SHF_COMPRESSED test. The
existing dw2-1.S/dw2-2.S tests generate non-compressed debug sections
for SHF_COMPRESSED since SHF_COMPRESSED compressed debug sections are
bigger.

* binutils-all/compress.exp (testfile): Remove suffix.
(compressedfile): Likewise.
(compressedfile2): Likewise.
(libfile): Likewise.
(testfile3): New.
(compressedfile3): Likewise.
Updated.
Add a dw2-3.S test.
* binutils-all/dw2-3.S: New file.
* binutils-all/dw2-3.W: Likewise.

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 4 Apr 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAdd Elf_Internal_Chdr and ElfXX_External_Chdr
H.J. Lu [Fri, 3 Apr 2015 19:49:45 +0000 (12:49 -0700)]
Add Elf_Internal_Chdr and ElfXX_External_Chdr

* external.h (Elf32_External_Chdr): New.
(Elf64_External_Chdr): Likewise.
* internal.h (Elf_Internal_Chdr): Likewise.

9 years agogdbtypes.c: remove the usuned "top_level" parameter
Pierre-Marie de Rodat [Fri, 3 Apr 2015 12:53:12 +0000 (14:53 +0200)]
gdbtypes.c: remove the usuned "top_level" parameter

This paramater is no longer useful after the previous commit, so remove
it as a cleanup.

gdb/ChangeLog:

* gdbtypes.c (is_dynamic_type_internal): Remove the unused
"top_level" parameter.
(resolve_dynamic_type_internal): Remove the unused "top_level"
parameter.  Update call to is_dynamic_type_internal.
(is_dynamic_type): Update call to is_dynamic_type_internal.
(resolve_dynamic_range): Update call to
resolve_dynamic_type_internal.
(resolve_dynamic_union): Likewise.
(resolve_dynamic_struct): Likewise.
(resolve_dynamic_type): Likewise.

9 years agoDo not consider reference types as dynamic
Pierre-Marie de Rodat [Fri, 3 Apr 2015 08:40:52 +0000 (10:40 +0200)]
Do not consider reference types as dynamic

Even when referenced types are dynamic, the corresponding referencing
type should not be considered as dynamic: it's only a pointer.  This
prevents reference type for values not in memory to be resolved.

gdb/ChangeLog:

* gdbtypes.c (is_dynamic_type_internal): Remove special handling
of TYPE_CODE_REF types so that they are not considered as
dynamic depending on the referenced type.
(resolve_dynamic_type_internal): Likewise.

gdb/testsuite/ChangeLog:

* gdb.ada/funcall_ref.exp: New file.
* gdb.ada/funcall_ref/foo.adb: New file.

9 years agoMake is_zlib_supported always return 1
H.J. Lu [Fri, 3 Apr 2015 11:03:07 +0000 (04:03 -0700)]
Make is_zlib_supported always return 1

* lib/binutils-common.exp (is_zlib_supported): Always return 1.

9 years agosim: d10v: fix signal updates
Mike Frysinger [Fri, 3 Apr 2015 00:15:43 +0000 (20:15 -0400)]
sim: d10v: fix signal updates

Way back in aba6488e0b73756f31f154d12a228baa82a68d8a, a bunch of signal
defines were changed to TARGET_SIGNAL_xxx.  For d10v, the transition was
incomplete which lead to sim_stop_reason using the new set but sim_resume
still using the old set.  Which meant in some cases, the sim would never
actually stop.

Convert all the remaining SIGxxx defines in here to TARGET_SIGNAL_xxx.
This has the nice side effect of fixing the testsuite.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 3 Apr 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoSecond fix for microblaze gas port's ability to parse constants.
Nick Clifton [Thu, 2 Apr 2015 16:13:12 +0000 (17:13 +0100)]
Second fix for microblaze gas port's ability to parse constants.

PR gas/18189
* config/tc-microblaze.c (parse_imm): Use offsetT as the type for
min and max parameters.  Sign extend values before testing.

9 years agoFixes a bug in the microblaze assembler where it would not complain about constants...
Nick Clifton [Thu, 2 Apr 2015 15:10:06 +0000 (16:10 +0100)]
Fixes a bug in the microblaze assembler where it would not complain about constants larger than 32-bits.

PR gas/18189
* config/tc-microblaze.c (parse_imm): Use offsetT as the type for
min and max parameters.

9 years agoFix the binutils readelf.ss test for the AArch64 target.
Nick Clifton [Thu, 2 Apr 2015 14:28:02 +0000 (15:28 +0100)]
Fix the binutils readelf.ss test for the AArch64 target.

* binutils-all/readelf.ss-64: Move possible location of the $d
mapping symbol.

9 years agoAdd support for configuring an aarch64-freebsd target.
Andrew Turner [Thu, 2 Apr 2015 14:07:27 +0000 (15:07 +0100)]
Add support for configuring an aarch64-freebsd target.

ld * Makefile.am: Add FreeBSD aarch64 files.
* Makefile.in: Regenerate.
* configure.tgt: Add aarch64-*-freebsd* target triple.
* emulparams/aarch64fbsd.sh: New file.
* emulparams/aarch64fbsdb.sh: New file.

bfd * config.bfd: Add aarch64-*-freebsd* target triple.

9 years ago[AArch64] Emit DATA_MAP in order within text section
Renlin Li [Thu, 2 Apr 2015 13:59:45 +0000 (14:59 +0100)]
[AArch64] Emit DATA_MAP in order within text section

2015-03-27  Renlin Li  <renlin.li@arm.com>

gas/
  * config/tc-aarch64.c (mapping_state): Emit MAP_DATA within text section in order.
  (mapping_state_2): Don't emit MAP_DATA here.
  (s_aarch64_inst): Align frag during state transition.
  (md_assemble): Likewise.

9 years agoRemove unused functions in tc-aarch64.c.
Ed Maste [Thu, 2 Apr 2015 13:44:59 +0000 (14:44 +0100)]
Remove unused functions in tc-aarch64.c.

* config/tc-aarch64.c (set_error_kind): Delete.
(set_error_message): Delete.

9 years agokfail two tests in no-unwaited-for-left.exp for remote target
Yao Qi [Thu, 2 Apr 2015 12:51:31 +0000 (13:51 +0100)]
kfail two tests in no-unwaited-for-left.exp for remote target

I see these two fails in no-unwaited-for-left.exp in remote testing
for aarch64-linux target.

...
continue
Continuing.
warning: Remote failure reply: E.No unwaited-for children left.

[Thread 1084] #2 stopped.
(gdb) FAIL: gdb.threads/no-unwaited-for-left.exp: continue stops when thread 2 exits

....
continue
Continuing.
warning: Remote failure reply: E.No unwaited-for children left.

[Thread 1081] #1 stopped.
(gdb) FAIL: gdb.threads/no-unwaited-for-left.exp: continue stops when the main thread exits

I checked the gdb.log on buildbot, and find that these two fails also
appear on Debian-i686-native-extended-gdbserver and Fedora-ppc64be-native-gdbserver-m64.
I recall that they are about local/remote parity, and related RSP is missing.
There has been already a PR 14618 about it.  This patch is to kfail them
on remote target.

gdb/testsuite:

2015-04-02  Yao Qi  <yao.qi@linaro.org>

* gdb.threads/no-unwaited-for-left.exp: Set up kfail if target
is remote.

9 years agoRegenerate configure in bfd/binutils/gas/gdb/gold
H.J. Lu [Thu, 2 Apr 2015 12:41:50 +0000 (05:41 -0700)]
Regenerate configure in bfd/binutils/gas/gdb/gold

bfd/

* configure: Regenerated.

binutils/

* configure: Regenerated.

gas/

* configure: Regenerated.

gdb/

* Makefile.in (top_srcdir): New.
* configure: Regenerated.

gold/

* configure: Regenerated.

9 years agoRegenerate configure in sim
H.J. Lu [Thu, 2 Apr 2015 12:38:34 +0000 (05:38 -0700)]
Regenerate configure in sim

* arm/configure: Regenerated.
* avr/configure: Likewise.
* bfin/configure: Likewise.
* common/configure: Likewise.
* cr16/configure: Likewise.
* cris/configure: Likewise.
* d10v/configure: Likewise.
* erc32/configure: Likewise.
* frv/configure: Likewise.
* ft32/configure: Likewise.
* h8300/configure: Likewise.
* igen/configure: Likewise.
* iq2000/configure: Likewise.
* lm32/configure: Likewise.
* m32c/configure: Likewise.
* m32r/configure: Likewise.
* m68hc11/configure: Likewise.
* mcore/configure: Likewise.
* microblaze/configure: Likewise.
* mips/configure: Likewise.
* mn10300/configure: Likewise.
* moxie/configure: Likewise.
* msp430/configure: Likewise.
* ppc/configure: Likewise.
* rl78/configure: Likewise.
* rx/configure: Likewise.
* sh/configure: Likewise.
* sh64/configure: Likewise.
* v850/configure: Likewise.

9 years agoSet zlibdir/zlibinc with top_builddir/top_srcdir
H.J. Lu [Thu, 2 Apr 2015 12:37:09 +0000 (05:37 -0700)]
Set zlibdir/zlibinc with top_builddir/top_srcdir

* zlib.m4 (AM_ZLIB): Set zlibdir to -L\$(top_builddir)/../zlib
and set zlibinc to -I\$(top_srcdir)/../zlib.

9 years agoDocument "target:" sysroot changes
Gary Benson [Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)]
Document "target:" sysroot changes

This commit documents the newly added "target:" sysroot feature.

gdb/ChangeLog:

* NEWS: Announce the new default sysroot of "target:".

gdb/doc/ChangeLog:

* gdb.texinfo (set sysroot): Document "target:".

9 years agoMake the default sysroot be "target:"
Gary Benson [Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)]
Make the default sysroot be "target:"

This commit makes GDB default to a sysroot of "target:".
One testcase needed updating as a result of this change.

gdb/ChangeLog:

* main.c (captured_main): Set gdb_sysroot to "target:"
if not otherwise set.

gdb/testsuite/ChangeLog:

* gdb.base/break-probes.exp: Cope with "target:" sysroot.

9 years agoUpdate exec_file_attach to cope with "target:" filenames
Gary Benson [Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)]
Update exec_file_attach to cope with "target:" filenames

This commit adds support for filenames prefixed with "target:" to
exec_file_attach.  This is required to correctly follow inferior
exec* calls when a gdb_sysroot prefixed with "target:" is set.

gdb/ChangeLog:

* exec.c (exec_file_attach): Support "target:" filenames.

9 years agoStrip "target:" prefix in solib_find if accessing local files
Gary Benson [Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)]
Strip "target:" prefix in solib_find if accessing local files

This commit updates solib_find to strip the "target:" prefix from
gdb_sysroot when accessing local files.  This ensures that the same
search algorithm is used for local files regardless of whether a
"target:" prefix was used or not.  It also avoids cluttering GDB's
output with unnecessary "target:" prefixes on paths.

gdb/ChangeLog:

* solib.c (solib_find): Strip "target:" prefix from sysroot
if accessing local files.

9 years agoRearrange symfile_bfd_open
Gary Benson [Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)]
Rearrange symfile_bfd_open

symfile_bfd_open handled what were remote files as a special case.
Converting from "remote:" files to "target:" made symfile_bfd_open
look like this:

  if remote:
    open bfd, check format, etc
    return
  local-specific stuff
  open bfd, check format, etc
  return

This commit rearranges symfile_bfd_open to remove the duplicated
code, like this:

  if local:
      local-specific stuff
  open bfd, check format, etc
  return

gdb/ChangeLog:

* symfile.c (symfile_bfd_open): Reorder to remove duplicated
checks and error messages.

9 years agoConvert "remote:" sysroots to "target:" and remove "remote:"
Gary Benson [Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)]
Convert "remote:" sysroots to "target:" and remove "remote:"

The functionality of "target:" sysroots is a superset of the
functionality of "remote:" sysroots.  This commit causes the
"set sysroot" command to rewrite "remote:" sysroots as "target:"
sysroots and replaces "remote:" specific code with "target:"
specific code where still necessary.

gdb/ChangeLog:

* remote.h (REMOTE_SYSROOT_PREFIX): Remove definition.
(remote_filename_p): Remove declaration.
(remote_bfd_open): Likewise.
* remote.c (remote_bfd_iovec_open): Remove function.
(remote_bfd_iovec_close): Likewise.
(remote_bfd_iovec_pread): Likewise.
(remote_bfd_iovec_stat): Likewise.
(remote_filename_p): Likewise.
(remote_bfd_open): Likewise.
* symfile.h (gdb_bfd_open_maybe_remote): Remove declaration.
* symfile.c (separate_debug_file_exists): Use gdb_bfd_open.
(gdb_bfd_open_maybe_remote): Remove function.
(symfile_bfd_open):  Replace remote filename check with
target filename check.
(reread_symbols): Use gdb_bfd_open.
* build-id.c (gdbcore.h): New include.
(build_id_to_debug_bfd): Use gdb_bfd_open.
* infcmd.c (attach_command_post_wait): Remove remote filename
check.
* solib.c (solib_find): Replace remote-specific handling with
target-specific handling.  Update comments where necessary.
(solib_bfd_open): Replace remote-specific handling with
target-specific handling.
(gdb_sysroot_changed): New function.
(_initialize_solib): Call the above when gdb_sysroot changes.
* windows-tdep.c (gdbcore.h): New include.
(windows_xfer_shared_library): Use gdb_bfd_open.

9 years agoMake gdb_bfd_open able to open BFDs using target fileio
Gary Benson [Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)]
Make gdb_bfd_open able to open BFDs using target fileio

This commit updates gdb_bfd_open to access files using target
fileio functions if the supplied path starts with "target:"
and if the local and target filesystems are not the same.
This allows users to specify "set sysroot target:" and have
GDB access files locally or from the remote as appropriate.

The new functions in gdb_bfd.c are copies of functions from
remote.c. This duplication is intentional and will be removed
by the next commit in this series.

gdb/ChangeLog:

* gdb/gdb_bfd.h (TARGET_SYSROOT_PREFIX): New definition.
(is_target_filename): New declaration.
(gdb_bfd_has_target_filename): Likewise.
(gdb_bfd_open): Update documentation comment.
* gdb_bfd.c (target.h): New include.
(gdb/fileio.h): Likewise.
(is_target_filename): New function.
(gdb_bfd_has_target_filename): Likewise.
(fileio_errno_to_host): Likewise.
(gdb_bfd_iovec_fileio_open): Likewise.
(gdb_bfd_iovec_fileio_pread): Likewise.
(gdb_bfd_iovec_fileio_close): Likewise.
(gdb_bfd_iovec_fileio_fstat): Likewise.
(gdb_bfd_open): Use target fileio to access paths prefixed
with "target:" where necessary.

9 years agoIntroduce target_filesystem_is_local
Gary Benson [Thu, 2 Apr 2015 12:38:28 +0000 (13:38 +0100)]
Introduce target_filesystem_is_local

This commit introduces a new target method target_filesystem_is_local
which can be used to determine whether or not the filesystem accessed
by the target_fileio_* methods is the local filesystem.

gdb/ChangeLog:

* target.h (struct target_ops) <to_filesystem_is_local>:
New field.
(target_filesystem_is_local): New macro.
* target-delegates.c: Regenerate.
* remote.c (remote_filesystem_is_local): New function.
(init_remote_ops): Initialize to_filesystem_is_local.

9 years agoIntroduce target_fileio_fstat
Gary Benson [Thu, 2 Apr 2015 12:38:28 +0000 (13:38 +0100)]
Introduce target_fileio_fstat

This commit introduces a new target method target_fileio_fstat
which can be used to retrieve information about files opened with
target_fileio_open.

gdb/ChangeLog:

* target.h (struct target_ops) <to_fileio_fstat>: New field.
(target_fileio_fstat): New declaration.
* target.c (target_fileio_fstat): New function.
* inf-child.c (inf_child_fileio_fstat): Likewise.
(inf_child_target): Initialize to_fileio_fstat.
* remote.c (init_remote_ops): Likewise.

9 years agobinutils: update my e-mail address
Mike Frysinger [Thu, 2 Apr 2015 04:48:04 +0000 (00:48 -0400)]
binutils: update my e-mail address

9 years agosim: clean up SIM_EXTRA_OBJS references
Mike Frysinger [Wed, 1 Apr 2015 06:34:00 +0000 (02:34 -0400)]
sim: clean up SIM_EXTRA_OBJS references

This variable was deleted in previous commits and is not used anymore.
Prune any stray references to it.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 2 Apr 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years ago[AArch64] Add support for the Samsung Exynos M1 processor
Evandro Menezes [Thu, 26 Mar 2015 20:18:08 +0000 (15:18 -0500)]
[AArch64] Add support for the Samsung Exynos M1 processor

2015-03-26  Evandro Menezes  <e.menezes@samsung.com>

gas/
* config/tc-aarch64.c: Add support for Samsung Exynos M1.
* doc/c-aarch64.texi (-mcpu=): Add "exynos-m1".

9 years ago[ARM] Add support for the Samsung Exynos M1 processor
Evandro Menezes [Thu, 26 Mar 2015 20:51:14 +0000 (15:51 -0500)]
[ARM] Add support for the Samsung Exynos M1 processor

2015-03-26  Evandro Menezes  <e.menezes@samsung.com>

gas/
* config/tc-arm.c: Add support for Samsung Exynos M1.
* doc/c-arm.texi (-mcpu=): Add "exynos-m1".

9 years agoAdd support for writing unwinders in Python.
Sasha Smundak [Wed, 1 Apr 2015 18:49:12 +0000 (11:49 -0700)]
Add support for writing unwinders in Python.

gdb/ChangeLog:

* Makefile.in (SUBDIR_PYTHON_OBJS): Add py-unwind.o.
(SUBDIR_PYTHON_SRCS): Add py-unwind.c.
(py-unwind.o): New recipe.
* NEWS: mention Python frame unwinding.
* data-directory/Makefile.in (PYTHON_FILE_LIST): Add
gdb/unwinder.py and gdb/command/unwinder.py
* python/lib/gdb/__init__.py (packages): Add frame_unwinders
list.
(execute_unwinders): New function.
* python/lib/gdb/command/unwinders.py: New file.
* python/lib/gdb/unwinder.py: New file.
* python/py-objfile.c (objfile_object): Add frame_unwinders field.
(objfpy_dealloc): Decrement frame_unwinders reference count.
(objfpy_initialize): Create frame_unwinders list.
(objfpy_get_frame_unwinders): New function.
(objfpy_set_frame_unwinders): Ditto.
(objfile_getset): Add frame_unwinders attribute to Objfile.
* python/py-progspace.c (pspace_object): Add frame_unwinders field.
(pspy_dealloc): Decrement frame_unwinders reference count.
(pspy_initialize): Create frame_unwinders list.
(pspy_get_frame_unwinders): New function.
(pspy_set_frame_unwinders): Ditto.
(pspy_getset): Add frame_unwinders attribute to gdb.Progspace.
* python/py-unwind.c: New file.
* python/python-internal.h (pspy_get_name_unwinders): New prototype.
(objpy_get_frame_unwinders): New prototype.
(gdbpy_initialize_unwind): New prototype.
* python/python.c (gdbpy_apply_type_printers): Call
gdbpy_initialize_unwind.

gdb/doc/ChangeLog:

* doc/python.texi (Writing a Frame Unwinder in Python): Add
section.

gdb/testsuite/ChangeLog:

* gdb.python/py-unwind-maint.c: New file.
* gdb.python/py-unwind-maint.exp: New test.
* gdb.python/py-unwind-maint.py: New file.
* gdb.python/py-unwind.c: New file.
* gdb.python/py-unwind.exp: New test.
* gdb.python/py-unwind.py: New test.

9 years agoFix sim build
H.J. Lu [Wed, 1 Apr 2015 17:27:34 +0000 (10:27 -0700)]
Fix sim build

* common/Make-common.in (CSEARCH): Remove $(ZLIBINC).
(BFD_LIB): Remove $(ZLIB).
(CONFIG_LIBS): Add $(ZLIB).
* ppc/Makefile.in (ZLIBINC): Removed.
(INCLUDES): Remove $(ZLIBINC).
(BFD_LIB): Remove $(ZLIB).

9 years agoRegenerate configure in sim
H.J. Lu [Wed, 1 Apr 2015 17:15:13 +0000 (10:15 -0700)]
Regenerate configure in sim

* arm/configure: Regenerated.
* avr/configure: Likewise.
* bfin/configure: Likewise.
* common/configure: Likewise.
* cr16/configure: Likewise.
* cris/configure: Likewise.
* d10v/configure: Likewise.
* erc32/configure: Likewise.
* frv/configure: Likewise.
* ft32/configure: Likewise.
* h8300/configure: Likewise.
* igen/configure: Likewise.
* iq2000/configure: Likewise.
* lm32/configure: Likewise.
* m32c/configure: Likewise.
* m32r/configure: Likewise.
* m68hc11/configure: Likewise.
* mcore/configure: Likewise.
* microblaze/configure: Likewise.
* mips/configure: Likewise.
* mn10300/configure: Likewise.
* moxie/configure: Likewise.
* msp430/configure: Likewise.
* ppc/configure: Likewise.
* rl78/configure: Likewise.
* rx/configure: Likewise.
* sh/configure: Likewise.
* sh64/configure: Likewise.
* v850/configure: Likewise.

9 years agoWork around a GCC uninitialized warning bug
H.J. Lu [Wed, 1 Apr 2015 15:14:32 +0000 (08:14 -0700)]
Work around a GCC uninitialized warning bug

* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Work
around a GCC uninitialized warning bug fixed in GCC 4.6.

9 years agoinfrun.c:resume: currently_stepping after clearing stepped_breakpoint
Pedro Alves [Mon, 30 Mar 2015 15:39:56 +0000 (16:39 +0100)]
infrun.c:resume: currently_stepping after clearing stepped_breakpoint

My all-stop-on-top-of-non-stop series manages to shows regressions due
to this latent bug.  currently_stepping returns true if
stepped_breakpoint is set.  Obviously we should clear
it before checking currently_stepping, not after.

Tested on x86_64 Fedora 20.

gdb/ChangeLog:
2015-04-01  Pedro Alves  <palves@redhat.com>

* infrun.c (resume): Check currently_stepping after clearing
stepped_breakpoint, not before.

9 years agogdb.threads/manythreads.exp: can't read "test": no such variable
Pedro Alves [Tue, 31 Mar 2015 17:36:51 +0000 (18:36 +0100)]
gdb.threads/manythreads.exp: can't read "test": no such variable

If interrupt_and_wait manages to trigger the FAIL path, we get:

  ERROR OCCURED: can't read "test": no such variable

gdb/testsuite/ChangeLog:
2015-04-01  Pedro Alves  <palves@redhat.com>

* gdb.threads/manythreads.exp (interrupt_and_wait): Pass $message
to fail instead of non-existent $test.

9 years agoFix gdb_spawn_with_cmdline_opts with non-empty GDBFLAGS
Pedro Alves [Mon, 30 Mar 2015 17:00:28 +0000 (18:00 +0100)]
Fix gdb_spawn_with_cmdline_opts with non-empty GDBFLAGS

Running attach.exp with a DejaGnu board that sets GDBFLAGS, like
e.g.,:

  set GDBFLAGS "-ex \"set displaced off\""

fails with (line breaks added for clarity):

 (gdb) PASS: gdb.base/attach.exp: starting with --pid
 Executing on build: kill -9 3537    (timeout = 300)
 spawn -ignore SIGHUP kill -9 3537
 spawn of build/gdb/gdb -nw -nx \
  -data-directory build/gdb/testsuite/../data-directory  \
  -ex "set displaced off"-iex "set height 0" -iex "set width 0" \
                     ^^^^^^^^
  --pid=4468 -ex "start"  failed
 ERROR: Spawning build/gdb/gdb failed.
 UNRESOLVED: gdb.base/attach.exp: cmdline attach run: run to prompt

gdb/testsuite/ChangeLog:
2015-04-01  Pedro Alves  <palves@redhat.com>

* lib/gdb.exp (gdb_spawn_with_cmdline_opts): Append space to
GDBFLAGS if not empty.

9 years agoMake print_target_wait_results print the whole ptid
Pedro Alves [Mon, 30 Mar 2015 16:02:01 +0000 (17:02 +0100)]
Make print_target_wait_results print the whole ptid

Makes "set debug infrun 1" a bit clearer.  Before:

infrun: target_wait (-1, status) =
 infrun:   6299 [Thread 0x7ffff7fc1700 (LWP 6340)],

after:

 infrun: target_wait (-1.0.0, status) =
 infrun:   7233.7237.0 [Thread 0x7ffff7fc1700 (LWP 7237)],

gdb/ChangeLog:
2015-04-01  Pedro Alves  <palves@redhat.com>

* infrun.c (print_target_wait_results): Print all the ptid
elements.

9 years agokeep_going: Add missing discard_cleanups call
Pedro Alves [Thu, 26 Mar 2015 19:05:40 +0000 (19:05 +0000)]
keep_going: Add missing discard_cleanups call

By inspection, I noticed a path where we return without discarding the
cleanups.

gdb/ChangeLog:
2015-04-01  Pedro Alves  <palves@redhat.com>

* infrun.c (keep_going): Also discard cleanups if inserting
breakpoints fails.

9 years agowait_for_inferior and errors thrown from target_wait
Pedro Alves [Wed, 1 Apr 2015 13:58:56 +0000 (14:58 +0100)]
wait_for_inferior and errors thrown from target_wait

Noticed that if an error is thrown out of target_wait, we miss running
finish_thread_state_cleanup.

Tested on x86_64 Fedora 20, with "maint set target-async off".

gdb/ChangeLog:
2015-04-01  Pedro Alves  <palves@redhat.com>

* infrun.c (wait_for_inferior): Install the
finish_thread_state_cleanup cleanup across the whole function, not
just around handle_inferior_event.

9 years agoConvert mov foo@GOT(%reg), %reg to lea foo@GOTOFF(%reg), %reg
Ilya Tocar [Wed, 1 Apr 2015 13:48:38 +0000 (16:48 +0300)]
Convert mov foo@GOT(%reg), %reg to lea foo@GOTOFF(%reg), %reg

2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>

PR gold/17640
* i386.cc (Target_i386::can_convert_mov_to_lea): New.
(Target_i386::Scan::local): Don't create GOT entry, when we
can convert GOT to GOTOFF.
(Target_i386::Scan::global): Ditto.
(Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
lea foo@GOTOFF(%reg), %reg if possible.
* testsuite/Makefile.am (i386_mov_to_lea): New test.
* testsuite/i386_mov_to_lea1.s: New.
* testsuite/i386_mov_to_lea2.s: Ditto.
* testsuite/i386_mov_to_lea3.s: Ditto.
* testsuite/i386_mov_to_lea4.s: Ditto.
* testsuite/i386_mov_to_lea5.s: Ditto.
* testsuite/i386_mov_to_lea.sh: Ditto.

9 years agoRegenerate configure in gold
H.J. Lu [Wed, 1 Apr 2015 13:24:42 +0000 (06:24 -0700)]
Regenerate configure in gold

Regenerate configure for zlib.m4 change, which adds --with-system-zlib and
removes --with-zlib in gold.  zlib is enabled unconditionally with builtin
zlib imported from GCC.

* Makefile.am (ZLIB): New.
(ZLIBINC): Likewise.
(AM_CFLAGS): Add $(ZLIBINC).
(AM_CXXFLAGS): Likewise.
(ldadd_varldadd_var): Add $(ZLIB).
(incremental_dump_LDADD): Likewise.
(dwp_LDADD): Likewise.
* compressed_output.cc: Don't check HAVE_ZLIB_H to include
<zlib.h>.
(zlib_compress): Don't check HAVE_ZLIB_H.
(zlib_decompress): Likewise.
* options.h (compress_debug_sections): Likewise.
* configure.ac (AM_CONDITIONAL): Removed.
* testsuite/Makefile.am (ZLIB): New.
(LDADD): Add $(ZLIB).
Don't check HAVE_ZLIB.
* Makefile.in: Regenerated.
* config.in: Likewise.
* configure: Likewise.
* testsuite/Makefile.in: Likewise.

9 years agoUse do_target_resume when stepping past permanent breakpoint too
Pedro Alves [Wed, 1 Apr 2015 14:24:54 +0000 (14:24 +0000)]
Use do_target_resume when stepping past permanent breakpoint too

We can use the recently added do_target_resume do simplify the code a
bit here.

Tested on x86_64 Fedora 20.

gdb/ChangeLog:
2015-04-01  Pedro Alves  <palves@redhat.com>

* infrun.c (resume) <step past permanent breakpoint>: Use
do_target_resume.

9 years agolinux_nat.c: Mark new thread running even if momentarily pausing
Pedro Alves [Tue, 24 Mar 2015 14:24:53 +0000 (14:24 +0000)]
linux_nat.c: Mark new thread running even if momentarily pausing

My all-stop-on-top-of-non-stop series manages to trip on a bug in the
linux-nat.c backend while running the testsuite.  If a thread is
discovered while threads are being momentarily paused (without the
core's intervention), the thread ends up stuck in THREAD_STOPPED
state, even though from the user's perspective, the thread is running
even while it is paused.

From inspection, in the current sources, this can happen if we call
stop_and_resume_callback, though there's no way to test that with
current Linux kernels.

(While trying to come up with test to exercise this, I stumbled on:
  https://sourceware.org/ml/gdb-patches/2015-03/msg00850.html

... which does include a non-trivial test, so I think I can still
claim I come out net positive. :-) )

Tested on x86_64 Fedora 20.

gdb/ChangeLog:
2015-04-01  Pedro Alves  <palves@redhat.com>

* linux-nat.c (linux_handle_extended_wait): Always call set_running.

9 years agoShare the "multi_line" helper among all testcases
Pierre-Marie de Rodat [Tue, 10 Mar 2015 08:51:27 +0000 (09:51 +0100)]
Share the "multi_line" helper among all testcases

gdb/testsuite/ChangeLog:

* gdb.ada/complete.exp: Remove "multi_line".
* gdb.ada/info_exc.exp: Remove "multi_line".
* gdb.ada/packed_tagged.exp: Remove "multi_line".
* gdb.ada/ptype_field.exp: Remove "multi_line".
* gdb.ada/sym_print_name.exp: Remove "multi_line".
* gdb.ada/tagged.exp: Remove "multi_line".
* gdb.btrace/buffer-size.exp: Replace [join [list ...]] with
[multi_line ...]
* gdb.btrace/delta.exp: Likewise.
* gdb.btrace/exception.exp: Likewise.
* gdb.btrace/function_call_history.exp: Likewise.
* gdb.btrace/instruction_history.exp: Likewise.
* gdb.btrace/nohist.exp: Likewise.
* gdb.btrace/record_goto.exp: Likewise.
* gdb.btrace/segv.exp: Likewise.
* gdb.btrace/stepi.exp: Likewise.
* gdb.btrace/tailcall.exp: Likewise.
* gdb.btrace/unknown_functions.exp: Likewise.
* gdb.dwarf2/dw2-undefined-ret-addr.exp: Likewise.
* lib/gdb.exp: Add the "multi_line" helper.

9 years agoAdd myself as a write-after-approval GDB maintainer
Pierre-Marie de Rodat [Wed, 1 Apr 2015 12:53:42 +0000 (14:53 +0200)]
Add myself as a write-after-approval GDB maintainer

gdb/ChangeLog:

* MAINTAINERS (Write After Approval): Add "Pierre-Marie de
Rodat".

9 years agoCrash on thread id wrap around
Pedro Alves [Wed, 1 Apr 2015 12:38:06 +0000 (13:38 +0100)]
Crash on thread id wrap around

On GNU/Linux, if the target reuses the TID of a thread that GDB still
has in its list marked as THREAD_EXITED, GDB crashes, like:

 (gdb) continue
 Continuing.
 src/gdb/thread.c:789: internal-error: set_running: Assertion `tp->state != THREAD_EXITED' failed.
 A problem internal to GDB has been detected,
 further debugging may prove unreliable.
 Quit this debugging session? (y or n) FAIL: gdb.threads/tid-reuse.exp: continue to breakpoint: after_reuse_time (GDB internal error)

Here:

 (top-gdb) bt
 #0  internal_error (file=0x953dd8 "src/gdb/thread.c", line=789, fmt=0x953da0 "%s: Assertion `%s' failed.")
     at src/gdb/common/errors.c:54
 #1  0x0000000000638514 in set_running (ptid=..., running=1) at src/gdb/thread.c:789
 #2  0x00000000004bda42 in linux_handle_extended_wait (lp=0x16f5760, status=0, stopping=0) at src/gdb/linux-nat.c:2114
 #3  0x00000000004bfa24 in linux_nat_filter_event (lwpid=20570, status=198015) at src/gdb/linux-nat.c:3127
 #4  0x00000000004c070e in linux_nat_wait_1 (ops=0xe193d0, ptid=..., ourstatus=0x7fffffffd2c0, target_options=1) at src/gdb/linux-nat.c:3478
 #5  0x00000000004c1015 in linux_nat_wait (ops=0xe193d0, ptid=..., ourstatus=0x7fffffffd2c0, target_options=1) at src/gdb/linux-nat.c:3722
 #6  0x00000000004c92d2 in thread_db_wait (ops=0xd80b60 <thread_db_ops>, ptid=..., ourstatus=0x7fffffffd2c0, options=1)
     at src/gdb/linux-thread-db.c:1525
 #7  0x000000000066db43 in delegate_wait (self=0xd80b60 <thread_db_ops>, arg1=..., arg2=0x7fffffffd2c0, arg3=1) at src/gdb/target-delegates.c:116
 #8  0x000000000067e54b in target_wait (ptid=..., status=0x7fffffffd2c0, options=1) at src/gdb/target.c:2206
 #9  0x0000000000625111 in fetch_inferior_event (client_data=0x0) at src/gdb/infrun.c:3275
 #10 0x0000000000648a3b in inferior_event_handler (event_type=INF_REG_EVENT, client_data=0x0) at src/gdb/inf-loop.c:56
 #11 0x00000000004c2ecb in handle_target_event (error=0, client_data=0x0) at src/gdb/linux-nat.c:4655

I managed to come up with a test that reliably reproduces this.  It
spawns enough threads for the pid number space to wrap around, so
could potentially take a while.  On my box that's 4 seconds; on
gcc110, a PPC box which has max_pid set to 65536, it's over 10
seconds.  So I made the test compute how long that would take, and cap
the time waited if it would be unreasonably long.

Tested on x86_64 Fedora 20.

gdb/ChangeLog:
2015-04-01  Pedro Alves  <palves@redhat.com>

* linux-thread-db.c (record_thread): Readd the thread to gdb's
list if it was marked exited.

gdb/testsuite/ChangeLog:
2015-04-01  Pedro Alves  <palves@redhat.com>

* gdb.threads/tid-reuse.c: New file.
* gdb.threads/tid-reuse.exp: New file.

9 years ago[AArch64] Workaround for Cortex A53 erratum 843419
Marcus Shawcroft [Tue, 24 Feb 2015 12:04:41 +0000 (12:04 +0000)]
[AArch64] Workaround for Cortex A53 erratum 843419

Some early revisions of the Cortex-A53 have an erratum (843419).  The
details of the erratum are quite complex and involve dynamic
conditions.  For the purposes of the workaround we have simplified the
static conditions to an ADRP in the last two instructions of a 4KByte
page, followed within four instructions by a load/store dependent on
the ADRP.

This patch adds support to conservatively scan for and workaround
Cortex A53 erratum 843419.  There are two different workaround
strategies used.  The first is to rewrite ADRP instructions which form
part of an erratum sequence with an ADR instruction.  In situations
where the ADR provides insufficient offset the dependent load or store
instruction from the sequence is moved to a stub section and branches
are inserted from the original sequence to the relocated instruction
and back again.

Stub section sizes are rounded up to a multiple of 4096 in order to
ensure that the act of inserting work around stubs does not create
more errata sequences.

Workaround stubs are always inserted into the stub section associated
with the input section containing the erratum sequence.  This ensures
that the fully relocated form of the veneered load store instruction
is available at the point in time when the stub section is written.

9 years agoAdd --with-system-zlib to top level configure
H.J. Lu [Wed, 1 Apr 2015 11:57:28 +0000 (04:57 -0700)]
Add --with-system-zlib to top level configure

The top level configure supports --with-system-zlib.  This patch makes
configure --help to display --with-system-zlib.

* configure.ac: Add --with-system-zlib.
* configure: Regenerated.

9 years agoRegenerate configure in bfd/binutils/gas/gdb
H.J. Lu [Wed, 1 Apr 2015 11:55:48 +0000 (04:55 -0700)]
Regenerate configure in bfd/binutils/gas/gdb

bfd/

2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>

* configure: Regenerated.

binutils/

2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>

* configure: Regenerated.

gas/

2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>

* configure: Regenerated.

gdb/

2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>

* configure: Regenerated.

9 years agoUnset zlibdir/zlibinc only for --with-system-zlib
H.J. Lu [Wed, 1 Apr 2015 11:51:55 +0000 (04:51 -0700)]
Unset zlibdir/zlibinc only for --with-system-zlib

* zlib.m4 (AM_ZLIB): Unset zlibdir and zlibinc only for
--with-system-zlib.

9 years agoAdd a testcase for PR ld/18176
H.J. Lu [Wed, 1 Apr 2015 11:24:05 +0000 (04:24 -0700)]
Add a testcase for PR ld/18176

PR ld/18176
* ld-x86-64/pr18176.d: New file.
* ld-x86-64/pr18176.s: Likewise.
* ld-x86-64/pr18176.t: Likewise.
* ld-x86-64/x86-64.exp: Run pr18176.

9 years agoPrevent multiple definitions for _HEAP_START, _HEAP_MAX, and _STACK_START when perfor...
Chen Gang [Wed, 1 Apr 2015 10:29:46 +0000 (11:29 +0100)]
Prevent multiple definitions for _HEAP_START, _HEAP_MAX, and _STACK_START when performing a relocatable link with a tic6x target.

* emulparams/elf32_tic6x_le.sh: Skip OTHER_BSS_SECTIONS for
relocating operation.

9 years agoGDBServer: give more complete usage information
Pedro Alves [Wed, 1 Apr 2015 10:01:44 +0000 (11:01 +0100)]
GDBServer: give more complete usage information

--attach/--multi are currently only mentioned on the usage info first
lines, the meaning of PROG is completely absent and the COMM text does
not mention '-/stdio'.

A few options are missing:

 . --disable-randomization / --no-disable-randomization is not mentioned.

Although the manual has a comment saying these are superceded by
QDisableRandomization, that only makes sense for "run" in
extended-remote mode.  When we start gdbserver passing it a PROG,
--disable-randomization / --no-disable-randomization do take effect.
So I think we should document these.

 . We show --debug / --remote-debug, so might as well show --disable-packet too.

GDB's --help has this "For more information, consult the GDB manual"
blurb that is missing in GDBserver's --help.

Then shuffle things around a bit into "Operating modes", "Other
options" and "Debug options" sections, similarly to GDB's --help
structure.

Before:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ ./gdbserver/gdbserver --help
Usage:  gdbserver [OPTIONS] COMM PROG [ARGS ...]
        gdbserver [OPTIONS] --attach COMM PID
        gdbserver [OPTIONS] --multi COMM

COMM may either be a tty device (for serial debugging), or
HOST:PORT to listen for a TCP connection.

Options:
  --debug               Enable general debugging output.
  --debug-format=opt1[,opt2,...]
                        Specify extra content in debugging output.
                          Options:
                            all
                            none
                            timestamp
  --remote-debug        Enable remote protocol debugging output.
  --version             Display version information and exit.
  --wrapper WRAPPER --  Run WRAPPER to start new programs.
  --once                Exit after the first connection has closed.
Report bugs to "<http://www.gnu.org/software/gdb/bugs/>".
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

After:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ ./gdbserver/gdbserver --help
Usage:  gdbserver [OPTIONS] COMM PROG [ARGS ...]
        gdbserver [OPTIONS] --attach COMM PID
        gdbserver [OPTIONS] --multi COMM

COMM may either be a tty device (for serial debugging),
HOST:PORT to listen for a TCP connection, or '-' or 'stdio' to use
stdin/stdout of gdbserver.
PROG is the executable program.  ARGS are arguments passed to inferior.
PID is the process ID to attach to, when --attach is specified.

Operating modes:

  --attach              Attach to running process PID.
  --multi               Start server without a specific program, and
                        only quit when explicitly commanded.
  --once                Exit after the first connection has closed.
  --help                Print this message and then exit.
  --version             Display version information and exit.

Other options:

  --wrapper WRAPPER --  Run WRAPPER to start new programs.
  --disable-randomization
                        Run PROG with address space randomization disabled.
  --no-disable-randomization
                        Don't disable address space randomization when
                        starting PROG.

Debug options:

  --debug               Enable general debugging output.
  --debug-format=opt1[,opt2,...]
                        Specify extra content in debugging output.
                          Options:
                            all
                            none
                            timestamp
  --remote-debug        Enable remote protocol debugging output.
  --disable-packet=opt1[,opt2,...]
                        Disable support for RSP packets or features.
                          Options:
                            vCont, Tthread, qC, qfThreadInfo and
                            threads (disable all threading packets).

For more information, consult the GDB manual (available as on-line
info or a printed manual).
Report bugs to "<http://www.gnu.org/software/gdb/bugs/>".
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gdb/gdbserver/ChangeLog:
2015-04-01  Pedro Alves  <palves@redhat.com>
    Cleber Rosa  <crosa@redhat.com>

* server.c (gdbserver_usage): Reorganize and extend the usage
message.

9 years agoStart of relro segment adjustment
Alan Modra [Wed, 1 Apr 2015 08:49:27 +0000 (19:19 +1030)]
Start of relro segment adjustment

Adjusting the start of the relro segment in order to make it end
exactly on a page boundary runs into difficulties when sections in the
relro segment are aligned;  Adjusting the start by (next_page - end)
sometimes results in more than that adjustment occurring at the end,
overrunning the page boundary.  So when that occurs we try a new lower
start position by masking the adjusted start with the maximum section
alignment.  However, we didn't consider that this masked start address
may in fact be before the initial relro base, which is silly since
that can only increase padding at the relro end.

I've also moved some calculations closer to where they are used, and
comments closer to the relevant statements.

* ldlang.c (lang_size_sections): When alignment of sections
results in relro base adjustment being too large, don't go lower
than the initial value.
* ldexp.c (fold_binary <DATA_SEGMENT_RELRO_END>): Comment.
* scripttempl/elf.sc (DATA_SEGMENT_ALIGN): Omit SEGMENT_SIZE
alignment when SEGMENT_SIZE is the same as MAXPAGESIZE.

9 years agosim: m32c: enable warnings & clean up a bunch
Mike Frysinger [Wed, 1 Apr 2015 06:21:21 +0000 (02:21 -0400)]
sim: m32c: enable warnings & clean up a bunch

This doesn't clean up all the warnings, just most of them.
The ones that are left will require some care to unravel.

9 years agosim: run: punt!
Mike Frysinger [Tue, 31 Mar 2015 05:13:12 +0000 (01:13 -0400)]
sim: run: punt!

Now that all targets have been converted to nrun, we can finally punt
this old inconsistent interface.

A few stray references to the old run were sprinkled about; clean them
up in the process.

We leave behind the run(1) man page mostly so that we get it updated for
the new nrun interface.

9 years agosim: update zlib handling
Mike Frysinger [Wed, 1 Apr 2015 03:32:49 +0000 (23:32 -0400)]
sim: update zlib handling

With zlib being mandatory, and the updated m4 configs, we need to regen
and use the new settings w/bfd to avoid linkage errors.

9 years agoYet another warning fix
Alan Modra [Wed, 1 Apr 2015 02:31:38 +0000 (13:01 +1030)]
Yet another warning fix

Older compilers that warn wrongly will just need -Wno-error.  No way
am I going to init every single field, then have to edit this code
whenever bfd_link_hash_entry changes.  Another option, making the
struct static, isn't very nice since it means larger binaries and
worse code.

* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Don't
init ehdr_start_save.

9 years agoFix ld eelf32ppcvxworks.c dependencies
Alan Modra [Wed, 1 Apr 2015 00:13:20 +0000 (10:43 +1030)]
Fix ld eelf32ppcvxworks.c dependencies

* Makefile.am (eelf32ppcvxworks.c): Depend on ppc32elf.em and
ldemul-list.h.
(eelf32lppc.c, eelf32lppclinux.c, eelf32lppcnto.c, eelf32lppcsim.c,
eelf32ppc.c, eelf32ppc_fbsd.c, eelf32ppclinux.c, eelf32ppcnto.c,
eelf32ppcsim.c): Rearrange deps for consistency.
* Makefile.in: Regenerate.

9 years agoFixes for a small number of compiler warnings
Ed Schouten [Tue, 31 Mar 2015 14:47:10 +0000 (16:47 +0200)]
Fixes for a small number of compiler warnings

The ehdr_start_save variable does not need to be initialized.  However,
not initializing it will trigger a compiler warning when using older
versions of GCC.  Self-assignment unfortunately doesn't work for Clang
as Clang has a warning similar to -Winit-self as part of -Wall.

* emultempl/elf32.em (gld*_before_allocation): Zero-initialize
the ehdr_start_save variable.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 1 Apr 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoImplement support for checking /proc/PID/coredump_filter
Sergio Durigan Junior [Tue, 31 Mar 2015 23:32:34 +0000 (19:32 -0400)]
Implement support for checking /proc/PID/coredump_filter

This patch, as the subject says, extends GDB so that it is able to use
the contents of the file /proc/PID/coredump_filter when generating a
corefile.  This file contains a bit mask that is a representation of
the different types of memory mappings in the Linux kernel; the user
can choose to dump or not dump a certain type of memory mapping by
enabling/disabling the respective bit in the bit mask.  Currently,
here is what is supported:

  bit 0  Dump anonymous private mappings.
  bit 1  Dump anonymous shared mappings.
  bit 2  Dump file-backed private mappings.
  bit 3  Dump file-backed shared mappings.
  bit 4 (since Linux 2.6.24)
         Dump ELF headers.
  bit 5 (since Linux 2.6.28)
         Dump private huge pages.
  bit 6 (since Linux 2.6.28)
         Dump shared huge pages.

(This table has been taken from core(5), but you can also read about it
on Documentation/filesystems/proc.txt inside the Linux kernel source
tree).

The default value for this file, used by the Linux kernel, is 0x33,
which means that bits 0, 1, 4 and 5 are enabled.  This is also the
default for GDB implemented in this patch, FWIW.

Well, reading the file is obviously trivial.  The hard part, mind you,
is how to determine the types of the memory mappings.  For that, I
extended the code of gdb/linux-tdep.c:linux_find_memory_regions_full and
made it rely *much more* on the information gathered from
/proc/<PID>/smaps.  This file contains a "verbose dump" of the
inferior's memory mappings, and we were not using as much information as
we could from it.  If you want to read more about this file, take a look
at the proc(5) manpage (I will also write a blog post soon about
everything I had to learn to get this patch done, and when I it is ready
I will post it here).

With Oleg Nesterov's help, we could improve the current algorithm for
determining whether a memory mapping is anonymous/file-backed,
private/shared.  GDB now also respects the MADV_DONTDUMP flag and does
not dump the memory mapping marked as so, and will always dump
"[vsyscall]" or "[vdso]" mappings (just like the Linux kernel).

In a nutshell, what the new code is doing is:

- If the mapping is associated to a file whose name ends with
  " (deleted)", or if the file is "/dev/zero", or if it is "/SYSV%08x"
  (shared memory), or if there is no file associated with it, or if
  the AnonHugePages: or the Anonymous: fields in the /proc/PID/smaps
  have contents, then GDB considers this mapping to be anonymous.
  There is a special case in this, though: if the memory mapping is a
  file-backed one, but *also* contains "Anonymous:" or
  "AnonHugePages:" pages, then GDB considers this mapping to be *both*
  anonymous and file-backed, just like the Linux kernel does.  What
  that means is simple: this mapping will be dumped if the user
  requested anonymous mappings *or* if the user requested file-backed
  mappings to be present in the corefile.

  It is worth mentioning that, from all those checks described above,
  the most fragile is the one to see if the file name ends with
  " (deleted)".  This does not necessarily mean that the mapping is
  anonymous, because the deleted file associated with the mapping may
  have been a hard link to another file, for example.  The Linux
  kernel checks to see if "i_nlink == 0", but GDB cannot easily do
  this check (as it has been discussed, GDB would need to run as root,
  and would need to check the contents of the /proc/PID/map_files/
  directory in order to determine whether the deleted was a hardlink
  or not).  Therefore, we made a compromise here, and we assume that
  if the file name ends with " (deleted)", then the mapping is indeed
  anonymous.  FWIW, this is something the Linux kernel could do
  better: expose this information in a more direct way.

- If we see the flag "sh" in the VmFlags: field (in /proc/PID/smaps),
  then certainly the memory mapping is shared (VM_SHARED).  If we have
  access to the VmFlags, and we don't see the "sh" there, then
  certainly the mapping is private.  However, older Linux kernels (see
  the code for more details) do not have the VmFlags field; in that
  case, we use another heuristic: if we see 'p' in the permission
  flags, then we assume that the mapping is private, even though the
  presence of the 's' flag there would mean VM_MAYSHARE, which means
  the mapping could still be private.  This should work OK enough,
  however.

Finally, it is worth mentioning that I added a new command, 'set
use-coredump-filter on/off'.  When it is 'on', it will read the
coredump_filter' file (if it exists) and use its value; otherwise, it
will use the default value mentioned above (0x33) to decide which memory
mappings to dump.

gdb/ChangeLog:
2015-03-31  Sergio Durigan Junior  <sergiodj@redhat.com>
    Jan Kratochvil  <jan.kratochvil@redhat.com>
    Oleg Nesterov  <oleg@redhat.com>

PR corefiles/16092
* linux-tdep.c: Include 'gdbcmd.h' and 'gdb_regex.h'.
New enum identifying the various options of the coredump_filter
file.
(struct smaps_vmflags): New struct.
(use_coredump_filter): New variable.
(decode_vmflags): New function.
(mapping_is_anonymous_p): Likewise.
(dump_mapping_p): Likewise.
(linux_find_memory_regions_full): New variables
'coredumpfilter_name', 'coredumpfilterdata', 'pid', 'filterflags'.
Removed variable 'modified'.  Read /proc/<PID>/smaps file; improve
parsing of its information.  Implement memory mapping filtering
based on its contents.
(show_use_coredump_filter): New function.
(_initialize_linux_tdep): New command 'set use-coredump-filter'.
* NEWS: Mention the possibility of using the
'/proc/PID/coredump_filter' file when generating a corefile.
Mention new command 'set use-coredump-filter'.

gdb/doc/ChangeLog:
2015-03-31  Sergio Durigan Junior  <sergiodj@redhat.com>

PR corefiles/16092
* gdb.texinfo (gcore): Mention new command 'set
use-coredump-filter'.
(set use-coredump-filter): Document new command.

gdb/testsuite/ChangeLog:
2015-03-31  Sergio Durigan Junior  <sergiodj@redhat.com>

PR corefiles/16092
* gdb.base/coredump-filter.c: New file.
* gdb.base/coredump-filter.exp: Likewise.

9 years agoCatch exception on solib_svr4_r_ldsomap
Sergio Durigan Junior [Tue, 31 Mar 2015 23:17:23 +0000 (19:17 -0400)]
Catch exception on solib_svr4_r_ldsomap

When loading a corefile that has some inaccessible memory region(s),
GDB complains about it:

   (gdb) core /my/corefile
   [New LWP 28468]
   Cannot access memory at address 0x355fc21148
   Cannot access memory at address 0x355fc21140
   (gdb)

However, despite not seeing the message "Core was generated by...", it
is still possible to inspect the corefile using regular GDB commands.
The reason for that is because read_memory_unsigned_integer throws an
exception when it cannot read the memory region, but
solib_svr4_r_ldsomap was not catching it.  The fix is to catch the
exception and act accordingly.

Tested on Fedora 20 x86_64, no regressions found.

gdb/ChangeLog:
2015-03-31  Sergio Durigan Junior  <sergiodj@redhat.com>

* solib-svr4.c (solib_svr4_r_ldsomap): Catch possible exception by
read_memory_unsigned_integer.

9 years agoAdd missing ChangeLog entry
H.J. Lu [Tue, 31 Mar 2015 20:15:43 +0000 (13:15 -0700)]
Add missing ChangeLog entry

9 years agoAdd missing ChangeLog entry
H.J. Lu [Tue, 31 Mar 2015 20:15:01 +0000 (13:15 -0700)]
Add missing ChangeLog entry

9 years agoRemove --with-target-subdir=. --disable-multilib
H.J. Lu [Tue, 31 Mar 2015 18:36:17 +0000 (11:36 -0700)]
Remove --with-target-subdir=. --disable-multilib

zlib/configure is updated to properly handle in-tree build for host.

* src-release.sh: Don't configure with  --with-target-subdir=.
--disable-multilib.

9 years agoUse AM_ENABLE_MULTILIB only if with_target_subdir isn't empty
H.J. Lu [Tue, 31 Mar 2015 18:35:30 +0000 (11:35 -0700)]
Use AM_ENABLE_MULTILIB only if with_target_subdir isn't empty

* configure.ac (AM_ENABLE_MULTILIB): Use only if
${with_target_subdir} isn't empty.
* configure: Regenerated.

9 years agoReplace src-release with src-release.sh
H.J. Lu [Tue, 31 Mar 2015 18:44:00 +0000 (11:44 -0700)]
Replace src-release with src-release.sh

* src-release.sh (DEVO_SUPPORT): Replace src-release with
src-release.sh.

9 years agoAdd --with-system-zlib in gdb
H.J. Lu [Tue, 31 Mar 2015 15:24:02 +0000 (08:24 -0700)]
Add --with-system-zlib in gdb

This patch adds --with-system-zlib and removes --with-zlib in gdb.

* Makefile.in (ZLIB): New.
(ZLIBINC): Likewise.
(INTERNAL_CFLAGS_BASE): Add $(ZLIBINC).
(CLIBS): Add $(ZLIB).
* acinclude.m4: (GDB_AC_CHECK_BFD): Add $zlibdir to LDFLAGS.
Add -lz to LIBS.
* gdb_bfd.c: Don't check HAVE_ZLIB_H to include <zlib.h>.
* top.c (print_gdb_configuration): Remove --with-zlib and
--without-zlib.
* config.in: Regenerated.
* configure: Likewise.

9 years agoRemove the last change on dw2-compress-1.d
H.J. Lu [Tue, 31 Mar 2015 15:20:55 +0000 (08:20 -0700)]
Remove the last change on dw2-compress-1.d

The compressed .debug_info section is bigger than the original in 32-bit.

9 years agoAdd support for Nuxi CloudABI on x86-64
Ed Schouten [Tue, 31 Mar 2015 09:33:45 +0000 (11:33 +0200)]
Add support for Nuxi CloudABI on x86-64

bfd/

* config.bfd (targ_defvec): Set to x86_64_elf64_cloudabi_vec
for x86_64-*-cloudabi*.
* configure.ac: Handle x86_64_elf64_cloudabi_vec.
* configure: Regenerated.
* elf64-x86-64.c (TARGET_LITTLE_SYM): Support x86_64-*-cloudabi*.
(TARGET_LITTLE_NAME): Likewise.
(ELF_OSABI): Likewise.
(elf64_bed): Likewise.
* targets.c (x86_64_elf64_cloudabi_vec): New.
(_bfd_target_vector): Add x86_64_elf64_cloudabi_vec.

gas/

* configure.tgt (fmt): Set to elf for *-*-cloudabi*.

ld/

* Makefile.am (ALL_64_EMULATION_SOURCES): Add
eelf_x86_64_cloudabi.c.
(eelf_x86_64_cloudabi.c): New.
* configure.tgt (targ_emul): Set to elf_x86_64_cloudabi for
x86_64-*-cloudabi*.
* Makefile.in: Regenerated.
* emulparams/elf_x86_64_cloudabi.sh: New file.