Commit Graph

103506 Commits

Author SHA1 Message Date
Kamil Rytarowski
8b667faedf Add NetBSD/i386 gdbserver support
The support is on part with NetBSD/amd64, thus GPR works,
single step and software breakpoint are operational, and the
SVR4 r_debug integration is functional.

gdbserver/ChangeLog:

	* netbsd-i386-low.cc: Add.
	* Makefile.in (SFILES): Register "netbsd-i386-low.c".
	* configure.srv: Add i[34567]86-*-netbsd*.
2020-10-02 00:41:21 +02:00
Kamil Rytarowski
15397b0e05 Refactor the NetBSD amd64 gdbserver support
Replace the pre-C++ construct of netbsd_target_ops, netbsd_regset_info
and netbsd_tdesc with C++ inheritance approach found in the Linux
gdbserver code. Add netbsd_amd64_target, that inherits from the
netbsd_process_target class and add proper singleton object for
the_netbsd_target, initialized from netbsd_amd64_target.

Call low_arch_setup () on post process creation, which sets machine
specific properties of the traced process.

Remove global singleton the_netbsd_target object from the generic
gdbserver code.

This refactoring introduces no functional change from the end-user
point of view.

gdbserver/ChangeLog:

	* netbsd-amd64-low.cc (netbsd_x86_64_arch_setup): Remove.
	(netbsd_target_regsets): Now const.
	(the_low_target): Remove.
	(class netbsd_amd64_target, the_netbsd_amd64_target)
	(the_netbsd_target): Add.
	* netbsd-low.cc (netbsd_process_target::post_create_inferior): Call
	low_arch_setup ().
	(netbsd_process_target::fetch_registers)
	(netbsd_process_target::store_registers, initialize_low): Update.
	(the_netbsd_target): Remove.
	* netbsd-low.h (netbsd_target_regsets, netbsd_target_ops)
	(the_low_target, netbsd_tdesc): Remove.
	(netbsd_process_target::get_regs_info)
	(netbsd_process_target::low_arch_setup): Add.
2020-10-02 00:39:20 +02:00
Kamil Rytarowski
e2a2a24a8e Preinitialize the sockaddr_un variable to zero
Don't pass random sun_len for the BSD's,
zero the whole structure as recommended for portability.

Reported by Coverity.

gdbsupport/ChangeLog:

	* agent.cc (gdb_connect_sync_socket): Preinitialize addr with zeros.
2020-10-02 00:38:12 +02:00
Kamil Rytarowski
1eb6eb795f Include the x86-bsd-nat.h header and fix the NetBSD/i386 build
In file included from ../../gdb/i386-nbsd-nat.c:26:
../../gdb/i386-bsd-nat.h:34:53: error: expected template-name before '<' token
   34 | class i386_bsd_nat_target : public x86bsd_nat_target<BaseTarget>
      |                                                     ^
../../gdb/i386-bsd-nat.h:34:53: error: expected '{' before '<' token
../../gdb/i386-nbsd-nat.c:74:45: error: aggregate 'i386_bsd_nat_target<nbsd_nat_target> the_i386_nbsd_nat_target' has incomplete type and cannot be defined
   74 | static i386_bsd_nat_target<nbsd_nat_target> the_i386_nbsd_nat_target;
      |                                             ^~~~~~~~~~~~~~~~~~~~~~~~

gdb/ChangeLog:

	* i386-bsd-nat.c: Include "x86-bsd-nat.h".
2020-10-02 00:37:38 +02:00
Nick Clifton
642f545a93 Add new directive to GAS: .attach_to_group.
* config/obj-elf (elf_pseudo_table): Add attach_to_group.
        (obj_elf_attach_to_group): New function.
        * doc/as.texi: Document the new directive.
	* NEWS: Mention the new feature.
        * testsuite/gas/elf/attach-1.s: New test.
        * testsuite/gas/elf/attach-1.d: New test driver.
        * testsuite/gas/elf/attach-2.s: New test.
        * testsuite/gas/elf/attach-2.d: New test driver.
        * testsuite/gas/elf/attach-err.s: New test.
        * testsuite/gas/elf/attach-err.d: New test driver.
        * testsuite/gas/elf/attach-err.err: New test error output.
        * testsuite/gas/elf/elf.exp: Run the new tests.
