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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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__.
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.
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.
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.
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.
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
gas * testsuite/gas/aarch64/ete.d: New test.
* testsuite/gas/aarch64/ete.s: New test.
opcodes * aarch64-opc.c: Add ETE system registers TRCEXTINSELR<0-3> and TRCRSR.
gas * testsuite/gas/aarch64/trbe-invalid.d: New test.
* testsuite/gas/aarch64/trbe-invalid.l: New test.
* testsuite/gas/aarch64/trbe-invalid.s: New test.
* testsuite/gas/aarch64/trbe.d: New test.
* testsuite/gas/aarch64/trbe.s: New test.
opcodes * aarch64-opc.c: Add TRBE system registers TRBIDR_EL1 , TRBBASER_EL1 ,
TRBLIMITR_EL1 , TRBMAR_EL1 , TRBPTR_EL1, TRBSR_EL1 and TRBTRG_EL1.
This simple follow-on patch adds a feature bit (FP16) that was missing
from the initial Neoverse V1 support.
gas/ChangeLog:
* config/tc-arm.c (arm_cpus): Add FP16 to Neoverse V1.
This simple follow-on patch groups the Neoverse cores together and adds
a missing feature bit (F16) to the entry for Neoverse V1.
gas/ChangeLog:
* config/tc-aarch64.c (aarch64_cpus): Group Neoverse cores
together, add missing F16 bit to Neoverse V1.