external/binutils.git
6 years agoFix syntax error in AArch64 default linker scripts when invoked with -shared.
Nick Clifton [Tue, 12 Jun 2018 11:45:49 +0000 (12:45 +0100)]
Fix syntax error in AArch64 default linker scripts when invoked with -shared.

* emulparams/aarch64elf.sh (OTHER_BSS_END_SYMBOLS): Make the
definition of the __bss_end__ symbol conditional upon CREATE_SHLIB.

6 years agoRename some functions, index -> gdb_index
Simon Marchi [Tue, 12 Jun 2018 01:51:25 +0000 (21:51 -0400)]
Rename some functions, index -> gdb_index

Since we now have two index formats, DWARF5/debug_names and gdb_index, I
wanted to rename some functions to make it clear that they deal with the
gdb_index format specifically.

gdb/ChangeLog:

* dwarf2read.c (read_index_from_section): Rename to...
(read_gdb_index_from_section): ... this, update all callers.
(dwarf2_read_index): Rename to...
(dwarf2_read_gdb_index): ... this, update all callers.

6 years agoFix gdb build on hppa-linux
John David Anglin [Tue, 12 Jun 2018 01:15:32 +0000 (21:15 -0400)]
Fix gdb build on hppa-linux

Fixes:

  CXX    hppa-linux-nat.o
../../src/gdb/hppa-linux-nat.c:277:17: error: no 'void hppa_linux_nat_target::fetch_inferior_registers(regcache*, int)' member function declared in class 'hppa_linux_nat_target'
        int regno)
                 ^
../../src/gdb/hppa-linux-nat.c:224:1: error: 'void fetch_register(regcache*, int)' defined but not used [-Werror=unused-function]
 fetch_register (struct regcache *regcache, int regno)
 ^~~~~~~~~~~~~~

gdb/ChangeLog:

* gdb/hppa-linux-nat.c
(hppa_linux_nat_target::fetch_inferior_registers): Rename to
hppa_linux_nat_target::fetch_registers.

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 12 Jun 2018 00:00:49 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoFix build of GDB documentation.
Eli Zaretskii [Mon, 11 Jun 2018 17:30:11 +0000 (20:30 +0300)]
Fix build of GDB documentation.

gdb/doc/ChangeLog
2018-06-11  Eli Zaretskii  <eliz@gnu.org>

* gdb.texinfo (Maintenance Commands): Add a missing @anchor.

6 years agoMIPS/GAS: Correct `-O0' and `-O' option help, add `-O1' and `-O2'
Maciej W. Rozycki [Mon, 11 Jun 2018 14:27:42 +0000 (15:27 +0100)]
MIPS/GAS: Correct `-O0' and `-O' option help, add `-O1' and `-O2'

