external/binutils.git
6 years agoImprove boostrap-ubsan config (PR bootstrap/64914).
marxin [Thu, 10 May 2018 10:15:42 +0000 (10:15 +0000)]
Improve boostrap-ubsan config (PR bootstrap/64914).

2018-05-10  Martin Liska  <mliska@suse.cz>

PR bootstrap/64914
* md5.c: Use strict alignment with UBSAN_BOOTSTRAP.

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

6 years ago* argv.c (expandargv): Fix memory leak for expanded arguments.
law [Mon, 30 Apr 2018 18:00:49 +0000 (18:00 +0000)]
* argv.c (expandargv): Fix memory leak for expanded arguments.

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

6 years agoUnset gdbarch significant_addr_bit by default
Omair Javaid [Sat, 26 May 2018 00:58:51 +0000 (05:58 +0500)]
Unset gdbarch significant_addr_bit by default

This patch fixes a bug introduced by fix to AArch64 pointer tagging.

In our fix for tagged pointer support our agreed approach was to sign
extend user-space address after clearing tag bits. This is not same
for all architectures and this patch allows sign extension for
addresses on targets which specifically set significant_addr_bit.

More information about patch that caused the issues and discussion
around tagged pointer support can be found in links below:

https://sourceware.org/ml/gdb-patches/2018-05/msg00000.html
https://sourceware.org/ml/gdb-patches/2017-12/msg00159.html

gdb/ChangeLog:

2018-05-31  Omair Javaid  <omair.javaid@linaro.org>

PR gdb/23210
* gdbarch.sh (significant_addr_bit): Default to zero when
not set by target architecture.
* gdbarch.c: Re-generated.
* utils.c (address_significant): Update.

6 years agoRun a few more binutils tests non-native
Alan Modra [Tue, 29 May 2018 01:23:18 +0000 (10:53 +0930)]
Run a few more binutils tests non-native

Setting CC_FOR_TARGET from the environment CC was just plain wrong,
and no doubt the reason these tests were only run natively.

* testsuite/binutils-all/compress.exp (test_gnu_debuglink): Don't
set CC_FOR_TARGET.  Run test non-native.
* testsuite/binutils-all/objdump.exp (test_build_id_debuglink):
Likewise.
(test_follow_debuglink): Run test non-native.

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 31 May 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years ago(ARI) remove trailing newline in call to error in stack.c::func_command
Joel Brobecker [Wed, 30 May 2018 23:43:02 +0000 (16:43 -0700)]
(ARI) remove trailing newline in call to error in stack.c::func_command

gdb/ChangeLog:

        * stack.c (func_command): Remove trailing newline in call to error.

6 years agoRemove regcache_raw_collect
Simon Marchi [Wed, 30 May 2018 18:54:46 +0000 (14:54 -0400)]
Remove regcache_raw_collect

Remove regcache_raw_collect, update callers to use
regcache::raw_collect.

gdb/ChangeLog:

* regcache.h (regcache_raw_collect): Remove, update callers to
use regcache::raw_collect.
* regcache.c (regcache_raw_collect): Remove.

6 years agoRemove regcache_raw_supply
Simon Marchi [Wed, 30 May 2018 18:54:45 +0000 (14:54 -0400)]
Remove regcache_raw_supply

Remove regcache_raw_supply, update callers to use
detached_regcache::raw_supply.

gdb/ChangeLog:

* regcache.h (regcache_raw_supply): Remove, update callers to
use detached_regcache::raw_supply.
* regcache.c (regcache_raw_supply): Remove.

6 years agoRemove regcache_cooked_write_part
Simon Marchi [Wed, 30 May 2018 18:54:44 +0000 (14:54 -0400)]
Remove regcache_cooked_write_part

Remove regcache_cooked_write_part, update callers to use
regcache::cooked_write_part.

gdb/ChangeLog:

* regcache.h (regcache_cooked_write_part): Remove, update
callers to use regcache::cooked_write_part.
* regcache.c (regcache_cooked_write_part): Remove.

6 years agoRemove regcache_cooked_read_part
Simon Marchi [Wed, 30 May 2018 18:54:43 +0000 (14:54 -0400)]
Remove regcache_cooked_read_part

Remove regcache_cooked_read_part, update callers to use
readable_regcache::cooked_read_part.

gdb/ChangeLog:

* regcache.h (regcache_cooked_read_part): Remove, update callers
to use readable_regcache::cooked_read_part.
* regcache.c (regcache_cooked_read_part): Remove.

6 years agoRemove regcache_cooked_read_value
Simon Marchi [Wed, 30 May 2018 18:54:42 +0000 (14:54 -0400)]
Remove regcache_cooked_read_value

Remove regcache_cooked_read_value, update callers to use
readable_regcache::cooked_read_value.

gdb/ChangeLog:

* regcache.h (regcache_cooked_read_value): Remove, update
callers to use readable_regcache::cooked_read_value.
* regcache.c (regcache_cooked_read_value): Remove.

6 years agoRemove regcache_cooked_write
Simon Marchi [Wed, 30 May 2018 18:54:42 +0000 (14:54 -0400)]
Remove regcache_cooked_write

Remove regcache_cooked_write, update callers to use
regcache::cooked_write.

gdb/ChangeLog:

* regcache.h (regcache_cooked_write): Remove, update callers to
use regcache::cooked_write.
* regcache.c (regcache_cooked_write): Remove.

6 years agoRemove regcache_invalidate
Simon Marchi [Wed, 30 May 2018 18:54:41 +0000 (14:54 -0400)]
Remove regcache_invalidate

Remove regcache_invalidate, update callers to use
detached_regcache::invalidate instead.

gdb/ChangeLog:

* regcache.h (regcache_invalidate): Remove, update callers to
use detached_regcache::invalidate instead.
* regcache.c (regcache_invalidate): Remove.

6 years agoRemove regcache_raw_write_part
Simon Marchi [Wed, 30 May 2018 18:54:40 +0000 (14:54 -0400)]
Remove regcache_raw_write_part

Remove regcache_raw_write_part, update callers to use
regcache::raw_write_part instead.

gdb/ChangeLog:

* regcache.h (regcache_raw_write_part): Remove, update callers
to use regcache::raw_write_part instead.
* regcache.c (regcache_raw_write_part): Remove.

6 years agoRemove regcache_raw_read_part
Simon Marchi [Wed, 30 May 2018 18:54:39 +0000 (14:54 -0400)]
Remove regcache_raw_read_part

Remove regcache_raw_read_part, update callers to use
readable_regcache::raw_read_part instead.

gdb/ChangeLog:

* regcache.h (regcache_raw_read_part): Remove, update callers to
use readable_regcache::raw_read_part instead.
* regcache.c (regcache_raw_read_part): Remove.

6 years agoRemove regcache_cooked_read
Simon Marchi [Wed, 30 May 2018 18:54:38 +0000 (14:54 -0400)]
Remove regcache_cooked_read

Remove regcache_cooked_read, update callers to use
readable_regcache::cooked_read instead.

gdb/ChangeLog:

* regcache.h (regcache_cooked_read): Remove, update callers to
use readable_regcache::cooked_read instead.
* regcache.c (regcache_cooked_read): Remove.

6 years agoRemove regcache_raw_write
Simon Marchi [Wed, 30 May 2018 18:54:37 +0000 (14:54 -0400)]
Remove regcache_raw_write

Remove regcache_raw_write, update all callers to use regcache::raw_write
instead.

gdb/ChangeLog:

* regcache.h (regcache_raw_write): Remove, update callers to use
regcache::raw_write instead.
* regcache.c (regcache_raw_write): Remove.

6 years agoRemove regcache_raw_read
Simon Marchi [Wed, 30 May 2018 18:54:36 +0000 (14:54 -0400)]
Remove regcache_raw_read

Remove regcache_raw_read, update all callers to use
readable_regcache::raw_read instead.

gdb/ChangeLog:

* regcache.h (regcache_raw_read): Remove, update callers to use
readable_regcache::raw_read instead.
* regcache.c (regcache_raw_read): Remove.

6 years agoRemove regcache_raw_update
Simon Marchi [Wed, 30 May 2018 18:54:36 +0000 (14:54 -0400)]
Remove regcache_raw_update

Remove regcache_raw_update, update callers to use
readable_regcache::raw_update instead.

gdb/ChangeLog:

* regcache.h (regcache_raw_update): Remove, update callers to
use readable_regcache::raw_update instead.
* regcache.c (regcache_raw_update): Remove.

6 years agoRemove regcache_register_status
Simon Marchi [Wed, 30 May 2018 18:54:35 +0000 (14:54 -0400)]
Remove regcache_register_status

Remove regcache_register_status, change callers to use
reg_buffer::get_register_status directly.

gdb/ChangeLog:

* regcache.h (regcache_register_status): Remove, update callers
to use reg_buffer::get_register_status directly instead.
* regcache.c (regcache_register_status): Remove.

6 years agoRemove regcache_get_ptid
Simon Marchi [Wed, 30 May 2018 18:54:34 +0000 (14:54 -0400)]
Remove regcache_get_ptid

Remove regcache_get_ptid, change all callers to call the regcache method
directly.

gdb/ChangeLog:

* regcache.h (regcache_get_ptid): Remove, update all callers to
call regcache::ptid instead.
* regcache.c (regcache_get_ptid): Remove.

6 years agoAdd option to ar's 't' command to display the offset of elements within the archive.
Ant Bikeneev [Wed, 30 May 2018 16:06:26 +0000 (17:06 +0100)]
Add option to ar's 't' command to display the offset of elements within the archive.

PR 23107
* ar.c (display_offsets): New variable.
(usage): Add description of 'O' operator.
(decode_option): Handle 'O' operator.
(print_descr): Pass display_offsets to print_arelt_descr.
* arsup.c: Update call to printy_arelt_descr.
* objdump.c: Likewise.
* bucomm.c (print_arelt_descr): If offsets parameter is true then
display offset of archive element within the archive.
* bucomm.h: Update prototype for print_arelt_descr.
* doc/binutils.texi: Update description of ar command.
* NEWS: Mention the new feature.
* testsuite/binutils-all/ar.exp: Add text of new feature.

6 years agoAdd or1k target to --enable-targets=all
Simon Marchi [Wed, 30 May 2018 16:04:35 +0000 (12:04 -0400)]
Add or1k target to --enable-targets=all

The or1k-tdep.o object is missing from the ALL_TARGET_OBS, which means
it's not currently included in an --enable-targets=all build.

gdb/ChangeLog:

* Makefile.in (ALL_TARGET_OBS): Add or1k-tdep.o.

6 years ago2018-05-30 Amaan Cheval <amaan.cheval@gmail.com>
Amaan Cheval [Fri, 18 May 2018 20:20:40 +0000 (01:50 +0530)]
2018-05-30  Amaan Cheval <amaan.cheval@gmail.com>

* config.bfd (x86_64-*-*): Add pei-x86-64 target to x86_64-*-rtems*
This is needed to generate UEFI application image files from ELFs.

6 years agoMark END_CATCH as ATTRIBUTE_NORETURN (-Wmaybe-uninitialized warnings)
Pedro Alves [Wed, 30 May 2018 13:18:47 +0000 (14:18 +0100)]
Mark END_CATCH as ATTRIBUTE_NORETURN (-Wmaybe-uninitialized warnings)