2020-10-01 16:34:05 +01:00
GDB Administrator
1f22ee1f72 Automatic date update in version.in 2020-10-01 00:00:06 +00:00
H.J. Lu
27f134698a x86: Check register operand for AddrPrefixOpReg
If the address prefix changes the register operand, we need to check the
register operand when the memory operand is RIP-relative.

	PR gas/26685
	* config/tc-i386.c (process_suffix): Check the register operand
	for the address size prefix if the memory operand is symbol(%rip).
	* testsuite/gas/i386/x86-64-enqcmd.s: Add tests with RIP-relative
	addressing.
	* testsuite/gas/i386/x86-64-movdir.s: Likewise.
	* testsuite/gas/i386/x86-64-enqcmd-intel.d: Updated.
	* testsuite/gas/i386/x86-64-enqcmd.d: Likewise.
	* testsuite/gas/i386/x86-64-movdir-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-movdir.d: Likewise.
2020-09-30 16:33:52 -07:00
Tom de Vries
95eb9e54a5 [gdb] Fix regression in dwarf2_name
Since commit 2c830f5475 "Change some uses of DW_STRING to string method" we
have these regressions:
...
FAIL: gdb.base/info-types-c++.exp: info types
FAIL: gdb.cp/anon-struct.exp: print type of t::t
FAIL: gdb.cp/anon-struct.exp: print type of X::t2
FAIL: gdb.cp/anon-struct.exp: print type of X::t2::t2
FAIL: gdb.cp/anon-struct.exp: print type of t3::~t3
...

Fix these in dwarf2_name by updating attr_name each time attr is updated.

Tested on x86_64-linux.

gdb/ChangeLog:

2020-09-30  Tom de Vries  <tdevries@suse.de>

	PR symtab/26683
	* dwarf2/read.c (dwarf2_name): Update attr_name after attr is updated.
2020-09-30 21:49:01 +02:00
Tom Tromey
cae21f8ebf Fix regression in variant part handling
My series to change DWARF attribute handling to be type-safe
introduced a regression in gdb.ada/variant.exp.  handle_variant was
using as_unsigned on an attribute with DW_FORM_sdata.  This patch
changes it to use constant_value instead.

2020-09-30  Tom Tromey  <tromey@adacore.com>

	* dwarf2/read.c (handle_variant): Use constant_value.
2020-09-30 09:51:44 -06:00
Przemyslaw Wirkus
77718e5b7d [GAS][AArch64] Add support for Cortex-A78 and Cortex-A78AE
* config/tc-aarch64.c: Add Cortex-A78 and Cortex-A78AE cores.
	* doc/c-aarch64.texi: Update docs.
	* NEWS: Update news.
2020-09-30 14:52:31 +01:00
H.J. Lu
04e433a857 ld: Override the IR definition for non-ELF targets
For non-ELF targets, override the IR definition before all LTO symbols
have been read.

	PR ld/26675
	* plugin.c (plugin_notice): Override the IR definition before
	all LTO symbols have been read for non-ELF targets.
2020-09-30 05:23:35 -07:00
Alex Coplan
c81946efc2 NEWS: Mention recent Arm CPU support
Mentions Armv8-R AArch64, Cortex-R82, Neoverse V1, and Neoverse N2.

gas/ChangeLog:

2020-09-30  Alex Coplan  <alex.coplan@arm.com>

	* NEWS: Mention recent Arm processor support.
2020-09-30 12:15:18 +01:00
Alex Coplan
990e5268d2 aarch64: Add support for Neoverse N2 CPU
This patch adds support for Arm's Neoverse N2 CPU to AArch64 binutils.

gas/ChangeLog:

	* config/tc-aarch64.c (aarch64_cpus): Add neoverse-n2.
	* doc/c-aarch64.texi: Document support for Neoverse N2.
2020-09-30 12:11:56 +01:00
Gary Benson
f65825ec7a Fix gdb.dwarf2/dw2-double-set-die-type.exp with Clang
gdb.dwarf2/dw2-double-set-die-type.exp failed to build with Clang,
because of the following issues:

- One .uleb128 directive was specified with an uppercase U,
  causing Clang to fail with the message:
    error: unknown directive
  This commit converts that directive to all-lowercase.

- The label ".Labbrev1_begin" was referenced but not defined,
  causing Clang to fail with the message:
    <unknown>:0: error: Undefined temporary symbol
  This commit adds the label in the appropriate place.

- The label ".Ldebug_line0" was referenced but not defined,
  causing Clang to fail with the message:
    <unknown>:0: error: Undefined temporary symbol
  This commit removes the reference.

gdb/testsuite/ChangeLog:

	* gdb.dwarf2/dw2-double-set-die-type.S (.Ldie_3e0):
	Convert directive to lowercase.
	(.Labbrev1_begin): Add missing label.
	(abbrev code 0x1): Remove DW_AT_stmt_list.
	(.Ldie_b): Likewise.