Match commit 4ffff32f75b1 ("Match mips_optimize to the -O option
supplied") and adjust `--help' output for `-O0', `-O', `-O1' and `-O2'
options.

gas/
* config/tc-mips.c (md_show_usage): Correct help text for `-O0'
and `-O'.  Mention `-O1'.  Add `-O2' and its description.

6 years agoEnable Aarch64 SVE for gdbserver
Alan Hayward [Mon, 11 Jun 2018 09:32:52 +0000 (10:32 +0100)]
Enable Aarch64 SVE for gdbserver

gdbserver/
* linux-aarch64-ipa.c (get_ipa_tdesc): Add null VQ param.
(initialize_low_tracepoint): Likewise
* linux-aarch64-low.c (aarch64_arch_setup): Get VQ.
* linux-aarch64-tdesc-selftest.c (aarch64_tdesc_test): Add null VQ
param.
* linux-aarch64-tdesc.c (aarch64_linux_read_description): Add VQ
checks.
* linux-aarch64-tdesc.h (aarch64_linux_read_description): Add VQ.

6 years agoUpdated Spanish translations for the binutils/ and ld/ subdirectories.
Nick Clifton [Mon, 11 Jun 2018 09:51:16 +0000 (10:51 +0100)]
Updated Spanish translations for the binutils/ and ld/ subdirectories.

* po/es.po: Updated Spanish translation.

6 years agoIncrease gdbsever PBUFSIZ
Alan Hayward [Mon, 11 Jun 2018 09:29:20 +0000 (10:29 +0100)]
Increase gdbsever PBUFSIZ

PBUFSIZ is no longer big enough for SVE. Increase accordingly.

gdbserver/
            * server.h (PBUFSIZ): Increase size

6 years agoAdd Aarch64 SVE dwarf regnums
Alan Hayward [Mon, 11 Jun 2018 09:24:20 +0000 (10:24 +0100)]
Add Aarch64 SVE dwarf regnums

This is as per the spec:
https://developer.arm.com/products/architecture/a-profile/docs/100985/0000

gdb/
* aarch64-tdep.c (aarch64_dwarf_reg_to_regnum): Add mappings.
* aarch64-tdep.h (AARCH64_DWARF_SVE_VG): Add define.
(AARCH64_DWARF_SVE_FFR): Likewise.
(AARCH64_DWARF_SVE_P0): Likewise.
(AARCH64_DWARF_SVE_Z0): Likewise.

6 years agoAdd regcache raw_compare method
Alan Hayward [Mon, 11 Jun 2018 09:09:30 +0000 (10:09 +0100)]
Add regcache raw_compare method

gdb/
* common/common-regcache.h (raw_compare): New function.
* regcache.c (regcache::raw_compare): Likewise.
* regcache.h (regcache::raw_compare): New declaration.

gdbserver/
* regcache.c (regcache::raw_compare): New function.
* regcache.h (regcache::raw_compare): New declaration.

6 years agoAdd reg_buffer_common
Alan Hayward [Mon, 11 Jun 2018 09:09:16 +0000 (10:09 +0100)]
Add reg_buffer_common

A purely virtual class containing functions from gdb/regcache.h

Both the gdb regcache structures and gdbserver regcache inherit
directly from reg_buffer_common. This will allow for common
functions which require the use of a regcache.

gdb/
* common/common-regcache.h (reg_buffer_common): New structure.
* regcache.c (reg_buffer::invalidate): Move from detached_regcache.
(reg_buffer::raw_supply): Likewise.
(reg_buffer::raw_supply_integer): Likewise.
(reg_buffer::raw_supply_zeroed): Likewise.
(reg_buffer::raw_collect): Likewise.
(reg_buffer::raw_collect_integer): Likewise.
* regcache.h (reg_buffer::invalidate): Move from detached_regcache.
(reg_buffer::raw_supply): Likewise.
(reg_buffer::raw_supply_integer): Likewise.
(reg_buffer::raw_supply_zeroed): Likewise.
(reg_buffer::raw_collect): Likewise.
(reg_buffer::raw_collect_integer): Likewise.

gdbserver/
* regcache.c (new_register_cache): Use new.
(free_register_cache): Use delete.
(register_data): Use const.
(supply_register): Move body inside regcache.
(regcache::raw_supply): New override function.
(collect_register): Move body inside regcache.
(regcache::raw_collect): New override function.
(regcache::get_register_status): New override function.
* regcache.h (struct regcache): Inherit from reg_buffer_common.

6 years agoRemove use of queue from remote.c
Tom Tromey [Thu, 7 Jun 2018 12:26:55 +0000 (06:26 -0600)]
Remove use of queue from remote.c

This removes a use of the queue data structure (common/queue.h) from
remote.c.

The queue is replaced with a std::vector.  A queue was not needed, as
the code never de-queued items.

This removes quite a bit of boilerplate code, mostly involved with
marshalling arguments to be passed through the queue iterator.

Tested by the buildbot.

gdb/ChangeLog
2018-06-10  Tom Tromey  <tom@tromey.com>

* remote.c (stop_reply_p): Remove typedef.  Don't declare queue.
(class remote_state) <stop_reply_queue>: Now std::vector.
(remote_state::~remote_state)
(remote_target::stop_reply_queue_length): Update.
(struct queue_iter_param, remove_child_of_pending_fork)
(struct check_pending_event_prevents_wildcard_vcont_callback_data)
(check_pending_event_prevents_wildcard_vcont_callback)
(remove_stop_reply_for_inferior)
(remove_stop_reply_of_remote_state)
(remote_notif_remove_once_on_match)
(stop_reply_match_ptid_and_ws)
(remote_kill_child_of_pending_fork): Remove.
(remote_target::remove_new_fork_children)
(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)
(remote_target::queued_stop_reply)
(remote_target::push_stop_reply, remote_target::peek_stop_reply)
(remote_target::wait, remote_target::kill_new_fork_children)
(remote_target::async): Update.

6 years agoRemove cleanups from record-full.c
Tom Tromey [Thu, 7 Jun 2018 21:56:37 +0000 (15:56 -0600)]
Remove cleanups from record-full.c

This removes cleanups from record-full.c.  In this case, the cleanups
were only ever run when an exception was thrown.  So, I replaced these
with try/catch, rather than introduce a new specialized RAII type.

Tested by the buildbot.

gdb/ChangeLog
2018-06-10  Tom Tromey  <tom@tromey.com>

* record-full.c (record_full_arch_list_cleanups): Remove.
(record_full_message): Use try/catch.
(record_full_wait_cleanups): Remove.
(record_full_wait_1): Use try/catch.
(record_full_restore): Likewise.

6 years agoRemove a VEC from record-full.c
Tom Tromey [Thu, 7 Jun 2018 23:22:49 +0000 (17:22 -0600)]
Remove a VEC from record-full.c

This replaces a VEC in record-full.c with a std::vector.  This version
of the patch also catches a memory leak in the original code noticed
by Simon.

Tested by the buildbot.

gdb/ChangeLog
2018-06-10  Tom Tromey  <tom@tromey.com>

* record-full.c (record_full_breakpoint_p): Remove typedef.  Don't
declare VEC.  Add constructor.
<in_target_beneath>: Now bool.
(record_full_breakpoints): Now a std::vector, static.
(record_full_sync_record_breakpoints)
(record_full_init_record_breakpoints)
(record_full_target::insert_breakpoint)
(record_full_target::remove_breakpoint): Update.  Don't use XNEW.

6 years agoRemove more "struct" keywords in range-based for loops
Simon Marchi [Mon, 11 Jun 2018 02:33:37 +0000 (22:33 -0400)]
Remove more "struct" keywords in range-based for loops

GCC 6.3.0 produces this kind of errors:

  CXX    dwarf2read.o
/home/simark/src/binutils-gdb/gdb/dwarf2read.c: In function 'void process_cu_includes(dwarf2_per_objfile*)':
/home/simark/src/binutils-gdb/gdb/dwarf2read.c:10220:8: error: types may not be defined in a for-range-declaration [-Werror]
   for (struct dwarf2_per_cu_data *iter : dwarf2_per_objfile->just_read_cus)
        ^~~~~~

Removing the struct keyword makes it happy.

gdb/ChangeLog:

* dwarf2read.c (process_cu_includes): Remove struct keyword.
* serial.c (serial_interface_lookup): Remove struct keyword.

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 11 Jun 2018 00:01:03 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years agoFix some missed "beneath" conversions
Tom Tromey [Sun, 10 Jun 2018 14:24:04 +0000 (08:24 -0600)]
Fix some missed "beneath" conversions

The buildbot pointed out that arm-linux-nat.c was not properly using
"beneath" as a method.  A search showed a few more places with this
issue.

Tested by the buildbot, though of course this only checked
arm-linux-nat.c.  Nevertheless I'm checking this in under the obvious
rule.

gdb/ChangeLog
2018-06-10  Tom Tromey  <tom@tromey.com>

* procfs.c (procfs_target::xfer_partial): Use "beneath" as a
method.
* nto-procfs.c (nto_procfs_target::xfer_partial): Use "beneath" as
a method.
* go32-nat.c (go32_nat_target::xfer_partial): Use "beneath" as a
method.
* arm-linux-nat.c (arm_linux_nat_target::read_description): Use
"beneath" as a method.
* arm-fbsd-nat.c (arm_fbsd_nat_target::read_description):
Use "beneath" as a method.

6 years agoRemove cleanups from tracefile.c
Tom Tromey [Thu, 7 Jun 2018 22:06:41 +0000 (16:06 -0600)]
Remove cleanups from tracefile.c

This removes cleanups from tracefile.c, by introducing a unique_ptr
specialization.

This code could be made even simpler via a deeper C++-ification, but I
have not attempted that.

Tested by the buildbot.

gdb/ChangeLog
2018-06-10  Tom Tromey  <tom@tromey.com>

* tracefile.c (struct trace_file_writer_deleter): New.
<operator()>: Rename from trace_file_writer_xfree.
(trace_file_writer_up): New typedef.
(tsave_command, trace_save_tfile, trace_save_ctf): Update.

6 years agoUse std::unique_ptr in reg_buffer
Simon Marchi [Sun, 10 Jun 2018 02:30:34 +0000 (22:30 -0400)]
Use std::unique_ptr in reg_buffer

Using std::unique_ptr allows to remove the manual xfree in the
destructor.

If I understand correctly, using the () after the new operator will make
sure the allocated objects will be value initialized, which for scalars
means they are zero-initialized.  So it should have the same behavior as
XCNEWVEC.

gdb/ChangeLog:

* regcache.h (reg_buffer) <~reg_buffer>: Use default destructor.
<m_registers, m_register_status>: Change type to
std::unique_ptr.
* regcache.c (reg_buffer::reg_buffer): Use new instead of
XCNEWVEC.

6 years agoChange type of reg_buffer::m_register_status to register_status
Simon Marchi [Sun, 10 Jun 2018 02:08:06 +0000 (22:08 -0400)]
Change type of reg_buffer::m_register_status to register_status

The type of reg_buffer::m_register_status is an array of signed char,
probably to ensure that each element takes up only one byte.  Instead,
since we use C++11, we can force the underlying type of register_status
to be signed char and use the enum type.

gdb/ChangeLog:

* common/common-regcache.h (enum register_status): Add
underlying type "signed char".
* regcache.h (reg_buffer) <m_register_status>: Change type to
register_status *.
* regcache.c (reg_buffer::reg_buffer): Alocate arrays of
register_status instead of signed char.
(reg_buffer::save): Use REG_UNKNOWN instead of 0.
(reg_buffer::get_register_status): Remove cast.
(readable_regcache::raw_read): Remove cast.
(readable_regcache::cooked_read): Remove cast.

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 10 Jun 2018 00:01:24 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years agoRemove use of queue.h from gdbserver/event-loop.c
Tom Tromey [Thu, 7 Jun 2018 22:28:22 +0000 (16:28 -0600)]
Remove use of queue.h from gdbserver/event-loop.c

This removes a use of queue.h from gdbserver/event-loop.c, replacing
it with std::queue.

I was not completely sure whether std::queue is even that useful.
Perhaps plain std::list could be used just as easily.

Tested by the buildbot.

gdb/gdbserver/ChangeLog
2018-06-09  Tom Tromey  <tom@tromey.com>

* event-loop.c (gdb_event, gdb_event_p): Remove typedefs.  Don't
declare queue.
(event_queue): Use std::queue.
(gdb_event_xfree): Remove.
(initialize_event_loop, process_event, wait_for_event): Update.

6 years agoRemove two more uses of make_cleanup_close
Tom Tromey [Thu, 7 Jun 2018 22:20:12 +0000 (16:20 -0600)]
Remove two more uses of make_cleanup_close

This removes two more uses of make_cleanup_close, replacing them with
relatively straightforward uses of scoped_fd.

Tested by the buildbot.

gdb/ChangeLog
2018-06-09  Tom Tromey  <tom@tromey.com>

* source.c (reverse_search_command, forward_search_command): Use
scoped_fd.

6 years agoRemove a VEC from serial.c
Tom Tromey [Thu, 7 Jun 2018 23:25:41 +0000 (17:25 -0600)]
Remove a VEC from serial.c

This replaces a VEC in serial.c with a std::vector.

Tested by the buildbot.

gdb/ChangeLog
2018-06-09  Tom Tromey  <tom@tromey.com>

* serial.c (serial_ops_p): Remove typedef.  Don't declare VEC.
(serial_ops_list): Now static, std::vector.
(serial_interface_lookup, serial_add_interface): Update.

6 years agoRemove a VEC from dwarf2read.c
Tom Tromey [Fri, 8 Jun 2018 04:11:47 +0000 (22:11 -0600)]
Remove a VEC from dwarf2read.c

This removes a VEC from dwarf2read.c, replacing it with a std::vector.

Tested by the buildbot.

gdb/ChangeLog
2018-06-09  Tom Tromey  <tom@tromey.com>

* dwarf2read.c (process_cu_includes): Update.
(process_full_comp_unit): Update.
* dwarf2read.h (struct dwarf2_per_objfile) <just_read_cus>: Now a
std::vector.

6 years agoMIPS/LD/testsuite: Add microMIPS lazy binding stub tests
Maciej W. Rozycki [Sat, 9 Jun 2018 00:09:23 +0000 (01:09 +0100)]
MIPS/LD/testsuite: Add microMIPS lazy binding stub tests

Adapt the existing regular MIPS lazy binding stub tests for microMIPS
code verification.  Check both regular and `--insn32' variants.

Correct indentation issues in the conditional updated.

ld/
* testsuite/ld-mips-elf/stub-dynsym-micromips-1-7fff.d: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-1-8000.d: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-1-fff0.d: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-1-10000.d: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-1-2fe80.d: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-1-7fff.d:
New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-1-8000.d:
New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-1-fff0.d:
New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-1-10000.d:
New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-1-2fe80.d:
New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.  Fix
indentation.

6 years agoMIPS/LD/testsuite: Fix lazy binding stub test symbol count comment
Maciej W. Rozycki [Sat, 9 Jun 2018 00:09:23 +0000 (01:09 +0100)]
MIPS/LD/testsuite: Fix lazy binding stub test symbol count comment

Update the symbol count in the comment associated with lazy binding stub
tests to match `base_syms', complementing commit 889acb80acd5
("MIPS/Linux/LD/testsuite: Linker script _gp scope updates"),
<https://sourceware.org/ml/binutils/2012-08/msg00066.html>, and commit
2f9efdfcdbf1 ("mips/bfd/ld: Fix --as-needed on mips and update related
ld tests"), <https://sourceware.org/ml/binutils/2013-09/msg00131.html>.

ld/
* testsuite/ld-mips-elf/mips-elf.exp: Update symbol count in the
comment associated with lazy binding stub tests.

6 years agoMIPS/LD: Add missing `mips-*-windiss' target emulation dependency
Maciej W. Rozycki [Sat, 9 Jun 2018 00:09:22 +0000 (01:09 +0100)]
MIPS/LD: Add missing `mips-*-windiss' target emulation dependency

As from commit 2ebd05b80b22 ("MIPS/LD: Correct `mips-*-windiss' target
emulation configuration") we have:

EXTRA_EM_FILE=mipself

in `emulparams/elf32mipswindiss.sh', however no corresponding Makefile
`mipself.em' dependency for `eelf32mipswindiss.c'.  Add it.

ld/
* Makefile.am (eelf32mipswindiss.c): Add `mipself.em' dependency.
* Makefile.in: Regenerate.

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 9 Jun 2018 00:00:45 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAdd missing client_state struct references to win target.
Stan Cox [Fri, 8 Jun 2018 20:40:52 +0000 (16:40 -0400)]
Add missing client_state struct references to win target.

gdbserver/ChangeLog
* win32-low.c (win32_create_inferior):  last_ptid and last_status
moved to client_state.

6 years agoMake gdbreplay use more common routines
Pedro Alves [Fri, 8 Jun 2018 19:48:28 +0000 (20:48 +0100)]
Make gdbreplay use more common routines

This makes gdbreplay share a bit more code with gdbserver, and paves
the way to share more in future.  Including common-defs.h pulls in
defines and headers that gdb and gdbserver assume are always
defined/available too, such as for example _(), ansidecl.h or a set of
system headers.  Including that revealed (static vs extern conflict)
gdbreplay had a local copy of perror_with_name (which exited directly
instead of throwing an error).  So I removed gdbreplay's local copy,
and then added enough .o files until gdbreplay linked successfully.

Also, use xstrdup instead of strdup.

gdb/gdbserver/ChangeLog:
2018-06-08  Pedro Alves  <palves@redhat.com>

* Makefile.in (GDBREPLAY_OBS): Add common/cleanups.o,
common/common-exceptions.o, common/common-utils.o,
common/errors.o, common/print-utils.o and utils.o.
* gdbreplay.c: Include "common-defs.h" instead of the two
'config.h's here.  Don't include stdio.h, errno.h, stdlib.h,
string.h or alloca.h.
(perror_with_name): Delete.
(remote_open): Use xstrdup instead of strdup.
(main): Rename to ...
(captured_main): ... this.
(main): New.

6 years agold/x86: Remove hidden _edata, __bss_start, and _end
H.J. Lu [Fri, 8 Jun 2018 19:41:31 +0000 (12:41 -0700)]
ld/x86: Remove hidden _edata, __bss_start, and _end

There is no need to put hidden _edata, __bss_start, and _end in dynamic
symbol table in shared libraries.

bfd/

PR ld/23161
* elfxx-x86.c (elf_x86_hide_linker_defined): New function.
(_bfd_x86_elf_link_check_relocs): Use it to hide hidden
__bss_start, _end and _edata in shared libraries.

ld/

PR ld/23161
* testsuite/ld-elf/pr23161d.rd: Remove local _edata, __bss_start,
and _end from dynamic symbol table.

6 years agoFix build issue with Python 3.7
Paul Koning [Fri, 8 Jun 2018 17:26:36 +0000 (13:26 -0400)]
Fix build issue with Python 3.7

Originally reported in
https://bugzilla.redhat.com/show_bug.cgi?id=1577396 -- gdb build fails
with Python 3.7 due to references to a Python internal function whose
declaration changed in 3.7.

gdb/ChangeLog
2018-06-08  Paul Koning  <paul_koning@dell.com>

    PR gdb/23252

    * python/python.c (do_start_initialization):
    Avoid call to internal Python API.
    (init__gdb_module): New function.

6 years agolinux: Add maintenance commands to test libthread_db
Gary Benson [Fri, 8 Jun 2018 17:06:46 +0000 (18:06 +0100)]
linux: Add maintenance commands to test libthread_db

This commit adds two new commands which may be used to test thread
debugging libraries used by GDB:

  * "maint check libthread-db" tests the thread debugging library GDB
     is using for the current inferior.

  * "maint set/show check-libthread-db" selects whether libthread_db
     tests should be run automatically as libthread_db is auto-loaded.
     The default is to not run tests automatically.

The test itself is a basic integrity check exercising all libthread_db
functions used by GDB on GNU/Linux systems.  By extension this also
exercises the proc_service functions provided by GDB that libthread_db
uses.

This functionality is useful for NPTL developers and libthread_db
developers.  It could also prove useful investigating bugs reported
against GDB where the thread debugging library or GDB's proc_service
layer is suspect.

gdb/ChangeLog:

* linux-thread-db.c (valprint.h): New include.
(struct check_thread_db_info): New structure.
(check_thread_db_on_load, tdb_testinfo): New static globals.
(check_thread_db, check_thread_db_callback): New functions.
(try_thread_db_load_1): Run integrity checks if requested.
(maintenance_check_libthread_db): New function.
(_initialize_thread_db): Register "maint check libthread-db"
and "maint set/show check-libthread-db".
* NEWS: Mention the above new commands.

gdb/doc/ChangeLog:

* gdb.texinfo (Maintenance Commands): Document "maint check
libthread-db" and "maint set/show check-libthread-db".

gdb/testsuite/ChangeLog:

* gdb.threads/check-libthread-db.exp: New file.
* gdb.threads/check-libthread-db.c: Likewise.

6 years agoFix gdb mingw build
Tom Tromey [Fri, 8 Jun 2018 16:06:43 +0000 (10:06 -0600)]
Fix gdb mingw build

I noticed that the mingw build was failing in the buildbot.  This
patch fixes the problem.  I'm checking it in as obvious.

gdb/ChangeLog
2018-06-08  Tom Tromey  <tom@tromey.com>

* windows-nat.c (windows_nat_target::xfer_partial): "beneath" is
now a method.

6 years ago[arm][gas] Add support for Arm Cortex-A76
kyrtka01 [Fri, 8 Jun 2018 14:40:39 +0000 (15:40 +0100)]
[arm][gas] Add support for Arm Cortex-A76

This patch adds support to gas for -mcpu=cortex-a76 in the usual way.
make check-gas passes without problems.

2018-06-08  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    * config/tc-arm.c (arm_cpus): Add Cortex-A76 entry.
    * doc/c-arm.texi (-mcpu): Document cortex-a76.

6 years ago[AArch64][gas] Add support for Arm Cortex-A76
kyrtka01 [Fri, 8 Jun 2018 14:39:47 +0000 (15:39 +0100)]
[AArch64][gas] Add support for Arm Cortex-A76

This patch adds support to gas for -mcpu=cortex-a76 in the usual way.
make check-gas passes without problems.

2018-06-08  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    * config/tc-aarch64.c (aarch64_cpus): Add Cortex-A76 entry.
    * doc/c-aarch64.texi (-mcpu): Document cortex-a76.

6 years agoRemove last cleanup from btrace code
Tom Tromey [Thu, 7 Jun 2018 21:38:25 +0000 (15:38 -0600)]
Remove last cleanup from btrace code

This removes the last cleanup from btrace.c, replacing it with a use
of unique_xmalloc_ptr.

gdb/ChangeLog
2018-06-08  Tom Tromey  <tom@tromey.com>

* btrace.c (parse_xml_raw): Use gdb::unique_xmalloc_ptr.

6 years agoRemove cleanups from btrace code
Tom Tromey [Thu, 7 Jun 2018 21:34:36 +0000 (15:34 -0600)]
Remove cleanups from btrace code

This removes some cleanups from the btrace code by minorly C++-ifying
struct btrace_data.

gdb/ChangeLog
2018-06-08  Tom Tromey  <tom@tromey.com>

* common/btrace-common.h (struct btrace_data): Add constructor,
destructor, move assignment operator.
<empty, clear, fini>: New methods.
<format>: Initialize.
(btrace_data_init, btrace_data_fini, btrace_data_clear)
(btrace_data_empty): Don't declare.
* common/btrace-common.c (btrace_data_init): Remove.
(btrace_data::fini): Rename from btrace_data_fini.
(btrace_data::empty): Rename from btrace_data_empty.
(btrace_data::clear): Rename from btrace_data_clear.  Return
bool.
* btrace.h (make_cleanup_btrace_data): Don't declare.
* btrace.c (btrace_add_pc, btrace_stitch_trace, btrace_clear)
(parse_xml_btrace): Update.
(do_btrace_data_cleanup, make_cleanup_btrace_data): Remove.
(maint_btrace_clear_packet_history_cmd): Update.

gdb/gdbserver/ChangeLog
2018-06-08  Tom Tromey  <tom@tromey.com>

* linux-low.c (linux_low_read_btrace): Update.

6 years agoPrevent undefined FMOV instructions being accepted by the AArch64 assembler.
Egeyar Bagcioglu [Fri, 8 Jun 2018 13:02:52 +0000 (14:02 +0100)]
Prevent undefined FMOV instructions being accepted by the AArch64 assembler.

    Detect illegal FMOV instructions that changes the size from 32 bits to 64
    bits and vice versa. Add tests for these and other undefined FMOV
    instructions.

        PR 20319
gas     * testsuite/gas/aarch64/illegal-3.s: Test if unallocated FMOV encodings
        are detected as undefined.
        * testsuite/gas/aarch64/illegal-3.d: Likewise.
        * testsuite/gas/aarch64/illegal.s: Test if FMOV instructions that are
        changing the size from 32 bits to 64 bits and vice versa trigger an
        error.
        * testsuite/gas/aarch64/illegal.l: Likewise.

opcodes * aarch64-tbl.h: Introduce QL_INT2FP_FMOV and QL_FP2INT_FMOV.
        (aarch64_opcode_table) : Use QL_INT2FP_FMOV and QL_FP2INT_FMOV.

6 years agoDefine various symbols conditionally in shared libraries
Alan Modra [Fri, 8 Jun 2018 10:47:34 +0000 (20:17 +0930)]
Define various symbols conditionally in shared libraries

The values of symbols in shared libraries like _end, _edata, and
__bss_start are generally not that useful outside of the shared
library.  This patch defines them conditionally with PROVIDE, since a
shared library might need the local value.  An example is glibc ld.so
local access to "_begin", "_etext" and "_end".  (ld.so gains access to
the local values by making the references using hidden visibility.
That makes the definitions hidden too.)

We can't use PROVIDE_HIDDEN in the linker scripts because the shared
library might need the value of the symbol in the executable.  An
example is freebsd libc dynamic access to "_end".

PR ld/23161
* emulparams/aarch64cloudabi.sh: PROVIDE __bss_start__, _bss_end__,
and __end__ in shared libraries.
* emulparams/aarch64fbsd.sh: Likewise.
* emulparams/aarch64linux.sh: Likewise.
* emulparams/aarch64linux32.sh: Likewise.
* emulparams/armelf_fuchsia.sh: Likewise.
* emulparams/armelf_linux.sh: Likewise.
* emulparams/armelf_phoenix.sh: Likewise.
* emulparams/aarch64elf.sh: Likewise, and __data_start
* emulparams/aarch64elf32.sh: Likewise.
* emulparams/armelf.sh: Likewise.
* emulparams/armnto.sh: Likewise.
* emulparams/elf32bmip.sh: Remove duplicate ". = ." from
OTHER_GOT_SYMBOLS.  PROVIDE _ftext, _fdata, and _fbss in shared libs.
* emulparams/elf32bmipn32-defs.sh: Likewise.
* emulparams/elf32frv.sh: PROVIDE __end and __data_start in shared libs.
* emulparams/elf32lriscv-defs.sh: Tidy.
* emulparams/elf32mcore.sh: PROVIDE __bss_start and _bss_end in
shared libs
* emulparams/elf32ppccommon.sh: PROVIDE __end in shared libs.
* emulparams/elf32rl78.sh: Tidy.
* emulparams/i386nto.sh: PROVIDE _btext in shared libs.
* emulparams/shelf_nto.sh: Likewise.
* emulparams/shlelf_nto.sh: Likewise.
* emulparams/score3_elf.sh: PROVIDE _gp, _bss_start__, _bss_end__,
__bss_end__, __end__, _fdata, _sdata_begin, and _bss_start in
shared libs.
* scripttempl/elf.sc: Don't use EXECUTABLE_SYMBOLS for shared
libraries.  PROVIDE _edata, edata, __bss_start, and _end in shared
libraries.
* testsuite/ld-elf/pr23161.map,
* testsuite/ld-elf/pr23161a.c,
* testsuite/ld-elf/pr23161b.c,
* testsuite/ld-elf/pr23161c.c,
* testsuite/ld-elf/pr23161a.rd,
* testsuite/ld-elf/pr23161b.rd,
* testsuite/ld-elf/pr23161c.rd,
* testsuite/ld-elf/pr23161d.rd: New tests.
* testsuite/ld-elf/shared.exp: Run ld/23161 tests.
* testsuite/ld-elf/pr23162.rd,
* testsuite/ld-aarch64/ifunc-1-local.d,
* testsuite/ld-aarch64/ifunc-1.d,
* testsuite/ld-aarch64/ifunc-2-local.d,
* testsuite/ld-aarch64/ifunc-2.d,
* testsuite/ld-aarch64/ifunc-21.d,
* testsuite/ld-aarch64/ifunc-3a.d,
* testsuite/ld-alpha/tlsbin.rd,
* testsuite/ld-alpha/tlsbin.sd,
* testsuite/ld-alpha/tlsbinr.rd,
* testsuite/ld-alpha/tlspic.rd,
* testsuite/ld-alpha/tlspic.sd,
* testsuite/ld-cris/dso-pltdis1.d,
* testsuite/ld-cris/dso-pltdis2.d,
* testsuite/ld-cris/dso12-pltdis.d,
* testsuite/ld-cris/gotplt1.d,
* testsuite/ld-cris/gotplt2.d,
* testsuite/ld-cris/gotplt3.d,
* testsuite/ld-cris/hiddef1.d,
* testsuite/ld-cris/libdso-1.d,
* testsuite/ld-cris/libdso-10.d,
* testsuite/ld-cris/libdso-11.d,
* testsuite/ld-cris/libdso-12.d,
* testsuite/ld-cris/libdso-12b.d,
* testsuite/ld-cris/libdso-12c.d,
* testsuite/ld-cris/libdso-13.d,
* testsuite/ld-cris/libdso-13b.d,
* testsuite/ld-cris/libdso-14.d,
* testsuite/ld-cris/libdso-15.d,
* testsuite/ld-cris/libdso-15b.d,
* testsuite/ld-cris/libdso-1c.d,
* testsuite/ld-cris/libdso-1d.d,
* testsuite/ld-cris/libdso-2.d,
* testsuite/ld-cris/pic-gc-72.d,
* testsuite/ld-cris/pic-gc-73.d,
* testsuite/ld-cris/pr16044.d,
* testsuite/ld-cris/pv32-1.d,
* testsuite/ld-cris/tls-dso-dtpoffd2.d,
* testsuite/ld-cris/tls-dso-dtpoffd4.d,
* testsuite/ld-cris/tls-dso-tpoffgotcomm1.d,
* testsuite/ld-cris/tls-gc-71.d,
* testsuite/ld-cris/tls-gd-1.d,
* testsuite/ld-cris/tls-gd-1h.d,
* testsuite/ld-cris/tls-gd-2.d,
* testsuite/ld-cris/tls-gd-2h.d,
* testsuite/ld-cris/tls-ie-10.d,
* testsuite/ld-cris/tls-ie-11.d,
* testsuite/ld-cris/tls-ie-78.d,
* testsuite/ld-cris/tls-ie-8.d,
* testsuite/ld-cris/tls-ie-9.d,
* testsuite/ld-cris/tls-js1.d,
* testsuite/ld-cris/tls-ld-4.d,
* testsuite/ld-cris/tls-ld-5.d,
* testsuite/ld-cris/tls-ld-6.d,
* testsuite/ld-cris/tls-ld-7.d,
* testsuite/ld-cris/tls-ldgd-14.d,
* testsuite/ld-cris/tls-ldgd-15.d,
* testsuite/ld-cris/tls-ldgdex-14.d,
* testsuite/ld-cris/tls-ldgdex-15.d,
* testsuite/ld-cris/tls-ldgdx-14.d,
* testsuite/ld-cris/tls-ldgdx-15.d,
* testsuite/ld-cris/tls-legdx-16.d,
* testsuite/ld-cris/tls-legdx-17.d,
* testsuite/ld-cris/tls-local-54.d,
* testsuite/ld-cris/tls-local-60.d,
* testsuite/ld-cris/tls-local-61.d,
* testsuite/ld-cris/tls-local-63.d,
* testsuite/ld-cris/tls-local-64.d,
* testsuite/ld-cris/tls-ok-30.d,
* testsuite/ld-cris/tls-ok-32.d,
* testsuite/ld-cris/tls-ok-34.d,
* testsuite/ld-cris/tls-und-38.d,
* testsuite/ld-cris/tls-und-42.d,
* testsuite/ld-cris/tls-und-46.d,
* testsuite/ld-cris/tls-und-50.d,
* testsuite/ld-cris/weakhiddso.d,
* testsuite/ld-cris/weakref2.d,
* testsuite/ld-frv/fdpic-shared-1.d,
* testsuite/ld-frv/fdpic-shared-2.d,
* testsuite/ld-frv/fdpic-shared-3.d,
* testsuite/ld-frv/fdpic-shared-4.d,
* testsuite/ld-frv/fdpic-shared-5.d,
* testsuite/ld-frv/fdpic-shared-7.d,
* testsuite/ld-frv/fdpic-shared-8.d,
* testsuite/ld-frv/tls-dynamic-2.d,
* testsuite/ld-i386/ibt-plt-1.d,
* testsuite/ld-i386/ibt-plt-2a.d,
* testsuite/ld-i386/ibt-plt-2b.d,
* testsuite/ld-i386/ibt-plt-2c.d,
* testsuite/ld-i386/ibt-plt-2d.d,
* testsuite/ld-i386/ibt-plt-3a.d,
* testsuite/ld-i386/ibt-plt-3b.d,
* testsuite/ld-i386/ibt-plt-3c.d,
* testsuite/ld-i386/ibt-plt-3d.d,
* testsuite/ld-i386/plt2.dd,
* testsuite/ld-i386/pr20830.d,
* testsuite/ld-i386/tlsbin-nacl.rd,
* testsuite/ld-i386/tlsbin.rd,
* testsuite/ld-i386/tlsbin2-nacl.rd,
* testsuite/ld-i386/tlsbin2.rd,
* testsuite/ld-i386/tlsbindesc-nacl.rd,
* testsuite/ld-i386/tlsbindesc.rd,
* testsuite/ld-i386/tlsdesc-nacl.rd,
* testsuite/ld-i386/tlsdesc.rd,
* testsuite/ld-i386/tlsgdesc-nacl.rd,
* testsuite/ld-i386/tlsgdesc.rd,
* testsuite/ld-i386/tlsnopic-nacl.rd,
* testsuite/ld-i386/tlsnopic.dd,
* testsuite/ld-i386/tlsnopic.rd,
* testsuite/ld-i386/tlsnopic.sd,
* testsuite/ld-i386/tlspic-nacl.rd,
* testsuite/ld-i386/tlspic.rd,
* testsuite/ld-i386/tlspic2-nacl.rd,
* testsuite/ld-i386/tlspic2.rd,
* testsuite/ld-ia64/merge1.d,
* testsuite/ld-ia64/merge2.d,
* testsuite/ld-ia64/merge3.d,
* testsuite/ld-ia64/merge4.d,
* testsuite/ld-ia64/merge5.d,
* testsuite/ld-ia64/tlsbin.rd,
* testsuite/ld-ia64/tlspic.rd,
* testsuite/ld-ifunc/ifunc-2-i386-now.d,
* testsuite/ld-ifunc/ifunc-2-local-i386-now.d,
* testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d,
* testsuite/ld-ifunc/ifunc-2-local-x86-64.d,
* testsuite/ld-ifunc/ifunc-2-x86-64-now.d,
* testsuite/ld-ifunc/ifunc-2-x86-64.d,
* testsuite/ld-ifunc/pr17154-i386-now.d,
* testsuite/ld-ifunc/pr17154-i386.d,
* testsuite/ld-ifunc/pr17154-x86-64-now.d,
* testsuite/ld-ifunc/pr17154-x86-64.d,
* testsuite/ld-m68k/tls-def-1.d,
* testsuite/ld-m68k/tls-gd-1.d2,
* testsuite/ld-metag/shared.d,
* testsuite/ld-metag/stub_pic_app.d,
* testsuite/ld-mips-elf/rel32-n32.d,
* testsuite/ld-mips-elf/rel32-o32.d,
* testsuite/ld-mips-elf/rel64.d,
* testsuite/ld-powerpc/ambiguousv1.d,
* testsuite/ld-powerpc/ambiguousv1b.d,
* testsuite/ld-powerpc/ambiguousv2.d,
* testsuite/ld-powerpc/ambiguousv2b.d,
* testsuite/ld-powerpc/tlsexe.d,
* testsuite/ld-powerpc/tlsexe.r,
* testsuite/ld-powerpc/tlsexe32.d,
* testsuite/ld-powerpc/tlsexe32.g,
* testsuite/ld-powerpc/tlsexe32.r,
* testsuite/ld-powerpc/tlsexetoc.d,
* testsuite/ld-powerpc/tlsexetoc.r,
* testsuite/ld-powerpc/tlsso.d,
* testsuite/ld-powerpc/tlsso.r,
* testsuite/ld-powerpc/tlsso32.g,
* testsuite/ld-powerpc/tlsso32.r,
* testsuite/ld-powerpc/tlstocso.d,
* testsuite/ld-powerpc/tlstocso.g,
* testsuite/ld-powerpc/tlstocso.r,
* testsuite/ld-s390/gotreloc_31-1.dd,
* testsuite/ld-s390/tlsbin.dd,
* testsuite/ld-s390/tlsbin.rd,
* testsuite/ld-s390/tlsbin_64.dd,
* testsuite/ld-s390/tlsbin_64.rd,
* testsuite/ld-s390/tlspic.rd,
* testsuite/ld-s390/tlspic_64.rd,
* testsuite/ld-sh/tlsbin-2.d,
* testsuite/ld-sh/tlspic-2.d,
* testsuite/ld-sparc/gotop32.rd,
* testsuite/ld-sparc/gotop64.rd,
* testsuite/ld-sparc/tlssunbin32.rd,
* testsuite/ld-sparc/tlssunbin64.rd,
* testsuite/ld-sparc/tlssunnopic32.rd,
* testsuite/ld-sparc/tlssunnopic64.rd,
* testsuite/ld-sparc/tlssunpic32.rd,
* testsuite/ld-sparc/tlssunpic64.rd,
* testsuite/ld-x86-64/bnd-branch-1-now.d,
* testsuite/ld-x86-64/bnd-ifunc-1-now.d,
* testsuite/ld-x86-64/bnd-ifunc-2-now.d,
* testsuite/ld-x86-64/bnd-ifunc-2.d,
* testsuite/ld-x86-64/bnd-plt-1-now.d,
* testsuite/ld-x86-64/bnd-plt-1.d,
* testsuite/ld-x86-64/ibt-plt-1-x32.d,
* testsuite/ld-x86-64/ibt-plt-1.d,
* testsuite/ld-x86-64/ibt-plt-2a-x32.d,
* testsuite/ld-x86-64/ibt-plt-2a.d,
* testsuite/ld-x86-64/ibt-plt-2b-x32.d,
* testsuite/ld-x86-64/ibt-plt-2b.d,
* testsuite/ld-x86-64/ibt-plt-2c-x32.d,
* testsuite/ld-x86-64/ibt-plt-2c.d,
* testsuite/ld-x86-64/ibt-plt-2d-x32.d,
* testsuite/ld-x86-64/ibt-plt-2d.d,
* testsuite/ld-x86-64/ibt-plt-3a-x32.d,
* testsuite/ld-x86-64/ibt-plt-3a.d,
* testsuite/ld-x86-64/ibt-plt-3b-x32.d,
* testsuite/ld-x86-64/ibt-plt-3b.d,
* testsuite/ld-x86-64/ibt-plt-3c-x32.d,
* testsuite/ld-x86-64/ibt-plt-3c.d,
* testsuite/ld-x86-64/ibt-plt-3d-x32.d,
* testsuite/ld-x86-64/ibt-plt-3d.d,
* testsuite/ld-x86-64/ilp32-4-nacl.d,
* testsuite/ld-x86-64/ilp32-4.d,
* testsuite/ld-x86-64/load1c-nacl.d,
* testsuite/ld-x86-64/load1c.d,
* testsuite/ld-x86-64/load1d-nacl.d,
* testsuite/ld-x86-64/load1d.d,
* testsuite/ld-x86-64/mpx3n.dd,
* testsuite/ld-x86-64/mpx4.dd,
* testsuite/ld-x86-64/mpx4n.dd,
* testsuite/ld-x86-64/plt2.dd,
* testsuite/ld-x86-64/pr14207.d,
* testsuite/ld-x86-64/pr19162.d,
* testsuite/ld-x86-64/pr20253-1f.d,
* testsuite/ld-x86-64/pr20253-1l.d,
* testsuite/ld-x86-64/pr20830a-now.d,
* testsuite/ld-x86-64/pr20830a.d,
* testsuite/ld-x86-64/pr20830b-now.d,
* testsuite/ld-x86-64/pr20830b.d,
* testsuite/ld-x86-64/pr21038a-now.d,
* testsuite/ld-x86-64/pr21038a.d,
* testsuite/ld-x86-64/pr21038b-now.d,
* testsuite/ld-x86-64/pr21038b.d,
* testsuite/ld-x86-64/pr21038c-now.d,
* testsuite/ld-x86-64/pr21038c.d,
* testsuite/ld-x86-64/tlsbin-nacl.rd,
* testsuite/ld-x86-64/tlsbin.rd,
* testsuite/ld-x86-64/tlsbin2-nacl.rd,
* testsuite/ld-x86-64/tlsbin2.rd,
* testsuite/ld-x86-64/tlsbindesc-nacl.rd,
* testsuite/ld-x86-64/tlsbindesc.rd,
* testsuite/ld-x86-64/tlsdesc-nacl.rd,
* testsuite/ld-x86-64/tlsdesc.rd,
* testsuite/ld-x86-64/tlsgdesc-nacl.rd,
* testsuite/ld-x86-64/tlsgdesc.rd,
* testsuite/ld-x86-64/tlspic-nacl.rd,
* testsuite/ld-x86-64/tlspic.rd,
* testsuite/ld-x86-64/tlspic2-nacl.rd,
* testsuite/ld-x86-64/tlspic2.rd: Update.

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 8 Jun 2018 00:00:43 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAdd ChangeLog entry for e5a77256e8961294b3ea7d483124834311ca363b
Sergio Durigan Junior [Thu, 7 Jun 2018 18:17:53 +0000 (14:17 -0400)]
Add ChangeLog entry for e5a77256e8961294b3ea7d483124834311ca363b

I forgot to add a ChangeLog entry for my previous commit:

commit e5a77256e8961294b3ea7d483124834311ca363b
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Tue Jun 5 17:55:39 2018 -0400

    Guard declarations of 'sve_{vq,vl}_from_{vl,vq}' macros on Aarch64 (and unbreak build)

This commit fixes that.

6 years agoIntroduce class target_stack
Pedro Alves [Thu, 7 Jun 2018 16:27:48 +0000 (17:27 +0100)]
Introduce class target_stack

Currently, the target stack is represented by a singly linked list,
with target_ops having a pointer to the target beneath.  This poses a
problem for multi-process / multi-target debugging.  In that case, we
will naturally want multiple instances of target stacks.  E.g., one
stack for inferior 1 which is debugging a core file, and another
target stack for inferior 2 which is debugging a remote process.  The
problem then is in finding a target's "beneath" target, if we consider
that for some target_ops types, we'll be sharing a single target_ops
instance between several inferiors.  For example, so far, I found no
need to have multiple instances of the spu_multiarch_target /
exec_target / dummy_target targets.

Thus this patch, which changes the target stack representation to an
array of pointers.  For now, there's still a single global instance of
this new target_stack class, though further down in the multi-target
work, each inferior will have its own instance.

gdb/ChangeLog:
2018-06-07  Pedro Alves  <palves@redhat.com>

* target.h (target_ops) <beneath>: Now a method.  All references
updated.
(class target_stack): New.
* target.c (g_target_stack): New.
(g_current_top_target): Delete.
(current_top_target): Get the top target out of g_target_stack.
(target_stack::push, target_stack::unpush): New.
(push_target, unpush_target): Reimplement.
(target_is_pushed): Reimplement in terms of g_target_stack.
(target_ops::beneath, target_stack::find_beneath): New.

6 years agoEliminate find_target_beneath
Pedro Alves [Thu, 7 Jun 2018 16:27:47 +0000 (17:27 +0100)]
Eliminate find_target_beneath

Call target_ops::beneath() throughout instead.

gdb/ChangeLog:
2018-06-07  Pedro Alves  <palves@redhat.com>

* target.h (find_target_beneath): Delete declaration.
* target.c (find_target_beneath): Delete definition.
* aix-thread.c: All callers of find_target_beneath adjusted to
call target_ops::beneath instead.
* bsd-uthread.c: Likewise.
* linux-thread-db.c: Likewise.
* ravenscar-thread.c: Likewise.
* sol-thread.c: Likewise.
* spu-multiarch.c: Likewise.

6 years agotarget_ops::beneath -> target_ops::beneath()
Pedro Alves [Thu, 7 Jun 2018 16:27:47 +0000 (17:27 +0100)]
target_ops::beneath -> target_ops::beneath()

This changes target_ops::beneath from a pointer to a method, and
adjusts all references throughout.  The idea here is to make it easier
to change the target stack representation from an intrusive singly
linked list to something else without leaking implementation details
throughout.

The commit does not change the representation yet, that will be done
in a following patch.  That is why a new target_ops::m_beneath field
appears here.  That new field isn't really documented properly or made
private, simply because it will be removed shortly.

Note that target_ops::beneath() is essentially the same as the current
find_target_beneath routine.  The following patch will eliminate the
latter.

gdb/ChangeLog:
2018-06-07  Pedro Alves  <palves@redhat.com>

* target.h (target_ops) <beneath>: Now a method.  All references
updated.
(target_ops) <m_beneath>: New.
* target.c (target_ops::beneath): New.
* corelow.c: Adjust all references to target_ops::beneath.
* linux-thread-db.c: Likewise.
* make-target-delegates: Likewise.
* record-btrace.c: Likewise.
* record-full.c: Likewise.
* remote.c: Likewise.
* target.c: Likewise.
* target-delegates.c: Regenerate.

6 years agotarget_stack -> current_top_target() throughout
Pedro Alves [Thu, 7 Jun 2018 16:27:46 +0000 (17:27 +0100)]
target_stack -> current_top_target() throughout

The recent C++ification of target_ops replaced references to the old
"current_target" squashed target throughout with references to a
"target_stack" pointer.  I had picked the "target_stack" name very
early in the multi-target work, and managed to stick with it, even
though it's a bit of a misnomer, since it isn't really a "target
stack" object, but a pointer into the current top target in the stack.
As I'm splitting more pieces off of the multi-target branch, I've come
to think that it's better to rename it now.  A following patch will
introduce a new class to represent a target stack, and "target_stack"
would be _its_ ideal name.  (In the branch, the class is called
a_target_stack to work around the clash.)

Thus this commit renames target_stack to current_top_target and
replaces all references throughout.  Also, while at it,
current_top_target is made a function instead of a pointer, to make it
possible to change its internal implementation without leaking
implementation details out.  In a couple patches, the implementation
of the function will change to refer to a target stack object, and
then further down the multi-target work, it'll change again to find
the right target stack for the current inferior.

gdb/ChangeLog:
2018-06-07  Pedro Alves  <palves@redhat.com>

* target.h (target_stack): Delete.
(current_top_target): Declare function.
* target.c (target_stack): Delete.
(g_current_top_target): New.
(current_top_target): New function.
* auxv.c: Use current_top_target instead of target_stack
throughout.
* avr-tdep.c: Likewise.
* breakpoint.c: Likewise.
* corefile.c: Likewise.
* elfread.c: Likewise.
* eval.c: Likewise.
* exceptions.c: Likewise.
* frame.c: Likewise.
* gdbarch-selftests.c: Likewise.
* gnu-v3-abi.c: Likewise.
* ia64-tdep.c: Likewise.
* ia64-vms-tdep.c: Likewise.
* infcall.c: Likewise.
* infcmd.c: Likewise.
* infrun.c: Likewise.
* linespec.c: Likewise.
* linux-tdep.c: Likewise.
* minsyms.c: Likewise.
* ppc-linux-nat.c: Likewise.
* ppc-linux-tdep.c: Likewise.
* procfs.c: Likewise.
* regcache.c: Likewise.
* remote.c: Likewise.
* rs6000-tdep.c: Likewise.
* s390-linux-nat.c: Likewise.
* s390-tdep.c: Likewise.
* solib-aix.c: Likewise.
* solib-darwin.c: Likewise.
* solib-dsbt.c: Likewise.
* solib-spu.c: Likewise.
* solib-svr4.c: Likewise.
* solib-target.c: Likewise.
* sparc-tdep.c: Likewise.
* sparc64-tdep.c: Likewise.
* spu-tdep.c: Likewise.
* symfile.c: Likewise.
* symtab.c: Likewise.
* target-descriptions.c: Likewise.
* target-memory.c: Likewise.
* target.c: Likewise.
* target.h: Likewise.
* tracefile-tfile.c: Likewise.
* tracepoint.c: Likewise.
* valops.c: Likewise.
* valprint.c: Likewise.
* value.c: Likewise.
* windows-tdep.c: Likewise.
* mi/mi-main.c: Likewise.

6 years agoChange build_address_symbolic to return std::string
Tom Tromey [Sat, 5 May 2018 16:24:54 +0000 (10:24 -0600)]
Change build_address_symbolic to return std::string

This changes two out parameters of build_address_symbolic to be
std::string, and updates the callers.  This allows removing some
cleanups.

This patch also moves the declaration of build_address_symbolic out of
defs.h.  I think that many things in defs.h should be elsewhere
instead.  In this case, I moved the declaration to valprint.h, becuase
there is no "printcmd.h" -- but perhaps it would be better to
introduce that instead.

Tested by the buildbot.

gdb/ChangeLog
2018-06-07  Tom Tromey  <tom@tromey.com>

* valprint.h (build_address_symbolic): Declare.
* printcmd.c (print_address_symbolic): Update.
(build_address_symbolic): Change "name" and "filename" to
std::string.
* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
Update.
* defs.h (build_address_symbolic): Remove declaration.

6 years agoFix AArch64 unintialized variable which can cause diagnostic failures.
Tamar Christina [Thu, 7 Jun 2018 10:53:13 +0000 (11:53 +0100)]
Fix AArch64 unintialized variable which can cause diagnostic failures.

This patch fixes an uninitialized memory issue that can under certain
circumstances turn an error into a warning because non_fatal was not initialised
in all cases.

Verified using valgrind.

gas/config/tc-aarch64.c

PR binutils/21446
* tc-aarch64.c (record_operand_error, record_operand_error_with_data):
  Initialize non_fatal.

6 years agoAarch64 SVE pseudo register support
Alan Hayward [Thu, 19 Oct 2017 15:35:35 +0000 (16:35 +0100)]
Aarch64 SVE pseudo register support

Add the functionality for reading/writing pseudo registers.

On SVE the V registers are pseudo registers. This is supported
by adding AARCH64_SVE_V0_REGNUM.

* aarch64-tdep.c (AARCH64_SVE_V0_REGNUM): Add define.
(aarch64_vnv_type): Add function.
(aarch64_pseudo_register_name): Add V regs for SVE.
(aarch64_pseudo_register_type): Likewise.
(aarch64_pseudo_register_reggroup_p): Likewise.
(aarch64_pseudo_read_value_2): Use V0 offset for SVE
(aarch64_pseudo_read_value): Add V regs for SVE.
(aarch64_pseudo_write_2): Use V0 offset for SVE
(aarch64_pseudo_write): Add V regs for SVE.
* aarch64-tdep.h (struct gdbarch_tdep): Add vnv_type.

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 7 Jun 2018 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoEXECUTABLE_SYMBOLS -> OTHER_SYMBOLS
Alan Modra [Sat, 2 Jun 2018 09:16:03 +0000 (18:46 +0930)]
EXECUTABLE_SYMBOLS -> OTHER_SYMBOLS

EXECUTABLE_SYMBOLS is supposed to be true to its name, only defining
symbols for the executable.

* emulparams/elf64bmip.sh (EXECUTABLE_SYMBOLS): Don't define.
(OTHER_SYMBOLS): Define this instead.
* emulparams/elf32bmipn32.sh (EXECUTABLE_SYMBOLS): Don't define.
(OTHER_SYMBOLS): Define similarly to elf64bmip.sh.
* emulparams/elf64hppa.sh (EXECUTABLE_SYMBOLS): Don't define.
(OTHER_SYMBOLS): Define instead.

6 years agoTIC6X __c6xabi_DSBT_BASE
Alan Modra [Sat, 2 Jun 2018 08:35:24 +0000 (18:05 +0930)]
TIC6X __c6xabi_DSBT_BASE

Adding an undefined __c6xabi_DSBT_BASE via an EXTERN in the linker
script isn't ideal, as the symbol is not always needed.  This patch
adds the undefined symbol on encountering relocations where it is
implicitly referenced.

bfd/
* elf32-tic6x.c (elf32_tic6x_check_relocs): Reference
__c6xabi_DSBT_BASE explicitly for R_C6000_SBR_* relocs.
ld/
* emulparams/elf32_tic6x_le.sh (EXECUTABLE_SYMBOLS): Don't define.

6 years agoGuard declarations of 'sve_{vq,vl}_from_{vl,vq}' macros on Aarch64 (and unbreak build)
Sergio Durigan Junior [Tue, 5 Jun 2018 21:55:39 +0000 (17:55 -0400)]
Guard declarations of 'sve_{vq,vl}_from_{vl,vq}' macros on Aarch64 (and unbreak build)

Commit 122394f1476b1c925a281b15399119500c8231c1 ("Function for reading
the Aarch64 SVE vector length") has added macros to manipulate SVE
vector sizes based on Linux kernel sources, but did not guard them
with #ifndef's, which breaks the build when the system headers already
have these macros:

    CXX    aarch64-linux-nat.o
  In file included from ../../gdb/aarch64-tdep.h:25,
                   from ../../gdb/aarch64-linux-nat.c:30:
  ../../gdb/arch/aarch64.h:79: error: "sve_vq_from_vl" redefined [-Werror]
   #define sve_vq_from_vl(vl) ((vl) / 0x10)

  In file included from /usr/include/bits/sigcontext.h:30,
                   from /usr/include/signal.h:291,
                   from build-gnulib/import/signal.h:52,
                   from ../../gdb/linux-nat.h:23,
                   from ../../gdb/aarch64-linux-nat.c:26:
  /usr/include/asm/sigcontext.h:154: note: this is the location of the previous definition
   #define sve_vq_from_vl(vl) ((vl) / SVE_VQ_BYTES)

  In file included from ../../gdb/aarch64-tdep.h:25,
                   from ../../gdb/aarch64-linux-nat.c:30:
  ../../gdb/arch/aarch64.h:80: error: "sve_vl_from_vq" redefined [-Werror]
   #define sve_vl_from_vq(vq) ((vq) * 0x10)

  In file included from /usr/include/bits/sigcontext.h:30,
                   from /usr/include/signal.h:291,
                   from build-gnulib/import/signal.h:52,
                   from ../../gdb/linux-nat.h:23,
                   from ../../gdb/aarch64-linux-nat.c:26:
  /usr/include/asm/sigcontext.h:155: note: this is the location of the previous definition
   #define sve_vl_from_vq(vq) ((vq) * SVE_VQ_BYTES)

In order to fix this breakage, this commit guards the declaration of
the macros using #ifndef's.

gdb/ChangeLog:
2018-06-06  Sergio Durigan Junior  <sergiodj@redhat.com>

* arch/aarch64.h (sve_vg_from_vl): Guard with #ifndef.
(sve_vl_from_vg): Likewise.
(sve_vq_from_vl): Likewise.
(sve_vl_from_vq): Likewise.
(sve_vq_from_vg): Likewise.
(sve_vg_from_vq): Likewise.

6 years agoUpdate the AArch64 assembler to note that the Qualcomm Saphira cpu supports ARMv8.4
Sameera Deshpande [Wed, 6 Jun 2018 14:19:59 +0000 (15:19 +0100)]
Update the AArch64 assembler to note that the Qualcomm Saphira cpu supports ARMv8.4

gas * config/tc-aarch64.c (aarch64_cpus): Add support of ARMv8.4 in
saphira.

6 years agoarmelf_fbsd and armelf_fuchsia dependencies
Alan Modra [Wed, 6 Jun 2018 10:08:28 +0000 (19:38 +0930)]
armelf_fbsd and armelf_fuchsia dependencies

* Makefile.am (earmelf_fbsd.c): Correct dependencies.
(earmelfb_fbsd.c, earmelfb_fuchsia.c): Likewise.
* Makefile.in: Regenerate.

6 years agoFix xtensa "clobbered by longjmp" warnings
Alan Modra [Wed, 6 Jun 2018 06:00:35 +0000 (15:30 +0930)]
Fix xtensa "clobbered by longjmp" warnings

.../opcodes/xtensa-dis.c: In function â€˜print_insn_xtensa’:
.../opcodes/xtensa-dis.c:257:17: error: variable â€˜fmt’ might be clobbered by â€˜longjmp’ or â€˜vfork’ [-Werror=clobbered]
   xtensa_format fmt;
                 ^~~
.../opcodes/xtensa-dis.c:262:26: error: variable â€˜valid_insn’ might be clobbered by â€˜longjmp’ or â€˜vfork’ [-Werror=clobbered]
   int first, first_slot, valid_insn = 0;
                          ^~~~~~~~~~

* xtensa-dis.c (print_insn_xtensa): Init fmt and valid_insn after
setjmp.  Move init for some other vars later too.

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

6 years agoRemove some text from --version output
Tom Tromey [Fri, 11 May 2018 18:21:03 +0000 (12:21 -0600)]
Remove some text from --version output

I happened to notice recently that "gdb --version" says:

    GNU gdb (GDB) 8.0.50.20170911-git
    Copyright (C) 2017 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-pc-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word".

This is a bit on the wordy side, but also references interactive
commands, which I think doesn't really make sense for --version.

This patch removes some text from --version, while leaving it in the
"show version" output.  It also adds a newline between the URLs and
the "For help, ..." text, because I thought that was easier to read.
Finally, it indents one of the URLs, since that was simpler to read,
but not the other URL, because the current format is specified by the
GNU coding standards section on "--version".

Now the --version output looks like:

    GNU gdb (GDB) 8.1.50.20180511-git
    Copyright (C) 2018 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

Tested by the buildbot.

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

* cli/cli-cmds.c (show_version): Update.
* top.c (print_gdb_version): Add "interactive" parameter.
Update.
* main.c (captured_main_1): Update.
* top.h (print_gdb_version): Add "interactive" parameter and a
comment.

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

* gdb.base/default.exp: Update expected "show version" output.

6 years agoFix typo in common/enum-flags.h example
David Malcolm [Tue, 5 Jun 2018 17:22:25 +0000 (18:22 +0100)]
Fix typo in common/enum-flags.h example

The DEF_ENUM_FLAGS_TYPE macro should be used with a trailing
semicolon, but the example in the comment lacks one.

gdb/ChangeLog:
2018-06-05  David Malcolm  <dmalcolm@redhat.com>

* common/enum-flags.h: Add trailing semicolon to example in
comment.

6 years agoAdd "continue" response to pager
Tom Tromey [Wed, 25 Apr 2018 14:52:00 +0000 (08:52 -0600)]
Add "continue" response to pager

This adds a "continue" response to the pager.  If the user types "c"
in response to the pager prompt, pagination will be disabled for the
duration of one command -- but re-enabled afterward.  This is handy if
you type a command that produces a lot of output, and you don't want
to baby-sit it by typing "return" each time the prompt comes up.

Tested by the buildbot.

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

PR cli/12326:
* NEWS: Add entry about pager.
* utils.c (pagination_disabled_for_command): New global.
(prompt_for_continue): Allow "c" response to prompt.
(reinitialize_more_filter): Clear
pagination_disabled_for_command.
(fputs_maybe_filtered): Check pagination_disabled_for_command.

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

PR cli/12326:
* gdb.texinfo (Screen Size): Document "c" response to pagination
prompt.

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

PR cli/12326:
* gdb.cp/static-print-quit.exp: Update.
* lib/gdb.exp (pagination_prompt): Update.
* gdb.base/page.exp: Use pagination_prompt.  Add new tests.
* gdb.python/python.exp: Update.

6 years agoTidy bfdio to consistenly use containing archive
Alan Modra [Tue, 5 Jun 2018 13:01:23 +0000 (22:31 +0930)]
Tidy bfdio to consistenly use containing archive

Archive element IO is performed on the file of the containing archive,
which leads to the BFD "where" field of archives and their elements
being out of sync with the real file position.  (We're talking
traditional archives here, not thin archives.)  The old bfd_seek code
recognized this by not attempting to optimize away seeks for
archives.  However, there was other code that could return bogus
results.  For example, cache.c limits the number of open files by
closing a file and remembering its state once the limit is reached.
If bfd_tell is called on an archive element when the containing
archive is closed, it will return an invalid file pointer.

It's possible to have a valid "where" field for archives by always
using and updating the containing archive BFD.  That's what this patch
does.  Note that cache.c used to find the containing archive BFD
anyway for the iostream, so we're not really doing extra work, just
transferring it up to the correct abstraction level.

The patch also gets rid of some hacks.  bfd_tell was called when
bfd_seek failed, in an attempt to correct "where".  That's got to be
papering over another problem, so that code has been removed.
bfd_read also had an "optimiziation" to return early when the number
of bytes was zero, and bfd_seek optimized calls that didn't move the
file pointer.  This was covering for a coff_slurp_line_table bug where
IO was attempted on a pe-dll BFD without an iovec.

* bfd.c (struct bfd): Update comment on "where" usage.
* bfdio.c (bfd_bwrite, bfd_stat): Use and update "iovec",
"iostream", and "where" from containing archive file.  Return
error on NULL iovec.
(bfd_bread): Similarly, and return error attempted out of
bounds archive element access.
(bfd_tell, bfd_flush): Use and update "iovec", "iostream", and
"where" from containing archive file.
(bfd_seek): Likewise.  Return error on NULL iovec.  Don't
attempt to optimize away seeks.  Don't paper over errors by
calling bfd_tell.
(bfd_get_mtime): Call bfd_stat rather than iovec->bstat.
(bfd_get_size): Likewise.
(bfd_mmap): Operate on and use iovec of containing archive
file.  Return error on NULL iovec.
* cache.c (bfd_cache_lookup_worker): Abort if working on
archive element bfd.
(cache_bread_1): Delete bfd parameter, add FILE* parameter.
Don't ignore zero byte reads.
(cache_bread): Look up FILE* in cache here.  Error on NULL
lookup.
(cache_bwrite): Rename "where" to "from".
(cache_bmmap): Don't handle archive elements.
* coffcode.h (coff_slurp_line_table): Exit early on zero
lineno count.
* bfd-in2.h: Regenerate.

6 years agoPR23254, ld.bfd mishandles file pointers while scanning archive
Alan Modra [Tue, 5 Jun 2018 11:34:00 +0000 (21:04 +0930)]
PR23254, ld.bfd mishandles file pointers while scanning archive

Best practice is to not mix lseek/read with fseek/fread on the same
underlying file descriptor, as not all stdio implementations will cope.
Since the plugin uses lseek/read while bfd uses fseek/fread this patch
reopens the file for exclusive use by the plugin rather than trying to
restore the file descriptor.  That allows the plugin to read the file
after plugin_call_claim_file too.

bfd/
PR 23254
* plugin.c (bfd_plugin_open_input): Allow for possibility of
nested archives.  Open file again for plugin.
(try_claim): Don't save and restore file position.  Close file
if not claimed.
* sysdep.h (O_BINARY): Define.
ld/
PR 23254
* plugin.c (plugin_call_claim_file): Revert 2016-07-19 patch.
(plugin_object_p): Don't dup file descriptor.

6 years agoAnother s12z regen
Alan Modra [Tue, 5 Jun 2018 11:31:56 +0000 (21:01 +0930)]
Another s12z regen

* Makefile.in: Regenerate.

6 years agoAdd a test of the linker's "-z noexecstack" command line option.
Flavio Ceolin [Tue, 5 Jun 2018 11:39:47 +0000 (12:39 +0100)]
Add a test of the linker's "-z noexecstack" command line option.

ld * testsuite/ld-elf/elf.exp Run new test.
* testsuite/ld-elf/stack-noexec.rd New file: Expected readelf output.

6 years agoUpdated Malay and Esperanto translations for the gprof/ subdirectory.
Nick Clifton [Tue, 5 Jun 2018 11:26:44 +0000 (12:26 +0100)]
Updated Malay and Esperanto translations for the gprof/ subdirectory.

2018-06-05  Nick Clifton  <nickc@redhat.com>

* po/eo.po: Updated Esperanto translation.
* po/ms.po: Updated Malay translation.

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

6 years agoRemove last Ada cleanups
Tom Tromey [Fri, 25 May 2018 19:32:20 +0000 (13:32 -0600)]
Remove last Ada cleanups

This removes the last cleanups from the Ada code by changing
ada_lookup_symbol_list's out parameter to be a std::vector, and then
fixing up the fallout.

This is a relatively shallow change.  Deeper changes are possible, for
example (1) changing various other functions to accept a vector rather
than a pointer, or (2) changing ada_lookup_symbol_list to return the
vector and omitting the length entirely.

Tested by the buildbot, but I'll wait for Joel to test these as well.

gdb/ChangeLog
2018-06-04  Tom Tromey  <tom@tromey.com>

* ada-lang.h (ada_lookup_symbol_list): Update.
* ada-lang.c (resolve_subexp): Update.
(symbols_are_identical_enums): Change type of syms.  Remove nsyms
parameter.
(remove_extra_symbols, remove_irrelevant_renamings): Likewise.
(ada_lookup_symbol_list_worker, ada_lookup_symbol_list): Change
results parameter to std::vector.
(ada_iterate_over_symbols, ada_lookup_symbol, get_var_value):
Update.
* ada-exp.y (block_lookup): Update.
(select_possible_type_sym): Change type of syms.  Remove nsyms
parameter.
(write_var_or_type, write_name_assoc): Update.

6 years ago(windows) GDB/MI crash when using "-list-thread-groups --available"
Joel Brobecker [Mon, 4 Jun 2018 20:03:32 +0000 (15:03 -0500)]
(windows) GDB/MI crash when using "-list-thread-groups --available"

On Windows, using the "-list-thread-groups --available" GDB/MI command
before an inferior is being debugged:

    % gdb -q -i=mi
    =thread-group-added,id="i1"
    =cmd-param-changed,param="auto-load safe-path",value="/"
    (gdb)
    -list-thread-groups --available
    Segmentation fault

Ooops!

The SEGV happens because the -list-thread-groups --available command
triggers a windows_nat_target::xfer_partial call for a TARGET_OBJECT_OSDATA
object.  Until a program is being debugged, the target_ops layer that
gets the call is the Windows "native" layer. Except for a couple of
specific objects (TARGET_OBJECT_MEMORY and TARGET_OBJECT_LIBRARIES),
this layer's xfer_partial method delegates the xfer of other objects
to the target beneath:

    default:
      return beneath->xfer_partial (object, annex,
                                    readbuf, writebuf, offset, len,
                                    xfered_len);

Unfortunately, there is no "beneath layer" in this case, so
beneath is NULL and dereferencing it leads to the SEGV.

This patch fixes the issue by checking beneath before trying
to delegate the request.

gdb/ChangeLog:

        * windows-nat.c (windows_nat_target::xfer_partial): Return
        TARGET_XFER_E_IO if we need to delegate to the target beneath
        but BENEATH is NULL.

gdb/testsuite/ChangeLog:

        * gdb.mi/list-thread-groups-no-inferior.exp: New testcase.

6 years agoxtensa: use property tables for correct disassembly
Max Filippov [Thu, 24 May 2018 18:22:14 +0000 (11:22 -0700)]
xtensa: use property tables for correct disassembly

xtensa disassembler does not use information from the .xt.prop sections
to switch between code/data disassembly in text sections. This may
result in incorrect disassembly when data is interpreted as code and
disassembler loses synchronization with instruction stream. Use .xt.prop
section information to correctly interpret code and data and synchronize
with instruction stream.

2018-06-04  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
* elf32-xtensa.c (xtensa_read_table_entries): Make global.
(compute_fill_extra_space): Drop declaration. Rename function to
xtensa_compute_fill_extra_space.
(compute_ebb_actions, remove_dead_literal): Update references to
compute_fill_extra_space.

include/
* elf/xtensa.h (xtensa_read_table_entries)
(xtensa_compute_fill_extra_space): New declarations.

opcodes/
* xtensa-dis.c (bfd.h, elf/xtensa.h): New includes.
(dis_private): Add new fields for property section tracking.
(xtensa_coalesce_insn_tables, xtensa_find_table_entry)
(xtensa_instruction_fits): New functions.
(fetch_data): Bump minimal fetch size to 4.
(print_insn_xtensa): Make struct dis_private static.
Load and prepare property table on section change.
Don't disassemble literals. Don't disassemble instructions that
cross property table boundaries.

6 years agoxtensa: add separate property sections option
Max Filippov [Wed, 23 May 2018 04:48:09 +0000 (21:48 -0700)]
xtensa: add separate property sections option

It is currently not possible to correctly match .xt.prop information
for sections with identical VMA. Allow creation of separate property
sections in the BFD. Add assembler option --separate-prop-tables to
allow creation of separate property sections.

2018-06-04  Volodymyr Arbatov  <arbatov@cadence.com>
bfd/

* elf32-xtensa.c (elf32xtensa_separate_props): New global
variable.
(xtensa_add_names): New function.
(xtensa_property_section_name): Add new parameter
separate_sections, use it to choose property section name.
(xtensa_get_separate_property_section): New function.
(xtensa_get_property_section): Invoke
xtensa_get_separate_property_section to get individual property
section if it exists, common property section otherwise.
(xtensa_make_property_section): Pass elf32xtensa_separate_props
to xtensa_property_section_name.

gas/
* config/tc-xtensa.c (elf32xtensa_separate_props): New
declaration.
(option_separate_props, option_no_separate_props): New
enumeration constants.
(md_longopts): Add separate-prop-tables option.
(md_parse_option): Add cases for option_separate_props and
option_no_separate_props.
(md_show_usage): Add help for [no-]separate-prop-tables options.

6 years agoUse DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION to silence GCC 8.1
H.J. Lu [Mon, 4 Jun 2018 17:01:34 +0000 (10:01 -0700)]
Use DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION to silence GCC 8.1

GCC 8.1 warns about destination size with -Wstringop-truncation:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643

Use DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION to silence it.

bfd/

PR binutils/23146
* bfd-in.h: Include "diagnostics.h".
* bfd-in2.h: Regenerated.
* elf32-arm.c (elf32_arm_nabi_write_core_note): Use
DIAGNOSTIC_PUSH, DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION and
DIAGNOSTIC_POP to silence GCC 8.1 warnings with
-Wstringop-truncation.
* elf32-ppc.c (ppc_elf_write_core_note): Likewse.
* elf32-s390.c (elf_s390_write_core_note): Likewse.
* elf64-ppc.c (ppc64_elf_write_core_note): Likewse.
* elf64-s390.c (elf_s390_write_core_note): Likewse.
* elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewse.

include/

* diagnostics.h (DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION): Always
define for GCC.

6 years agoUse ELF_SECTION_IN_SEGMENT to map segments
Alan Hayward [Mon, 4 Jun 2018 16:21:04 +0000 (17:21 +0100)]
Use ELF_SECTION_IN_SEGMENT to map segments

The macro ELF_SECTION_IN_SEGMENT should be used when calculating if
a section maps to a segment.

gdb/
* elfread.c (elf_symfile_segments): Use ELF_SECTION_IN_SEGMENT.

6 years agoAdd configure.nat as a dependency of config.status
Simon Marchi [Mon, 4 Jun 2018 14:40:27 +0000 (10:40 -0400)]
Add configure.nat as a dependency of config.status

After pulling Alan's change that added aarch64-sve-linux-ptrace.o to
configure.nat, I got an undefined reference to aarch64_sve_get_vq when
doing a "make clean && make".  It turns out that re-running configure
(./config.status --recheck) was needed to re-generate the Makefile with
aarch64-sve-linux-ptrace.o included in the object list.  Putting
configure.nat in the dependencies of config.status would make sure that
when we modify configure.nat, the configure script is re-ran.  I think
it also makes sense because configure.tgt and configure.host are also
there.

gdb/ChangeLog:

* Makefile.in (config.status): Add configure.nat as a
dependency.

6 years agoAdd client_state struct.
Stan Cox [Mon, 4 Jun 2018 14:20:49 +0000 (10:20 -0400)]
Add client_state struct.

Collect per client specific global data items into struct client_state,
which is similar in purpose to remote.c::remote_state.

gdbserver/ChangeLog
* server.h (struct client_state): New.
* server.c (cont_thread, general_thread, multi_process)
(report_fork_events, report_vfork_events, report_exec_events)
(report_thread_events, swbreak_feature, hwbreak_feature)
(vCont_supported, disable_randomization, pass_signals)
(program_signals, program_signals_p, last_status, last_ptid, own_buf):
Moved to client_state.
* remote-utils.c (remote_debug, noack_mode)
(transport_is_reliable): Moved to client_state.
* tracepoint.c (current_traceframe): Moved to client_state.

Update all callers.
* server.c, remote-utils.c, tracepoint.c, fork-child.c,
linux-low.c, remote-utils.h, target.c: Use client_state.

6 years agoAdd DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION
H.J. Lu [Mon, 4 Jun 2018 13:33:07 +0000 (06:33 -0700)]
Add DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION

Add DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION for GCC 8.1 to silence
-Wstringop-truncation warning:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643

* diagnostics.h (DIAGNOSTIC_STRINGIFY_1): New.
(DIAGNOSTIC_STRINGIFY): Likewise.
(DIAGNOSTIC_IGNORE): Replace STRINGIFY with DIAGNOSTIC_STRINGIFY.
(DIAGNOSTIC_IGNORE_SELF_MOVE): Define empty if not defined.
(DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER): Likewise.
(DIAGNOSTIC_IGNORE_UNUSED_FUNCTION): Likewise.
(DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES): Likewise.
(DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION): New.

6 years agoChange functions in cp-name-parser.y into methods
Tom Tromey [Fri, 1 Jun 2018 17:50:01 +0000 (11:50 -0600)]
Change functions in cp-name-parser.y into methods

Pedro pointed out in an earlier patch that it would be possible to
make some helper functions in cp-name-parser.y into methods on
cpname_state, cleaning up the code a bit.  This patch implements this
idea.

Doing this required moving the %union earlier in the .y file, so the
patch is somewhat bigger than you might expect.

Tested by building with both bison and byacc, and then running the
gdb.cp tests.

gdb/ChangeLog
2018-06-04  Tom Tromey  <tom@tromey.com>

* cp-name-parser.y (cpname_state): Add method declarations.
(HANDLE_QUAL): Update.
(cpname_state::d_grab, cpname_state::fill_comp)
(cpname_state::make_operator, cpname_state::make_dtor)
(cpname_state::make_builtin_type, cpname_state::make_name)
(cpname_state::d_qualify, cpname_state::d_int_type)
(cpname_state::d_unary, cpname_state::d_binary): Now methods.
(%union): Move earlier.

6 years agoAdd aarch64 pseudo help functions
Alan Hayward [Thu, 26 Apr 2018 13:58:40 +0000 (14:58 +0100)]
Add aarch64 pseudo help functions

Reduce code copy/paste by adding two helper functions for
aarch64_pseudo_read_value and aarch64_pseudo_write
Does not change any functionality.

gdb/
* aarch64-tdep.c (aarch64_pseudo_read_value_1): New helper func.
(aarch64_pseudo_write_1): Likewise.
(aarch64_pseudo_read_value): Use helper.
(aarch64_pseudo_write): Likewise.

6 years agoFix macOS null pointer dereference
Pedro Alves [Mon, 4 Jun 2018 11:26:39 +0000 (12:26 +0100)]
Fix macOS null pointer dereference

<https://sourceware.org/bugzilla/show_bug.cgi?id=22960#c4> reports
that macOS gdb crashes with a null pointer dereference in
push_target(struct target_ops *).  This commit fixes that.

The problem is that commit f6ac5f3d63e0 ("Convert struct target_ops to
C++") left the darwin_ops global uninitialized.

We don't need that global anymore, we can use the (new)
get_native_target function instead for the same effect.

gdb/ChangeLog:
2018-06-04  Pedro Alves  <palves@redhat.com>

* darwin-nat.c (darwin_ops): Delete.
(darwin_attach_pid): Use get_native_target.

6 years agoUse uint64_t for aarch64 tdep VQ
Alan Hayward [Mon, 4 Jun 2018 11:13:43 +0000 (12:13 +0100)]
Use uint64_t for aarch64 tdep VQ

6 years agoEnable SVE for GDB
Alan Hayward [Mon, 4 Jun 2018 10:39:41 +0000 (11:39 +0100)]
Enable SVE for GDB

Enable SVE support for GDB by reading the VQ when creating a
target description.

Also ensurse that SVE is taken into account when creating
the tdep structure, and store the current VQ value directly in tdep.

gdb/
* aarch64-linux-nat.c (aarch64_linux_read_description): Support SVE.
* aarch64-tdep.c (aarch64_get_tdesc_vq): New function.
(aarch64_gdbarch_init): Check for SVE.
* aarch64-tdep.h (gdbarch_tdep::has_sve): New function.

6 years agoUse uint64_t for SVE VQ
Alan Hayward [Fri, 1 Jun 2018 15:37:45 +0000 (16:37 +0100)]
Use uint64_t for SVE VQ

Previously VQ was of type long. Using uint64_t ensures it always matches the
same type as the VG register.
Note that in the Linux kernel, VQ is 16bits. We cast it up to 64bits
immediately after reading to ensure we always use the same type throughout
the code.

gdb/
* aarch64-tdep.c (aarch64_read_description): Use uint64_t for VQ.
* aarch64-tdep.h (aarch64_read_description): Likewise.
* arch/aarch64.c (aarch64_create_target_description): Likewise.
* arch/aarch64.h (aarch64_create_target_description): Likewise.
* features/aarch64-sve.c (create_feature_aarch64_sve): Likewise.
* nat/aarch64-sve-linux-ptrace.c(aarch64_sve_get_vq): Likewise.
* nat/aarch64-sve-linux-ptrace.h (aarch64_sve_get_vq): Likewise.

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 4 Jun 2018 00:00:48 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoRISC-V: Handle out-of-range calls to undefined weak.
Jim Wilson [Sun, 3 Jun 2018 22:42:29 +0000 (15:42 -0700)]
RISC-V: Handle out-of-range calls to undefined weak.

bfd/
PR ld/23244
* elfnn-riscv.c (riscv_elf_relocate_section) <R_RISCV_CALL>: Check
for and handle an undefined weak with no PLT.

ld/
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run new weak ref tests.
* testsuite/ld-riscv-elf/weakref.ld: New.
* testsuite/ld-riscv-elf/weakref32.d: New.
* testsuite/ld-riscv-elf/weakref32.s: New.
* testsuite/ld-riscv-elf/weakref64.d: New.
* testsuite/ld-riscv-elf/weakref64.s: New.

6 years agoRISC-V: Fix symbol address problem with versioned symbols.
Jim Wilson [Sun, 3 Jun 2018 21:44:44 +0000 (14:44 -0700)]
RISC-V: Fix symbol address problem with versioned symbols.

bfd/
PR ld/22756
* elfnn-riscv.c (riscv_relax_delete_bytes): Add versioned_hidden check
to code that ignores duplicate symbols.

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 3 Jun 2018 00:00:49 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoSplit value_fetch_lazy
Simon Marchi [Sat, 2 Jun 2018 13:17:06 +0000 (09:17 -0400)]
Split value_fetch_lazy

While reading value_fetch_lazy, I thought it would be good to split it
in small functions (especially the part that handles lval_register).

gdb/ChangeLog:

* value.c (value_fetch_lazy_bitfield): New.
(value_fetch_lazy_memory): New.
(value_fetch_lazy_register): New.
(value_fetch_lazy): Factor out to smaller functions.

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 2 Jun 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoMake two cp-name-parser.y constants "const"
Tom Tromey [Wed, 30 May 2018 14:19:01 +0000 (08:19 -0600)]
Make two cp-name-parser.y constants "const"

This changes "backslashable" and "represented" in cp-name-parser.y to
be const.  This lets the compiler make them read-only (though in my
build it seems that GCC inlines them, which seems even better).

gdb/ChangeLog
2018-06-01  Tom Tromey  <tom@tromey.com>

* cp-name-parser.y (backslashable, represented): Now const.

6 years agoInclude parser-defs.h in cp-name-parser.y
Tom Tromey [Tue, 29 May 2018 18:54:59 +0000 (12:54 -0600)]
Include parser-defs.h in cp-name-parser.y

This changes cp-name-parser.y to include parser-defs.h, removing the
copy-pasted declaration of parser_fprintf.  This can be done now that
cp-name-parser.y does not define any global variables.

gdb/ChangeLog
2018-06-01  Tom Tromey  <tom@tromey.com>

* cp-name-parser.y: Include parser-defs.h.
(parser_fprintf): Remove declaration.

6 years agoMake cp-name-parser.y a pure parser
Tom Tromey [Thu, 24 May 2018 03:46:59 +0000 (21:46 -0600)]
Make cp-name-parser.y a pure parser

This changes cp-name-parser.y to be a pure parser.

Originally I had thought that doing this would mean that gdb would
always require Bison.  However, I've learned that Byacc supports some
of the Bison extensions in this area.  So, the new code ought to work
reasonably well with both.

Note that the Byacc documentations says:

    %pure-parser
        Most variables (other than yydebug and yynerrs) are allocated
        on the stack within yyparse, making the parser reasonably
        reentrant.

In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.

gdb/ChangeLog
2018-06-01  Tom Tromey  <tom@tromey.com>

* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.

6 years agoUse yy-remap.h in cp-name-parser.y
Tom Tromey [Tue, 29 May 2018 18:20:09 +0000 (12:20 -0600)]
Use yy-remap.h in cp-name-parser.y

This changes cp-name-parser.y to use yy-remap.h, rather than its old
manual approach.

This required declaring parser_fprintf in cp-name-parser.y.
parser-defs.h can't be included here because parser-defs.h declares a
global "lexptr", which conflicts with the local one in
cp-name-parser.y.  This is only temporary, and will be cleaned up
later in the series.

gdb/ChangeLog
2018-06-01  Tom Tromey  <tom@tromey.com>

* cp-name-parser.y (parser_fprintf): Declare.
(GDB_YY_REMAP_PREFIX): Define.
Include yy-remap.h.  Don't redefine yy* identifiers.

6 years agoRemove a static buffer from cp-name-parser.y
Tom Tromey [Thu, 24 May 2018 03:05:52 +0000 (21:05 -0600)]
Remove a static buffer from cp-name-parser.y

This removes a static buffer from cp-name-parser.y by replacing the
fixed-sized buffer with a std::string out parameter.

gdb/ChangeLog
2018-06-01  Tom Tromey  <tom@tromey.com>

* python/py-type.c (typy_legacy_template_argument): Update.
* cp-support.h (cp_demangled_name_to_comp): Update.
* cp-name-parser.y (cp_demangled_name_to_comp): Change errmsg
parameter to be a "std::string *".
(main): Update.

6 years agoMove gdb/common/diagnostics.h to include/diagnostics.h
H.J. Lu [Fri, 1 Jun 2018 16:38:22 +0000 (09:38 -0700)]
Move gdb/common/diagnostics.h to include/diagnostics.h

Move gdb/common/diagnostics.h to include/diagnostics.h so that it can
be used in binutils.

gdb/

* ada-lex.l: Include "diagnostics.h" instead of
"common/diagnostics.h".
* unittests/environ-selftests.c: Likewise.
* common/diagnostics.h: Moved to ../include.

include/

* diagnostics.h: Moved from ../gdb/common/diagnostics.h.

6 years agoinadvertent language switch during breakpoint_re_set_one
Joel Brobecker [Fri, 1 Jun 2018 16:36:05 +0000 (09:36 -0700)]
inadvertent language switch during breakpoint_re_set_one

Trying to insert a breakpoint using *FUNC'address with an Ada program
and then running the program until reaching that breakpoint currently
yields the following behavior:

    (gdb) break *a'address
    Breakpoint 1 at 0x40240c: file a.adb, line 1.
    (gdb) run
    [1]  + 27222 suspended (tty output) /[...]/gdb -q simple_main

Unsuspending GDB then shows it was suspended trying to report
the following error:

    Starting program: /home/takamaka.a/brobecke/ex/simple/a
    Error in re-setting breakpoint 1: Unmatched single quote.
    Error in re-setting breakpoint 1: Unmatched single quote.
    Error in re-setting breakpoint 1: Unmatched single quote.
    [Inferior 1 (process 32470) exited normally]

The "a'address" is Ada speak for function A's address ("A" by
itself means the result of calling A with no arguments). The
transcript above shows that we're having problems trying to
parse the breakpoint location while re-setting it.  As a result,
we also fail to stop at the breakpoint.

Normally, breakpoint locations are evaluated with the current_language
being set to the language of the breakpoint. But, unfortunately for us,
what happened in this case is that parse_exp_in_context_1 calls
get_selected_block which eventually leads to a call to select_frame
because the current_frame hadn't been set yet.  select_frame then
finds that our language_mode is auto, and therefore changes the
current_language to match the language of the frame we just selected.
In our case, the language chosen was 'c', which of course is not
able to parse an Ada expression, hence the error.

This patch prevents this by forcing the language_mode to manual
before we call breakpoint_re_set_one.

gdb/ChangeLog:

        * breakpoint.c (breakpoint_re_set): Temporarily force language_mode
        to language_mode_manual while calling breakpoint_re_set_one.

gdb/testsuite/ChangeLog:

        * gdb.ada/bp_fun_addr: New testcase.

Tested on x86_64-linux.

6 years agoBump version number to 2.30.52
H.J. Lu [Fri, 1 Jun 2018 16:34:04 +0000 (09:34 -0700)]
Bump version number to 2.30.52

Bump version number to 2.30.52 since _bfd_link_hide_symbol has been added
to bfd_target.

bfd/

* version.m4: Bump version to 2.30.52
* configure: Regenerated.

binutils/

* configure: Regenerated.

gas/

* configure: Regenerated.

gprof/

* configure: Regenerated.

ld/

* configure: Regenerated.

opcodes/

* configure: Regenerated.

6 years agoRemove type_name_no_tag and rename type_name_no_tag_or_error
Tom Tromey [Tue, 17 Apr 2018 19:51:25 +0000 (13:51 -0600)]
Remove type_name_no_tag and rename type_name_no_tag_or_error

type_name_no_tag is just a plain wrapper for TYPE_NAME now, so this
patch removes it.  And, because tag names no longer exist, this
renames type_name_no_tag_or_error to type_name_or_error.

gdb/ChangeLog
2018-06-01  Tom Tromey  <tom@tromey.com>

* valops.c (value_cast_structs, destructor_name_p): Update.
* symtab.c (gdb_mangle_name): Update.
* stabsread.c (define_symbol, read_cpp_abbrev, read_baseclasses):
Update.
* p-valprint.c (pascal_object_is_vtbl_ptr_type)
(pascal_object_print_value_fields, pascal_object_print_value):
Update.
* p-typeprint.c (pascal_type_print_derivation_info): Update.
* linespec.c (find_methods): Update.
* gdbtypes.h (type_name_no_tag): Remove.
(type_name_or_error): Rename from type_name_no_tag_or_error.
* gdbtypes.c (type_name_no_tag): Remove.
(type_name_or_error): Rename from type_name_no_tag_or_error.
(lookup_struct_elt_type, check_typedef): Update.
* expprint.c (print_subexp_standard): Update.
* dwarf2read.c (dwarf2_add_field, load_partial_dies): Update.
* d-namespace.c (d_lookup_nested_symbol): Update.
* cp-valprint.c (cp_is_vtbl_ptr_type, cp_print_value_fields)
(cp_print_class_member): Update.
* cp-namespace.c (cp_lookup_nested_symbol): Update.
* completer.c (add_struct_fields): Update.
* c-typeprint.c (cp_type_print_derivation_info)
(c_type_print_varspec_prefix, c_type_print_base_struct_union):
Update.
* ada-lang.c (parse_old_style_renaming, xget_renaming_scope)
(ada_prefer_type, ada_is_exception_sym): Update.

6 years agoRemove TYPE_TAG_NAME
Tom Tromey [Tue, 17 Apr 2018 19:51:24 +0000 (13:51 -0600)]
Remove TYPE_TAG_NAME

TYPE_TAG_NAME has been an occasional source of confusion and bugs.  It
seems to me that it is only useful for C and C++ -- but even there,
not so much, because at least with DWARF there doesn't seem to be any
way to wind up with a type where the name and the tag name are both
non-NULL and different.

So, this patch removes TYPE_TAG_NAME entirely.  This should save a
little memory, but more importantly, it simplifies this part of gdb.

A few minor test suite adjustments were needed.  In some situations
the new code does not yield identical output to the old code.

gdb/ChangeLog
2018-06-01  Tom Tromey  <tom@tromey.com>

* valops.c (enum_constant_from_type, value_namespace_elt)
(value_maybe_namespace_elt): Update.
* valarith.c (find_size_for_pointer_math): Update.
* target-descriptions.c (make_gdb_type): Update.
* symmisc.c (print_symbol): Update.
* stabsread.c (define_symbol, read_type)
(complain_about_struct_wipeout, add_undefined_type)
(cleanup_undefined_types_1): Update.
* rust-lang.c (rust_tuple_type_p, rust_slice_type_p)
(rust_range_type_p, val_print_struct, rust_print_struct_def)
(rust_internal_print_type, rust_composite_type)
(rust_evaluate_funcall, rust_evaluate_subexp)
(rust_inclusive_range_type_p): Update.
* python/py-type.c (typy_get_tag): Update.
* p-typeprint.c (pascal_type_print_base): Update.
* mdebugread.c (parse_symbol, parse_type): Update.
* m2-typeprint.c (m2_long_set, m2_record_fields, m2_enum):
Update.
* guile/scm-type.c (gdbscm_type_tag): Update.
* go-lang.c (sixg_string_p): Update.
* gnu-v3-abi.c (build_gdb_vtable_type, build_std_type_info_type):
Update.
* gdbtypes.h (struct main_type) <tag_name>: Remove.
(TYPE_TAG_NAME): Remove.
* gdbtypes.c (type_name_no_tag): Simplify.
(check_typedef, check_types_equal, recursive_dump_type)
(copy_type_recursive, arch_composite_type): Update.
* f-typeprint.c (f_type_print_base): Update.  Print "Type" prefix
in summary mode when needed.
* eval.c (evaluate_funcall): Update.
* dwarf2read.c (fixup_go_packaging, read_structure_type)
(process_structure_scope, read_enumeration_type)
(read_namespace_type, read_module_type, determine_prefix): Update.
* cp-support.c (inspect_type): Update.
* coffread.c (process_coff_symbol, decode_base_type): Update.
* c-varobj.c (c_is_path_expr_parent): Update.
* c-typeprint.c (c_type_print_base_struct_union): Update.
(c_type_print_base_1): Update.  Print struct/class/union/enum in
summary when using C language.
* ax-gdb.c (gen_struct_ref, gen_namespace_elt)
(gen_maybe_namespace_elt): Update.
* ada-lang.c (ada_type_name): Simplify.
(empty_record, ada_template_to_fixed_record_type_1)
(template_to_static_fixed_type)
(to_record_with_fixed_variant_part, ada_check_typedef): Update.

gdb/testsuite/ChangeLog
2018-06-01  Tom Tromey  <tom@tromey.com>

* gdb.xml/tdesc-regs.exp (load_description): Update expected
results.
* gdb.dwarf2/method-ptr.exp: Set language to C++.
* gdb.dwarf2/member-ptr-forwardref.exp: Set language to C++.
* gdb.cp/typeid.exp (do_typeid_tests): Update type_re.
* gdb.base/maint.exp (maint_pass_if): Update.

6 years agoThread language through c_type_print_args
Tom Tromey [Tue, 17 Apr 2018 19:51:23 +0000 (13:51 -0600)]
Thread language through c_type_print_args

Currently dwarf2read.c will pass the CU's language to
c_type_print_args -- but this doesn't affect all aspects of type
printing, because some code in c-typeprint.c refers to
current_language.

This patch threads the language through more of the type printing
code, adding an overload to c_type_print.  Some uses of
current_language remain, but now they are only in top-level functions.

gdb/ChangeLog
2018-06-01  Tom Tromey  <tom@tromey.com>

* dwarf2read.c (dwarf2_compute_name): Pass CU's language to
c_print_type.
* c-typeprint.c (c_print_type_1): Add "language" parameter.
(c_print_type): Update.
(c_print_type): New overload.
(c_type_print_varspec_prefix, c_type_print_args)
(c_type_print_varspec_suffix, c_print_type_no_offsets)
(c_type_print_base_struct_union, c_type_print_base_1)
(cp_type_print_method_args): Add "language" parameter.
(c_type_print_base): Update.
* c-lang.h (c_print_type): Add new overload.