This commit fixes a set of -Wmaybe-uninitialized warnings in GDB and
GDBserver, seen with GCC 7.3.1 on F27 at -O2.  Specifically, all of
these:

 src/gdb/breakpoint.c:5040:4: warning: ‘e’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 src/gdb/cli/cli-cmds.c:277:71: warning: ‘tracker’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 src/gdb/cli/cli-cmds.c:302:22: warning: ‘word’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 src/gdb/gdbserver/server.c:1895:7: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 src/gdb/gdbserver/server.c:1966:7: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized]

For example, looking at one of the gdbserver ones in more detail:

 ../../../src/gdb/gdbserver/server.c: In function ‘int handle_qxfer_btrace_conf(const char*, gdb_byte*, const gdb_byte*, ULONGEST, LONGEST)’:
 ../../../src/gdb/gdbserver/server.c:1966:7: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (result != 0)
^~

In this case (like the others), the 'result' variable is assigned in
both TRY and CATCH blocks:

      TRY
        {
          result = target_read_btrace_conf (thread->btrace, &cache);
          if (result != 0)
            memcpy (own_buf, cache.buffer, cache.used_size);
        }
      CATCH (exception, RETURN_MASK_ERROR)
        {
          sprintf (own_buf, "E.%s", exception.message);
          result = -1;
        }
      END_CATCH

      if (result != 0)
        return -3;

so it would seem like the warning is bogus.

However, END_CATCH is really a catch block in disguise, and that path
indeed does not initialize the variable:

#define END_CATCH \
    catch (...) \
      { \
exception_rethrow (); \
      } \
  }

exception_rethrow does not return normally (it rethrows the current
exception after running cleanups), but the compiler can not see that.
If it could return normally, then indeed 'result' could be used
uninitialized if the TRY block threw some non-gdb exception, which
would be caught by END_CATCH.

The fix it to let the compiler know that the exception_rethrow does
not return normally, using ATTRIBUTE_NORETURN.

gdb/ChangeLog:
2018-05-30  Pedro Alves  <palves@redhat.com>

* common/common-exceptions.h (exception_rethrow): Use
ATTRIBUTE_NORETURN.

6 years agoAdd znver2 support.
Amit Pawar [Wed, 30 May 2018 06:57:35 +0000 (12:27 +0530)]
Add znver2 support.

gas/
* config/tc-i386.c (cpu_flag_init): Add CPU_ZNVER2_FLAGS.
* doc/c-i386.texi : Document znver2.
* gas/testsuite/gas/i386/arch-13.s: Updated for znver2.
* gas/testsuite/gas/i386/arch-13.d: Updated.
* gas/testsuite/gas/i386/arch-13-znver1.d: Updated.
* gas/testsuite/gas/i386/arch-13-znver2.d: New file.
* gas/testsuite/gas/i386/x86-64-arch-3.s: Updated for znver2.
* gas/testsuite/gas/i386/x86-64-arch-3.d: Updated.
* gas/testsuite/gas/i386/x86-64-arch-3-znver1.d: Updated.
* gas/testsuite/gas/i386/x86-64-arch-3-znver2.d: New file.
* gas/testsuite/gas/i386/i386.exp: Updated for new test.

opcode/
* i386-gen.c (cpu_flag_init): Add CPU_ZNVER2_FLAGS.
* i386-init.h : Regenerated.

6 years agoRemove "struct" keyword in range-based for loops
Simon Marchi [Wed, 30 May 2018 00:13:04 +0000 (20:13 -0400)]
Remove "struct" keyword in range-based for loops

I get this kind of errors with GCC 6.3.0:

/home/simark/src/binutils-gdb/gdb/breakpoint.c: In function 'void print_solib_event(int)':
/home/simark/src/binutils-gdb/gdb/breakpoint.c:4618:12: error: types may not be defined in a for-range-declaration [-Werror]
       for (struct so_list *iter : current_program_space->added_solibs)
            ^~~~~~

Removing the struct keyword makes it happy.

gdb/ChangeLog:

* breakpoint.c (print_solib_event, check_status_catch_solib):
Remove struct keyword in range-based for loops.
* dbxread.c (find_corresponding_bincl_psymtab): Likewise.
* dwarf2read.c (compute_delayed_physnames, rust_union_quirks);
Likewise.
* linespec.c (find_superclass_methods, search_minsyms_for_name):
Likewise.
* symfile.c (addr_info_make_relative): Likewise.
* thread.c (value_in_thread_stack_temporaries): Likewise.

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 30 May 2018 00:01:00 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years agoRemoving lookup_minimal_symbol_and_objfile
Weimin Pan [Tue, 29 May 2018 22:01:34 +0000 (22:01 +0000)]
Removing lookup_minimal_symbol_and_objfile

Function lookup_minimal_symbol_and_objfile iterates on all objfiles and
calls lookup_minimal_symbol for each of them, effectively searching in all
objfiles.  lookup_bound_minimal_symbol calls lookup_minimal_symbol with NULL,
which also effectively searches all objfiles.  AFAIK, they do exactly the same
thing, so we can get rid of one (and lookup_minimal_symbol_and_objfile happens
to be the most inefficient because it ends up n^2 on the number of objfiles).

Tested in both aarch64-linux-gnu and amd64-linux-gnu. No regressions.

6 years agoFix fall-through comment in windows-nat.c
Tom Tromey [Tue, 29 May 2018 03:26:50 +0000 (21:26 -0600)]
Fix fall-through comment in windows-nat.c

Now that the mingw builder in the buildbot is working again, it
pointed out a build failure due to a missing fall-through comment in
windows-nat.c.  This patch fixes the problem.

Tested by first triggering the failure with a local mingw build, then
by rebuilding successfully with the patch.

I'm checking this in as obvious.

gdb/ChangeLog
2018-05-29  Tom Tromey  <tom@tromey.com>

* windows-nat.c (handle_exception): Update fall-through comment.

6 years agoChange program_space::added_solibs to a std::vector
Tom Tromey [Tue, 29 May 2018 06:38:23 +0000 (00:38 -0600)]
Change program_space::added_solibs to a std::vector

This changes program_space::added_solibs to a std::vector, removing a
VEC.

Tested by the buildbot.

gdb/ChangeLog
2018-05-29  Tom Tromey  <tom@tromey.com>

* progspace.h (so_list_ptr): Remove typedef.  Don't declare VEC.
(struct program_space) <added_solibs>: Now a std::vector.
* breakpoint.c (print_solib_event): Update.
(check_status_catch_solib): Update.
* progspace.c (clear_program_space_solib_cache): Update.
* solib.c (update_solib_list): Update.

6 years agoRemove a VEC from type.c
Tom Tromey [Tue, 29 May 2018 06:29:23 +0000 (00:29 -0600)]
Remove a VEC from type.c

This removes a VEC from type.c, by using std::vector.

While doing this I also took the opportunity to change
types_deeply_equal to return bool.  This caught some weird code in
typy_richcompare, now fixed.

And, since I was changing types_deeply_equal, it seemed like a good
idea to also change types_equal, so this patch includes that as well.

Tested by the buildbot.

ChangeLog
2018-05-29  Tom Tromey  <tom@tromey.com>

* python/py-type.c (typy_richcompare): Update.
* guile/scm-type.c (tyscm_equal_p_type_smob): Update.
* gdbtypes.h (types_deeply_equal): Return bool.
(types_equal): Likewise.
* gdbtypes.c (type_equality_entry_d): Remove typedef.  Don't
declare VEC.
(check_types_equal): Change worklist to std::vector.  Return
bool.
(struct type_equality_entry): Add constructor.
(compare_maybe_null_strings): Return bool.
(check_types_worklist): Return bool.  Change worklist to
std::vector.
(types_deeply_equal): Use std::vector.
(types_equal): Return bool.
(compare_maybe_null_strings): Simplify.

6 years agoRemove tp_t typedef
Tom Tromey [Tue, 29 May 2018 06:16:01 +0000 (00:16 -0600)]
Remove tp_t typedef

The tp_t typedef is no longer used and can be removed.

ChangeLog
2018-05-29  Tom Tromey  <tom@tromey.com>

* record-btrace.c (tp_t): Remove typedef.  Don't declare VEC.

6 years agoRemove const_char_ptr typedef
Tom Tromey [Tue, 29 May 2018 06:14:58 +0000 (00:14 -0600)]
Remove const_char_ptr typedef

The const_char_ptr is no longer used, so it can be removed.

ChangeLog
2018-05-29  Tom Tromey  <tom@tromey.com>

* objc-lang.h: Don't include cp-support.h.
* common/gdb_vecs.h (const_char_ptr): Remove typedef.  Don't
declare VEC.

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 29 May 2018 00:00:36 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agox86-64: Add TLSDESC fields to elf_x86_lazy_plt_layout
H.J. Lu [Mon, 28 May 2018 17:46:16 +0000 (10:46 -0700)]
x86-64: Add TLSDESC fields to elf_x86_lazy_plt_layout

ENDBR64 is added to the special TLSDESC entry, which is similar to the
PLT0 entry, in the x86-64 lazy procedure linkage table to support Intel
CET.  The NaCl PLT is different from the normal PLT.  This patch adds
plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
plt_tlsdesc_got2_insn_end to elf_x86_lazy_plt_layout to support both
normal and NaCl TLSDESC entries.  This fixed

FAIL: TLS descriptor -fpic -shared transitions

for x86_64-nacl.

* elf32-i386.c (elf_i386_lazy_plt): Add plt_tlsdesc_entry,
plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
plt_tlsdesc_got2_insn_end for TLSDESC entry.
(elf_i386_lazy_ibt_plt): Likewise.
(elf_i386_nacl_plt): Likewise.
* elf64-x86-64.c (tlsdesc_plt_entry): Moved and renamed to ...
(elf_x86_64_tlsdesc_plt_entry): This.
(elf_x86_64_lazy_plt): Add plt_tlsdesc_entry,
plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
plt_tlsdesc_got2_insn_end for TLSDESC entry.
(elf_x86_64_lazy_bnd_plt): Likewise.
(elf_x86_64_lazy_ibt_plt): Likewise.
(elf_x32_lazy_ibt_plt): Likewise.
(elf_x86_64_nacl_plt): Likewise.
(elf_x86_64_finish_dynamic_sections): Use plt_tlsdesc_entry,
plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
plt_tlsdesc_got2_insn_end to update TLSDESC entry.
* elfxx-x86.h (elf_x86_lazy_plt_layout): Update comments.
Add plt_tlsdesc_entry, plt_tlsdesc_entry_size,
plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset,
plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end.
(elf_x86_non_lazy_plt_layout): Update comments.
(elf_x86_plt_layout): Likewise.

6 years agold: Unify STT_GNU_IFUNC handling
H.J. Lu [Mon, 28 May 2018 15:15:06 +0000 (08:15 -0700)]
ld: Unify STT_GNU_IFUNC handling

Take STT_GNU_IFUNC handling scattered across targets and gather it in
the generic ELF linker.

bfd/

PR ld/23238
* elf-s390-common.c (elf_s390_add_symbol_hook): Removed.
* elf32-arc.c (elf_arc_add_symbol_hook): Likewise.
(elf_backend_add_symbol_hook): Likewise.
* elf32-m68k.c (elf_m68k_add_symbol_hook): Likewise.
(elf_backend_add_symbol_hook): Likewise.
* elf32-s390.c (elf_backend_add_symbol_hook): Likewise.
* elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise.
(elf_backend_add_symbol_hook): Likewise.
* elf64-s390.c (elf_backend_add_symbol_hook): Likewise.
* elfxx-aarch64.c (_bfd_aarch64_elf_add_symbol_hook): Likewise.
* elfxx-aarch64.h (_bfd_aarch64_elf_add_symbol_hook): Likewise.
(elf_backend_add_symbol_hook): Likewise.
* elf32-arm.c (elf32_arm_add_symbol_hook): Remove STT_GNU_IFUNC
handling.
* elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
* elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise.
* elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise.
* elflink.c (elf_link_add_object_symbols): Set
elf_gnu_symbol_ifunc for STT_GNU_IFUNC symbols.