2020-09-30 10:51:58 +01:00
Jeremy Drake
51dee44b37 After preventing creating an import library for an exe when there are no exports, to avoid a crash, it turned out that some projects expected to be able to create an import library for a dll with no exports, so more closely match the condition to the condition around initializing the dll name.
PR 26588
	* emultempl/pe.em (_finish): Generate an import library for DLLs,
	even if they have no exports.
	* emultempl/pep.em (_finish): Likewise.
2020-09-30 10:50:46 +01:00
Alan Modra
e37c930f9e gcc-4.4.7 warning fixes
* config/obj-elf.c (obj_elf_change_section): Rename variable to
	avoid shadowing warning.
	* symbols.c (symbol_entry_find): Init all symbol_flags fields.
2020-09-30 14:31:15 +09:30
Tom Tromey
529908cbd0 Remove DW_UNSND
This removes DW_UNSND, replacing uses with either as_unsigned or
constant_value, depending primarily on whether or not the form is
already known to be appropriate.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (lookup_dwo_id, get_type_unit_group)
	(read_file_scope, dwarf2_get_pc_bounds)
	(dwarf2_record_block_ranges, dwarf2_add_field, get_alignment)
	(read_structure_type, handle_struct_member_die)
	(read_enumeration_type, read_array_type, read_set_type)
	(read_tag_pointer_type, read_tag_reference_type)
	(read_subroutine_type, read_base_type, read_subrange_type)
	(read_full_die_1, partial_die_info::read)
	(partial_die_info::read, by, new_symbol)
	(dwarf2_const_value_data, dwarf2_const_value_attr)
	(dump_die_shallow, dwarf2_fetch_constant_bytes)
	(prepare_one_comp_unit): Update.
	* dwarf2/attribute.h (DW_UNSND): Remove.
2020-09-29 20:29:07 -06:00
Tom Tromey
c45bc3f8ab Add attribute::as_boolean method
This adds a new attribute::as_boolean method, and updates the reader
to use it.  The main benefit of this change is that now the code will
respect the attribute's form.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (read_func_scope, prototyped_function_p)
	(read_subroutine_type, partial_die_info::read)
	(dwarf2_flag_true_p, new_symbol, dump_die_shallow)
	(dwarf2_add_member_fn): Update.
	* dwarf2/attribute.h (struct attribute) <as_boolean>: Declare.
	* dwarf2/attribute.c (attribute::as_boolean): New method.
2020-09-29 20:29:07 -06:00
Tom Tromey
23dca5c3d7 Add attribute::as_virtuality method
This adds a new attribute::as_virtuality method and changes the DWARF
reader to use it.  This also ensures that the attibute's form will now
be respected.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (dwarf2_add_field, dwarf2_add_member_fn): Update.
	* dwarf2/attribute.h (struct attribute) <as_virtuality>: New
	method.
	* dwarf2/attribute.c (attribute::as_virtuality): New method.
2020-09-29 20:29:07 -06:00
Tom Tromey
52c14d1128 Change die_info methods to check the attribute's form
This changes two die_info methods to check the form of the attribute
before using it.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/die.h (struct die_info) <addr_base, ranges_base>: Check
	the attribute's form.
2020-09-29 20:29:07 -06:00
Tom Tromey
e8e5c1585d Change is_valid_DW_AT_defaulted to a method on attribute
This changes is_valid_DW_AT_defaulted to be a method on struct attribute.
Now it correctly respects the form of the attribute.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (is_valid_DW_AT_defaulted): Move to attribute.c.
	(dwarf2_add_member_fn): Update.
	* dwarf2/attribute.h (struct attribute) <defaulted>: Declare.
	* dwarf2/attribute.c (attribute::defaulted): New method, from
	is_valid_DW_AT_defaulted.
2020-09-29 20:29:07 -06:00
Tom Tromey
d4df075e8b Add attribute::as_unsigned method
This introduces a new attribute::as_unsigned method and changes a few
spots to use it.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (dw2_get_file_names_reader)
	(dwarf2_build_include_psymtabs, handle_DW_AT_stmt_list)
	(dwarf2_cu::setup_type_unit_groups, fill_in_loclist_baton)
	(dwarf2_symbol_mark_computed): Use as_unsigned.
	* dwarf2/attribute.h (struct attribute) <as_unsigned>: New
	method.
	<form_is_section_offset>: Update comment.
