aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-10-02gdb: give names to async event/signal handlersSimon Marchi10-23/+59
Assign names to async event/signal handlers. They will be used in debug messages when file handlers are invoked. Unlike in the previous patch, the names are not copied in the structure, since we don't need to (all names are string literals for the moment). gdb/ChangeLog: * async-event.h (create_async_signal_handler): Add name parameter. (create_async_event_handler): Likewise. * async-event.c (struct async_signal_handler) <name>: New field. (struct async_event_handler) <name>: New field. (create_async_signal_handler): Assign name. (create_async_event_handler): Assign name. * event-top.c (async_init_signals): Pass name when creating handler. * infrun.c (_initialize_infrun): Likewise. * record-btrace.c (record_btrace_push_target): Likewise. * record-full.c (record_full_open): Likewise. * remote-notif.c (remote_notif_state_allocate): Likewise. * remote.c (remote_target::open_1): Likewise. * tui/tui-win.c (tui_initialize_win): Likewise. Change-Id: Icd9d9f775542ae5fc2cd148c12f481e7885936d5
2020-10-02gdb: give names to event loop file handlersSimon Marchi15-30/+85
Assign names to event loop file handlers. They will be used in debug messages when file handlers are invoked. In GDB, each UI used to get its own unique number, until commit cbe256847e19 ("Remove ui::num"). Re-introduce this field, and use it to make a unique name for the handler. I'm not too sure what goes on in ser-base.c, all I know is that it's what is used when debugging remotely. I've just named the main handler "serial". It would be good to have unique names there too. For instance when debugging with two different remote connections, we'd ideally want the handlers to have unique names. I didn't do it in this patch though. gdb/ChangeLog: * async-event.c (initialize_async_signal_handlers): Pass name to add_file_handler * event-top.c (ui_register_input_event_handler): Likewise. * linux-nat.c (linux_nat_target::async): Likewise. * run-on-main-thread.c (_initialize_run_on_main_thread): Likewise * ser-base.c (reschedule): Likewise. (ser_base_async): Likewise. * tui/tui-io.c: Likewise. * top.h (struct ui) <num>: New field. * top.c (highest_ui_num): New variable. (ui::ui): Initialize num. gdbserver/ChangeLog: * linux-low.cc (linux_process_target::async): Pass name to add_file_handler. * remote-utils.cc (handle_accept_event): Likewise. (remote_open): Likewise. gdbsupport/ChangeLog: * event-loop.h (add_file_handler): Add "name" parameter. * event-loop.cc (struct file_handler) <name>: New field. (create_file_handler): Add "name" parameter, assign it to file handler. (add_file_handler): Add "name" parameter. Change-Id: I9f1545f73888ebb6778eb653a618ca44d105f92c
2020-10-02gdb: remove arguments from inferior_created observableSimon Marchi15-18/+24
I noticed that non of the listeners of the inferior_created observable used either of the arguments. Remove them. This in turn allows removing the target parameter of post_create_inferior. Tested only by rebuilding. gdb/ChangeLog: * observable.h <inferior_created>: Remove parameters. Update all listeners. * inferior.h (post_create_inferior): Remove target parameter. Update all callers. Change-Id: I8944cefdc4447ed5347dc927b75abf1e7a0e27e6
2020-10-02Fix spelling mistake in gdb/testsuite/README.Gary Benson2-1/+5
This commit corrects the spelling mistake detailed below. gdb/testsuite/ChangeLog: * README: Fix "paralell".
2020-10-02Fix the mve-vcvtne-it assembler test for the arm-*-pe targets.Nick Clifton2-1/+7
* testsuite/gas/arm/mve-vcvtne-it.d: Allow for padding inserted by PE based targets.
2020-10-02Allow note sections to be discarded when they are linked to another ↵H.J. Lu6-1/+33
discarded secction. PR 26681 bfd * elflink.c (bfd_elf_gc_sections): Do not arbitrarily keep note sections which are linked to another section. ld * testsuite/ld-elf/pr26681.s: New test. * testsuite/ld-elf/pr26681.d: New test driver. * testsuite/ld-elf/pr26681.l: New test output.
2020-10-02DWARFv5: Handle DW_MACRO_define_strx and DW_MACRO_undef_strx macro entries.nitachra4-4/+101
GDB complaints "During symbol reading: unrecognized DW_MACFINO opcode 0xb" with the testcase given below. Clang is emitting DW_MACRO_define_strx and DW_MACRO_undef_strx entries in .debug_macro section which are not supported in GDB. This patch handles them. DW_MACRO_define_strx and DW_MACRO_undef_strx are added in DWARFv5. They have two operands. The first operand encodes the line number of the #define or #undef macro directive. The second operand identifies a string; it is represented using an unsigned LEB128 encoded value, which is interpreted as a zero-based index into an array of offsets in the .debug_str_offsets section. This is as per the section 6.3.2.1 of Dwarf Debugging Information Format Version 5. Test case used: #define MAX_SIZE 10 int main(void) { int size = 0; size = size + MAX_SIZE; printf("\n The value of size is [%d]\n",size); return 0; } clang -gdwarf-5 -fdebug-macro macro.c -o macro.out Before the patch: gdb/new_gdb/binutils-gdb/build/bin/gdb -q macro.out -ex "set complaints 1" -ex "start" Reading symbols from macro.out... During symbol reading: unrecognized DW_MACFINO opcode 0xb Temporary breakpoint 1 at 0x4004df: file macro.c, line 7. Starting program: /home/nitika/workspace/macro.out Temporary breakpoint 1, main () at macro.c:7 7 int size = 0; (gdb) Tested by running the testsuite before and after the patch with -gdwarf-5 and there is no increase in the number of test cases that fails. Used clang 11.0.0. gdb/ChangeLog: * dwarf2/macro.c (dwarf_decode_macro_bytes): Handle DW_MACRO_define_strx and DW_MACRO_undef_strx. (dwarf_decode_macros): Likewise * dwarf2/read.c (dwarf_decode_macros): Pass str_offsets_base in the parameters which is the value of DW_AT_str_offsets_base. * dwarf2/macro.h (dwarf_decode_macros): Modify the definition to include str_offsets_base.
2020-10-02Automatic date update in version.inGDB Administrator1-1/+1
2020-10-02Fix the i386 buildKamil Rytarowski2-1/+4
Remove old, no longer needed and no longer valid extern. ../../gdb/i386-nbsd-tdep.c:58:12: error: 'i386nbsd_sc_reg_offset' was declared 'extern' and later 'static' [-fpermissive] 58 | static int i386nbsd_sc_reg_offset[] = | ^~~~~~~~~~~~~~~~~~~~~~ In file included from ../../gdb/i386-nbsd-tdep.c:31: ../../gdb/i386-tdep.h:480:12: note: previous declaration of 'i386nbsd_sc_reg_offset' 480 | extern int i386nbsd_sc_reg_offset[]; | ^~~~~~~~~~~~~~~~~~~~~~ gdb/ChangeLog: * i386-tdep.h (i386nbsd_sc_reg_offset): Remove.
2020-10-02Remove the old sanity check of sigcontext offsets for NetBSD/i386Kamil Rytarowski3-6/+7
NetBSD switched to ucontext, back in 2003 and the sigcontext code is no longer available for users, except for legacy compat layers. This code was not available anyway as the pre-processor check was probably never operational and buildable on NetBSD. The code inside it does not compile. Meanwhile, move the offset variable into the ifdef goards and avoid the error about unused variable. ../../gdb/i386-bsd-nat.c: In function 'void _initialize_i386bsd_nat()': ../../gdb/i386-bsd-nat.c:347:7: error: unused variable 'offset' [-Werror=unused-variable] 347 | int offset; | ^~~~~~ cc1plus: all warnings being treated as errors gdb/ChangeLog: * i386-bsd-nat.c (_initialize_i386bsd_nat): Update. * i386-nbsd-tdep.c (i386nbsd_sc_reg_offset): Now static.
2020-10-02Add NetBSD/i386 gdbserver supportKamil Rytarowski4-0/+170
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-02Refactor the NetBSD amd64 gdbserver supportKamil Rytarowski4-46/+67
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-02Preinitialize the sockaddr_un variable to zeroKamil Rytarowski2-2/+5
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-02Include the x86-bsd-nat.h header and fix the NetBSD/i386 buildKamil Rytarowski2-0/+6
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-01Add new directive to GAS: .attach_to_group.Nick Clifton11-1/+108
* 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-01Automatic date update in version.inGDB Administrator1-1/+1
2020-09-30x86: Check register operand for AddrPrefixOpRegH.J. Lu8-34/+114
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[gdb] Fix regression in dwarf2_nameTom de Vries2-0/+7
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-30Fix regression in variant part handlingTom Tromey2-2/+6
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[GAS][AArch64] Add support for Cortex-A78 and Cortex-A78AEPrzemyslaw Wirkus4-0/+24
* config/tc-aarch64.c: Add Cortex-A78 and Cortex-A78AE cores. * doc/c-aarch64.texi: Update docs. * NEWS: Update news.
2020-09-30ld: Override the IR definition for non-ELF targetsH.J. Lu2-2/+10
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-30NEWS: Mention recent Arm CPU supportAlex Coplan2-0/+9
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-30aarch64: Add support for Neoverse N2 CPUAlex Coplan3-0/+16
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-30Fix gdb.dwarf2/dw2-double-set-die-type.exp with ClangGary Benson2-4/+10
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-30After preventing creating an import library for an exe when there are no ↵Jeremy Drake3-2/+11
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-30gcc-4.4.7 warning fixesAlan Modra3-3/+10
* 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-29Remove DW_UNSNDTom Tromey3-89/+102
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-29Add attribute::as_boolean methodTom Tromey4-15/+40
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-29Add attribute::as_virtuality methodTom Tromey4-2/+37
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-29Change die_info methods to check the attribute's formTom Tromey2-5/+22
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-29Change is_valid_DW_AT_defaulted to a method on attributeTom Tromey4-21/+40
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-29Add attribute::as_unsigned methodTom Tromey3-12/+31
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-29Change how accessibility is handled in dwarf2/read.cTom Tromey2-22/+26
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-29Change how reprocessing is doneTom Tromey3-32/+47
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-29Remove DW_ADDRTom Tromey4-9/+37
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-29Add reprocessing flag to struct attributeTom Tromey4-6/+71
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-29Use setter for attribute's unsigned valueTom Tromey4-26/+66
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-29Remove DW_SNDTom Tromey3-9/+36
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-29Remove DW_SIGNATURETom Tromey3-6/+29
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-29Remove DW_BLOCKTom Tromey4-74/+124
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-29Remove DW_STRING and DW_STRING_IS_CANONICALTom Tromey4-49/+81
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-29Remove some uses of DW_STRING_IS_CANONICALTom Tromey3-4/+21
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-29Change some uses of DW_STRING to string methodTom Tromey2-28/+43
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-29Avoid using DW_* macros in dwarf2/attribute.cTom Tromey2-5/+13
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-29Rename struct attribute accessorsTom Tromey4-16/+26
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-29Add attribute::value_as_string methodTom Tromey2-5/+9
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-30Automatic date update in version.inGDB Administrator1-1/+1
2020-09-29Tweak gdbsupport/valid-expr.h for GCC 6, fix buildPedro Alves4-10/+33
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-29Add a note about recent changes to the AArch64 assembler: TRBE, ETE and ↵Przemyslaw Wirkus2-0/+15
ETMv4 system registers and Cortex-X1 enablement. gas * NEWS: TRBE, ETE, ETMv4 and Cortex-X1 news updates.
2020-09-29binutils: dwarf.c handle DWARF5 DW_LLE_start_end and DW_LLE_start_length.Mark Wielaard2-4/+24
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.