ld/

PR ld/23238
* testsuite/ld-ifunc/ifunc-26.d: New file.
* testsuite/ld-ifunc/ifunc-26.s: Likewise.
* testsuite/ld-ifunc/ifunc.exp: Run *.d tests without a
working compiler.

6 years agold: Skip some x86 IFUNC tests for NaCl targets
H.J. Lu [Mon, 28 May 2018 15:05:09 +0000 (08:05 -0700)]
ld: Skip some x86 IFUNC tests for NaCl targets

Since NaCl linker may not support "-m elf_i386" nor "-m elf_x86_64", skip
x86 IFUNC tests for NaCl targets where "-m elf_i386" or "-m elf_x86_64"
are passed to linker.

* testsuite/ld-ifunc/ifunc-10-i386.d: Skip NaCl targets.
* testsuite/ld-ifunc/ifunc-10-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-11-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-11-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-12-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-12-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-13-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-13-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14c-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14c-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14d-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14d-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14e-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14e-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14f-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14f-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-15-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-15-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-i386-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-17a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-17a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-17b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-17b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-18a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-18a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-18b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-18b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-19a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-19a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-19b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-19b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-20-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-20-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5r-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5r-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-6a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-6a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-6b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-6b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-7a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-7a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-7b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-7b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-8-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-8-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-9-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-9-x86-64.d: Likewise.
* testsuite/ld-ifunc/pr17154-i386.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.

6 years agoPR23235, make check uses system installed ld
Alan Modra [Mon, 28 May 2018 07:00:23 +0000 (16:30 +0930)]
PR23235, make check uses system installed ld

This patch doesn't stop the build-id and debuglink tests using the
installed ld, it just prevents a compiler failure from resulting in a
test fail.  We could move the tests to the ld testsuite but it doesn't
seem all that important.

PR 23235
* testsuite/binutils-all/compress.exp (test_gnu_debuglink): Return
unsupported rather than fail on compile errors.
* testsuite/binutils-all/objdump.exp (test_build_id_debuglink):
Likewise.  Save and restore CFLAGS_FOR_TARGET.

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 28 May 2018 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoRemove last reference to REMOTE_OBS
Tom Tromey [Sun, 27 May 2018 19:05:03 +0000 (13:05 -0600)]
Remove last reference to REMOTE_OBS

REMOTE_OBS was removed from Makefile.in in
18ca73470a0d7eb96a807c97559cbb9fddb4b461, but one reference remains.
This patch removes the lingerer.

ChangeLog
2018-05-27  Tom Tromey  <tom@tromey.com>

* Makefile.in (DEPFILES): Don't reference REMOTE_OBS.

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 27 May 2018 00:01:17 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years agold: Add _bfd_elf_link_hide_sym_by_version
H.J. Lu [Sat, 26 May 2018 11:27:09 +0000 (04:27 -0700)]
ld: Add _bfd_elf_link_hide_sym_by_version

bfd_hide_sym_by_version can't be used to check if a versioned symbol is
hidden.  This patch adds _bfd_elf_link_hide_sym_by_version to support
both versioned and unversioned symbols by extracting versioned symbol
check from _bfd_elf_link_assign_sym_version.

bfd/

PR ld/23194
* elf-bfd.h (_bfd_elf_link_hide_sym_by_version): New.
* elflink.c (_bfd_elf_link_hide_versioned_symbol): New function.
Extracted from _bfd_elf_link_assign_sym_version.
(_bfd_elf_link_hide_sym_by_version): New function.
(_bfd_elf_link_assign_sym_version): Use
_bfd_elf_link_hide_versioned_symbol.
* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Call
_bfd_elf_link_hide_sym_by_version instead of
bfd_hide_sym_by_version.  Don't check unversioned symbol.

ld/

PR ld/23194
* testsuite/ld-i386/pr23194.d: Expect only R_386_GLOB_DAT
against foobar.
* testsuite/ld-i386/pr23194.map: Add foobar.
* testsuite/ld-x86-64/pr23194.map: Likewise.
* testsuite/ld-i386/pr23194.s: Add a common foobar symbol.
* testsuite/ld-x86-64/pr23194.s: Likewise.
* testsuite/ld-x86-64/pr23194.d: Expect only R_X86_64_GLOB_DAT
against foobar.

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 26 May 2018 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoClear entire "location" in value constructor
Tom Tromey [Tue, 10 Apr 2018 14:24:43 +0000 (08:24 -0600)]
Clear entire "location" in value constructor

My recent change to allocate values with "new" may have introduced a
small bug.  In particular, the previous code allocated with XCNEW, but
the new code only clears a part of the "location" field in the
constructor.  I didn't try very hard to actually trigger a bug here,
the problem remains theoretical.

This patch just arranges to initialize the entire location.

Regression tested by the buildbot.

2018-05-25  Tom Tromey  <tom@tromey.com>

* value.c (value::location): Initialize.

6 years agoRemove cleanups from dbxread.c
Tom Tromey [Fri, 25 May 2018 04:09:24 +0000 (22:09 -0600)]
Remove cleanups from dbxread.c

This removes the remaining cleanups from dbxread.c, via std::vector,
scoped_restore, and unique_xmalloc_ptr.

Tested by the buildbot.

ChangeLog
2018-05-25  Tom Tromey  <tom@tromey.com>

* dbxread.c (init_bincl_list): Remove.
(bincl_list): Now a std::vector.
(bincls_allocated, next_bincl): Remove.
(free_bincl_list, do_free_bincl_list_cleanup)
(make_cleanup_free_bincl_list): Remove.
(dbx_read_symtab, elfstab_build_psymtabs): Use scoped_restore,
unique_xmalloc_ptr.
(find_corresponding_bincl_psymtab, read_dbx_symtab): Update.
(struct header_file_location): Add constructor.
(add_bincl_to_list): Remove.

6 years agoAdd "name" method to class interp
Tom Tromey [Fri, 25 May 2018 18:39:51 +0000 (12:39 -0600)]
Add "name" method to class interp

In a review Pedro pointed out that interp::name is intended to be
read-only, and so an accessor would be a better fit.  This patch
renames the field and adds a "name" method that is used instead.

ChangeLog
2018-05-25  Tom Tromey  <tom@tromey.com>

* tui/tui.c (tui_enable): Update.
* mi/mi-interp.c (mi_interp::init): Update.
* interps.h (class interp) <name>: New method.
<m_name>: Rename from name.
(~scoped_restore_interp): Update.
* interps.c (interp::interp): Update.
(interp_add, interp_set, interp_lookup_existing)
(current_interp_named_p): Update.

6 years agoRemove interp_name
Tom Tromey [Mon, 30 Apr 2018 05:12:07 +0000 (23:12 -0600)]
Remove interp_name

This removes the interp_name function.  It is only used a few spots --
one of which was only calling it on "this".  It's simpler to remove
it; and should class interp become opaque in the future, it will be
just as easy to update the two remaining spots to use an accessor.

ChangeLog
2018-05-25  Tom Tromey <tom@tromey.com>

* interps.c (interp_name): Remove.
* mi/mi-interp.c (mi_interp::init): Update.
* interps.h (interp_name): Remove.
(~scoped_restore_interp): Update.
* tui/tui.c (tui_enable): Update.

6 years agoRemove interp_ui_out
Tom Tromey [Mon, 30 Apr 2018 05:12:06 +0000 (23:12 -0600)]
Remove interp_ui_out

The function interp_ui_out simply calls the interp_ui_out method.
However, if it is passed a NULL interpreter, it first finds the
current interpreter.  I believe, though, that NULL is never passed
here, and I think it's simpler to just remove this function and
require callers to be more explicit.

ChangeLog
2018-05-25  Tom Tromey <tom@tromey.com>

* utils.c (fputs_maybe_filtered): Update.
* linespec.c (decode_line_full): Update.
* mi/mi-interp.c (mi_on_normal_stop_1, mi_tsv_modified)
(mi_print_breakpoint_for_event, mi_solib_loaded)
(mi_solib_unloaded, mi_command_param_changed, mi_memory_changed)
(mi_user_selected_context_changed): Update.
* mi/mi-main.c (mi_execute_command): Update.
* cli/cli-script.c (execute_control_command): Update.
* python/python.c (execute_gdb_command): Update.
* solib.c (info_sharedlibrary_command): Update.
* interps.c (interp_ui_out): Remove.
* interps.h (interp_ui_out): Remove.

6 years agoChange the as_*_interp functions to use dynamic_cast
Tom Tromey [Mon, 30 Apr 2018 05:12:05 +0000 (23:12 -0600)]
Change the as_*_interp functions to use dynamic_cast

This changes the various as_*_interp functions to be implemented using
dynamic_cast.  I believe this is a small improvement, because it is
more typesafe -- the C++ runtime does the type-checking for us.

ChangeLog
2018-05-25  Tom Tromey  <tom@tromey.com>

* tui/tui-interp.c (as_tui_interp): Use dynamic_cast.
* mi/mi-interp.c (as_mi_interp): Use dynamic_cast.
* cli/cli-interp.c (as_cli_interp): Use dynamic_cast.

6 years agoUse scoped_restore in a couple of interp-related places
Tom Tromey [Mon, 30 Apr 2018 05:12:04 +0000 (23:12 -0600)]
Use scoped_restore in a couple of interp-related places

While looking through the "interp" code I found a couple of spots that
could use scoped_restore.

ChangeLog
2018-05-25  Tom Tromey  <tom@tromey.com>

* cli/cli-interp.c (safe_execute_command): Use scoped_restore.
* interps.c (interp_exec): Use scoped_restore.

6 years agoUse gdb::byte_vector in remote.c
Tom Tromey [Fri, 25 May 2018 03:52:54 +0000 (21:52 -0600)]
Use gdb::byte_vector in remote.c

This changes a couple of spots in remote.c to use gdb::byte_vector,
allowing for some cleanup removal.

ChangeLog
2018-05-25  Tom Tromey  <tom@tromey.com>

* remote.c (remote_target::remote_file_get): Use
gdb::byte_vector.
(remote_target::remote_file_put): Likewise.

6 years agoRemove cleanups from coff-pe-read.c
Tom Tromey [Fri, 25 May 2018 04:32:24 +0000 (22:32 -0600)]
Remove cleanups from coff-pe-read.c

This removes cleanups from coff-pe-read.c, using std::string,
std::vector, and gdb::def_vector.

Tested by the buildbot, though I'm not sure these code paths are
exercised there.

ChangeLog
2018-05-25  Tom Tromey  <tom@tromey.com>

* coff-pe-read.c (struct read_pe_section_data) <section_name>: Now
a std::string.
(get_pe_section_index, add_pe_exported_sym): Update.
(read_pe_exported_syms): Use gdb::def_vector.

6 years agoUse TRY/CATCH in remove_prev_frame
Tom Tromey [Fri, 25 May 2018 00:23:37 +0000 (18:23 -0600)]
Use TRY/CATCH in remove_prev_frame