2020-09-29 20:29:07 -06:00
Tom Tromey
bf23a26804 Change how accessibility is handled in dwarf2/read.c
dwarf2/read.c uses dwarf2_default_access_attribute to check for the
default access attribute.  This patch simplifies the code by moving
more of the access processing into this function, changing its name to
reflect the difference.  This also ensures that the attribute's form
is respected, by changing to code to use the constant_value method.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (dwarf2_access_attribute): Rename from
	dwarf2_default_access_attribute.  Look up attribute.
	(dwarf2_add_field, dwarf2_add_type_defn, dwarf2_add_member_fn):
	Update.
2020-09-29 20:29:07 -06:00
Tom Tromey
7a5f294dbd Change how reprocessing is done
Currently gdb keeps a vector of attributes that require reprocessing.
However, now that there is a reprocessing flag in the attribute, we
can remove the vector and instead simply loop over attributes a second
time.  Normally there are not many attributes, so this should be
reasonably cheap.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (skip_one_die): Update.
	(read_full_die_1): Change how reprocessing is done.
	(partial_die_info::read): Update.
	(read_attribute_value): Remove need_reprocess parameter.
	(read_attribute): Likewise.
	* dwarf2/attribute.h (struct attribute) <requires_reprocessing_p>:
	New method.
2020-09-29 20:29:07 -06:00
Tom Tromey
36d378cf86 Remove DW_ADDR
This removes DW_ADDR in favor of accessor methods.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (read_attribute_reprocess, read_attribute_value)
	(dwarf2_const_value_attr, dump_die_shallow)
	(dwarf2_fetch_constant_bytes): Update.
	* dwarf2/attribute.h (struct attribute) <form_is_ref>: Update
	comment.
	<set_address>: New method.
	(DW_ADDR): Remove.
	* dwarf2/attribute.c (attribute::form_is_ref): Update comment.
	(attribute::as_string, attribute::as_address): Add assert.
2020-09-29 20:29:07 -06:00
Tom Tromey
fe56917a86 Add reprocessing flag to struct attribute
Some forms require "reprocessing" -- a second pass to update their
value appropriately.  In this case, we'll set the unsigned value on
the attribute, and then later set it to the correct value.

To handle this, we introduce a reprocessing flag to attribute.  Then,
we manage this flag to ensure that setting and unsetting is done
properly.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (read_cutu_die_from_dwo): Use OBSTACK_ZALLOC.
	(read_attribute_reprocess, read_attribute_value): Update.
	(read_attribute): Clear requires_reprocessing.
	* dwarf2/attribute.h (struct attribute) <as_unsigned_reprocess,
	form_requires_reprocessing>: New methods.
	<string_init>: Clear requires_reprocessing.
	<set_unsigned_reprocess>: New method.
	<name>: Shrink by one bit.
	<requires_reprocessing>: New member.
	* dwarf2/attribute.c (attribute::form_requires_reprocessing): New
	method.
2020-09-29 20:29:06 -06:00
Tom Tromey
414ad644a8 Use setter for attribute's unsigned value
This adds form_is_unsigned and an unsigned setter method to struct
attribute, and updates the remaining code.  Now DW_UNSND is no longer
used as an lvalue.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (read_attribute_value): Update.
	* dwarf2/attribute.h (struct attribute) <form_is_unsigned,
	set_unsigned>: New methods.
	* dwarf2/attribute.c (attribute::form_is_unsigned): New method.
2020-09-29 20:29:06 -06:00
Tom Tromey
1bc397c561 Remove DW_SND
This removes DW_SND in favor of accessors on struct attribute.
These accessors check that the form is appropriate.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (get_alignment, read_array_order)
	(read_attribute_value, dwarf2_const_value_attr)
	(dump_die_shallow, dwarf2_fetch_constant_bytes): Update.
	* dwarf2/attribute.h (struct attribute) <as_signed, set_signed>:
	New methods.
	(DW_SND): Remove.
2020-09-29 20:29:06 -06:00
Tom Tromey
630ed6b975 Remove DW_SIGNATURE
This removes DW_SIGNATURE in favor of methods on struct attribute.  As
usual, the methods check the form, which DW_SIGNATURE did not do.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (read_attribute_value, lookup_die_type)
	(dump_die_shallow, follow_die_sig, get_DW_AT_signature_type):
	Update.
	* dwarf2/attribute.h (struct attribute) <as_signature,
	set_signature>: New methods.
	(DW_SIGNATURE): Remove.
2020-09-29 20:29:06 -06:00
Tom Tromey
9d2246fce0 Remove DW_BLOCK
This removes the DW_BLOCK accessor in favor of methods on struct
attribute.  The methods, unlike the access, check the form.

