aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-11-23[testsuite] Pass -g3 to clang in gdb.base/macscp.expYao Qi2-1/+5
clang accepts option -g3 too. I checked the manual of xlc and icc, looks they don't accept -g3 option, so I don't pass -g3 for them. gdb/testsuite: 2017-11-23 Yao Qi <yao.qi@linaro.org> * gdb.base/macscp.exp: Append -g3 to additional_flags for clang.
2017-11-23Add Disp8MemShift for AVX512 VAES instructions.Igor Tsimbalist21-120/+244
opcodes/ * i386-opc.tbl: Add Disp8MemShift for AVX512 VAES instructions. * i386-tbl.h: Regenerate. gas/ * testsuite/gas/i386/avx512f_vaes-intel.d: Regenerate. * testsuite/gas/i386/avx512f_vaes.d: Likewise. * testsuite/gas/i386/avx512f_vaes-wig1-intel.d: Likewise. * testsuite/gas/i386/avx512f_vaes-wig1.d: Likewise. * testsuite/gas/i386/avx512vl_vaes-intel.d: Likewise. * testsuite/gas/i386/avx512vl_vaes.d: Likewise. * testsuite/gas/i386/x86-64-avx512f_vaes.s: Add instructions with disp8*N. * testsuite/gas/i386/x86-64-avx512f_vaes-intel.d: Regenerate. * testsuite/gas/i386/x86-64-avx512f_vaes.d: Likewise. * testsuite/gas/i386/x86-64-avx512f_vaes-wig.s: Add instructions with disp8*N. * testsuite/gas/i386/x86-64-avx512f_vaes-wig1-intel.d: Regenerate. * testsuite/gas/i386/x86-64-avx512f_vaes-wig1.d: Likewise. * testsuite/gas/i386/x86-64-avx512vl_vaes-intel.d: Regenerate. * testsuite/gas/i386/x86-64-avx512vl_vaes.d: Likewise. * testsuite/gas/i386/x86-64-avx512vl_vaes-wig.s: Add instructions with disp8*N. * testsuite/gas/i386/x86-64-avx512vl_vaes-wig1-intel.d: Regenerate. * testsuite/gas/i386/x86-64-avx512vl_vaes-wig1.d: Regenerate.
2017-11-23Don't move weak alias dyn_relocs to weakdefAlan Modra3-109/+113
I did this for powerpc64 a while ago. Not moving weak symbol dyn_relocs to the strong alias makes for a much simpler test for dynamic relocs in relocate_section. This patch implements the change for powerpc and hppa. Other targets could benefit from similar changes. * elf32-hppa.c (pc_dynrelocs): Define. (elf32_hppa_copy_indirect_symbol): Don't copy dyn_relocs to weakdefs. (alias_readonly_dynrelocs): New function. (elf32_hppa_adjust_dynamic_symbol): Don't clear non_got_ref to indicate dyn_relocs should be discarded, discard them here. Use alias_readonly_dynrelocs. (allocate_dynrelocs): Don't test or clear non_got_ref. (elf32_hppa_relocate_section): Simplify test for dynamic relocs. * elf32-ppc.c (ppc_elf_copy_indirect_symbol): Don't copy dyn_relocs to weakdefs. (alias_readonly_dynrelocs, pc_dynrelocs): New functions. (ppc_elf_adjust_dynamic_symbol): Don't clear non_got_ref to indicate dyn_relocs should be discarded, discard them here. Use alias_readonly_dynrelocs. (allocate_dynrelocs): Don't test or clear non_got_ref. (ppc_elf_relocate_section): Simplify test for dynamic relocs.
2017-11-23Delete powerpc64 symbol weakref fieldAlan Modra2-39/+15
Now that u.alias is circular, weakref just duplicates its function. Also, function symbols shouldn't be on the alias list so there is no need to use alias_readonly_dynrelocs with them. * elf64-ppc.c (struct ppc_link_hash_entry): Delete weakref field. (ppc64_elf_copy_indirect_symbol): Don't set weakref. (alias_readonly_dynrelocs): Use u.alias rather than weakref. (ppc64_elf_adjust_dynamic_symbol): Don't use alias_readonly_dynrelocs for function symbols.
2017-11-23Rename u.weakdef and make it a circular listAlan Modra42-294/+377
This makes the elf_link_hash_entry weakdef field, currently used to point from a weak symbol to a strong alias, a circular list so that all aliases can be found from any of them. A new flag, is_weakalias, distinguishes the weak symbol from a strong alias, and is used in all places where we currently test u.weakdef != NULL. With the original u.weakdef handling it was possible to have two or more weak symbols pointing via u.weakdef to a strong definition. Obviously that situation can't map to a circular list; One or more of the weak symbols must point at another weak alias rather than the strong definition. To handle that, I've added an accessor function to return the strong definition. * elf-bfd.h (struct elf_link_hash_entry): Add is_weakalias. Rename u.weakdef to u.alias and update comment. (weakdef): New static inline function. * elflink.c (bfd_elf_record_link_assignment) Test is_weakalias rather than u.weakdef != NULL, and use weakdef function. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. Clear is_weakalias on all aliases if def has been overridden in a regular object, not u.weakdef. (elf_link_add_object_symbols): Delete new_weakdef flag. Test is_weakalias and use weakdef. Set is_weakalias and circular u.alias. Update comments. (_bfd_elf_gc_mark_rsec): Test is_weakalias rather than u.weakdef != NULL and use weakdef function. * elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Test is_weakalias rather than u.weakdef != NULL and use weakdef function. Assert that def is strong defined. * elf32-arc.c (elf_arc_adjust_dynamic_symbol): Likewise. * elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise. * elf32-bfin.c (elf32_bfinfdpic_adjust_dynamic_symbol): Likewise. (bfin_adjust_dynamic_symbol): Likewise. * elf32-cr16.c (_bfd_cr16_elf_adjust_dynamic_symbol): Likewise. * elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise. * elf32-frv.c (elf32_frvfdpic_adjust_dynamic_symbol): Likewise. * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise. * elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise. * elf32-lm32.c (lm32_elf_adjust_dynamic_symbol): Likewise. * elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise. * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise. * elf32-metag.c (elf_metag_adjust_dynamic_symbol): Likewise. * elf32-microblaze.c (microblaze_elf_adjust_dynamic_symbol): Likewise. * elf32-nds32.c (nds32_elf_adjust_dynamic_symbol): Likewise. * elf32-nios2.c (nios2_elf32_adjust_dynamic_symbol): Likewise. * elf32-or1k.c (or1k_elf_adjust_dynamic_symbol): Likewise. * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise. * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. * elf32-score.c (s3_bfd_score_elf_adjust_dynamic_symbol): Likewise. * elf32-score7.c (s7_bfd_score_elf_adjust_dynamic_symbol): Likewise. * elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise. * elf32-tic6x.c (elf32_tic6x_adjust_dynamic_symbol): Likewise. * elf32-tilepro.c (tilepro_elf_gc_mark_hook): Likewise. (tilepro_elf_adjust_dynamic_symbol): Likewise. * elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise. * elf32-xtensa.c (elf_xtensa_adjust_dynamic_symbol): Likewise. * elf64-alpha.c (elf64_alpha_adjust_dynamic_symbol): Likewise. * elf64-hppa.c (elf64_hppa_adjust_dynamic_symbol): Likewise. * elf64-ia64-vms.c (elf64_ia64_adjust_dynamic_symbol): Likewise. * elf64-ppc.c (ppc64_elf_gc_mark_hook): Likewise. (ppc64_elf_adjust_dynamic_symbol): Likewise. * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. * elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise. * elfnn-aarch64.c (elfNN_aarch64_adjust_dynamic_symbol): Likewise. * elfnn-ia64.c (elfNN_ia64_adjust_dynamic_symbol): Likewise. * elfnn-riscv.c (riscv_elf_adjust_dynamic_symbol): Likewise. * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Likewise. (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise. * elfxx-tilegx.c (tilegx_elf_gc_mark_hook): Likewise. (tilegx_elf_adjust_dynamic_symbol): Likewise. * elfxx-x86.c (_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
2017-11-23Add libmsvcrt, libmsvcrt-os and libucrtbase to the list of libraries for ↵Martin Storsjo2-0/+8
which the automatic generation of exported variables should be disabled. In the latest git version of mingw-w64, one can set the default libmsvcrt.a to actually be the import library of another CRT version, to facilitate switching to ucrtbase.dll. In these versions, the traditional libmsvcrt.a (for linking to msvcrt.dll) is also provided with the name libmsvcrt-os.a. The import libraries for the CRT also contain a number of compatibility wrapper functions. The ones in libmsvcrt.a have so far been excluded automatically since they in most cases come with a corresponding __imp_foo function. None of these make sense to export automatically from a DLL though, so add these libraries to the exclude list. libucrtbase.a contains a number of compatibility wrapper functions that don't have a corresponding __imp_foo symbol, which cause these symbols to be exported from DLLs. This can be worked around on the mingw-w64 side by adding extra __imp_ symbols, but since they aren't strictly necessary for linking to succeed, it's probably better long-term to add these libraries to the exclusion list. ld * pe-dll.c (autofilter_liblist): Add libmsvcrt, libmsvcrt-os and libucrtbase.
2017-11-23x86: fix AVX-512 16-bit addressingJan Beulich7-5/+35
Despite EVEX encodings not being available in real and VM86 modes, 16-bit addressing still needs to be handled properly for 16-bit protected mode as well as 16-bit addressing in 32-bit mode. Neither should displacements be dropped silently by the assembler, nor should the disassembler fail to correctly scale 8-bit displacements.
2017-11-23x86-64: always use unsigned 32-bit reloc for 32-bit addressing w/o base regJan Beulich8-2/+59
Except for %eip-relative addressing, where we don't have a suitable relocation type silently wrapping at the 4G boundary, consistently force use of R_X86_64_32 (in ELF terms) instead of its sign-extending counterpart. This wasn't right in case there was no base register in the addressing expression.
2017-11-23x86: drop redundant VSIB handling codeJan Beulich2-7/+6
The vecsib && !base_reg case is already being handled (in a more correct manner) by earlier code.
2017-11-23x86: correct UDnJan Beulich13-25/+68
Make the assembler recognize UD0, supporting only the newer form expecting a ModR/M byte. Make assembler and disassembler properly emit / expect a ModR/M byte for UD1. For the testsuite, as arch-4 already tests all UDn, avoid producing a huge delta for other tests using UD2B by making them use UD2 instead.
2017-11-23x86/Intel: don't report multiple errors for a single insn operandJan Beulich4-8/+11
Multiple errors are more confusing than helpful, as the more generic one often implies a sufficiently different adjustment than would actually be needed to fix the code. Additionally it makes it more cumbersome to add missing error checks, as the testsuite then needs extra updating.
2017-11-22Convert DTrace probe interface to C++ (and perform some cleanups)Sergio Durigan Junior2-276/+340
This patch converts the DTrace probe interface (gdb/dtrace-probe.[ch]) to C++, and also performs some cleanups that were on my TODO list for a while. The main changes were the conversion of 'struct dtrace_probe' to 'class dtrace_probe', and a new 'class dtrace_static_probe_ops' to replace the use of 'dtrace_probe_ops'. Both classes implement the virtual methods exported by their parents, 'class probe' and 'class static_probe_ops', respectively. I believe it's now a bit simpler to understand the logic behind the dtrace-probe interface. There are several helper functions used to parse parts of a dtrace probe, and since they are generic and don't need to know about the probe they're working on, I decided to leave them as simple static functions (instead of e.g. converting them to class methods). I've also converted a few uses of "VEC" to "std::vector", which makes the code simpler and easier to maintain. And, as usual, some cleanups here and there. Even though I'm sending a series of patches, they need to be tested and committed as a single unit, because of inter-dependencies. But it should be easier to review in separate logical units. I wasn't able to test these modifications because the current test framework for DTrace probes is not working. See <https://sourceware.org/bugzilla/show_bug.cgi?id=22420>. gdb/ChangeLog: 2017-11-22 Sergio Durigan Junior <sergiodj@redhat.com> * dtrace-probe.c (struct probe_ops dtrace_probe_ops): Delete. (struct dtrace_probe_arg) <dtrace_probe_arg>: New constructor. <type_str>: Convert to 'std::string'. <expr>: Convert to 'expression_up'. (dtrace_probe_arg_s): Delete type and VEC. (dtrace_probe_enabler_s): Likewise. (struct dtrace_probe): Replace by... (class dtrace_static_probe_ops): ...this and... (class dtrace_probe): ...this. (dtrace_probe_is_linespec): Rename to... (dtrace_static_probe_ops::is_linespec): ...this. Adjust code to reflect change. (dtrace_process_dof_probe): Use 'std::vector' instead of VEC. Adjust code. Create new instance of 'dtrace_probe'. (dtrace_build_arg_exprs): Rename to... (dtrace_probe::build_arg_exprs): ...this. Adjust code to reflect change. (dtrace_get_probes): Rename to... (dtrace_static_probe_ops::get_probes): ...this. Adjust code to reflect change. (dtrace_get_arg): Rename to... (dtrace_probe::get_arg_by_number): ...this. Adjust code to reflect change. (dtrace_probe_is_enabled): Rename to... (dtrace_probe::is_enabled): ...this. Adjust code to reflect change. (dtrace_get_probe_address): Rename to... (dtrace_probe::get_relocated_address): ...this. Adjust code to reflect change. (dtrace_get_probe_argument_count): Rename to... (dtrace_probe::get_argument_count): ...this. Adjust code to reflect change. (dtrace_can_evaluate_probe_arguments): Rename to... (dtrace_probe::can_evaluate_arguments): ...this. Adjust code to reflect change. (dtrace_evaluate_probe_argument): Rename to... (dtrace_probe::evaluate_argument): ...this. Adjust code to reflect change. (dtrace_compile_to_ax): Rename to... (dtrace_probe::compile_to_ax): ...this. Adjust code to reflect change. (dtrace_probe_destroy): Delete. (dtrace_type_name): Rename to... (dtrace_static_probe_ops::type_name): ...this. Adjust code to reflect change. (dtrace_probe::get_static_ops): New method. (dtrace_gen_info_probes_table_header): Rename to... (dtrace_static_probe_ops::gen_info_probes_table_header): ...this. Adjust code to reflect change. (dtrace_gen_info_probes_table_values): Rename to... (dtrace_probe::gen_info_probes_table_values): ...this. Adjust code to reflect change. (dtrace_enable_probe): Rename to... (dtrace_probe::enable_probe): ...this. Adjust code to reflect change. (dtrace_disable_probe): Rename to... (dtrace_probe::disable_probe): ...this. Adjust code to reflect change. (struct probe_ops dtrace_probe_ops): Delete. (info_probes_dtrace_command): Call 'info_probes_for_spops' instead of 'info_probes_for_ops'. (_initialize_dtrace_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'.
2017-11-22Convert SystemTap probe interface to C++ (and perform some cleanups)Sergio Durigan Junior2-273/+328
This patch converts the SystemTap probe interface (gdb/stap-probe.[ch]) to C++, and also performs some cleanups that were on my TODO list for a while. The main changes were the conversion of 'struct stap_probe' to 'class stap_probe', and a new 'class stap_static_probe_ops' to replace the use of 'stap_probe_ops'. Both classes implement the virtual methods exported by their parents, 'class probe' and 'class static_probe_ops', respectively. I believe it's now a bit simpler to understand the logic behind the stap-probe interface. There are several helper functions used to parse parts of a stap probe, and since they are generic and don't need to know about the probe they're working on, I decided to leave them as simple static functions (instead of e.g. converting them to class methods). I've also converted a few uses of "VEC" to "std::vector", which makes the code simpler and easier to maintain. And, as usual, some cleanups here and there. Even though I'm sending a series of patches, they need to be tested and committed as a single unit, because of inter-dependencies. But it should be easier to review in separate logical units. I've regtested this patch on BuildBot, no regressions found. gdb/ChangeLog: 2017-11-22 Sergio Durigan Junior <sergiodj@redhat.com> Simon Marchi <simark@simark.ca> * stap-probe.c (struct probe_ops stap_probe_ops): Delete variable. (struct stap_probe_arg) <stap_probe_arg>: New constructor. <aexpr>: Change type to 'expression_up'. (stap_probe_arg_s): Delete type and VEC. (struct stap_probe): Delete. Replace by... (class stap_static_probe_ops): ...this and... (class stap_probe): ...this. Rename variables to add 'm_' prefix. Do not use 'union' for arguments anymore. (stap_get_expected_argument_type): Receive probe name instead of 'struct stap_probe'. Adjust code. (stap_parse_probe_arguments): Rename to... (stap_probe::parse_arguments): ...this. Adjust code to reflect change. (stap_get_probe_address): Rename to... (stap_probe::get_relocated_address): ...this. Adjust code to reflect change. (stap_get_probe_argument_count): Rename to... (stap_probe::get_argument_count): ...this. Adjust code to reflect change. (stap_get_arg): Rename to... (stap_probe::get_arg_by_number'): ...this. Adjust code to reflect change. (can_evaluate_probe_arguments): Rename to... (stap_probe::can_evaluate_arguments): ...this. Adjust code to reflect change. (stap_evaluate_probe_argument): Rename to... (stap_probe::evaluate_argument): ...this. Adjust code to reflect change. (stap_compile_to_ax): Rename to... (stap_probe::compile_to_ax): ...this. Adjust code to reflect change. (stap_probe_destroy): Delete. (stap_modify_semaphore): Adjust comment. (stap_set_semaphore): Rename to... (stap_probe::set_semaphore): ...this. Adjust code to reflect change. (stap_clear_semaphore): Rename to... (stap_probe::clear_semaphore): ...this. Adjust code to reflect change. (stap_probe::get_static_ops): New method. (handle_stap_probe): Adjust code to create instance of 'stap_probe'. (stap_get_probes): Rename to... (stap_static_probe_ops::get_probes): ...this. Adjust code to reflect change. (stap_probe_is_linespec): Rename to... (stap_static_probe_ops::is_linespec): ...this. Adjust code to reflect change. (stap_type_name): Rename to... (stap_static_probe_ops::type_name): ...this. Adjust code to reflect change. (stap_gen_info_probes_table_header): Rename to... (stap_static_probe_ops::gen_info_probes_table_header): ...this. Adjust code to reflect change. (stap_gen_info_probes_table_values): Rename to... (stap_probe::gen_info_probes_table_values): ...this. Adjust code to reflect change. (struct probe_ops stap_probe_ops): Delete. (info_probes_stap_command): Use 'info_probes_for_spops' instead of 'info_probes_for_ops'. (_initialize_stap_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'.
2017-11-22Convert generic probe interface to C++ (and perform some cleanups)Sergio Durigan Junior12-490/+524
This patch converts the generic probe interface (gdb/probe.[ch]) to C++, and also performs some cleanups that were on my TODO list for a while. The main changes were the conversion of 'struct probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. Even though I'm sending a series of patches, they need to be tested and committed as a single unit, because of inter-dependencies. But it should be easier to review in separate logical units. I've regtested this patch on BuildBot, no regressions found. gdb/ChangeLog: 2017-11-22 Sergio Durigan Junior <sergiodj@redhat.com> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-23Automatic date update in version.inGDB Administrator1-1/+1
2017-11-22(Ada) ravenscar-thread.c: remove unwanted trailing \n in call to warningJoel Brobecker2-1/+6
A recent patch introduced a call to warning, and the string used had a trailing newline, which is not correct; the nightly ARI run caught it, so this patch removes it. gdb/ChangeLog: * ravenscar-thread.c (ravenscar_inferior_created): Remove trailing newline at end of string in call to warning. Tested on powerpc-eabispe, no regression.
2017-11-22C++ify osdataSimon Marchi4-263/+138
This patch c++ifies the osdata structure: osdata_column, osdata_item and osdata. char* are replaced with std::string and VEC are replaced with std::vector. This allows to get rid of a great deal of cleanup and free'ing code. I replaced the splay tree in list_available_thread_groups with an std::map. Unless there's a good advantage to keep using a splay tree, I think using the standard type should make things simpler to understand. gdb/ChangeLog: * osdata.h: Include vector isntead of vec.h. (osdata_column_s): Remove typedef. (struct osdata_column): Add constructor. <name, value>: Change type to std::string. (DEF_VEC_O (osdata_column_s)): Remove. (osdata_item_s): Remove typedef. (struct osdata_item) <columns>: Change type to std::vector. (DEF_VEC_O (osdata_item_s)): Remove. (struct osdata): Add constructor. <type>: Change type to std::string. <items>: Change type to std::vector. (osdata_p): Remove typedef. (DEF_VEC_P (osdata_p)): Remove. (osdata_parse): Return a unique_ptr. (osdata_free): Remove. (make_cleanup_osdata_free): Remove. (get_osdata): Return a unique_ptr. (get_osdata_column): Return pointer to std::string, take a reference to osdata_item as parameter. * osdata.c (struct osdata_parsing_data) <osdata>: Change type to unique_ptr. <property_name>: Change type to std::string. (osdata_start_osdata): Allocate osdata with new and adjust. (osdata_start_item): Adjust. (osdata_start_column): Adjust. (osdata_end_column): Adjust. (clear_parsing_data): Remove. (osdata_parse): Return a unique_ptr and adjust, remove cleanup. (osdata_item_clear): Remove. (get_osdata): return a unique_ptr and adjust. (get_osdata_column): Return a pointer to std::string and adjust. (info_osdata): Adjust. * mi/mi-main.c: Include <map>. (free_vector_of_osdata_items): Remove. (list_available_thread_groups): Adjust, use std::map instead of splay tree.
2017-11-22Show optimized out local variables in "info locals"Simon Marchi6-0/+111
Currently, optimized out variables are not shown when doing "info locals". Some users found that confusing, thinking GDB forgot to print their variable. This patch adds them to the "info locals" output. I added a test in gdb.dwarf2 to test for that behavior. I think doing a synthetic DWARF test is the easiest way to have an optimized out local variable for sure. However, this change reveals what I think is a bug in GDB, see: http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/2017-September/004394.html This patch marks the tests in inline-locals.exp that start failing as KFAIL. I'd like to tackle this bug eventually, but I don't have the time right now. I think it's still better to show an extra erroneous entry than to not show the optimized out variables at all. I haven't created a bug in bugzilla yet, but if we agree it's indeed a bug, I'll create one and update the setup_kfail lines with the actual bug number before pushing. gdb/ChangeLog: * stack.c (iterate_over_block_locals): Add LOC_OPTIMIZED_OUT case in switch. gdb/testsuite/ChangeLog: * gdb.opt/inline-locals.exp: Mark tests as KFAIL. * gdb.dwarf2/info-locals-optimized-out.exp: New file. * gdb.dwarf2/info-locals-optimized-out.c: New file.
2017-11-22Remove DEF_VEC_P (varobj_p)Simon Marchi2-3/+4
The last patch removed the last usage of this type, so we can remove it. gdb/ChangeLog: * varobj.h (DEF_VEC_P (varobj_p)): Remove.
2017-11-22Replace VEC (varobj_update_result) with std::vectorSimon Marchi4-129/+107
This patch replaces makes varobj_update return an std::vector, and updates the fallouts. To make that easier, the varobj_update_result is c++ified a bit. I added a constructor and initialized its fields in-class. The newobj vector is also made an std::vector, so that it's automatically freed when varobj_update_result is destroyed and handled correctly by the default move constructor. I disabled copy constructor and assignment for that structure, because normally it never needs to be copied, only moved. As a result, the newobj parameter of update_dynamic_varobj_children must be changed to an std::vector. The patch converts the other vector parameters of update_dynamic_varobj_children to std::vector. It's not strictly necessary to do it in the same patch, but I think it makes sense to do it. gdb/ChangeLog: * varobj.h (struct varobj_update_result): Add constructor, add move constructor, disable copy and assign, initialize fields. <newobj>: Change type to std::vector. (varobj_update): Return std::vector. * varobj.c (install_dynamic_child): Change VEC parameters to std::vector and adjust. (update_dynamic_varobj_children): Likewise. (varobj_update): Return std::vector and adjust. * mi/mi-cmd-var.c (varobj_update_one): Adjust to vector changes.
2017-11-22Make varobj::children an std::vectorSimon Marchi5-62/+74
This patch makes the children field of varobj an std::vector, and updates the fallout. One note is that varobj::parent must be made non-const. The reason is that when a child deletes itself, it modifies its writes NULL to its slot in its parent's children vector. With the VEC, the const didn't made the parent's children vector content const, only the pointer to it, but with std::vector, even the content is. gdb/ChangeLog: * varobj.h (struct varobj) <parent>: Remove const. <children>: Change type to std::vector. (varobj_list_children): Return std::vector const reference. (varobj_restrict_range): Change parameter type to std::vector const reference. * varobj.c (varobj_has_more): Adjust. (varobj_restrict_range): Change parameter type to std::vector const reference and adjust. (install_dynamic_child): Adjust. (update_dynamic_varobj_children): Adjust. (varobj_list_children): Return std::vector const reference and adjust. (varobj_add_child): Adjust. (update_type_if_necessary): Adjust. (varobj_update): Adjust. (delete_variable_1): Adjust. * ada-varobj.c (ada_value_has_mutated): Adjust. * mi/mi-cmd-var.c (mi_cmd_var_list_children): Adjust.
2017-11-22Basic c++ification of varobjSimon Marchi3-116/+63
This patch does a basic c++ification or the varobj data structure. - varobj: add constructor and destructor, initialize fields - varobj_root: initialize fields - varobj_dynamic: initialize fields This allows getting rid of new_variable, new_root_variable. free_variable essentially becomes varobj's destructor. This also allows getting rid of a cleanup, make_cleanup_free_variable, which was only used in varobj_create in case the varobj creation fails. It is replaced with a unique_ptr. gdb/ChangeLog: * varobj.h (struct varobj): Add constructor and destructor, initialize fields. * varobj.c (struct varobj_root): Initialize fields. (struct varobj_dynamic): Initialize fields. (varobj_create): Use unique_ptr instead of cleanup. Create varobj with new instead of new_root_variable. (delete_variable_1): Free variable with delete instead of free_variable. (create_child_with_value): Create variable with new instead of new_variable. (varobj::varobj): New. (varobj::~varobj): New (body mostly coming from free_variable). (new_variable): Remove. (free_variable): Remove. (do_free_variable_cleanup): Remove. (make_cleanup_free_variable): Remove.
2017-11-22Riscv ld-elf/stab failure and fake label cleanup.Jim Wilson10-14/+57
* as.c: Include write.h. (common_emul_init): Use FAKE_LABEL_NAME. * ecoff.c (add_file, ecoff_directive_end, ecoff_directive_loc): Likewise. (ecoff_build_symbols): Use FAKE_LABEL_CHAR. * expr.c (get_symbol_name): Use FAKE_LABEL_CHAR. Accept only if input_from_string is TRUE. * read.c (input_from_string): New. (read_symbol_name): Use FAKE_LABEL_CHAR. Accept only if input_from_string is TRUE. (temp_ilp): Set input_from_string to TRUE. (restore_ilp): Set input_from_string to FALSE. * read.h (input_from_string): Declare. * symbols.c: Include write.h (S_IS_LOCAL): Check for FAKE_LABEL_CHAR. (symbol_relc_make_sym): Fix comment refering to default fake label string. * write.h (FAKE_LABEL_CHAR): New. * config/tc-riscv.h (FAKE_LABEL_CHAR): Define. * testsuite/gas/all/err-fakelabel.s: New.
2017-11-22Update docs on filling text with nops.Jim Wilson2-3/+8
gas/ * doc/as.texinfo (.align): Change some to most for text nop fill. (.balign, .p2align): Likewise.
2017-11-22Remove obsolete core-regset.cUlrich Weigand3-119/+5
The last target that used core-regset.c (FreeBSD/alpha) has been removed with GDB 8.0, and since then this file is obsolete.
2017-11-22[testsuite] Pass pthreads in prepare_for_testingYao Qi3-2/+7
"pthreads" in the right flag to pass in prepare_for_testing to linker, instead of additional_flags. Without this patch, the test case can't be complied by clang. gdb compile failed, clang: warning: -lpthread: 'linker' input unused gdb/testsuite: 2017-11-22 Yao Qi <yao.qi@linaro.org> * gdb.base/info-os.exp: Pass pthreads. * gdb.multi/multi-attach.exp: Likewise.
2017-11-22[testsuite] Don't skip gdb.dwarf2/pr10770.exp for non-gcc compilerYao Qi2-6/+5
gdb.dwarf2/pr10770.exp can be used for non-gcc compiler, at least clang. This patch removes the restriction to only use gcc. If other compilers, like xlc or icc, can't compile the .c file, test result is not changed. gdb/testsuite: 2017-11-22 Yao Qi <yao.qi@linaro.org> * gdb.dwarf2/pr10770.exp: Remove code skipping non-gcc compiler.
2017-11-22Remove Vec_Disp8 field for vgf2p8mulb for AVX flavor.Igor Tsimbalist3-4/+9
* i386-opc.tbl: Remove Vec_Disp8 from vgf2p8mulb. * i386-tbl.h: Regenerate.
2017-11-22[testsuite] Pass -pie in ldflagsYao Qi4-3/+10
-pie is a linker flag, it should be passed via "ldflags", instead of "additional_flags". Otherwise, clang complains, clang: warning: argument unused during compilation: '-pie' gdb/testsuite: 2017-11-22 Yao Qi <yao.qi@linaro.org> * gdb.base/attach-pie-noexec.exp: Pass "-pie" in ldflags. * gdb.base/break-interp.exp: Likewise. * gdb.base/jit-attach-pie.exp: Likewise.
2017-11-22Update ChangeLogIgor Tsimbalist1-0/+5
2017-11-22Remove Vec_Disp8 from vpcompressb and vpexpandb.Igor Tsimbalist2-13/+12
* i386-opc.tbl: Remove Vec_Disp8 from vpcompressb and vpexpandb. * i386-tbl.h: Regenerate.
2017-11-22[GAS/ARM] Clarify relation between reg_expected_msgs and arm_reg_typeThomas Preud'homme2-23/+33
Uses of reg_expected_msgs rely on each arm_reg_type enumerator to have a message entry in the same order as the enumerator declaration. This is not clearly stated in the definition of both the arm_reg_type enum and the reg_expected_msgs. Worse, there is nothing to ensure both are kept in sync. As an attempt towards this, this patch uses C99 array designators to ensure that each message is associated with the right arm_reg_type. A comment is also added near the definition of arm_reg_type to point to the reg_expected_msgs array. Finally, the array is synced with arm_reg_type by adding the missing error message for REG_TYPE_RNB. 2017-11-22 Thomas Preud'homme <thomas.preudhomme@arm.com> gas/ * config/tc-arm.c (arm_reg_type): Comment on the link with reg_expected_msgs. (reg_expected_msgs): Initialize using array designators with arm_reg_type index.
2017-11-22Target FP: Make use of MPFR if availableUlrich Weigand13-1/+1178
This second patch introduces mfpr_float_ops, an new implementation of target_float_ops. This implements precise emulation of target floating-point formats using the MPFR library. This is then used to perform operations on types that do not match any host type. Note that use of MPFR is still not required. The patch adds a configure option --with-mpfr similar to --with-expat. If use of MPFR is disabled via the option or MPFR is not available, code will fall back to current behavior. This means that operations on types that do not match any host type will be implemented on the host long double type instead. A new test case verifies that we can correctly print the largest __float128 value now. gdb/ChangeLog: 2017-11-22 Ulrich Weigand <uweigand@de.ibm.com> * NEWS: Document use of GNU MPFR. * README: Likewise. * Makefile.in (LIBMPFR): Add define. (CLIBS): Add $(LIBMPFR). * configure.ac: Add --with-mpfr configure option. * configure: Regenerate. * config.in: Regenerate. * target-float.c [HAVE_LIBMPFR]: Include <mpfr.h>. (class mpfr_float_ops): New type. (mpfr_float_ops::from_target): Two new overloaded functions. (mpfr_float_ops::to_target): Likewise. (mpfr_float_ops::to_string): New function. (mpfr_float_ops::from_string): Likewise. (mpfr_float_ops::to_longest): Likewise. (mpfr_float_ops::from_longest): Likewise. (mpfr_float_ops::from_ulongest): Likewise. (mpfr_float_ops::to_host_double): Likewise. (mpfr_float_ops::from_host_double): Likewise. (mpfr_float_ops::convert): Likewise. (mpfr_float_ops::binop): Likewise. (mpfr_float_ops::compare): Likewise. (get_target_float_ops): Use mpfr_float_ops if available. gdb/doc/ChangeLog: 2017-11-22 Ulrich Weigand <uweigand@de.ibm.com> * gdb.texinfo (Requirements): Document use of GNU MPFR. gdb/testsuite/ChangeLog: 2017-11-22 Ulrich Weigand <uweigand@de.ibm.com> * gdb.base/float128.c (large128): New variable. * gdb.base/float128.exp: Add test to print largest __float128 value.
2017-11-22Target FP: Refactor use of host floating-point arithmeticUlrich Weigand4-428/+747
Prepare for using MPFR to implement floating-point arithmetic by refactoring the way host floating-point arithmetic is currently used. In particular, fix the following two problems that cause different (and incorrect) results due to using host arithmetic: - Current processing always uses host "long double", and then converts back to the actual target format. This may introduce rounding errors. - Conversion of FP values to LONGEST simply does a host C++ type cast. However the result of such a cast is undefined if the source value is outside the representable range. MPFR always has defined behavior here (returns the minimum or maximum representable value). To fix the first issue, I've now created not just one set of routines using host FP arithmetic (on long double), but instead three different sets of routines, one each for host float, double, and long double. Operations can then be performed in the desired type directly, avoiding the extra rounding step. Using C++ templates, the three sets can all share the same source code without duplication. To fix the second issue, I'm simply enforcing the same conversion rule (which makes sense anyway) when converting out-of-range values from FP to LONGEST. To contain the code complexity with the variety of options now possible, I've created a new class "target_float_ops". There are a total of five separate implementations of this: host_float_ops<float> Implemented via host FP in given type host_float_ops<double> host_float_ops<long double> mpfr_float_ops Implemented via MPFR if available decimal_float_ops Implemented via libdecnumber Note instead of using the DOUBLEST define, this always just uses the "long double" data type. But since we now require C++11 anyway, this type must in any case be avaialble unconditionally. Most target floating-point operations simply dispatch to a (virtual) member routine of this class. Which implementation to choose is determined from the target types involved, and whether they match some host type or not. E.g. any operation on a single type that matches a host type is performed in that type. Operations involving two types that both match host types are performed in the larger one (according to C/C++ implicit conversion rules). Operations that involve any type that does not match a host type are performed using MPFR. (And of course operations involving decimal FP are performed using libdecnumber.) This first patch implements the refactoring of target-float.c as described above, introduing the host_float_ops and decimal_float_ops classes, and using them. Use of MPFR is introduced in the second patch. A bit of special-case handling code is moved around to as to avoid code duplication between host_float_ops and mpfr_float_ops. Note that due to the changes mentioned above, I've had to update (fix) the floating-point register values tested in the gdb.arch/vsx-regs.exp test case. (The new values now work both with host arithmetic and MPFR.) gdb/ChangeLog: 2017-11-22 Ulrich Weigand <uweigand@de.ibm.com> * target-float.c: Do not include <math.h>. Include <cmath> and <limits>. (DOUBLEST): Do not define. (class target_float_ops): New type. (class host_float_ops): New templated type. (class decimal_float_ops): New type. (floatformat_to_doublest): Rename to ... (host_float_ops<T>::from_target): ... this. Use template type T instead of DOUBLEST. Use C++ math routines. Update recursive calls. (host_float_ops<T>::from_target): New overload using a type argument. (floatformat_from_doublest): Rename to ... (host_float_ops<T>::to_target): ... this. Use template type T instead of DOUBLEST. Use C++ math routines. Update recursive calls. (host_float_ops<T>::to_target): New overload using a type argument. (floatformat_printf_format): New function. (struct printf_length_modifier): New templated type. (floatformat_to_string): Rename to ... (host_float_ops<T>::to_string): ... this. Use type instead of floatformat argument. Use floatformat_printf_format and printf_length_modifier. Remove special handling of invalid numbers, infinities and NaN (moved to target_float_to_string). (struct scanf_length_modifier): New templated type. (floatformat_from_string): Rename to ... (host_float_ops<T>::from_string): ... this. Use type instead of floatformat argument. Use scanf_length_modifier. (floatformat_to_longest): Rename to ... (host_float_ops<T>::to_longest): ... this. Use type instead of floatformat argument. Handle out-of-range values deterministically. (floatformat_from_longest): Rename to ... (host_float_ops<T>::from_longest): ... this. Use type instead of floatformat argument. (floatformat_from_ulongest): Rename to ... (host_float_ops<T>::from_ulongest): ... this. Use type instead of floatformat argument. (floatformat_to_host_double): Rename to ... (host_float_ops<T>::to_host_double): ... this. Use type instead of floatformat argument. (floatformat_from_host_double): Rename to ... (host_float_ops<T>::from_host_double): ... this. Use type instead of floatformat argument. (floatformat_convert): Rename to ... (host_float_ops<T>::convert): ... this. Use type instead of floatformat arguments. Remove handling of no-op conversions. (floatformat_binop): Rename to ... (host_float_ops<T>::binop): ... this. Use type instead of floatformat arguments. (floatformat_compare): Rename to ... (host_float_ops<T>::compare): ... this. Use type instead of floatformat arguments. (match_endianness): Use type instead of length/byte_order arguments. (set_decnumber_context): Likewise. (decimal_from_number): Likewise. Update calls. (decimal_to_number): Likewise. (decimal_is_zero): Likewise. Update calls. Move to earlier in file. (decimal_float_ops::to_host_double): New dummy function. (decimal_float_ops::from_host_double): Likewise. (decimal_to_string): Rename to ... (decimal_float_ops::to_string): ... this. Use type instead of length/byte_order arguments. Update calls. (decimal_from_string): Rename to ... (decimal_float_ops::from_string): ... this. Use type instead of length/byte_order arguments. Update calls. (decimal_from_longest): Rename to ... (decimal_float_ops::from_longest): ... this. Use type instead of length/byte_order arguments. Update calls. (decimal_from_ulongest): Rename to ... (decimal_float_ops::from_ulongest): ... this. Use type instead of length/byte_order arguments. Update calls. (decimal_to_longest): Rename to ... (decimal_float_ops::to_longest): ... this. Use type instead of length/byte_order arguments. Update calls. (decimal_binop): Rename to ... (decimal_float_ops::binop): ... this. Use type instead of length/byte_order arguments. Update calls. (decimal_compare): Rename to ... (decimal_float_ops::compare): ... this. Use type instead of length/byte_order arguments. Update calls. (decimal_convert): Rename to ... (decimal_float_ops::convert): ... this. Use type instead of length/byte_order arguments. Update calls. (target_float_same_category_p): New function. (target_float_same_format_p): Likewise. (target_float_format_length): Likewise. (enum target_float_ops_kind): New type. (get_target_float_ops_kind): New function. (get_target_float_ops): Three new overloaded functions. (target_float_is_zero): Update call. (target_float_to_string): Add special handling of invalid numbers, infinities and NaN (moved from floatformat_to_string). Use target_float_ops callback. (target_float_from_string): Use target_float_ops callback. (target_float_to_longest): Likewise. (target_float_from_longest): Likewise. (target_float_from_ulongest): Likewise. (target_float_to_host_double): Likewise. (target_float_from_host_double): Likewise. (target_float_convert): Add special case for no-op conversions. Use target_float_ops callback. (target_float_binop): Use target_float_ops callback. (target_float_compare): Likewise. gdb/testsuite/ChangeLog: 2017-11-22 Ulrich Weigand <uweigand@de.ibm.com> * gdb.arch/vsx-regs.exp: Update register content checks.
2017-11-22Fix build with GCC 8: strncpy ->strcpyYao Qi2-1/+5
Recent gcc 8 trunk emits the warning below, ../../binutils-gdb/gdb/python/py-gdb-readline.c:79:15: error: ‘char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] strncpy (q, p, n); ~~~~~~~~^~~~~~~~~ ../../binutils-gdb/gdb/python/py-gdb-readline.c:73:14: note: length computed here n = strlen (p); ~~~~~~~^~~ gdb: 2017-11-22 Yao Qi <yao.qi@linaro.org> * python/py-gdb-readline.c (gdbpy_readline_wrapper): Use strcpy.
2017-11-22Fix build with GCC 8: strncpy -> memcpyYao Qi5-4/+13
Recent gcc 8 trunk emits the warning below, ../../../binutils-gdb/gdb/gdbserver/remote-utils.c:1204:14: error: ‘char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying 6 bytes from a string of the same length [-Werror=stringop-truncation] strncpy (buf, "watch:", 6); ~~~~~~~~^~~~~~~~~~~~~~~~~~ ../../binutils-gdb/gdb/cli/cli-decode.c:1118:15: error: ‘char* strncpy(char*, const char*, size_t)’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=] strncpy (cmdtype1 + 1, cmdtype, len - 1); ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../binutils-gdb/gdb/cli/cli-decode.c:1110:16: note: length computed here len = strlen (cmdtype); ~~~~~~~^~~~~~~~~ ../../binutils-gdb/gdb/cli/cli-decode.c:1120:15: error: ‘char* strncpy(char*, const char*, size_t)’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=] strncpy (cmdtype2, cmdtype, len - 1); ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../binutils-gdb/gdb/cli/cli-decode.c:1110:16: note: length computed here len = strlen (cmdtype); ~~~~~~~^~~~~~~~~ ../../binutils-gdb/gdb/cp-namespace.c:1071:11: error: ‘char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying 2 bytes from a string of the same length [-Werror=stringop-truncation] strncpy (full_name + scope_length, "::", 2); ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This patch fixes it by using memcpy instead of strncpy. gdb: 2017-11-22 Yao Qi <yao.qi@linaro.org> * cli/cli-decode.c (help_list): Use memcpy instead of strncpy. * cp-namespace.c (cp_lookup_transparent_type_loop): Likewise. gdb/gdbserver: 2017-11-22 Yao Qi <yao.qi@linaro.org> * remote-utils.c (prepare_resume_reply): Use memcpy.
2017-11-22[ARC] Fix handling of ARCv2 H-register class.claziss4-0/+21
For ARCv2, h-regs are only valid unitl r31. gas/ 2017-11-21 Claudiu Zissulescu <claziss@synopsys.com> * testsuite/gas/arc/hregs-err.s: New test. opcodes/ 2017-11-21 Claudiu Zissulescu <claziss@synopsys.com> * arc-opc.c (insert_rhv2): Check h-regs range.
2017-11-21x86: Add tests for -n option of x86 assemblerH.J. Lu5-0/+58
The -n command-line of x86 assembler disables optimization of alignment directives, like ".balign 8, 0x90", with multi-byte nop instructions such as leal 0(%esi),%esi. PR gas/22464 * testsuite/gas/i386/align-1.s: New file. * testsuite/gas/i386/align-1a.d: Likewise. * testsuite/gas/i386/align-1b.d: Likewise. * testsuite/gas/i386/i386.exp: Run align-1a and align-1b.
2017-11-22Automatic date update in version.inGDB Administrator1-1/+1
2017-11-21ravenscar: update inferior ptid with event ptidJerome Guitton2-1/+9
When debugging a program using a ravenscar runtime, the thread layer sometimes gets confused, and even missing some threads. This was traced to an assumption that ravenscar_wait was making, which is that calling the "to_wait" target_ops method would set the inferior_ptid, so that we could then use that assumption to update our thread_list and current ptid. However, this has not been the case for quite a while now. This patch fixes the problem by assigning inferior_ptid the ptid returned by "to_wait". gdb/ChangeLog: * ravenscar-thread.c (ravenscar_wait): Update inferior ptid with event ptid from the lower layer before doing the ravenscar-specific update.
2017-11-21(Ada) crash connecting to TSIM simulatorJoel Brobecker2-2/+13
Connecting to a TSIM simulator over the remote protocol causes GDB to crash with the following failed assertion: (gdb) tar remote :1234 Remote debugging using :1234 /[...]/gdb/ravenscar-thread.c:182: internal-error: ravenscar_update_inferior_ptid: Assertion `!is_ravenscar_task (inferior_ptid)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) y What happens is the following. Upon connection to the target, GDB sends a 'qfThreadInfo' query, which is the query asking the target for the ID of the first thread, and TSIM replies 'm0': Sending packet: $qfThreadInfo#bb...Ack Packet received: m0 As a result of this, GDB takes the '0' as the TID, and because of it, constructs a ptid whose value is {42000, 0, 0}. This trips our !is_ravenscar_task check, because all it does to identify threads corresponding to ravenscar tasks is that their lwp is null, because that's how we construct their ptid. But this is unfortunatly not sufficient when debugging with TSIM, because the thread ID that TSIM returns causes the creation of a ptid whose lwp is zero, which matches the current identification scheme and yet is clearly not a ravenscar task. The fix is to also make sure that the ptid's tid field is nonzero. gdb/ChangeLog: * ravenscar-thread.c (is_ravenscar_task): Also verify that the ptid's TID is nonzero.
2017-11-21problem debugging ravenscar programs if runtime is strippedJoel Brobecker4-17/+43
Trying to debug a program using a stripped version of the ravenscar runtime, we can get the following error: (gdb) cont Continuing. Cannot find Ada_Task_Control_Block type. Aborting This is because the ravenscar-thread layer makes the assumption that the runtime is built the way we expect it, meaning that the Ada tasking units we rely on for Ada tasking debugging, are built with debugging information, and that this debug information has not been stripped from the runtime. When this assumption is not true, resuming such a program can trigger the error above, which then leads GDB a little confused. For instance, we can see things like: (gdb) bt Target is executing. This patch fixes the issue by disabling the ravenscar thread layer if we detect that the runtime is missing some of the debugging info we need in order to support Ada task debugging. This is the best we can do, as the ravenscar-thread layer actually depends on the ada-tasks layer to implement thread debugging. gdb/ChangeLog: * ada-lang.h (ada_get_tcb_types_info): Add declaration. * ada-tasks.c (ada_get_tcb_types_info): Renames get_tcb_types_info. Make non-static. Change return type to char *. Adjust code accordingly. Rewrite the function's documentation. (read_atcb): Adjust call to get_tcb_types_info accordingly. * ravenscar-thread.c (ravenscar_inferior_created): Check that we have enough debugging information in the runtime to support Ada task debugging before we enable the ravenscar-thread layer.
2017-11-21Add multiple-CPU support in ravenscar-thread.cJoel Brobecker4-34/+191
This patch reworks the ravenscar-thread layer to remove the assumption that the target only has 1 CPU. In particular, when connected to a QEMU target over the remote protocol, QEMU reports each CPU as one thread. This patch adapts the ravenscar-thread layer to this, and adds a large comment explaining the general design of this unit. gdb/ChangeLog: * ada-lang.h (ada_get_task_info_from_ptid): Add declaration. * ada-tasks.c (ada_get_task_info_from_ptid): New function. * ravenscar-thread.c: Add into comment. (base_magic_null_ptid): Delete. (base_ptid): Change documentation. (ravenscar_active_task): Renames ravenscar_running_thread. All callers updated throughout. (is_ravenscar_task, ravenscar_get_thread_base_cpu): New function. (ravenscar_task_is_currently_active): Likewise. (get_base_thread_from_ravenscar_task): Ditto. (ravenscar_update_inferior_ptid): Adjust to handle multiple CPUs. (ravenscar_runtime_initialized): Likewise. (get_running_thread_id): Add new parameter "cpu". Adjust implementation to handle this new parameter. (ravenscar_fetch_registers): Small adjustment to use is_ravenscar_task and ravenscar_task_is_currently_active in order to decide whether to use the target beneath or this module's arch_ops. (ravenscar_store_registers, ravenscar_prepare_to_store): Likewise. (ravenscar_stopped_by_sw_breakpoint): Use get_base_thread_from_ravenscar_task to get the underlying thread, rather than using base_ptid. (ravenscar_stopped_by_hw_breakpoint, ravenscar_stopped_by_watchpoint) (ravenscar_stopped_data_address, ravenscar_core_of_thread): Likewise. (ravenscar_inferior_created): Do not set base_magic_null_ptid.
2017-11-21Provide the "Base CPU" in output of "info task" (if set by runtime).Joel Brobecker3-0/+24
At the user level, this patch enhances the debugger to print the ID of the base CPU a task is running on: (gdb) info task 3 Ada Task: 0x13268 Name: raven1 Thread: 0x13280 LWP: 0 !!!-> Base CPU: 1 No parent Base Priority: 127 State: Runnable This new field is only printed when the base CPU is nonzero or, in other words, if the base CPU info is being provided by the runtime. For instance, on native systems, where threads/processes can "jump" from CPU to CPU, the info is not available, and the output of the command above then remains unchanged. At the internal level, the real purpose of this change is to prepare the way for ravenscar-thread to start handling SMP systems. For that, we'll need to know which CPU each task is running on... More info on that in the commit that actually adds support for it. gdb/ChangeLog: * ada-lang.h (struct ada_task_info) <base_cpu>: New field. * ada-lang.c (struct atcb_fieldno) <base_cpu>: New field. (get_tcb_types_info): Set fieldnos.base_cpu. (read_atcb): Set task_info->base_cpu. (info_task): Print "Base CPU" info if set by runtime.
2017-11-21watchpoint regression debugging with remote protocol (bare metal)Joel Brobecker2-0/+93
We have noticed a regression in our watchpoint support when debugging through the remote protocol a program running on a bare metal platform, when the program uses what we call the Ravenscar Runtime. This runtime is a subset of the Ada runtime defined by the Ravenscar Profile. One of the nice things about this runtime is that it provides tasking, which is equivalent to the concept of threads in C (it is actually often mapped to threads, when available). For bare metal targets, however, there is no OS, and therefore no thread layer. What we did, then, was add a ravenscar-thread layer, which has insider knowledge of the runtime to get the list of threads, but also all necessary info to perform thread switching. For the record, the commit which caused the regression is: commit 799a2abe613be0645b84f5aaa050f2f91e6ae3f7 Date: Mon Nov 30 16:05:16 2015 +0000 Subject: remote: stop reason and watchpoint data address per thread Running local-watch-wrong-thread.exp with "maint set target-non-stop on" exposes that gdb/remote.c only records whether the target stopped for a breakpoint/watchpoint plus the watchpoint data address *for the last reported remote event*. But in non-stop mode, we need to keep that info per-thread, as each thread can end up with its own last-status pending. Our testcase is very simple. We have a package defining a global variable named "Watch"... package Pck is Watch : Integer := 1974; end Pck; ... and a main subprogram which changes its value procedure Foo is begin Pck.Watch := Pck.Watch + 1; end Foo; To reproduce, we built our program as usual, started it in QEMU, and then connected GDB to QEMU... (gdb) target remote :4444 (gdb) break _ada_foo (gdb) cont <--- this is to make sure the program is started and the variable we want to watch is initialized ... at which point we try to use a watchpoint on our global variable: (gdb) watch watch ... but, upon resuming the execution with a "cont", we expected to get a watchpoint-hit notification, such as... (gdb) cont Hardware watchpoint 2: watch Old value = 1974 New value = 1975 0xfff00258 in foo () at /[...]/foo.adb:6 6 end Foo; ... but unfortunately, we get a SIGTRAP instead: (gdb) cont Program received signal SIGTRAP, Trace/breakpoint trap. foo () at /[...]/foo.adb:6 6 end Foo; What happens is that, on the one hand, the change in remote.c now stores the watchpoint-hit notification info in the thread that received it; and on the other hand, we have a ravenscar-thread layer which manages the thread list on top of the remote protocol layer. The two of them get disconnected, and this eventually results in GDB not realizing that we hit a watchpoint. Below is how: First, once connected and just before inserting our watchpoint, we have the ravenscar-thread layer which built the list of threads by extracting some info from inferior memory, giving us the following two threads: (gdb) info threads Id Target Id Frame 1 Thread 0 "0Q@" (Ravenscar task) foo () at /[...]/foo.adb:5 * 2 Thread 0x24618 (Ravenscar task) foo () at /[...]/foo.adb:5 The first thread is the only thread QEMU told GDB about. The second one is a thread that the ravenscar-thread added. QEMU has now way to know about those threads, since they are really embedded inside the program; that's why we have the ravenscar layer, which uses inside-knowledge to extract the list of threads. Next, we insert a watchpoint, which applies to all threads. No problem so far. Then, we continue; meaning that GDB sends a Z2 packet to QEMU to get the watchpoint inserted, then a vCont to resume the program's execution. The program hits the watchpoints, and thererfore QEMU reports it back: Packet received: T05thread:01;watch:000022c4; Since QEMU knows about one thread and one thread only, it stands to reason that it would say that the event applies to thread:01, which is our first thread in the "info threads" listing. That thread has a ptid of {42000, lwp=1, tid=0}. This is where Pedro's change kicks in: Seeing this event, and having determined that the event was reported for thread 01, and therefore ptid {42000, lwp=1, tid=0}, it saves the watchpoint-hit event info in the private area of that thread/ptid. Once this is done, remote.c's event-wait layer returns. Enter the ravenscar-thread layer of the event-wait, which does a little dance to delegate the wait to underlying layers with ptids that those layers know about, and then when the target_beneath's to_wait is done, tries to figure out which thread is now the active thread. The code looks like this: 1. inferior_ptid = base_ptid; 2. beneath->to_wait (beneath, base_ptid, status, 0); 3. [...] 4. ravenscar_update_inferior_ptid (); 5. 6. return inferior_ptid; Line 1 is where we reset inferior_ptid to the ptid that the target_beneath layer knows about, allowing us to then call its to_wait implementation (line 2). And then, upon return, we call ravenscar_update_inferior_ptid, which reads inferior memory to determine which thread is actually active, setting inferior_ptid accordingly. Then we return that inferior_ptid (which, again, neither QEMU and therefore nor the remote.c layer knows about). Upon return, we eventually arrive to the part where we try to handle the inferior event: we discover that we got a SIGTRAP and, as part of its handling, we call watchpoints_triggered, which calls target_stopped_by_watchpoint, which eventually remote_stopped_by_watchpoint, where Pedro's change kicks in again: struct thread_info *thread = inferior_thread (); return (thread->priv != NULL && thread->priv->stop_reason == TARGET_STOPPED_BY_WATCHPOINT); Because the ravenscar-thread layer changed the inferior_ptid to the ptid of the active thread, inferior_thread now returns the private data of that thread. This is not the thread that QEMU reported the watchpoint-hit on, and thus, the function returns "no watchpoint hit, mister". Hence GDB not understanding the SIGTRAP, thus reporting it verbatim. The way we chose to fix the issue is by making sure that the ravenscar-thread layer doesn't let the remote layer be called with inferior_ptid being set to a thread that the remote layer does not know about. gdb/ChangeLog: * ravenscar-thread.c (ravenscar_stopped_by_sw_breakpoint) (ravenscar_stopped_by_hw_breakpoint, ravenscar_stopped_by_watchpoint) (ravenscar_stopped_data_address, ravenscar_core_of_thread): New functions. (init_ravenscar_thread_ops): Set the to_stopped_by_sw_breakpoint, to_stopped_by_hw_breakpoint, to_stopped_by_watchpoint, to_stopped_data_address and to_core_of_thread fields of ravenscar_ops.
2017-11-21Add a test for PR binutils/22451H.J. Lu3-0/+68
Check in the object file generated from the older assembler as a compressed file. PR binutils/22451 * testsuite/binutils-all/x86-64/objects.exp: New file. * testsuite/binutils-all/x86-64/pr22451.o.bz2: Likewise.
2017-11-21[PowerPC] Detect different long double floating-point formatsUlrich Weigand7-12/+163
Current versions of GCC support switching the format used for "long double" to either IBM double double or IEEE-128. The resulting binary is marked via different setting of the Tag_GNU_Power_ABI_FP GNU attribute. This patch checks this attribute to detect the format of the default "long double" type and sets GDB's notion of the format accordingly. The patch also adds support for the "__ibm128" type, which always uses IBM double double format independent of the format used for "long double". A new test case verifies that all three types, "long double", "__float128", and "__ibm128" are correctly detected in all three compiler settings, the default setting, -mabi=ieeelongdouble, and -mabi=ibmlongdouble. gdb/ChangeLog: 2017-11-21 Ulrich Weigand <uweigand@de.ibm.com> * ppc-tdep.h (enum powerpc_long_double_abi): New data type. (struct gdbarch_tdep): New member long_double_abi. * rs6000-tdep.c (rs6000_gdbarch_init): Initialize long_double_abi member of tdep struct based on Tag_GNU_Power_ABI_FP attribute. * ppc-linux-tdep.c (ppc_linux_init_abi): Install long double data format depending on long_double_abi tdep member. (ppc_floatformat_for_type): Handle __ibm128 type. gdb/testsuite/ChangeLog: 2017-11-21 Ulrich Weigand <uweigand@de.ibm.com> * gdb.arch/ppc-longdouble.exp: New file. * gdb.arch/ppc-longdouble.c: Likewise.
2017-11-21gdb.ada/minsyms.exp: Don't hardcode the variable's addressPedro Alves2-1/+5
This new testcase has a test that fails like this here: $1 = (<data variable, no debug info> *) 0x60208c <some_minsym> (gdb) FAIL: gdb.ada/minsyms.exp: print &some_minsym The problem is that the testcase hardcodes an expected address for the "some_minsym" variable, which obviously isn't stable. Fix that by expecting $hex instead. gdb/testsuite/ChangeLog: 2017-11-21 Pedro Alves <palves@redhat.com> * gdb.ada/minsyms.exp: Accept any address for 'some_minsym'.
2017-11-21Stop the v850 linker from converting to other output formats whilst linking.Nick Clifton4-2/+32
PR 22419 * emultempl/v850elf.em (v850_create_output_section_statements): New function. Generate an error if attempting to convert the format of the output file. * testsuite/ld-unique/pr21529.d: Skip for the V850. * testsuite/ld-elf/pr21884.d: Skip for the V850.
2017-11-21[ARC] [COMMITTED] Update test pattern patching.claziss2-1/+6
2017-11-21 Claudiu Zissulescu <claziss@synopsys.com> * testsuite/binutils-all/arc/objdump.exp: Update pattern matching expression.