This changes remove_prev_frame to use TRY/CATCH instead of a cleanup.
TRY/CATCH seemed appropriate here because the cleanup is only needed
in the case where an exception is thrown.

Tested by the buildbot.

ChangeLog
2018-05-25  Tom Tromey  <tom@tromey.com>

* frame.c (remove_prev_frame): Remove.
(get_prev_frame_if_no_cycle): Use TRY/CATCH.

6 years agoMIPS/Linux: Correct o32 core file FGR interpretation
Maciej W. Rozycki [Fri, 25 May 2018 11:37:45 +0000 (12:37 +0100)]
MIPS/Linux: Correct o32 core file FGR interpretation

Our interpretation of the layout of floating-point general registers
(FGRs) in o32 MIPS/Linux core files is different from how the kernel
makes them, affecting the CP0 Status.FR=0 aka FP32 mode (we don't
currently support the CP0 Status.FR=1 aka FP64 mode with the o32 ABI).

In the FP32 mode pairs of consecutive even/odd-numbered 32-bit registers
are placed together as 64-bit values in even-indexed 64-bit slots
corresponding to the even index, leaving the odd-indexed 64-bit slots
unused.  These 64-bit values are stored according to the endianness in
effect, which is how the MIPS II SDC1 instruction would store them.

It has always been like that with the Linux kernel for MIPS II and
higher ISA processors, which are the vast majority ever supported, as it
is indeed SDC1 that the kernel uses to store FGRs in a floating-point
context.

With MIPS I processors, which lack the SDC1 instruction, a layout that
we expect used to be used long ago, but it was corrected for consistency
with newer processors back in 2002, with `linux-mips.org' (LMO) commit
42533948caac ("Major pile of FP emulator changes."), the fix corrected
with LMO commit 849fa7a50dff ("R3k FPU ptrace() handling fixes."), and
then broken and fixed over and over again, until last time fixed with
commit 80cbfad79096 ("MIPS: Correct MIPS I FP context layout").

Consequently the values we see in FP32 core files or produce with the
`gcore' command are different from those obtained from the same FP
context of a live process, e.g. with a big-endian configuration these
live values:

(gdb) info registers float
f0:  0x4b5c6d7e flt: 14445950          dbl: 1.7446153562345001e-274
f1:  0x0718293a flt: 1.14473244e-34
f2:  0xc3d4e5f6 flt: -425.79657        dbl: -1.046160437414959e-233
f3:  0x8f90a1b2 flt: -1.42617791e-29
f4:  0x4c5d6e7f flt: 58046972          dbl: 1.1908587841220294e-269
f5:  0x08192a3b flt: 4.60914044e-34
f6:  0xc4d5e6f7 flt: -1711.21765       dbl: -6.2784661835068965e-306
f7:  0x8091a2b3 flt: -1.33745124e-38
f8:  0x45566778 flt: 3430.4668         dbl: 1.6530355595710607e-303
f9:  0x01122334 flt: 2.68412219e-38
f10: 0xcddeeff0 flt: -467533312        dbl: -2.1174864564135575e-262
f11: 0x899aabbc flt: -3.72356497e-33
f12: 0x46576879 flt: 13786.1182        dbl: 1.143296486773654e-298
f13: 0x02132435 flt: 1.08102453e-37
f14: 0xcedfe0f1 flt: -1.87803046e+09   dbl: -1.4399511533369862e-257
f15: 0x8a9bacbd flt: -1.4990934e-32
f16: 0x4758697a flt: 55401.4766        dbl: 7.8856820439568725e-294
f17: 0x03142536 flt: 4.3536007e-37
f18: 0xcfd0e1f2 flt: -7.00893696e+09   dbl: -9.7791926757340559e-253
f19: 0x8b9cadbe flt: -6.03504325e-32
f20: 0x48596a7b flt: 222633.922        dbl: 5.4255001483306113e-289
f21: 0x04152637 flt: 1.75324132e-36
f22: 0xc0d1e2f3 flt: -6.55895376       dbl: -6.6332401002310683e-248
f23: 0x8c9daebf flt: -2.42948516e-31
f24: 0x495a6b7c flt: 894647.75         dbl: 3.7244369058749787e-284
f25: 0x05162738 flt: 7.06016945e-36
f26: 0xc1d2e3f4 flt: -26.3613052       dbl: -4.4941535759306202e-243
f27: 0x8d9eafb0 flt: -9.77979703e-31
f28: 0x4a5b6c7d flt: 3595039.25        dbl: 2.5514593711161396e-279
f29: 0x06172839 flt: 2.84294945e-35
f30: 0xc2d3e4f5 flt: -105.947182       dbl: -3.035646690850097e-238
f31: 0x8e9fa0b1 flt: -3.93512664e-30
fcsr: 0x0
fir: 0xf30000
(gdb)

show up in a core file as these:

(gdb) info registers float
f0:  0x0718293a flt: 1.14473244e-34    dbl: nan
f1:  0x7ff80000 flt: nan
f2:  0x8f90a1b2 flt: -1.42617791e-29   dbl: nan
f3:  0x7ff80000 flt: nan
f4:  0x08192a3b flt: 4.60914044e-34    dbl: nan
f5:  0x7ff80000 flt: nan
f6:  0x8091a2b3 flt: -1.33745124e-38   dbl: nan
f7:  0x7ff80000 flt: nan
f8:  0x01122334 flt: 2.68412219e-38    dbl: nan
f9:  0x7ff80000 flt: nan
f10: 0x899aabbc flt: -3.72356497e-33   dbl: nan
f11: 0x7ff80000 flt: nan
f12: 0x02132435 flt: 1.08102453e-37    dbl: nan
f13: 0x7ff80000 flt: nan
f14: 0x8a9bacbd flt: -1.4990934e-32    dbl: nan
f15: 0x7ff80000 flt: nan
f16: 0x03142536 flt: 4.3536007e-37     dbl: nan
f17: 0x7ff80000 flt: nan
f18: 0x8b9cadbe flt: -6.03504325e-32   dbl: nan
f19: 0x7ff80000 flt: nan
f20: 0x04152637 flt: 1.75324132e-36    dbl: nan
f21: 0x7ff80000 flt: nan
f22: 0x8c9daebf flt: -2.42948516e-31   dbl: nan
f23: 0x7ff80000 flt: nan
f24: 0x05162738 flt: 7.06016945e-36    dbl: nan
f25: 0x7ff80000 flt: nan
f26: 0x8d9eafb0 flt: -9.77979703e-31   dbl: nan
f27: 0x7ff80000 flt: nan
f28: 0x06172839 flt: 2.84294945e-35    dbl: nan
f29: 0x7ff80000 flt: nan
f30: 0x8e9fa0b1 flt: -3.93512664e-30   dbl: nan
f31: 0x7ff80000 flt: nan
(gdb)

Notice how values from odd-numbered registers are shown in corresponding
even-numbered registers and how dummy 0x7ff80000 NaN values, which the
kernel places in unused slots, are reported in odd-numbered registers.

Correct our intepretation then, to match the kernel's.  As it happens
the o32 FGR core file representation matches that used by the `ptrace'
PTRACE_GETFPREGS request, which means our 64-bit handlers can be readily
used, as they already correctly handle the differences between o32 FP32
mode vs n32/n64 representations.

Adjust comments accordingly throughout, in particular remove a reference
to the r3000/tx39 MIPS I processor peculiarity, long irrelevant.

Add a test case to verify correctness.  Avoid GCC bugs and limitations
in the test case where possible; the test case still fails to build with
GCC 8 and the o32 FP64 mode (i.e. with `-mips32r2 -mfp64' options)
giving:

mips-fpregset-core.c: In function 'main':
mips-fpregset-core.c:66:3: error: inconsistent operand constraints in an 'asm'
   asm (
   ^~~

(GCC PR target/85909), but that is not a concern for us as yet, because
as noted above we do not currently support the o32 FP64 mode anyway.

gdb/
* mips-linux-tdep.h (mips_supply_fpregset, mips_fill_fpregset):
Remove prototypes.
* mips-linux-nat.c (supply_fpregset): Always call
`mips64_supply_fpregset' rather than `mips_supply_fpregset'.
(fill_fpregset): Always call `mips64_fill_fpregset' rather than
`mips_fill_fpregset'.
* mips-linux-tdep.c (mips_supply_fpregset)
(mips_supply_fpregset_wrapper, mips_fill_fpregset)
(mips_fill_fpregset_wrapper): Remove functions.
(mips64_supply_fpregset, mips64_fill_fpregset): Update comments.
(mips_linux_fpregset): Remove variable.
(mips_linux_iterate_over_regset_sections): Use
`mips64_linux_fpregset' in place of `mips_linux_fpregset'.
(mips_linux_o32_sigframe_init): Remove comment.

gdb/testsuite/
* gdb.arch/mips-fpregset-core.exp: New test.
* gdb.arch/mips-fpregset-core.c: New test source.

6 years agoremote_target::m_remote_state, pointer -> object
Pedro Alves [Fri, 25 May 2018 10:58:58 +0000 (11:58 +0100)]
remote_target::m_remote_state, pointer -> object

The only reason remote_target::m_remote_state is a pointer is that
struct remote_state is incomplete when struct remote_target is
defined.

This commit thus moves struct remote_state (and its dependencies)
higher up and makes remote_target::m_remote_state an object instead of
a pointer.

gdb/ChangeLog:
2018-05-25  Pedro Alves  <palves@redhat.com>

* remote.c (struct vCont_action_support, MAXTHREADLISTRESULTS)
(struct readahead_cache, struct packet_reg, struct
remote_arch_state, class remote_state): Move higher up in the
file.
(remote_target::m_remote_state): Now an object instead of a pointer.
(remote_target::get_remote_state): Adjust.

6 years agos12z regen
Alan Modra [Fri, 25 May 2018 06:35:30 +0000 (16:05 +0930)]
s12z regen

This patch regenerates a number of files that either were edited by
hand or not regenerated when s12z support was added to binutils.

bfd/
* Makefile.in: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
gas/
* po/POTFILES.in: Regenerate.
ld/
* po/BLD-POTFILES.in: Regenerate.
opcodes/
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.

6 years agoFix hidden visibility compiler test
Alan Modra [Fri, 25 May 2018 05:37:15 +0000 (15:07 +0930)]
Fix hidden visibility compiler test

Warnings from configure tests aren't usually checked.  gcc's
"visibility attribute not supported in this configuration" warning is
enabled by default so we don't need to add any warning flag except
-Werror.

* configure.ac (bfd_cv_hidden): Run test with -Werror in CFLAGS.
* configure: Regenerate.

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 25 May 2018 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agogdb: Split func_command into two parts.
Andrew Burgess [Sat, 5 May 2018 14:55:58 +0000 (15:55 +0100)]
gdb: Split func_command into two parts.

The func_command function is used to emulate the dbx 'func' command.
However, finding a stack frame based on function name might be a useful
feature, and so the core of func_command is now split out into a
separate function.

gdb/ChangeLog:

* stack.c (select_and_print_frame): Delete.
(struct function_bounds): Move struct within function.
(func_command): Most content moved into new function
find_frame_for_function, use new function, print result, add
function comment.
(find_frame_for_function): New function, now returns a result.

6 years agoPATCH (obvious): Fix a comment, and pass stream to cb_data.
Philippe Waroquiers [Thu, 24 May 2018 21:19:05 +0000 (23:19 +0200)]
PATCH (obvious): Fix a comment, and pass stream to cb_data.

iterate_over_block_arg_vars is a void function, so does
not return 1 or 0.
print_frame_arg_vars tells it prints on STREAM,
so pass STREAM in the cb_data, not gdb_stdout.

gdb/ChangeLog

2018-05-24  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* stack.c (iterate_over_block_arg_vars): Fix comment.
(print_frame_arg_vars): Pass stream in cb_data, not gdb_stdout.

6 years agoUpdate help text in record.c
Tom Tromey [Mon, 30 Apr 2018 14:37:31 +0000 (08:37 -0600)]
Update help text in record.c

This updates some help text in record.c to conform to GNU standards.
I also added a "Usage" line to "record save".

2018-04-29  Tom Tromey  <tom@tromey.com>

* record.c (_initialize_record): Update help text.

6 years agoUpdate help text in linux-fork.c
Tom Tromey [Mon, 30 Apr 2018 14:37:30 +0000 (08:37 -0600)]
Update help text in linux-fork.c

This updates some help text in linux-fork.c to conform to GNU
standards.

2018-04-29  Tom Tromey  <tom@tromey.com>

* linux-fork.c (_initialize_linux_fork): Update help text.

6 years agoUpdate help text in record-btrace.c
Tom Tromey [Mon, 30 Apr 2018 14:37:29 +0000 (08:37 -0600)]
Update help text in record-btrace.c

This updates the help text in record-btrace.c to conform to GNU
standards.

2018-04-29  Tom Tromey  <tom@tromey.com>

* record-btrace.c (_initialize_record_btrace): Update help text.

6 years agoUpdate help text in tracepoint.c
Tom Tromey [Mon, 30 Apr 2018 14:37:28 +0000 (08:37 -0600)]
Update help text in tracepoint.c

This changes the help text of a couple of commands in tracepoint.c to
follow the GNU style.

ChangeLog
2018-04-29  Tom Tromey  <tom@tromey.com>

* tracepoint.c (_initialize_tracepoint): Update help text.

testsuite/ChangeLog
2018-04-30  Tom Tromey  <tom@tromey.com>

* gdb.trace/tfind.exp: Update help tests.

6 years agoUpdate help text in disasm.c
Tom Tromey [Mon, 30 Apr 2018 14:37:27 +0000 (08:37 -0600)]
Update help text in disasm.c

This changes some help text in disasm.c to follow the GNU style.

2018-04-29  Tom Tromey  <tom@tromey.com>

* disasm.c (_initialize_disasm): Update help text.

6 years agoUpdate help text for "jump" command
Tom Tromey [Mon, 30 Apr 2018 14:37:26 +0000 (08:37 -0600)]
Update help text for "jump" command

This updates the usage text for the "jump" command to conform to the
GNU style.

2018-04-29  Tom Tromey  <tom@tromey.com>

* infcmd.c (_initialize_infcmd): Update help text.

6 years agoUpdate help text in dcache.c
Tom Tromey [Mon, 30 Apr 2018 14:37:25 +0000 (08:37 -0600)]
Update help text in dcache.c

This updates some text in dcache.c to follow GNU standards.
Here, I found a couple of spots needing an update.

2018-04-29  Tom Tromey  <tom@tromey.com>

* dcache.c (dcache_info_1): Update usage text.
(_initialize_dcache): Update help text.

6 years agoUpdate help strings in TUI
Tom Tromey [Mon, 30 Apr 2018 14:37:24 +0000 (08:37 -0600)]
Update help strings in TUI

This updates some help strings in the TUI to more closely follow GNU
standards.  In this case I chose to reuse some existing "usage" macros
in the help text.  Also, I found that XDBWIN_HEIGHT_USAGE is unused,
so I removed it.

ChangeLog
2018-04-29  Tom Tromey  <tom@tromey.com>

* tui/tui-layout.c (_initialize_tui_layout): Update help text.
* tui/tui-win.c (WIN_HEIGHT_USAGE, FOCUS_USAGE): Update
(XDBWIN_HEIGHT_USAGE): Remove.
(_initialize_tui_win): Use macros.  Update help text.

6 years agoUpdate memattr.c help strings
Tom Tromey [Mon, 30 Apr 2018 14:37:23 +0000 (08:37 -0600)]
Update memattr.c help strings

This changes memattr.c to use the GNU style for help strings.

2018-04-29  Tom Tromey  <tom@tromey.com>

* memattr.c (_initialize_mem): Update help string.

6 years agoUpdate core-related help strings
Tom Tromey [Mon, 30 Apr 2018 14:37:22 +0000 (08:37 -0600)]
Update core-related help strings

This updates some help strings in corefile.c and gcore.c.

2018-04-27  Tom Tromey  <tom@tromey.com>

* corefile.c (_initialize_core): Update help string.
* gcore.c (_initialize_gcore): Update help string.

6 years agoUpdate help strings in skip.c
Tom Tromey [Mon, 30 Apr 2018 14:37:21 +0000 (08:37 -0600)]
Update help strings in skip.c

This changes help strings in skip.c to follow the GNU style.

2018-04-27  Tom Tromey  <tom@tromey.com>

* skip.c (_initialize_step_skip): Update help strings.

6 years agoFix help and documentation for inferior commands
Tom Tromey [Mon, 30 Apr 2018 14:37:20 +0000 (08:37 -0600)]
Fix help and documentation for inferior commands

This changes inferior.c to add Usage lines for all commands, and to
change how "metasyntactic variables" are written to conform to GNU
style.

While doing this I noticed that the manual doesn't document the
argument to "info inferiors", so I've added that as well.

ChangeLog
2018-04-27  Tom Tromey  <tom@tromey.com>

* inferior.c (initialize_inferiors): Update help strings.

doc/ChangeLog
2018-04-27  Tom Tromey  <tom@tromey.com>

* gdb.texinfo (Inferiors and Programs): Document argument to "info
inferiors".

6 years agoRISC-V: Fix .align handling when .option norelax.
Jim Wilson [Thu, 24 May 2018 17:35:59 +0000 (10:35 -0700)]
RISC-V: Fix .align handling when .option norelax.

gas/
PR gas/23219
* config/tc-riscv.c (riscv_frag_align_code): Move frag_more call after
!riscv_opts.relax check.
(riscv_handle_align): Rewrite !riscv_opts.relax support.
* config/tc-riscv (MAX_MEM_FOR_RS_ALIGN_CODE): Update.
* testsuite/gas/riscv/no-relax-align.d: New
* testsuite/gas/riscv/no-relax-align.s: New
* testsuite/gas/riscv/no-relax-align-2.d: New
* testsuite/gas/riscv/no-relax-align-2.s: New

6 years agogdb: Restore selected frame in print_frame_local_vars
Andrew Burgess [Fri, 18 May 2018 16:45:16 +0000 (17:45 +0100)]
gdb: Restore selected frame in print_frame_local_vars

PR gdb/23203 reports 'bt full' causing the currently selected frame to
change, this issue is fixed in this commit.

Add a new class scoped_restore_selected_frame that saves and restores
the selected frame.  Make use of this in print_frame_local_vars to
restore the selected frame on exit.

gdb/ChangeLog:

PR gdb/23203
* frame.c
(scoped_restore_selected_frame::scoped_restore_selected_frame):
Define.
(scoped_restore_selected_frame::~scoped_restore_selected_frame):
Define.
* frame.h (class scoped_restore_selected_frame): New class.
* stack.c (print_frame_local_vars): Remove catching and rethrowing
of any exception, use scoped_restore_selected_frame to restore the
frame instead.

gdb/testsuite/ChangeLog:

PR gdb/23203
* gdb.base/bt-selected-frame.c: New file.
* gdb.base/bt-selected-frame.exp: New file.
* lib/gdb.exp (get_current_frame_number): New function.

6 years agotestsuite: Extend TLS core file testing with an OS-generated dump
Maciej W. Rozycki [Thu, 24 May 2018 14:31:32 +0000 (15:31 +0100)]
testsuite: Extend TLS core file testing with an OS-generated dump

Complementing commit 280ca31f4d60 ("Add test for fetching TLS from
core file") extend gdb.threads/tls-core.exp with an OS-generated dump
where supported.

This verifies not only that our core dump interpreter is consistent
with our producer, but that it matches the OS verified as well,
avoiding a possible case where our interpreter would be bug-compatible
with our producer but not the OS and it would go unnoticed in testing.

This results in:

 PASS: gdb.threads/tls-core.exp: native: load core file
 PASS: gdb.threads/tls-core.exp: native: print thread-local storage variable
 PASS: gdb.threads/tls-core.exp: gcore: load core file
 PASS: gdb.threads/tls-core.exp: gcore: print thread-local storage variable

with local testing and:

 UNSUPPORTED: gdb.threads/tls-core.exp: native: load core file
 UNSUPPORTED: gdb.threads/tls-core.exp: native: print thread-local storage variable
 PASS: gdb.threads/tls-core.exp: gcore: load core file
 PASS: gdb.threads/tls-core.exp: gcore: print thread-local storage variable

with remote testing, or for testing on ports that don't supports
cores.

gdb/testsuite/ChangeLog:
2018-05-24  Maciej W. Rozycki  <macro@mips.com>
    Pedro Alves  <palves@redhat.com>

* gdb.threads/tls-core.c: Include <stdlib.h>
(thread_proc): Call `abort'.
* gdb.threads/tls-core.exp: Generate a core with core_find too.
(tls_core_test): New procedure, bits factored out from ...
(top level): ... here.  Test both native cores and gcore cores.

6 years agoFix macOS build, missing override
Pedro Alves [Thu, 24 May 2018 12:07:53 +0000 (13:07 +0100)]
Fix macOS build, missing override

Fixes:

In file included from ../../src/gdb/darwin-nat.c:63:0:
../../src/gdb/darwin-nat.h:28:8: error: 'virtual void darwin_nat_target::create_inferior(const char*, const string&, char**, int)' can be marked override [-Werror=suggest-override]
   void create_inferior (const char *exec_file,
        ^

gdb/ChangeLog:
2018-05-24  Pedro Alves  <palves@redhat.com>

* darwin-nat.h (darwin_nat_target::create_inferior): Mark with
override.

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 24 May 2018 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAdd ATTRIBUTE_NONSTRING to ppc64_elf_write_core_note
H.J. Lu [Wed, 23 May 2018 17:15:11 +0000 (10:15 -0700)]
Add ATTRIBUTE_NONSTRING to ppc64_elf_write_core_note

This patch silences gcc8 -Wstringop-truncation warnings.

* elf64-ppc.c (ppc64_elf_write_core_note): Add ATTRIBUTE_NONSTRING
to data.

6 years agoRemove struct complaints
Tom Tromey [Thu, 17 May 2018 05:25:09 +0000 (23:25 -0600)]
Remove struct complaints

struct complaints now just holds a single enum value, so remove it and
symfile_complaint_book and replace it with a global variable.

gdb/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* complaints.c (struct complaints): Remove.
(symfile_complaint_book): Remove.
(series): New global.
(complaint_internal): Update.
(clear_complaints): Update.

6 years agoRemove struct complain
Tom Tromey [Thu, 17 May 2018 05:22:54 +0000 (23:22 -0600)]
Remove struct complain

At this point, struct complain is just holds a key, a value, and a
"next" pointer to form a linked list.  It's simpler to replace this
with an unordered map.

gdb/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* complaints.c (counters): New global.
(struct complain): Remove.
(struct complaints) <root>: Remove.
(complaint_sentinel): Remove.
(symfile_complaint_book): Update.
(find_complaint) Remove.
(complaint_internal, clear_complaints): Update.

gdb/testsuite/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* gdb.gdb/complaints.exp (test_initial_complaints): Simplify.

6 years agoRemove file and line from struct complain
Tom Tromey [Thu, 17 May 2018 05:14:03 +0000 (23:14 -0600)]
Remove file and line from struct complain

The file and line handling in complaints.c wasn't used once
internal_complaint was removed.  This patch removes all the related
code.

gdb/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* complaints.c (struct complain) <file, line>: Remove.
(find_complaint): Remove file, line parameters.
(complaint_internal): Update.

6 years agoRemove vcomplaint
Tom Tromey [Thu, 17 May 2018 05:10:51 +0000 (23:10 -0600)]
Remove vcomplaint

vcomplaint now has a single caller, so merge it with that caller.

gdb/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* complaints.c (vcomplaint): Remove.
(complaint_internal) Merge in contents of vcomplaint.

6 years agoRemove struct explanation
Tom Tromey [Thu, 17 May 2018 05:05:54 +0000 (23:05 -0600)]
Remove struct explanation

Now that there's only a single reason for a complaint to be emitted,
this removes "struct explanation" and changes vcomplaint to emit the
desired messages directly.

gdb/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* complaints.c (struct complaints) <explanation>: Remove.
(symfile_explanations): Remove.
(symfile_complaint_book): Update.
(vcomplaint): Update.
(struct explanation): Remove.

6 years agoRemove symfile_complaints
Tom Tromey [Thu, 17 May 2018 04:54:44 +0000 (22:54 -0600)]
Remove symfile_complaints

The complaint system seems to allow for multiple different complaint
topics.  However, in practice only symfile_complaints has ever been
defined.  Seeing that complaints.c dates to 1992, and that no new
complaints have been added in the intervening years, I think it is
reasonable to admit that complaints are specifically related to
debuginfo reading.

This patch removes symfile_complaints and updates all the callers.
Some of these spots should perhaps be calls to warning instead, but I
did not make that change.

gdb/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* complaints.c (symfile_complaints): Remove.
(complaint_internal): Remove "complaints" parameter.
(clear_complaints, vcomplaint): Remove "c" parameter.
(get_complaints): Remove.
* dwarf2read.c (dwarf2_statement_list_fits_in_line_number_section_complaint)
(dwarf2_debug_line_missing_file_complaint)
(dwarf2_debug_line_missing_end_sequence_complaint)
(dwarf2_complex_location_expr_complaint)
(dwarf2_const_value_length_mismatch_complaint)
(dwarf2_section_buffer_overflow_complaint)
(dwarf2_macro_malformed_definition_complaint)
(dwarf2_invalid_attrib_class_complaint)
(create_addrmap_from_index, dw2_symtab_iter_next)
(dw2_expand_marked_cus)
(dw2_debug_names_iterator::find_vec_in_debug_names)
(dw2_debug_names_iterator::next, dw2_debug_names_iterator::next)
(create_debug_type_hash_table, init_cutu_and_read_dies)
(partial_die_parent_scope, add_partial_enumeration)
(skip_one_die, fixup_go_packaging, quirk_rust_enum, process_die)
(dwarf2_compute_name, dwarf2_physname, read_namespace_alias)
(read_import_statement, read_file_scope, create_dwo_cu_reader)
(create_cus_hash_table, create_dwp_hash_table)
(inherit_abstract_dies, read_func_scope, read_call_site_scope)
(dwarf2_rnglists_process, dwarf2_ranges_process)
(dwarf2_add_type_defn, dwarf2_attach_fields_to_type)
(dwarf2_add_member_fn, get_alignment, maybe_set_alignment)
(handle_struct_member_die, process_structure_scope)
(read_array_type, read_common_block, read_module_type)
(read_tag_pointer_type, read_typedef, read_base_type)
(read_subrange_type, load_partial_dies, partial_die_info::read)
(partial_die_info::read, partial_die_info::read)
(partial_die_info::read, read_checked_initial_length_and_offset)
(dwarf2_string_attr, read_formatted_entries)
(dwarf_decode_line_header)
(lnp_state_machine::check_line_address, dwarf_decode_lines_1)
(new_symbol, dwarf2_const_value_attr, lookup_die_type)
(read_type_die_1, determine_prefix, dwarf2_get_ref_die_offset)
(dwarf2_get_attr_constant_value, dwarf2_fetch_constant_bytes)
(get_signatured_type, get_DW_AT_signature_type)
(decode_locdesc, file_file_name, consume_improper_spaces)
(skip_form_bytes, skip_unknown_opcode, dwarf_parse_macro_header)
(dwarf_decode_macro_bytes, dwarf_decode_macros)
(dwarf2_symbol_mark_computed, set_die_type)
(read_attribute_value): Update.
* stap-probe.c (handle_stap_probe, get_stap_base_address):
Update.
* dbxread.c (unknown_symtype_complaint)
(lbrac_mismatch_complaint, repeated_header_complaint)
(set_namestring, function_outside_compilation_unit_complaint)
(read_dbx_symtab, process_one_symbol): Update.
* gdbtypes.c (stub_noname_complaint): Update.
* windows-nat.c (handle_unload_dll): Update.
* coffread.c (coff_symtab_read, enter_linenos, decode_type)
(decode_base_type): Update.
* xcoffread.c (bf_notfound_complaint, ef_complaint)
(eb_complaint, record_include_begin, record_include_end)
(enter_line_range, xcoff_next_symbol_text, read_xcoff_symtab)
(process_xcoff_symbol, read_symbol)
(function_outside_compilation_unit_complaint)
(scan_xcoff_symtab): Update.
* machoread.c (macho_symtab_read, macho_add_oso_symfile): Update.
* buildsym.c (finish_block_internal, make_blockvector)
(end_symtab_get_static_block, augment_type_symtab): Update.
* dtrace-probe.c (dtrace_process_dof)
(dtrace_static_probe_ops::get_probes): Update.
* complaints.h (struct complaint): Don't declare.
(symfile_complaints): Remove.
(complaint_internal): Remove "complaints" parameter.
(complaint): Likewise.
(clear_complaints): Likewise.
* symfile.c (syms_from_objfile_1, finish_new_objfile)
(reread_symbols): Update.
* dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program)
(dwarf2_frame_cache, decode_frame_entry): Update.
* dwarf2loc.c (dwarf_reg_to_regnum): Update.
* objc-lang.c (lookup_objc_class, lookup_child_selector)
(info_selectors_command): Update.
* macrotab.c (macro_include, check_for_redefinition)
(macro_undef): Update.
* objfiles.c (filter_overlapping_sections): Update.
* stabsread.c (invalid_cpp_abbrev_complaint)
(reg_value_complaint, stabs_general_complaint, dbx_lookup_type)
(define_symbol, error_type, read_type, rs6000_builtin_type)
(stabs_method_name_from_physname, read_member_functions)
(read_cpp_abbrev, read_baseclasses, read_tilde_fields)
(attach_fields_to_type, complain_about_struct_wipeout)
(read_range_type, read_args, common_block_start)
(common_block_end, cleanup_undefined_types_1, scan_file_globals):
Update.
* mdebugread.c (index_complaint, unknown_ext_complaint)
(basic_type_complaint, bad_tag_guess_complaint)
(bad_rfd_entry_complaint, unexpected_type_code_complaint)
(reg_value_complaint, parse_symbol, parse_type, upgrade_type)
(parse_procedure, parse_lines)
(function_outside_compilation_unit_complaint)
(parse_partial_symbols, psymtab_to_symtab_1, cross_ref)
(bad_tag_guess_complaint, reg_value_complaint): Update.
* cp-support.c (demangled_name_complaint): Update.
* macroscope.c (sal_macro_scope): Update.
* dwarf-index-write.c (class debug_names): Update.

gdb/testsuite/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* gdb.gdb/complaints.exp (test_initial_complaints): Don't mention
symfile_complaints.
(test_short_complaints): Likewise.
(test_empty_complaints): Likewise.
(test_initial_complaints): Update.

6 years agoRemove "noisy" parameter from clear_complaints
Tom Tromey [Thu, 17 May 2018 04:27:50 +0000 (22:27 -0600)]
Remove "noisy" parameter from clear_complaints

After the previous patch, the "noisy" parameter to clear_complaints is
no longer used, so this patch removes it.

gdb/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* complaints.c (clear_complaints): Remove "noisy" parameter.
* complaints.h (clear_complaints): Update.
* symfile.c (syms_from_objfile_1, finish_new_objfile)
(reread_symbols): Update.

gdb/testsuite/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* gdb.gdb/complaints.exp (test_empty_complaints): Update.

6 years agoRemove elements from complaint_series
Tom Tromey [Thu, 17 May 2018 04:23:09 +0000 (22:23 -0600)]
Remove elements from complaint_series

I couldn't find a way to get complaints to use a couple of cases, and
the difference between the actual printed output for these cases was
minimal anyway.  So, this patch removes a couple of constants from
complaint_series, plus the associated code.

gdb/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* complaints.c (enum complaint_series): Remove FIRST_MESSAGE,
SUBSEQUENT_MESSAGE.
(vcomplaint, clear_complaints): Update.
(symfile_explanations): Remove some messages.

gdb/testsuite/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* gdb.gdb/complaints.exp (test_serial_complaints): Remove.
(test_short_complaints): Update.

6 years agoRemove internal_complaint
Tom Tromey [Wed, 16 May 2018 21:09:32 +0000 (15:09 -0600)]
Remove internal_complaint

I happened to notice that gdb has both complaint_internal and
internal_complaint.  The latter is unused, so this patch removes it.

gdb/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* complaints.c (internal_complaint): Remove.
* complaints.h (internal_complaint): Remove.

6 years agoImprove File I/O overflow detection in gdbserver (PR server/23198)
Erik Kurzinger [Wed, 23 May 2018 11:04:39 +0000 (12:04 +0100)]
Improve File I/O overflow detection in gdbserver (PR server/23198)

Currently, the function used by gdbserver to parse integers from
received File I/O commands will detect overflow and fail for any value
over 0xfffffff.  Among other things, this has the effect of limiting
the file offsets for reading or writing to about 268MB which can be
insufficient for particularly large libraries.

This change allows the parsing of integers up to the true maximum
positive value of 0x7fffffff, increasing the file size limit to about
2GB.

gdb/gdbserver/ChangeLog:
2018-05-23  Erik Kurzinger  <ekurzinger@nvidia.com>

PR server/23198
* hostio.c (require_int): Do not report overflow for integers
between 0xfffffff and 0x7fffffff.

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 23 May 2018 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoFix gdb.base/remote.exp with native-extended-gdbserver board
Pedro Alves [Tue, 22 May 2018 22:26:46 +0000 (23:26 +0100)]
Fix gdb.base/remote.exp with native-extended-gdbserver board

This fixes gdb.base/remote.exp regressions caused by the previous
commit to the testcase, when tested with
--target_board=native-extended-gdbserver.  For example:

  ...
  show remote memory-write-packet-size
  The memory-write-packet-size is 0 (default). Packets are limited to 16383 bytes.
  (gdb) FAIL: gdb.base/remote.exp: write-packet default
  ...

With that board, GDB connects to GDBserver at gdb_start time, so GDB
is showing the actual remote/gdbserver packet size limits.

Fix it using the usual "disconnect" pattern.  While at it, there's no
need to start GDB before compiling the testcase.

gdb/testsuite/ChangeLog:
2018-05-22  Pedro Alves  <palves@redhat.com>

* gdb.base/remote.exp: Only gdb_start after compiling the
testcase.  Issue "disconnect" before testing "set remote" command
defaults.  Issue clean_restart before running to main.

6 years agogdb/x86: Fix `-Wstrict-overflow' build error in `i387_collect_xsave'
Maciej W. Rozycki [Tue, 22 May 2018 21:52:14 +0000 (22:52 +0100)]
gdb/x86: Fix `-Wstrict-overflow' build error in `i387_collect_xsave'

Make `i' defined within `i387_collect_xsave' unsigned, removing a
`-Werror=strict-overflow' compilation error:

.../gdb/i387-tdep.c: In function 'void i387_collect_xsave(const regcache*, int, void*, int)':
.../gdb/i387-tdep.c:1348:1: error: assuming signed overflow does not occur when assuming that (X + c) < X is always false [-Werror=strict-overflow]
 i387_collect_xsave (const struct regcache *regcache, int regnum,
 ^
cc1plus: all warnings being treated as errors
Makefile:1610: recipe for target 'i387-tdep.o' failed
make: *** [i387-tdep.o] Error 1

seen with GCC 5.4.0, a commit 8ee22052f690 ("gdb/x86: Handle kernels
using compact xsave format") regression.  While `regnum' can be -1 on
entry to the function, to mean all registers, `i' is only used with
non-negative register numbers.

gdb/
* i387-tdep.c (i387_collect_xsave): Make `i' unsigned.

6 years agoMIPS/gdbserver: Correctly handle narrow big-endian register transfers
Maciej W. Rozycki [Tue, 22 May 2018 21:52:14 +0000 (22:52 +0100)]
MIPS/gdbserver: Correctly handle narrow big-endian register transfers

Fix an issue with `gdbserver' on big-endian n64 MIPS targets, where
$dspctl is 32-bit while the `ptrace' transfer data type is 64-bit.

Such register data is held in the low order 32 bits of the 64-bit data
quantity exchanged with the buffer used by `fetch_register' and
`store_register', however `supply_register' and `collect_register'
access the same data as a 32-bit quantity.  Consequently the register is
presented and written as all-zeros held in the most-significant part of
the big-endian 64-bit data quantity represented in the buffer:

(gdb) info registers
                  zero               at               v0               v1
 R0   0000000000000000 0000000000000001 0000000000000001 0000000000000000
                    a0               a1               a2               a3
 R4   00000001200212b0 0000000000000000 0000000000000021 000000012001a260
                    a4               a5               a6               a7
 R8   000000012001a260 0000000000000004 800000010c60c000 fffffffffffffff8
                    t0               t1               t2               t3
 R12  0000000000000000 000000fff7edab68 0000000000000001 0000000000000000
                    s0               s1               s2               s3
 R16  000000fff7ee2068 0000000120008b80 0000000000000000 0000000000000000
                    s4               s5               s6               s7
 R20  000000000052e5c8 000000000052f008 0000000000000000 0000000000000000
                    t8               t9               k0               k1
 R24  0000000000000000 00000001200027c0 0000000000000000 0000000000000000
                    gp               sp               s8               ra
 R28  00000001200212b0 000000ffffffc850 000000ffffffc850 0000000120005ee8
                status               lo               hi         badvaddr
      0000000000109cf3 0000000000943efe 000000000000000e 000000012001a008
                 cause               pc
      0000000000800024 0000000120005ee8
                  fcsr              fir              hi1              lo1
              0e800000         00f30000 0000000000000000 0101010101010101
                   hi2              lo2              hi3              lo3
      0202020202020202 0303030303030303 0404040404040404 0505050505050505
                dspctl          restart
              00000000 0000000000000000
(gdb)

Correct this problem then by using the `mips_supply_register'
`mips_collect_register' accessors for 32-bit registers where the
`ptrace' data type is 64-bit.  These accessors already operate on 32-bit
data quantities held in 64-bit containers:

(gdb) info registers
                  zero               at               v0               v1
 R0   0000000000000000 0000000000000001 0000000000000001 0000000000000000
                    a0               a1               a2               a3
 R4   00000001200212b0 0000000000000000 0000000000000021 000000012001a260
                    a4               a5               a6               a7
 R8   000000012001a260 0000000000000004 800000010d82e900 fffffffffffffff8
                    t0               t1               t2               t3
 R12  0000000000000000 000000fff7edab68 0000000000000001 0000000000000000
                    s0               s1               s2               s3
 R16  000000fff7ee2068 0000000120008b80 0000000000000000 0000000000000000
                    s4               s5               s6               s7
 R20  000000000052e5c8 000000000052f008 0000000000000000 0000000000000000
                    t8               t9               k0               k1
 R24  0000000000000000 00000001200027c0 0000000000000000 0000000000000000
                    gp               sp               s8               ra
 R28  00000001200212b0 000000ffffffc850 000000ffffffc850 0000000120005ee8
                status               lo               hi         badvaddr
      0000000000109cf3 0000000000943efe 000000000000000e 000000012001a008
                 cause               pc
      0000000000800024 0000000120005ee8
                  fcsr              fir              hi1              lo1
              0e800000         00f30000 0000000000000000 0101010101010101
                   hi2              lo2              hi3              lo3
      0202020202020202 0303030303030303 0404040404040404 0505050505050505
                dspctl          restart
              55aa33cc 0000000000000000
(gdb)

gdb/gdbserver/
* linux-mips-low.c [HAVE_PTRACE_GETREGS] (mips_collect_register)
(mips_supply_register): Move outside HAVE_PTRACE_GETREGS.
(mips_collect_ptrace_register, mips_supply_ptrace_register): New
functions.
(the_low_target): Wire them.

6 years agoremote: one struct remote_state per struct remote_target
Pedro Alves [Tue, 22 May 2018 17:22:11 +0000 (18:22 +0100)]
remote: one struct remote_state per struct remote_target

'struct remote_state' today contains per-connection state, however
there's only a single global instance of that type.  In order to
support multiple connections, we must have one such object per
connection.

Thus this patch eliminates the 'remote_state' global in favor of
having a remote_state instance per remote_target instance.

The get_remote_state free function is eliminated as well, by making it
a remote_target method instead.

The patch then fixes the fallout by making all free functions that
refer to get_remote_state() directly or indirectly be methods of
remote_target too.

Likewise, remote-fileio.c and remote-notif.c routines are
parameterized with a remote_target pointer too, so they can call into
the right remote_target instance.

References to the global 'get_remote_state ()->remote_desc' to tell
whether the remote target is open (!= nullptr) must be replaced with
something else:

 - Command implementations use a new get_current_remote_target free
 function.

 - remote_target::open_1 checks the exception type instead.

Finally, remote_target and extended_remote_target are made
heap-allocated targets.  As with the earlier core target patches, it
still won't be possible to have more than one remote_target instance
in practice, but this puts us closer.

gdb/ChangeLog:
2018-05-22  Pedro Alves  <palves@redhat.com>

* remote-fileio.c (remote_fileio_reply, remote_fileio_ioerror)
(remote_fileio_badfd, remote_fileio_return_errno)
(remote_fileio_return_success, remote_fileio_func_open)
(remote_fileio_func_open, remote_fileio_func_close)
(remote_fileio_func_read, remote_fileio_func_write)
(remote_fileio_func_lseek, remote_fileio_func_rename)
(remote_fileio_func_unlink, remote_fileio_func_stat)
(remote_fileio_func_fstat, remote_fileio_func_gettimeofday)
(remote_fileio_func_isatty, remote_fileio_func_system): Add
remote_target parameter.
(remote_fio_func_map) <func>: Add remote_target parameter.
(do_remote_fileio_request, remote_fileio_request):
* remote-fileio.h (remote_fileio_request):
* remote-notif.c (remote_notif_ack, remote_notif_parse, ): Add
remote_target parameter.
(remote_notif_process, handle_notification): Adjust to pass down
the remote.
(remote_notif_state_allocate): Add remote_target parameter.  Save
it.
* remote-notif.h (struct remote_target): Forward declare.
(struct notif_client) <parse, ack, can_get_pending_events>: Add
remote_target parameter.
(struct remote_notif_state) <remote>: New field.
(remote_notif_ack, remote_notif_parse): Add remote_target
parameter.
(remote_notif_state_allocate, remote_notif_state_allocate): Add
remote_target parameter.
* remote.c (OPAQUETHREADBYTES, threadref, gdb_ext_thread_info)
(threads_listing_context, rmt_thread_action, protocol_feature)
(packet_reg, stop_reply, stop_reply_p, enum packet_support)
(packet_result, struct threads_listing_context, remote_state):
Move definitions and declarations higher up.
(remote_target) <~remote_target>: Declare.
(remote_download_command_source, remote_file_put, remote_file_get)
(remote_file_delete, remote_hostio_pread, remote_hostio_pwrite)
(remote_hostio_pread_vFile, remote_hostio_send_command)
(remote_hostio_set_filesystem, remote_hostio_open)
(remote_hostio_close, remote_hostio_unlink, remote_state)
(get_remote_state, get_remote_packet_size, get_memory_packet_size)
(get_memory_write_packet_size, get_memory_read_packet_size)
(append_pending_thread_resumptions, remote_detach_1)
(append_resumption, remote_resume_with_vcont)
(add_current_inferior_and_thread, wait_ns, wait_as)
(process_stop_reply, remote_notice_new_inferior)
(process_initial_stop_replies, remote_add_thread)
(btrace_sync_conf, remote_btrace_maybe_reopen)
(remove_new_fork_children, kill_new_fork_children)
(discard_pending_stop_replies, stop_reply_queue_length)
(check_pending_events_prevent_wildcard_vcont)
(discard_pending_stop_replies_in_queue, stop_reply)
(remote_notif_remove_queued_reply, stop_reply *queued_stop_reply)
(peek_stop_reply, remote_parse_stop_reply, remote_stop_ns)
(remote_interrupt_as, remote_interrupt_ns)
(remote_get_noisy_reply, remote_query_attached)
(remote_add_inferior, remote_current_thread, get_current_thread)
(set_thread, set_general_thread, set_continue_thread)
(set_general_process, write_ptid)
(remote_unpack_thread_info_response, remote_get_threadinfo)
(parse_threadlist_response, remote_get_threadlist)
(remote_threadlist_iterator, remote_get_threads_with_ql)
(remote_get_threads_with_qxfer)
(remote_get_threads_with_qthreadinfo, extended_remote_restart)
(get_offsets, remote_check_symbols, remote_supported_packet)
(remote_query_supported, remote_packet_size)
(remote_serial_quit_handler, remote_detach_pid)
(remote_vcont_probe, remote_resume_with_hc)
(send_interrupt_sequence, interrupt_query)
(remote_notif_get_pending_events, fetch_register_using_p)
(send_g_packet, process_g_packet, fetch_registers_using_g)
(store_register_using_P, store_registers_using_G)
(set_remote_traceframe, check_binary_download)
(remote_write_bytes_aux, remote_write_bytes, remote_read_bytes_1)
(remote_xfer_live_readonly_partial, remote_read_bytes)
(remote_send_printf, remote_flash_write, readchar)
(remote_serial_write, putpkt, putpkt_binary, skip_frame)
(read_frame, getpkt, getpkt_or_notif_sane_1, getpkt_sane)
(getpkt_or_notif_sane, remote_vkill, remote_kill_k)
(extended_remote_disable_randomization, extended_remote_run)
(send_environment_packet, extended_remote_environment_support)
(extended_remote_set_inferior_cwd, remote_write_qxfer)
(remote_read_qxfer, push_stop_reply, vcont_r_supported)
(packet_command): Now methods of ...
(remote_target): ... this class.
(m_remote_state) <remote_target>: New field.
(struct remote_state) <stop_reply_queue,
remote_async_inferior_event_token, wait_forever_enabled_p>: New
fields.
(remote_state::remote_state): Allocate stop_reply_queue.
(remote_state): Delete global.
(get_remote_state_raw): Delete.
(remote_target::get_remote_state): Allocate m_remote_state on
demand.
(get_current_remote_target): New.
(remote_ops, extended_remote_ops): Delete.
(wait_forever_enabled_p, remote_async_inferior_event_token):
Delete, moved to struct remote_state.
(remote_target::close): Delete self.  Destruction bits split to
...
(remote_target::~remote_target): ... this.
(show_memory_packet_size): Adjust to use
get_current_remote_target.
(struct protocol_feature) <func>: Add remote_target parameter.
All callers adjusted.
(curr_quit_handler_target): New.
(remote_serial_quit_handler): Reimplement.
(remote_target::open_1): Adjust to use get_current_remote_target.
Heap-allocate remote_target/extended_remote_target instances.
(vcont_builder::vcont_builder): Add remote_target parameter, and
save it in m_remote.  All callers adjusted.
(vcont_builder::m_remote): New field.
(vcont_builder::restart, vcont_builder::flush)
(vcont_builder::push_action): Use it.
(remote_target::commit_resume): Use it.
(struct queue_iter_param) <remote>: New field.
(remote_target::remove_new_fork_children): Fill in 'remote' field.
(check_pending_event_prevents_wildcard_vcont_callback_data): New.
(check_pending_event_prevents_wildcard_vcont_callback)
(remote_target::check_pending_events_prevent_wildcard_vcont)
(remote_target::discard_pending_stop_replies)
(remote_target::discard_pending_stop_replies_in_queue)
(remote_target::remote_notif_remove_queued_reply): Fill in
'remote' field.
(remote_notif_get_pending_events): New.
(remote_target::readchar, remote_target::remote_serial_write):
Save/restore curr_quit_handler_target.
(putpkt): New.
(kill_new_fork_children): Fill in 'remote' field.
(packet_command): Use get_current_remote_target, defer to
remote_target method of same name.
(scoped_remote_fd::scoped_remote_fd): Add 'remote_target'
parameter, and save it in m_remote.  All callers adjusted.
(scoped_remote_fd::release): Use m_remote.
(scoped_remote_fd::m_remote): New field.
(remote_file_put, remote_file_get, remote_file_delete): Use
get_current_remote_target, defer to remote_target method of same
name.
(remote_btrace_reset): Add remote_state paremeter.  Update all
callers.
(remote_async_inferior_event_handler). Pass down 'data'.
(remote_new_objfile): Use get_current_remote_target.
(remote_target::vcont_r_supported): New.
(set_range_stepping): Use get_current_remote_target and
remote_target::vcont_r_supported.
(_initialize_remote): Don't allocate 'remote_state' and
'stop_reply_queue' globals.
* remote.h (struct remote_target): Forward declare.
(getpkt, putpkt, remote_notif_get_pending_events): Add
'remote_target' parameter.

6 years agoremote: Make vcont_builder a class
Pedro Alves [Tue, 22 May 2018 17:22:11 +0000 (18:22 +0100)]
remote: Make vcont_builder a class

gdb/ChangeLog:
2018-05-22  Pedro Alves  <palves@redhat.com>

* remote.c (vcont_builder): Now a class.  Make all data members
private.
(vcont_builder) <vcont_builder, restart, flush, push_action>:
Declare methods.
(vcont_builder_restart): Rename to ...
(vcont_builder::restart): ... this.
(vcont_builder_flush): Rename to ...
(vcont_builder::flush): ... this.
(vcont_builder_push_action): Rename to ...
(vcont_builder::push_action): ... this.
(remote_target::commit_resume): Adjust.

6 years agoHandle "show remote memory-write-packet-size" when not connected
Pedro Alves [Tue, 22 May 2018 17:22:10 +0000 (18:22 +0100)]
Handle "show remote memory-write-packet-size" when not connected

Currently "show remote memory-write-packet-size" says that the packet
size is limited to whatever is stored in the remote_state global, even
if not connected to a target.

When we get to support multiple instances of remote targets, there
won't be a remote_state global anymore, so that must be replaced by
something else.

Since it doesn't make sense to print the limit of the packet size of a
non-existing connection, this patch makes us say that the limit will
be further reduced when we connect.

The text is taken from the command's online help, which says:

 "The actual limit is further reduced dependent on the target."

Note that a value of "0" is special, as per "help set remote
memory-write-packet-size":

 ~~~
 Specify the number of bytes in a packet or 0 (zero) for the
 default packet size.
 ~~~

I've tweaked "show remote memory-write-packet-size" to include
"(default)" in the output in that case, like this:

 (gdb) show remote memory-write-packet-size
 The memory-write-packet-size is 0 (default). The actual limit will be further reduced dependent on the target.

While working on this, I noticed that an explicit "set remote
write-packet-size 0" does not makes GDB go back to the exact same
state as the default state when GDB starts up:

 (gdb) show remote memory-write-packet-size
 The memory-write-packet-size is 0. [...]
                                 ^^

 (gdb) set remote memory-write-packet-size 0
 (gdb) show remote memory-write-packet-size
 The memory-write-packet-size is 16384. [...]
                                 ^^^^^

The "16384" number comes from DEFAULT_MAX_MEMORY_PACKET_SIZE.

This happens because git commit a5c0808e221c ("gdb: remove packet size
limit") at
<https://sourceware.org/ml/gdb-patches/2015-08/msg00743.html>, added
this:

  /* So that the query shows the correct value.  */
  if (size <= 0)
    size = DEFAULT_MAX_MEMORY_PACKET_SIZE;

to set_memory_packet_size, but despite what the comment suggests, that
also has the side-effect of recording DEFAULT_MAX_MEMORY_PACKET_SIZE
in config->size.

Finally, DEFAULT_MAX_MEMORY_PACKET_SIZE only makes sense for "set
remote memory-write-packet-size fixed", so I've renamed it
accordingly, to make it a little bit clearer.

gdb/ChangeLog:
2018-05-22  Pedro Alves  <palves@redhat.com>

* remote.c (DEFAULT_MAX_MEMORY_PACKET_SIZE): Rename to ...
(DEFAULT_MAX_MEMORY_PACKET_SIZE_FIXED): ... this.
(get_fixed_memory_packet_size): New.
(get_memory_packet_size): Use it.
(set_memory_packet_size): Don't override the config size with
DEFAULT_MAX_MEMORY_PACKET_SIZE.
(show_memory_packet_size): Use get_fixed_memory_packet_size.
Don't refer to get_memory_packet_size if not connected to a remote
target.  Show "(default)" if configured size is 0.

gdb/testsuite/ChangeLog:
2018-05-22  Pedro Alves  <palves@redhat.com>

* gdb.base/remote.exp: Adjust expected output of "show remote
memory-write-packet-size".  Add tests for "set remote
memory-write-packet-size 0" and "set remote
memory-write-packet-size fixed/limit".

6 years agoremote: Move discard_pending_stop_replies call
Pedro Alves [Tue, 22 May 2018 17:22:09 +0000 (18:22 +0100)]
remote: Move discard_pending_stop_replies call

This helps because discard_pending_stop_replies will later become a
method of remote_target.  Otherwise, when we have multiple instances
of remote_target, we'd have to make discard_pending_stop_replies find
the inferior's target_ops, and upcast it to remote_target (if indeed a
remote) to find the pending stop replies queue to clear.

gdb/ChangeLog:
2018-05-22  Pedro Alves  <palves@redhat.com>

* remote.c (remote_target::mourn_inferior): Move
discard_pending_stop_replies call here from ...
(_initialize_remote): ... here.

6 years agoremote: Small cleanup in compare_section_command
Pedro Alves [Tue, 22 May 2018 17:22:09 +0000 (18:22 +0100)]
remote: Small cleanup in compare_section_command

The set_general_process call in compare_sections_command isn't
actually needed.  remote_target::verify_memory and
remote_target::xfer_partial already handle making sure the remote is
pointing at the right process or thread.

Getting this out of the way helps a bit with further elimination of
the remote_state global, because we have to handle the case of a user
invoking the command even if not connect to a remote target.

gdb/ChangeLog:
2018-05-22  Pedro Alves  <palves@redhat.com>

* remote.c (compare_section_command): Remove set_general_process
call.

6 years agoremote: remote_arch_state pointers -> remote_arch_state objects
Pedro Alves [Tue, 22 May 2018 17:22:08 +0000 (18:22 +0100)]
remote: remote_arch_state pointers -> remote_arch_state objects

The previous patch made the map store pointers to remote_arch_state
instead of objects directly, simply because struct remote_arch_state
is still incomplete where struct remote_state is declared.  This patch
thus moves the remote_arch_state declaration higher up in the file,
and makes the map store remote_arch_state objects directly instead of
pointers to objects.

gdb/ChangeLog:
2018-05-22  Pedro Alves  <palves@redhat.com>

* remote.c (struct packet_reg, struct remote_arch_state):
Move higher up in the file.
(remote_state) <m_arch_states>: Store remote_arch_state values
instead of remote_arch_state pointers.
(remote_state::get_remote_arch_state): Adjust.

6 years agoremote: multiple remote_arch_state instances per arch
Pedro Alves [Tue, 22 May 2018 17:22:08 +0000 (18:22 +0100)]
remote: multiple remote_arch_state instances per arch

Currently, we associate gdbarch-related remote protocol state on a
per-gdbarch data object.  Things like the size of the g/G packet, and
the max remote packet size.  If we'll support being connected to
different remote servers at the same time, then we need to cope with
each having their own packet sizes, even if they are each debugging
programs of the same architecture.  I.e., a single instance of
remote_arch_state per arch is not sufficient.

This patch moves the remote_arch_state object to a map of
gdbarch-to-remote_arch_state saved in the remote_state structure.
Usually there will only be one entry in the map, though we may see
more with stubs that support multi-process and/or archs with multiple
ABIs (e.g, one remote_arch_state for 64-bit inferiors and another for
32-bit inferiors).

gdb/ChangeLog:
2018-05-22  Pedro Alves  <palves@redhat.com>

* remote.c: Include <unordered_map>.
(remote_state): Now a class.
(remote_state) <get_remote_arch_state>: Declare method.
<get_remote_arch_state>: New field.
(remote_arch_state) <remote_arch_state>: Declare ctor.
<regs>: Now a unique_ptr.
(remote_gdbarch_data_handle): Delete.
(get_remote_arch_state): Delete.
(remote_state::get_remote_arch_state): New.
(get_remote_state): Adjust to call remote_state's
get_remote_arch_state method.
(init_remote_state): Delete, bits factored out to ...
(remote_arch_state::remote_arch_state): ... this new method.
(get_remote_packet_size, get_memory_packet_size)
(process_g_packet, remote_target::fetch_registers)
(remote_target::prepare_to_store, store_registers_using_G)
(remote_target::store_registers, remote_target::get_trace_status):
Adjust to call remote_state's method.
(_initialize_remote): Remove reference to
remote_gdbarch_data_handle.