Note that DW_FORM_data16 had to be handled by form_is_block, because
in practice that is how we store values of this form.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (read_call_site_scope)
	(handle_data_member_location, dwarf2_add_member_fn)
	(mark_common_block_symbol_computed, attr_to_dynamic_prop)
	(partial_die_info::read, read_attribute_value)
	(var_decode_location, dwarf2_const_value_attr, dump_die_shallow)
	(dwarf2_fetch_die_loc_sect_off, dwarf2_fetch_constant_bytes)
	(dwarf2_symbol_mark_computed): Update.
	* dwarf2/attribute.h (struct attribute) <as_block, set_block>: New
	methods.
	(DW_BLOCK): Remove.
	* dwarf2/attribute.c (attribute::form_is_block): Add
	DW_FORM_data16.
2020-09-29 20:29:06 -06:00
Tom Tromey
c648120540 Remove DW_STRING and DW_STRING_IS_CANONICAL
This removes DW_STRING and DW_STRING_IS_CANONICAL, replacing them with
accessor methods on struct attribute.  The new code ensures that a
string value will only ever be used when the form allows it.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (read_cutu_die_from_dwo)
	(read_attribute_reprocess, read_attribute_value, read_attribute)
	(dwarf2_const_value_attr, dwarf2_name, dump_die_shallow)
	(dwarf2_fetch_constant_bytes): Update.
	* dwarf2/attribute.h (struct attribute) <form_is_string>: Declare.
	<set_string_noncanonical, set_string_canonical>: New methods.
	<string_is_canonical>: Update comment.
	<canonical_string_p>: Add assert.
	(DW_STRING, DW_STRING_IS_CANONICAL): Remove.
	* dwarf2/attribute.c (attribute::form_is_string): New method.
	(attribute::string): Use it.
2020-09-29 20:29:06 -06:00
Tom Tromey
3b64bf15bc Remove some uses of DW_STRING_IS_CANONICAL
This removes the rvalue uses of DW_STRING_IS_CANONICAL, replacing them
with an accessor method.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (anonymous_struct_prefix, dwarf2_name)
	(dump_die_shallow): Use canonical_string_p.
	* dwarf2/attribute.h (struct attribute) <canonical_string_p>: New
	method.
2020-09-29 20:29:06 -06:00
Tom Tromey
2c830f5475 Change some uses of DW_STRING to string method
This changes some of the simpler spots to use attribute::string rather
than DW_STRING.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (partial_die_info::read)
	(dwarf2_const_value_attr, anonymous_struct_prefix, )
	(dwarf2_name, dwarf2_fetch_constant_bytes): Use
	attribute::as_string.
2020-09-29 20:29:06 -06:00
Tom Tromey
6c412691f9 Avoid using DW_* macros in dwarf2/attribute.c
There's no need to use the DW_* accessor macros in dwarf2/attribute.c,
and this is a necessary step toward our goal of removing them
entirely.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/attribute.c (attribute::address): Don't use DW_UNSND or
	DW_ADDR.
	(attribute::string): Don't use DW_STRING.
	(attribute::get_ref_die_offset): Don't use DW_UNSND.
	(attribute::constant_value): Don't use DW_UNSND or DW_SND.
2020-09-29 20:29:06 -06:00
Tom Tromey
95f982e587 Rename struct attribute accessors
This removes the "value_" prefix from the struct value accessors.
This seemed unnecessarily wordy to me.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (dwarf2_find_base_address, read_call_site_scope)
	(dwarf2_get_pc_bounds, dwarf2_record_block_ranges)
	(partial_die_info::read, dwarf2_string_attr, new_symbol): Update.
	* dwarf2/attribute.h (struct attribute): Rename methods.
	* dwarf2/attribute.c (attribute::as_address): Rename from
	value_as_address.
	(attribute::as_string): Rename from value_as_string.
2020-09-29 20:29:06 -06:00
Tom Tromey
f800b00e51 Add attribute::value_as_string method
The full DIE reader checks that an attribute has a "string" form in
some spots, but the partial DIE reader does not.  This patch brings
the two readers in sync for one specific case, namely when examining
the linkage name.  This avoids regressions in an existing DWARF test
case.

A full fix for this problem would be preferable.  An accessor like
DW_STRING should always check the form.  However, I haven't attempted
that in this series.

Also the fact that the partial and full readers can disagree like this
is a design flaw.

gdb/ChangeLog
2020-09-29  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (partial_die_info::read) <case
	DW_AT_linkage_name>: Use value_as_string.
	(dwarf2_string_attr): Use value_as_string.
	* dwarf2/attribute.h (struct attribute) <value_as_string>: Declare
	method.
	* dwarf2/attribute.c (attribute::value_as_string): New method.
2020-09-29 20:29:06 -06:00
GDB Administrator
9dc318a3e5 Automatic date update in version.in 2020-09-30 00:00:06 +00:00
Pedro Alves
de38d64ad2 Tweak gdbsupport/valid-expr.h for GCC 6, fix build
With GCC 6.4 and 6.5 (at least), unit tests that use
gdbsupport/valid-expr.h's CHECK_VALID fail to compile, with:

 In file included from src/gdb/unittests/offset-type-selftests.c:24:0:
 src/gdb/unittests/offset-type-selftests.c: In substitution of 'template<class Expected, template<class ...> class Op, class ... Args> using is_detected_exact = std::is_same<Expected, typename gdb::detection_detail::detector<gdb::nonesuch, void, Op, Args ...>::type> [with Expected = selftests::offset_type::off_A&; Op = selftests::offset_type::check_valid_expr75::archetype; Args = {selftests::offset_type::off_A, selftests::offset_type::off_B}]':
 src/gdb/unittests/offset-type-selftests.c:75:1:   required from here
 src/gdb/../gdbsupport/valid-expr.h:65:20: error: type/value mismatch at argument 2 in template parameter list for 'template<class Expected, template<class ...> class Op, class ... Args> using is_detected_exact = std::is_same<Expected, typename gdb::detection_detail::detector<gdb::nonesuch, void, Op, Args ...>::type>'
     archetype, TYPES>::value == VALID,   \
		     ^

The important part is the "error: type/value mismatch" error.  Seems
like that GCC doesn't understand that archetype is an alias template,
and is being strict in requiring a template class.

The fix here is then to make archetype a template class, to pacify
GCC.  The resulting code looks like this:

  template <TYPENAMES, typename = decltype (EXPR)>
  struct archetype
  {
  };

  static_assert (gdb::is_detected_exact<archetype<TYPES, EXPR_TYPE>,
 		 archetype, TYPES>::value == VALID, "");

is_detected_exact<Expected, Op, Args> checks whether Op<Args> is type
Expected:

 - For Expected, we pass the explicit EXPR_TYPE, overriding the
   default parameter type of archetype.

 - For Args we don't pass the last template parameter, so archtype
   defaults to the EXPR's decltype.

So in essence, we're really checking whether EXPR_TYPE is the same as
decltype(EXPR).

We need to do the decltype in a template context in order to trigger
SFINAE instead of failing to compile.


The hunk in unittests/enum-flags-selftests.c becomes necessary,
because unlike with the current alias template version, this new
version makes GCC trigger -Wenum-compare warnings as well:

 src/gdb/unittests/enum-flags-selftests.c:328:33: error: comparison between 'enum selftests::enum_flags_tests::RE' and 'enum selftests::enum_flags_tests::RE2' [-Werror=enum-compare]
  CHECK_VALID (true,  bool, RE () != RE2 ())
				  ^
 src/gdb/../gdbsupport/valid-expr.h:61:45: note: in definition of macro 'CHECK_VALID_EXPR_INT'
    template <TYPENAMES, typename = decltype (EXPR)>   \
					      ^

Build-tested with:

 - GCC {4.8.5, 6.4, 6.5, 7.3.1, 9.3.0, 11.0.0-20200910}
 - Clang 10.0.0

gdbsupport/ChangeLog:

	* valid-expr.h (CHECK_VALID_EXPR_INT): Make archetype a template
	class instead of an alias template and adjust static_assert.

gdb/ChangeLog:

	* unittests/enum-flags-selftests.c: Check whether __GNUC__ is
	defined before using '#pragma GCC diagnostic' instead of checking
	__clang__.
2020-09-29 23:48:04 +01:00
Przemyslaw Wirkus
aeaccbf4c5 Add a note about recent changes to the AArch64 assembler: TRBE, ETE and ETMv4 system registers and Cortex-X1 enablement.
gas	* NEWS: TRBE, ETE, ETMv4 and Cortex-X1 news updates.
2020-09-29 16:43:57 +01:00
Mark Wielaard
1c9f770d16 binutils: dwarf.c handle DWARF5 DW_LLE_start_end and DW_LLE_start_length.
display_loclists_list only handled DW_LLE_offset_pair as bounded
location description. Also handle DW_LLE_start_end and DW_LLE_start_lenght.
These don't use the base_address.

binutils/ChangeLog:

      * dwarf.c (display_loclists_list): Handle DW_LLE_start_end and
      DW_LLE_start_length. Only add base_address for DW_LLE_offset_pair.
2020-09-29 14:08:51 +02:00
Tom Tromey
9aed480c3a Turn target_have_steppable_watchpoint into function
This changes the object-like macro target_have_steppable_watchpoint
into an inline function.

gdb/ChangeLog
2020-09-28  Tom Tromey  <tom@tromey.com>

	* infrun.c (displaced_step_fixup, thread_still_needs_step_over)
	(handle_signal_stop): Update.
	* procfs.c (procfs_target::insert_watchpoint): Update.
	* target.h (target_have_steppable_watchpoint): Now a function.
2020-09-28 19:52:21 -06:00
Tom Tromey
8a3ecb79b0 Turn target_can_lock_scheduler into a function
This changes the object-like macro target_can_lock_scheduler into an
inline function.

gdb/ChangeLog
2020-09-28  Tom Tromey  <tom@tromey.com>

	* infrun.c (set_schedlock_func): Update.
	* target.h (target_can_lock_scheduler): Now a function.
2020-09-28 19:52:21 -06:00
Tom Tromey
55f6301ac0 Remove target_has_execution macro
This removes the object-like macro target_has_execution, replacing it
with a function call.  target_has_execution_current is also now
handled by this function.

gdb/ChangeLog
2020-09-28  Tom Tromey  <tom@tromey.com>

	* inferior.h (class inferior) <has_execution>: Update.
	* windows-tdep.c (windows_solib_create_inferior_hook): Update.
	* valops.c (find_function_in_inferior)
	(value_allocate_space_in_inferior): Update.
	* top.c (kill_or_detach): Update.
	* target.c (target_preopen, set_target_permissions): Update.
	(target_has_execution_current): Remove.
	* sparc64-tdep.c (adi_examine_command, adi_assign_command):
	Update.
	* solib.c (update_solib_list, reload_shared_libraries): Update.
	* solib-svr4.c (svr4_solib_create_inferior_hook): Update.
	* solib-dsbt.c (enable_break): Update.
	* score-tdep.c (score7_fetch_inst): Update.
	* rs6000-nat.c (rs6000_nat_target::xfer_shared_libraries):
	Update.
	* remote.c (remote_target::start_remote)
	(remote_target::remote_check_symbols, remote_target::open_1)
	(remote_target::remote_detach_1, remote_target::verify_memory)
	(remote_target::xfer_partial, remote_target::read_description)
	(remote_target::get_min_fast_tracepoint_insn_len): Update.
	* record-full.c (record_full_open_1): Update.
	* record-btrace.c (record_btrace_target_open): Update.
	* objc-lang.c (lookup_objc_class, lookup_child_selector)
	(value_nsstring): Update.
	* linux-thread-db.c (add_thread_db_info)
	(thread_db_find_new_threads_silently, check_thread_db_callback)
	(try_thread_db_load_1, record_thread): Update.
	* linux-tdep.c (linux_info_proc, linux_vsyscall_range_raw):
	Update.
	* linux-fork.c (checkpoint_command): Update.
	* infrun.c (set_non_stop, set_observer_mode)
	(check_multi_target_resumption, for_each_just_stopped_thread)
	(maybe_remove_breakpoints, normal_stop)
	(class infcall_suspend_state): Update.
	* infcmd.c (ERROR_NO_INFERIOR, kill_if_already_running)
	(info_program_command, attach_command): Update.
	* infcall.c (call_function_by_hand_dummy): Update.
	* inf-loop.c (inferior_event_handler): Update.
	* gcore.c (gcore_command, derive_heap_segment): Update.
	* exec.c (exec_file_command): Update.
	* eval.c (evaluate_subexp): Update.
	* compile/compile.c (compile_to_object): Update.
	* cli/cli-dump.c (restore_command): Update.
	* breakpoint.c (update_watchpoint)
	(update_inserted_breakpoint_locations)
	(insert_breakpoint_locations, get_bpstat_thread): Update.
	* target.h (target_has_execution): Remove macro.
	(target_has_execution_current): Don't declare.
	(target_has_execution): Rename from target_has_execution_1.  Add
	argument default.
2020-09-28 19:52:21 -06:00
Tom Tromey
05374cfd90 Turn target_can_execute_reverse into function
This changes target_can_execute_reverse from an object-like macro to
an inline function.

gdb/ChangeLog
2020-09-28  Tom Tromey  <tom@tromey.com>

	* mi/mi-main.c (exec_reverse_continue)
	(mi_cmd_list_target_features): Update.
	* infrun.c (set_exec_direction_func): Update.
	* target.c (default_execution_direction): Update.
	* reverse.c (exec_reverse_once): Update.
	* target.h (target_can_execute_reverse): Now a function.
2020-09-28 19:52:21 -06:00
Tom Tromey
9dccd06e8a Remove target_has_registers macro
This removes the target_has_registers object-like macro, replacing it
with the underlying function.

gdb/ChangeLog
2020-09-28  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.c (tui_get_register)
	(tui_data_window::show_registers): Update.
	* thread.c (scoped_restore_current_thread::restore)
	(scoped_restore_current_thread::scoped_restore_current_thread):
	Update.
	* regcache-dump.c (regcache_print): Update.
	* python/py-finishbreakpoint.c (bpfinishpy_detect_out_scope_cb):
	Update.
	* mi/mi-main.c (mi_cmd_data_write_register_values): Update.
	* mep-tdep.c (current_me_module, current_options): Update.
	* linux-thread-db.c (thread_db_load): Update.
	* infcmd.c (registers_info, info_vector_command)
	(info_float_command): Update.
	* ia64-tdep.c (ia64_frame_prev_register)
	(ia64_sigtramp_frame_prev_register): Update.
	* ia64-libunwind-tdep.c (libunwind_frame_prev_register): Update.
	* gcore.c (derive_stack_segment): Update.
	* frame.c (get_current_frame, has_stack_frames): Update.
	* findvar.c (language_defn::read_var_value): Update.
	* arm-tdep.c (arm_pc_is_thumb): Update.
	* target.c (target_has_registers): Rename from
	target_has_registers_1.
	* target.h (target_has_registers): Remove macro.
	(target_has_registers): Rename from target_has_registers_1.
2020-09-28 19:52:21 -06:00
Tom Tromey
841de12014 Remove target_has_stack macro
This removes the target_has_stack object-like macro, replacing it with
the underlying function.

gdb/ChangeLog
2020-09-28  Tom Tromey  <tom@tromey.com>

	* windows-tdep.c (tlb_make_value): Update.
	* tui/tui-regs.c (tui_data_window::show_registers): Update.
	* thread.c (scoped_restore_current_thread::restore)
	(scoped_restore_current_thread::scoped_restore_current_thread)
	(thread_command): Update.
	* stack.c (backtrace_command_1, frame_apply_level_command)
	(frame_apply_all_command, frame_apply_command): Update.
	* infrun.c (siginfo_make_value, restore_infcall_control_state):
	Update.
	* gcore.c (derive_stack_segment): Update.
	* frame.c (get_current_frame, has_stack_frames): Update.
	* auxv.c (info_auxv_command): Update.
	* ada-tasks.c (ada_build_task_list): Update.
	* target.c (target_has_stack): Rename from target_has_stack_1.
	* target.h (target_has_stack): Remove macro.
	(target_has_stack): Rename from target_has_stack_1.
2020-09-28 19:52:21 -06:00
Tom Tromey
a739972c7c Remove target_has_memory macro
This removes the target_has_memory object-like macro, replacing it
with the underlying function.

gdb/ChangeLog
2020-09-28  Tom Tromey  <tom@tromey.com>

	* target.c (target_has_memory): Rename from target_has_memory_1.
	* tui/tui-regs.c (tui_data_window::show_registers): Update.
	* thread.c (scoped_restore_current_thread::restore)
	(scoped_restore_current_thread::scoped_restore_current_thread):
	Update.
	* frame.c (get_current_frame, has_stack_frames): Update.
	* target.h (target_has_memory): Remove macro.
	(target_has_memory): Rename from target_has_memory_1.
2020-09-28 19:52:21 -06:00
Tom Tromey
5b8a477608 Remove target_has_all_memory
target_has_all_memory isn't used anywhere, so this patch removes it.

gdb/ChangeLog
2020-09-28  Tom Tromey  <tom@tromey.com>

	* target.c (target_has_all_memory_1): Remove.
	* target.h (target_has_all_memory): Remove define.
	(target_has_all_memory_1): Don't declare.
2020-09-28 19:52:21 -06:00
GDB Administrator
2714a459f8 Automatic date update in version.in 2020-09-29 00:00:07 +00:00
Simon Marchi
bd356ec6c0 gdb: fix formatting of serial::async_state's enumerators
The comments related to these enumerators are placed under the
corresponding enumerator.  This is quite unusual and confusing.  Change
it to have the comments above, as usual.

gdb/ChangeLog:

	* ser-base.c: Adjust comments formatting.

Change-Id: If2ea143a7d5217efa5ac088102ddb1933fbcb16a
2020-09-28 14:21:24 -04:00