aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-05-17Fix for dwz-related crashTom Tromey2-34/+67
PR symtab/23010 reports a crash that occurs when using -readnow on a dwz-generated debuginfo file. The crash occurs because the DWARF has a partial CU with no language set, and then a full CU that references this partial CU using DW_AT_abstract_origin. In this case, the partial CU is read by dw2_expand_all_symtabs using language_minimal; but then this conflicts with the creation of the block's symbol table in the C++ CU. This patch fixes the problem by arranging for partial CUs not to be read by -readnow. I tend to think that it doesn't make sense to read a partial CU in isolation -- they should only be read when imported into some other CU. In conjunction with some other patches I am going to post, this also fixes the Rust -readnow crash that Jan reported. There are two problems with this patch: 1. It is difficult to reason about. There are many cases where I've patched the code to call init_cutu_and_read_dies with the flag set to "please do read partial units" -- but I find it difficult to be sure that this is always correct. 2. It is still missing a standalone test case. This seemed hard. 2018-05-17 Tom Tromey <tom@tromey.com> PR symtab/23010: * dwarf2read.c (load_cu, dw2_do_instantiate_symtab) (dw2_instantiate_symtab): Add skip_partial parameter. (dw2_find_last_source_symtab, dw2_map_expand_apply) (dw2_lookup_symbol, dw2_expand_symtabs_for_function) (dw2_expand_all_symtabs, dw2_expand_symtabs_with_fullname) (dw2_expand_symtabs_matching_one) (dw2_find_pc_sect_compunit_symtab) (dw2_debug_names_lookup_symbol) (dw2_debug_names_expand_symtabs_for_function): Update. (init_cutu_and_read_dies): Add skip_partial parameter. (process_psymtab_comp_unit, build_type_psymtabs_1) (process_skeletonless_type_unit, load_partial_comp_unit) (psymtab_to_symtab_1): Update. (load_full_comp_unit): Add skip_partial parameter. (process_imported_unit_die, dwarf2_read_addr_index) (follow_die_offset, dwarf2_fetch_die_loc_sect_off) (dwarf2_fetch_constant_bytes, dwarf2_fetch_die_type_sect_off) (read_signatured_type): Update.
2018-05-17Updated simplified Chinese translation for the opcodes directory.Nick Clifton2-466/+465
opcodes * po/zh_CN.po: Updated simplified Chinese translation.
2018-05-17value.c: Remove unused variablesSimon Marchi2-6/+7
Obvious patch to remove unused local variables (found by adding -Wunused). I didn't touch this one in value_fetch_lazy, because check_typedef could have a desired side-effect. 3743 struct type *type = check_typedef (value_type (val)); gdb/ChangeLog: * value.c (release_value): Remove unused variable. (record_latest_value): Likewise. (access_value_history): Likewise. (preserve_values): Likewise.
2018-05-17Initialize py_type_printers in ext_lang_type_printersTom Tromey2-1/+6
When running gdb in the build directory without passing --data-directory, I noticed I could provoke a crash by: $ ./gdb -nx ./gdb (gdb) ptype/o struct dwarf2_per_objfile ... and then trying to "q" out at the pagination prompt. valgrind complained about an uninitialized use of py_type_printers. Initializing this member fixes the bug. I believe this bug can occur even when the gdb Python libraries are available, for example if get_type_recognizers fails. Tested by hand on x86-64 Fedora 26. No test case because it seemed difficult to guarantee failures. gdb/ChangeLog 2018-05-17 Tom Tromey <tom@tromey.com> * extension.h (struct ext_lang_type_printers) <py_type_printers>: Initialize.
2018-05-17Automatic date update in version.inGDB Administrator1-1/+1
2018-05-16PR gdb/22286: linux-nat-trad: Support arbitrary register widthsMaciej W. Rozycki2-10/+26
Update `fetch_register' and `store_register' code to support arbitrary register widths rather than only ones that are a multiply of the size of the `ptrace' data type used with PTRACE_PEEKUSR and PTRACE_POKEUSR requests to access registers. Remove associated assertions, correcting an issue with accessing the DSPControl (`$dspctl') register on n64 MIPS native targets: (gdb) print /x $dspctl .../gdb/linux-nat-trad.c:50: internal-error: void linux_nat_trad_target::fetch_register(regcache*, int): Assertion `(size % sizeof (PTRACE_TYPE_RET)) == 0' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) n This is a bug, please report it. For instructions, see: <http://www.gnu.org/software/gdb/bugs/>. .../gdb/linux-nat-trad.c:50: internal-error: void linux_nat_trad_target::fetch_register(regcache*, int): Assertion `(size % sizeof (PTRACE_TYPE_RET)) == 0' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) n Command aborted. (gdb) All registers are now reported correctly and their architectural hardware widths respected: (gdb) print /x $dspctl $1 = 0x55aa33cc (gdb) info registers zero at v0 v1 R0 0000000000000000 0000000000000001 000000fff7ffeb20 0000000000000000 a0 a1 a2 a3 R4 0000000000000001 000000ffffffeaf8 000000ffffffeb08 0000000000000000 a4 a5 a6 a7 R8 000000fff7ee3800 000000fff7ede8f0 000000ffffffeaf0 2f2f2f2f2f2f2f2f t0 t1 t2 t3 R12 0000000000000437 0000000000000002 000000fff7ffd000 0000000120000ad0 s0 s1 s2 s3 R16 000000fff7ee2068 0000000120000e60 0000000000000000 0000000000000000 s4 s5 s6 s7 R20 0000000000521ec8 0000000000522608 0000000000000000 0000000000000000 t8 t9 k0 k1 R24 0000000000000000 0000000120000d9c 0000000000000000 0000000000000000 gp sp s8 ra R28 0000000120019030 000000ffffffe990 000000ffffffe990 000000fff7d5b88c status lo hi badvaddr 0000000000109cf3 0000000000005ea5 0000000000000211 000000fff7fc6fe0 cause pc 0000000000800024 0000000120000dbc fcsr fir hi1 lo1 00000000 00f30000 0000000000000000 0101010101010101 hi2 lo2 hi3 lo3 0202020202020202 0303030303030303 0404040404040404 0505050505050505 dspctl restart 55aa33cc 0000000000000000 (gdb) NB due to the lack of access to 64-bit DSP hardware all DSP register values in the dumps are artificial and have been created with a debug change applied to the kernel handler of the `ptrace' syscall. The use of `store_unsigned_integer' and `extract_unsigned_integer' unconditionally in all cases rather than when actual data occupies a part of the data quantity exchanged with `ptrace' makes code perhaps marginally slower, however I think avoiding it is not worth code obfuscation it would cause. If this turns out unfounded, then there should be no problem with optimizing this code later. gdb/ PR gdb/22286 * linux-nat-trad.c (linux_nat_trad_target::fetch_register): Also handle registers whose width is not a multiple of PTRACE_TYPE_RET. (linux_nat_trad_target::store_register): Likewise.
2018-05-16NDS32/GAS: Correct an `expr' global shadowing error for pre-4.8 GCCMaciej W. Rozycki2-2/+7
Remove `-Wshadow' compilation errors: cc1: warnings being treated as errors .../gas/config/tc-nds32.c: In function 'md_assemble': .../gas/config/tc-nds32.c:5212: error: declaration of 'expr' shadows a global declaration .../gas/expr.h:180: error: shadowed declaration is here make[4]: *** [tc-nds32.o] Error 1 which for versions of GCC before 4.8 prevent support for NDS32 targets from being built. See also GCC PR c/53066. gas/ * tc-nds32.c (md_assemble): Rename `expr' local variable to `insn_expr'.
2018-05-16NDS32/BFD: Fix build error in `nds32_convert_32_to_16'Maciej W. Rozycki2-1/+5
Fix: cc1: warnings being treated as errors .../bfd/elf32-nds32.c: In function 'nds32_convert_32_to_16': .../bfd/elf32-nds32.c:6816: error: 'insn_type' may be used uninitialized in this function make[4]: *** [elf32-nds32.lo] Error 1 seen with GCC 4.1.2 and 4.4.7. bfd/ * elf32-nds32.c (nds32_convert_32_to_16): Preset `insn_type'.
2018-05-16Make "cbfd" a gdb_bfd_ref_ptrTom Tromey4-5/+13
This changes program_space::cbfd to be a gdb_bfd_ref_ptr. This makes it somewhat less error-prone to use, because now it manages the reference counting automatically. Tested by the buildbot. 2018-05-16 Tom Tromey <tom@tromey.com> * gdbcore.h (core_bfd): Redefine. * corelow.c (core_target::close): Update. (core_target_open): Update. * progspace.h (struct program_space) <cbfd>: Now a gdb_bfd_ref_ptr.
2018-05-16Use a distinguishing name for minidebug objfileTom Tromey4-5/+25
One part of PR cli/19551 is that the mini debug info objfile reuses the name of the main objfile from which it comes. This can be seen because gdb claims to be reading symbols from the same file two times, like: Reading symbols from /bin/gdb...Reading symbols from /bin/gdb...(no debugging symbols found)...done. I think this would be less confusing if the minidebug objfile were given a different name. That is what this patch implements. It also arranges for the minidebug objfile to be marked OBJF_NOT_FILENAME. After this patch the output looks like: Reading symbols from /bin/gdb...Reading symbols from .gnu_debugdata for /usr/libexec/gdb...(no debugging symbols found)...done. Tested by the buildbot. gdb/ChangeLog 2018-05-16 Tom Tromey <tom@tromey.com> PR cli/19551: * symfile-add-flags.h (enum symfile_add_flags) <SYMFILE_NOT_FILENAME>: New constant. * symfile.c (read_symbols): Use SYMFILE_NOT_FILENAME. Get objfile name from BFD. (symbol_file_add_with_addrs): Check SYMFILE_NOT_FILENAME. * minidebug.c (find_separate_debug_file_in_section): Put ".gnu_debugdata" into BFD's file name.
2018-05-16regcache.c: Remove unused typedefsSimon Marchi2-5/+5
gdb/ChangeLog: * regcache.c (regcache_read_ftype, regcache_write_ftype): Remove.
2018-05-16PR22458, failure to choose a matching ELF targetAlan Modra7-32/+44
https://sourceware.org/ml/binutils/2013-05/msg00271.html was supposed to banish "file format is ambiguous" errors for ELF. It didn't, because the code supposedly detecting formats that implement match_priority didn't work. That was due to not placing all matching targets into the vector of matching targets. ELF objects should all match the generic ELF target (priority 2), plus one or more machine specific targets (priority 1), and perhaps a single machine specific target with OS/ABI set (priority 0, best match). So the armel object in the testcase actually matches elf32-littlearm, elf32-littlearm-symbian, and elf32-littlearm-vxworks (all priority 1), and elf32-little (priority 2). As the PR reported, elf32-little wasn't seen as matching. Fixing that part of the problem wasn't too difficult but matching the generic ELF target as well as the ARM ELF targets resulted in ARM testsuite failures. These proved to be the annoying reordering of stubs that occurs from time to time due to the stub names containing the section id. Matching another target causes more sections to be created in elf_object_p. If section ids change, stub names change, which results in different hashing and can therefore result in different hash table traversal and stub creation order. That particular problem is fixed by resetting section_id to the initial state before attempting each target match, and taking a snapshot of its value after a successful match. PR 22458 * format.c (struct bfd_preserve): Add section_id. (bfd_preserve_save, bfd_preserve_restore): Save and restore _bfd_section_id. (bfd_reinit): Set _bfd_section_id. (bfd_check_format_matches): Put all matches of any priority into matching_vector. Save initial section id and start each attempted match at that section id. * libbfd-in.h (_bfd_section_id): Declare. * section.c (_bfd_section_id): Rename from section_id and make global. Adjust uses. (bfd_get_next_section_id): Delete. * elf64-ppc.c (ppc64_elf_setup_section_lists): Replace use of bfd_get_section_id with _bfd_section_id. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate.
2018-05-16Fix disassembly mask for vector sdot on AArch64.Tamar Christina3-160/+186
This patch corrects the disassembly masks for by element dot product instructions. The bit 10 was wrong and supposed to be 1. This caused incorrect disassembly of instructions in the unallocated space to disassemble as dot product instructions. No encoding errors can arrise from this issue. opcodes/ PR binutils/23109 * aarch64-tbl.h (aarch64_opcode_table): Correct sdot and udot. * aarch64-dis-2.c: Regenerate.
2018-05-16Automatic date update in version.inGDB Administrator1-1/+1
2018-05-15Implement Read/Write constraints on system registers on AArch64Tamar Christina16-100/+247
This patch adds constraints for read and write only system registers with the msr and mrs instructions. The code will treat having both flags set and none set as the same. These flags add constraints that must be matched up. e.g. a system register with a READ only flag set, can only be used with mrs. If The constraint fails a warning is emitted. Examples of the warnings generated: test.s: Assembler messages: test.s:5: Warning: specified register cannot be written to at operand 1 -- `msr dbgdtrrx_el0,x3' test.s:7: Warning: specified register cannot be read from at operand 2 -- `mrs x3,dbgdtrtx_el0' test.s:8: Warning: specified register cannot be written to at operand 1 -- `msr midr_el1,x3' and disassembly notes: 0000000000000000 <main>: 0: d5130503 msr dbgdtrtx_el0, x3 4: d5130503 msr dbgdtrtx_el0, x3 8: d5330503 mrs x3, dbgdtrrx_el0 c: d5330503 mrs x3, dbgdtrrx_el0 10: d5180003 msr midr_el1, x3 ; note: writing to a read-only register. Note that because dbgdtrrx_el0 and dbgdtrtx_el0 have the same encoding, during disassembly the constraints are use to disambiguate between the two. An exact constraint match is always prefered over partial ones if available. As always the warnings can be suppressed with -w and also be made errors using warnings as errors. binutils/ PR binutils/21446 * doc/binutils.texi (-M): Document AArch64 options. gas/ PR binutils/21446 * testsuite/gas/aarch64/illegal-sysreg-2.s: Fix pmbidr_el1 test. * testsuite/gas/aarch64/illegal-sysreg-2.l: Likewise. * testsuite/gas/aarch64/illegal-sysreg-2.d: Likewise. * testsuite/gas/aarch64/sysreg-diagnostic.s: New. * testsuite/gas/aarch64/sysreg-diagnostic.l: New. * testsuite/gas/aarch64/sysreg-diagnostic.d: New. include/ PR binutils/21446 * opcode/aarch64.h (F_SYS_READ, F_SYS_WRITE): New. opcodes/ PR binutils/21446 * aarch64-asm.c (opintl.h): Include. (aarch64_ins_sysreg): Enforce read/write constraints. * aarch64-dis.c (aarch64_ext_sysreg): Likewise. * aarch64-opc.h (F_DEPRECATED, F_ARCHEXT, F_HASXT): Moved here. (F_REG_READ, F_REG_WRITE): New. * aarch64-opc.c (aarch64_print_operand): Generate notes for AARCH64_OPND_SYSREG. (F_DEPRECATED, F_ARCHEXT, F_HASXT): Move to aarch64-opc.h. (aarch64_sys_regs): Add constraints to currentel, midr_el1, ctr_el0, mpidr_el1, revidr_el1, aidr_el1, dczid_el0, id_dfr0_el1, id_pfr0_el1, id_pfr1_el1, id_afr0_el1, id_mmfr0_el1, id_mmfr1_el1, id_mmfr2_el1, id_mmfr3_el1, id_mmfr4_el1, id_isar0_el1, id_isar1_el1, id_isar2_el1, id_isar3_el1, id_isar4_el1, id_isar5_el1, mvfr0_el1, mvfr1_el1, mvfr2_el1, ccsidr_el1, id_aa64pfr0_el1, id_aa64pfr1_el1, id_aa64dfr0_el1, id_aa64dfr1_el1, id_aa64isar0_el1, id_aa64isar1_el1, id_aa64mmfr0_el1, id_aa64mmfr1_el1, id_aa64mmfr2_el1, id_aa64afr0_el1, id_aa64afr0_el1, id_aa64afr1_el1, id_aa64zfr0_el1, clidr_el1, csselr_el1, vsesr_el2, erridr_el1, erxfr_el1, rvbar_el1, rvbar_el2, rvbar_el3, isr_el1, tpidrro_el0, cntfrq_el0, cntpct_el0, cntvct_el0, mdccsr_el0, dbgdtrrx_el0, dbgdtrtx_el0, osdtrrx_el1, osdtrtx_el1, mdrar_el1, oslar_el1, oslsr_el1, dbgauthstatus_el1, pmbidr_el1, pmsidr_el1, pmswinc_el0, pmceid0_el0, pmceid1_el0. * aarch64-tbl.h (aarch64_opcode_table): Add constraints to msr (F_SYS_WRITE), mrs (F_SYS_READ).
2018-05-15Allow non-fatal errors to be emitted and for disassembly notes be placed on ↵Tamar Christina10-55/+152
AArch64 This patch adds a new platform option "notes" that can be used to indicate if disassembly notes should be placed in the disassembly as comments. These notes can contain information about a failing constraint such as reading from a write-only register. The disassembly will not be blocked because of this but -M notes will emit a comment saying that the operation is not allowed. For assembly this patch adds a new non-fatal status for errors. This is essentially a warning. The reason for not creating an actual warning type is that this causes the interaction between the ordering of warnings and errors to be problematic. Currently the error buffer is almost always filled because of the way operands are matched during assembly. An earlier template may have put an error there that would only be displayed if no other template matches or generates a higher priority error. But by definition a warning is lower priority than a warning, so the error (which is incorrect if another template matched) will supersede the warning. By treating warnings as errors and only later relaxing the severity this relationship keeps working and the existing reporting infrastructure can be re-used. binutils/ PR binutils/21446 * doc/binutils.texi (-M): Document AArch64 options. * NEWS: Document notes and warnings. gas/ PR binutils/21446 * config/tc-aarch64.c (print_operands): Indicate no notes. (output_operand_error_record): Support non-fatal errors. (output_operand_error_report, warn_unpredictable_ldst, md_assemble): Likewise. include/ PR binutils/21446 * opcode/aarch64.h (aarch64_operand_error): Add non_fatal. (aarch64_print_operand): Support notes. opcodes/ PR binutils/21446 * aarch64-dis.c (no_notes: New. (parse_aarch64_dis_option): Support notes. (aarch64_decode_insn, print_operands): Likewise. (print_aarch64_disassembler_options): Document notes. * aarch64-opc.c (aarch64_print_operand): Support notes.
2018-05-15Modify AArch64 Assembly and disassembly functions to be able to fail and ↵Tamar Christina15-573/+813
report why. This patch if the first patch in a series to add the ability to add constraints to system registers that an instruction must adhere to in order for the register to be usable with that instruction. These constraints can also be used to disambiguate between registers with the same encoding during disassembly. This patch adds a new flags entry in the sysreg structures and ensures it is filled in and read out during assembly/disassembly. It also adds the ability for the assemble and disassemble functions to be able to gracefully fail and re-use the existing error reporting infrastructure. The return type of these functions are changed to a boolean to denote success or failure and the error structure is passed around to them. This requires aarch64-gen changes so a lot of the changes here are just mechanical. gas/ PR binutils/21446 * config/tc-aarch64.c (parse_sys_reg): Return register flags. (parse_operands): Fill in register flags. gdb/ PR binutils/21446 * aarch64-tdep.c (aarch64_analyze_prologue, aarch64_software_single_step, aarch64_displaced_step_copy_insn): Indicate not interested in errors. include/ PR binutils/21446 * opcode/aarch64.h (aarch64_opnd_info): Change sysreg to struct. (aarch64_decode_insn): Accept error struct. opcodes/ PR binutils/21446 * aarch64-asm.h (aarch64_insert_operand, aarch64_##x): Return boolean and take error struct. * aarch64-asm.c (aarch64_ext_regno, aarch64_ins_reglane, aarch64_ins_reglist, aarch64_ins_ldst_reglist, aarch64_ins_ldst_reglist_r, aarch64_ins_ldst_elemlist, aarch64_ins_advsimd_imm_shift, aarch64_ins_imm, aarch64_ins_imm_half, aarch64_ins_advsimd_imm_modified, aarch64_ins_fpimm, aarch64_ins_imm_rotate1, aarch64_ins_imm_rotate2, aarch64_ins_fbits, aarch64_ins_aimm, aarch64_ins_limm_1, aarch64_ins_limm, aarch64_ins_inv_limm, aarch64_ins_ft, aarch64_ins_addr_simple, aarch64_ins_addr_regoff, aarch64_ins_addr_offset, aarch64_ins_addr_simm, aarch64_ins_addr_simm10, aarch64_ins_addr_uimm12, aarch64_ins_simd_addr_post, aarch64_ins_cond, aarch64_ins_sysreg, aarch64_ins_pstatefield, aarch64_ins_sysins_op, aarch64_ins_barrier, aarch64_ins_prfop, aarch64_ins_hint, aarch64_ins_reg_extended, aarch64_ins_reg_shifted, aarch64_ins_sve_addr_ri_s4xvl, aarch64_ins_sve_addr_ri_s6xvl, aarch64_ins_sve_addr_ri_s9xvl, aarch64_ins_sve_addr_ri_s4, aarch64_ins_sve_addr_ri_u6, aarch64_ins_sve_addr_rr_lsl, aarch64_ins_sve_addr_rz_xtw, aarch64_ins_sve_addr_zi_u5, aarch64_ext_sve_addr_zz, aarch64_ins_sve_addr_zz_lsl, aarch64_ins_sve_addr_zz_sxtw, aarch64_ins_sve_addr_zz_uxtw, aarch64_ins_sve_aimm, aarch64_ins_sve_asimm, aarch64_ins_sve_index, aarch64_ins_sve_limm_mov, aarch64_ins_sve_quad_index, aarch64_ins_sve_reglist, aarch64_ins_sve_scale, aarch64_ins_sve_shlimm, aarch64_ins_sve_shrimm, aarch64_ins_sve_float_half_one, aarch64_ins_sve_float_half_two, aarch64_ins_sve_float_zero_one, aarch64_opcode_encode): Likewise. * aarch64-dis.h (aarch64_extract_operand, aarch64_##x): Likewise. * aarch64-dis.c (aarch64_ext_regno, aarch64_ext_reglane, aarch64_ext_reglist, aarch64_ext_ldst_reglist, aarch64_ext_ldst_reglist_r, aarch64_ext_ldst_elemlist, aarch64_ext_advsimd_imm_shift, aarch64_ext_imm, aarch64_ext_imm_half, aarch64_ext_advsimd_imm_modified, aarch64_ext_fpimm, aarch64_ext_imm_rotate1, aarch64_ext_imm_rotate2, aarch64_ext_fbits, aarch64_ext_aimm, aarch64_ext_limm_1, aarch64_ext_limm, decode_limm, aarch64_ext_inv_limm, aarch64_ext_ft, aarch64_ext_addr_simple, aarch64_ext_addr_regoff, aarch64_ext_addr_offset, aarch64_ext_addr_simm, aarch64_ext_addr_simm10, aarch64_ext_addr_uimm12, aarch64_ext_simd_addr_post, aarch64_ext_cond, aarch64_ext_sysreg, aarch64_ext_pstatefield, aarch64_ext_sysins_op, aarch64_ext_barrier, aarch64_ext_prfop, aarch64_ext_hint, aarch64_ext_reg_extended, aarch64_ext_reg_shifted, aarch64_ext_sve_addr_ri_s4xvl, aarch64_ext_sve_addr_ri_s6xvl, aarch64_ext_sve_addr_ri_s9xvl, aarch64_ext_sve_addr_ri_s4, aarch64_ext_sve_addr_ri_u6, aarch64_ext_sve_addr_rr_lsl, aarch64_ext_sve_addr_rz_xtw, aarch64_ext_sve_addr_zi_u5, aarch64_ext_sve_addr_zz, aarch64_ext_sve_addr_zz_lsl, aarch64_ext_sve_addr_zz_sxtw, aarch64_ext_sve_addr_zz_uxtw, aarch64_ext_sve_aimm, aarch64_ext_sve_asimm, aarch64_ext_sve_index, aarch64_ext_sve_limm_mov, aarch64_ext_sve_quad_index, aarch64_ext_sve_reglist, aarch64_ext_sve_scale, aarch64_ext_sve_shlimm, aarch64_ext_sve_shrimm, aarch64_ext_sve_float_half_one, aarch64_ext_sve_float_half_two, aarch64_ext_sve_float_zero_one, aarch64_opcode_decode): Likewise. (determine_disassembling_preference, aarch64_decode_insn, print_insn_aarch64_word, print_insn_data): Take errors struct. (print_insn_aarch64): Use errors. * aarch64-asm-2.c: Regenerate. * aarch64-dis-2.c: Regenerate. * aarch64-gen.c (print_operand_inserter): Use errors and change type to boolean in aarch64_insert_operan. (print_operand_extractor): Likewise. * aarch64-opc.c (aarch64_print_operand): Use sysreg struct.
2018-05-15MIPS/Linux/native: Supply $zero for the !PTRACE_GETREGS caseMaciej W. Rozycki2-1/+12
With native MIPS/Linux targets the $zero register is inaccessible, with its supposed context slot provided by the OS occupied by the $restart register. The PTRACE_GETREGS path takes care of it by artificially supplying the hardwired contents of $zero in `mips_supply_gregset' or `mips64_supply_gregset', as applicable, however the PTRACE_PEEKUSER fallback does not, making the register unavailable, e.g.: (gdb) info registers zero at v0 v1 a0 a1 a2 a3 R0 <unavl> 00000001 00000001 d2f1a9fc 00000000 00000000 00417158 00417150 t0 t1 t2 t3 t4 t5 t6 t7 R8 00000004 00000000 fffffff8 00000000 00000000 00000000 00000001 00000007 s0 s1 s2 s3 s4 s5 s6 s7 R16 00000000 00405e30 00000000 00500000 00000000 0052ec08 00000000 00000000 t8 t9 k0 k1 gp sp s8 ra R24 00000000 00417008 00000000 00000000 0041e220 7fff4ce0 7fff4ce0 00405d0c status lo hi badvaddr cause pc <unavl> 00441cf1 00000017 00417004 00800024 00405d10 fcsr fir restart 00800000 00f30000 00000000 (gdb) or (under certain circumstances): (gdb) stepi Register 0 is not available (gdb) This is specifically because `mips_linux_register_addr' and `mips64_linux_register_addr', both correctly return -1 for MIPS_ZERO_REGNUM, and therefore `linux_nat_trad_target::fetch_registers' faithfully marks this register as unavailable. Supply this register artificially then in the PTRACE_PEEKUSER case as well, correcting this issue. gdb/ * mips-linux-nat.c (mips_linux_nat_target::fetch_registers): Supply the MIPS_ZERO_REGNUM register.
2018-05-15MIPS: Make `mask_address_var' staticMaciej W. Rozycki2-1/+5
Make the `mask_address_var' variable static, it is not used outside mips-tdep.c and having no target name embedded within it causes a risk of a namespace clash. gdb/ * mips-tdep.c (mask_address_var): Make variable static.
2018-05-15testsuite: Fix a `server_pid' access crash in gdb.server/server-kill.expMaciej W. Rozycki2-1/+7
Fix a commit f90183d7e31b ("Get GDBserver pid on remote target") bug and correctly handle the case where the PID of `gdbserver' could not have been retrieved. If that happens, $server_pid is unset causing: FAIL: gdb.server/server-kill.exp: p server_pid ERROR: tcl error sourcing .../gdb/testsuite/gdb.server/server-kill.exp. ERROR: can't read "server_pid": no such variable while executing "if {$server_pid == "" } { return -1 }" (file ".../gdb/testsuite/gdb.server/server-kill.exp" line 49) invoked from within "source .../gdb/testsuite/gdb.server/server-kill.exp" ("uplevel" body line 1) invoked from within "uplevel #0 source .../gdb/testsuite/gdb.server/server-kill.exp" invoked from within "catch "uplevel #0 source $test_file_name"" Verify that the variable exists then rather than trying to access it. gdb/testsuite/ * gdb.server/server-kill.exp: Verify whether `server_pid' exists rather then trying to access it in determining whether the PID of `gdbserver' could have been retrieved.
2018-05-15Fix uninitialised memory acccess in COFF bfd backendChristophe Guillon2-0/+8
2018-05-15 Christophe Guillon <christophe.guillon@st.com> * coffcode.h (coff_bigobj_swap_aux_in): Make sure that all fields of the aux structure are initialised. Change-Id: I81be255ac6611afbe00995fac550e98e6a07e5df
2018-05-15Fix error messages in the NFP sources when building for 32-bit targets.Francois H. Theron6-100/+104
bfd * targets.c: Wrap nfp_elf64_vec in BFD64 ifdef. include * opcode/nfp.h: Use uint64_t instead of bfd_vma. opcodes * nfp-dis.c: Use uint64_t for instruction variables, not bfd_vma.
2018-05-15Add a new Portuguese translation for the bfd sub-directory.Nick Clifton4-2/+8774
* po/pt.po: New Portuguese translation. * configure.ac (ALL_LINGUAS): Add pt. * configure: Regenerate.
2018-05-15Restore LDFLAGS in notes.expAlan Modra2-0/+6
Fixes an spu-elf test regression due to using the wrong flags. * testsuite/ld-elf/notes.exp: Restore LDFLAGS.
2018-05-15Recognize more targets as ELF for testingAlan Modra3-12/+25
Also use the correct rel strip-13 variant for more ARM targets. * testsuite/lib/binutils-common.exp (is_elf_format): Add chorus, cloudabi, fuchsia, kaos and nto. Merge netbsdelf* into *elf*, and *uclinux* into *linux*. * testsuite/binutils-all/objcopy.exp: Accept armeb for rel strip-13 test, exclude arm-vxworks and arm-windiss.
2018-05-15Automatic date update in version.inGDB Administrator1-1/+1
2018-05-14Clear rust_unions in rust_union_quirksTom Tromey2-0/+6
It turns out that a dwarf2_cu can remain allocated after psymtab expansion is done, and so it makes sense to clear rust_unions when done processing it. Tested on x86-64 Fedora 27. 2018-05-14 Tom Tromey <tom@tromey.com> * dwarf2read.c (rust_union_quirks): Clear rust_unions.
2018-05-14Stop generating GNU build notes for linkonce sections.Nick Clifton7-48/+139
gas * write.c (maybe_generate_build_notes): Generate notes on a per-code-section basis. Skip linkonce sections. ld * testsuite/ld-elf/notes.exp: New file: Run new test. * testsuite/ld-elf/note1_1.s: New file: Source file for test. * testsuite/ld-elf/note1_2.s: New file: Source file for test. * testsuite/ld-elf/note1.r: New file: Expected readelf output.
2018-05-14Fix a problem in the assembler when checking for overlapping input and ↵Nick Clifton2-1/+7
output files on non-POSIX compliant systems. PR 23153 * as.c (main): When checking for an output file that is also an input file, also check that the inode is not zero.
2018-05-14x86; Allow IFUNC pointer defined in PDEH.J. Lu17-4/+290
If IFUNC symbol is defined in position-dependent executable, we should change it to the normal function and set its address to its PLT entry which should be resolved by R_*_IRELATIVE at run-time. All external references should be resolved to its PLT in executable. bfd/ PR ld/23169 * elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Don't issue an error on IFUNC pointer defined in PDE. * elf32-i386.c (elf_i386_finish_dynamic_symbol): Call _bfd_x86_elf_link_fixup_ifunc_symbol. * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise. * elfxx-x86.c (_bfd_x86_elf_link_fixup_ifunc_symbol): New function. * elfxx-x86.h (_bfd_x86_elf_link_fixup_ifunc_symbol): New. ld/ PR ld/23169 * testsuite/ld-ifunc/ifunc-9-i386.d: New file. * testsuite/ld-ifunc/ifunc-9-x86-64.d: Likewise. * testsuite/ld-ifunc/pr23169a.c: Likewise. * testsuite/ld-ifunc/pr23169a.rd: Likewise. * testsuite/ld-ifunc/pr23169b.c: Likewise. * testsuite/ld-ifunc/pr23169b.c: Likewise. * testsuite/ld-ifunc/pr23169c.rd: Likewise. * testsuite/ld-ifunc/pr23169c.rd: Likewise. * testsuite/ld-ifunc/ifunc-9-x86.d: Removed. * testsuite/ld-ifunc/ifunc.exp: Run PR ld/23169 tests.
2018-05-14x86: Mark __bss_start, _end and _edata locally definedH.J. Lu8-10/+137
__bss_start, _end and _edata are defined by linker to mark regions within executables and shared libraries. All references within executables should be locally resolved. This patch doesn't change how their references within shared libraries are resolved. bfd/ PR ld/23162 * elfxx-x86.c (elf_x86_linker_defined): New function. (_bfd_x86_elf_link_check_relocs): Use it to mark __bss_start, _end and _edata locally defined within executables. ld/ PR ld/23162 * testsuite/ld-elf/pr23162.map: New file. * testsuite/ld-elf/pr23162.rd: Likewise. * testsuite/ld-elf/pr23162a.c: Likewise. * testsuite/ld-elf/pr23162b.c: Likewise. * testsuite/ld-elf/shared.exp: Run PR ld/23162 tests.
2018-05-14Automatic date update in version.inGDB Administrator1-1/+1
2018-05-13Automatic date update in version.inGDB Administrator1-1/+1
2018-05-12score gcc-8 warning fixesAlan Modra2-70/+72
Rather than just silencing the gcc-8 warnings, I decided to rewrite the buffer handling in the two functions where gcc was warning. The rest of the file could do with the same treatment. * config/tc-score.c (s3_do_macro_bcmp): Don't use fixed size buffers. (s3_do_macro_bcmpz): Likewise.
2018-05-12PR20659, Objcopy and change section lma failingAlan Modra6-86/+116
Sections may well belong in multiple segments. The testcase in the PR saw an allocated section being assigned to an ABIFLAGS segment, then not being assigned to a LOAD segment because it had already been handled. To fix that particular problem this patch sets and tests segment_mark only for LOAD segments. I kept the segment_mark test for LOAD segments because I think there may otherwise be a problem with zero size sections. A few other problems showed up with the testcase. Some targets align .dynamic, resulting in the test failing with "section .dynamic lma 0x800000c0 adjusted to 0x800000cc" and similar messages. I've tried to handle that with some more hacks to the segment lma, which do the right thing for the testcase, but may well fail in other situations. I've also removed the tests of segment lma (p_paddr) and code involved in deciding that an adjusted segment no longer covers the file or program headers. Those test can't be correct in the face of objcopy --change-section-lma. It may be necessary to reinstate the tests but do them modulo page size, but we'll see how this goes. PR 20659 bfd/ * elf.c (rewrite_elf_program_header): Use segment_mark only for PT_LOAD headers. Delete first_matching_lma and first_suggested_lma. Instead make matching_lma and suggested_lma pointers to the sections. Align section vma and lma calculated from segment. Don't clear includes_phdrs or includes_filehdr based on p_paddr test. Try to handle alignment padding before first section by adjusting new segment lma down. Adjust PT_PHDR map p_paddr. ld/ * testsuite/ld-elf/changelma.d, * testsuite/ld-elf/changelma.lnk, * testsuite/ld-elf/changelma.s: New test.
2018-05-12Automatic date update in version.inGDB Administrator1-1/+1
2018-05-11gdb/x86: Fix write out of mxcsr register for xsave targetsAndrew Burgess2-2/+7
In commit: commit 8ee22052f690c007556b97eed59f49350ece5ca9 Author: Andrew Burgess <andrew.burgess@embecosm.com> Date: Thu May 3 17:46:14 2018 +0100 gdb/x86: Handle kernels using compact xsave format in two places FXSAVE_ADDR was used instead of FXSAVE_MXCSR_ADDR to get the address of the mxcsr register within the xsave buffer. This will mean we are potentially accessing the wrong location within the xsave buffer. There are no tests included with this patch. The first mistake would only trigger an issue if/when the user tries to manually set the mxcsr register to a value that matches the random (value off stack) value that is in the xsave buffer, in this case the change by the user will go unnoticed by GDB, and the default value of mxcsr will be preserved. The second mistake only happens on the code path where all x87 registers are being written out of the register cache. I'm not sure how to trigger that code path. gdb/ChangeLog: * i387-tdep.c (i387_collect_xsave): Use FXSAVE_MXCSR_ADDR not FXSAVE_ADDR for the mxcsr register.
2018-05-11gdb: xtensa: drop gdb_target definitionMax Filippov2-1/+5
gdb_target definitions were removed from configure.tgt in 2007, before xtensa port was merged. Remove it from the xtensa target as well. gdb/ 2018-05-11 Max Filippov <jcmvbkbc@gmail.com> * configure.tgt (xtensa*-*-linux*): Drop gdb_target definition.
2018-05-11Fix email address in ChangeLog entryPedro Alves1-1/+1
tromey@redhat.com -> palves@redhat.com
2018-05-11Heap-allocate core_target instancesPedro Alves3-121/+184
This gets rid of the core_ops global, and replaces it with heap-allocated core_target instances. In practice, there will only be one such instance, though that will change further ahead as more pieces of multi-target support are merged. Notice that this replaces one heap-allocated object for another, the number of allocations is the same. Specifically, currently we heap-allocate the 'core_data' object, which holds the core's section table. With this patch, that object is made a field of the core_target class, and no longer allocated separately. Note that this bit: - /* Looks semi-reasonable. Toss the old core file and work on the - new. */ - - unpush_target (&core_ops); does not need a replacement, because by the time we get here, the target_preopen call at the top of core_target_open has already unpushed any previous target. gdb/ChangeLog: 2018-05-11 Pedro Alves <palves@redhat.com> * corelow.c (core_target) <core_target>: No longer inline. Initialize m_core_gdbarch, m_core_vec and build the section table here. <~core_target>: New. <core_gdbarch, get_core_register_section>: New methods. <m_core_section_table, m_core_vec, m_core_gdbarch>: New fields, factored out from ... <core_data, core_vec, core_gdbarch>: ... these deleted globals. (core_ops): Delete. (sniff_core_bfd): Add gdbarch parameter. (core_close): Delete, merged into ... (core_target::close): ... here. Delete self. (core_close_cleanup): Delete. (core_target_open): Allocate a core_target on the heap. Use a unique_ptr instead of a cleanup. Bits moved into the core_target ctor. Adjust to use core_target methods instead of globals. (get_core_register_section): Rename to ... (core_target::get_core_register_section): ... this and adjust. (struct get_core_registers_cb_data): New. (get_core_registers_cb): Use it. Use bool. (core_target::fetch_registers, core_target::files_info) (core_target::xfer_partial, core_target::read_description) (core_target::pid_to, core_target::thread_name): Adjust to reference class fields instead of globals. * target.h (struct target_ops_deleter, target_ops_up): New.
2018-05-11Eliminate the 'the_core_target' globalPedro Alves4-33/+43
(previously called 'core_target', but since renamed because 'core_target' is the name of the target_ops class now.) This eliminates the "the_core_target" global, as preparation for being able to have more than one core loaded. When we get there, we will instantiate one core_target object per core instead. Essentially, this replaces the reference to the_core_target in core_file_command by a reference to core_bfd, which is per program_space. Currently, core_file_command calls 'the_core_target->detach()' even if the core target is not open and pushed on the target stack. If it is indeed not open, then the practical effect is that core_target::detach() prints "No core file now.". That is preserved by printing that directly from within core_file_command if not debugging a core. gdb/ChangeLog: 2018-05-11 Pedro Alves <palves@redhat.com> * corefile.c (core_file_command): Move to corelow.c. * corelow.c (the_core_target): Delete. (core_file_command): Moved from corefile.c. Check exec_bfd instead of the_core_target. Use target_detach instead of calling into the_core_target directly. (maybe_say_no_core_file_now): New. (core_target::detach): Use it. (_initialize_corelow): Remove references to the_core_target. * gdbcore.h (the_core_target): Delete.
2018-05-11Move core_bfd to program spaceTom Tromey4-5/+11
This moves the core_bfd global to be a field of the program space. It then replaces core_bfd with a macro to avoid a massive patch -- the same approach taken for various other program space fields. This is a basic transformation for multi-target work. 2018-05-11 Tom Tromey <tromey@redhat.com> Pedro Alves <tromey@redhat.com> * corefile.c (core_bfd): Remove. * gdbcore.h (core_bfd): Now a macro. * progspace.h (struct program_space) <cbfd>: New field.
2018-05-11Remove cleanups from mdebugread.cTom Tromey2-30/+20
This removes the remaining cleanups from mdebugread.c, replacing them with gdb::def_vector. Tested by the buildbot, though I doubt this exercises mdebugread. gdb/ChangeLog 2018-05-11 Tom Tromey <tom@tromey.com> * mdebugread.c (parse_partial_symbols, psymtab_to_symtab_1): Use gdb::def_vector.
2018-05-11Automatic date update in version.inGDB Administrator1-1/+1
2018-05-10x86 LynxOS-178: Adjust floating-point context structureJoel Brobecker2-1/+46
The floating point context structure on x86 LynxOS-178 is not the same as on LynxOS 5.x. As a consequence, trying to print the return value of a function returning a float, for instance, yields incorrect results. This patch fixes the issue by providing an updated definition for LynxOS-178 (the reason why we cannot access the actual definition provided by the system still remains true). gdb/gdbserver/ChangeLog: * lynx-i386-low.c (LYNXOS_178): New macro. [LYNXOS_178] (usr_fcontext_t): Provide a definition that matches the layout on LynxOS-178. (lynx_i386_fill_fpregset, lynx_i386_store_fpregset): Do not handle floating point registers that are not supported by LynxOS-178.
2018-05-10Fix the clang buildTom Tromey5-3/+12
Simon pointed out that gdb would not build with clang, due to the addition of -Wimplicit-fallthrough. This patch fixes the problem by using -Wimplicit-fallthrough=3 -- this does not work with clang, bypassing the issue. Tested by rebuilding with both gcc and clang; and also by verifying that -Wimplicit-fallthrough=3 is used in the gcc build. I will file a follow-up bug to convert the fall-through comments to a form that can be used by both clang and gcc. gdb/ChangeLog 2018-05-10 Tom Tromey <tom@tromey.com> * configure: Rebuild. * warning.m4 (AM_GDB_WARNINGS): Use -Wimplicit-fallthrough=3. gdb/gdbserver/ChangeLog 2018-05-10 Tom Tromey <tom@tromey.com> * configure: Rebuild.
2018-05-10Allow integer immediates for AArch64 fmov instructions.Tamar Christina8-43/+37
This patch makes it possible to use an integer immediate with the fmov instructions allowing you to simply write fmov d0, #2 instead of needing fmov d0, #2.0. The parse double function already know to deal with this so we just need to list the restriction put in place in parser. The is considered a QoL improvement for hand assembly writers and allows more code portability between assembler. gas/ * config/tc-aarch64.c (parse_aarch64_imm_float): Remove restrictions. * testsuite/gas/aarch64/diagnostic.s: Move fmov int test to.. * testsuite/gas/aarch64/fpmov.s: Here. * testsuite/gas/aarch64/fpmov.d: Update results with fmov. * testsuite/gas/aarch64/diagnostic.l: Remove fmov values. * testsuite/gas/aarch64/sve-invalid.s: Update test files. * testsuite/gas/aarch64/sve-invalid.l: Likewise
2018-05-10Allow integer immediate for VFP vmov instructions.Tamar Christina4-0/+34
This patch fixes the case where you want to use an integer value the floating point immediate to a VFP vmov instruction such as vmovmi.f32 s27, #11. If the immediate is not a float we convert it and copy it's representation into the imm field and then carry on validating as if we originally entered a floating point immediate. The is considered a QoL improvement for hand assembly writers and allows more code portability between assembler. gas/ * gas/config/tc-arm.c (do_neon_mov): Allow integer literal for float immediate. * testsuite/gas/arm/vfp-mov-enc.s: New. * testsuite/gas/arm/vfp-mov-enc.d: New.
2018-05-10gdbserver/Windows: crash during connection establishment phaseJoel Brobecker12-28/+81
On Windows, starting a new process with GDBserver seems to work, in the sense that the program does get started, and GDBserver confirms that it is listening for GDB to connect. However, as soon as GDB establishes the connection with GDBserver, and starts discussing with it, GDBserver crashes, with a SEGV. This SEGV occurs in remote-utils.c::prepare_resume_reply... | regp = current_target_desc ()->expedite_regs; | [...] | while (*regp) ... because, in our case, REGP is NULL. This patches fixes the issues by adding a parameter to init_target_desc, in order to make sure that we always provide the list of registers when we initialize a target description. gdb/ChangeLog: PR server/23158: * regformats/regdat.sh: Adjust script, following the addition of the new expedite_regs parameter to init_target_desc. gdb/gdbserver/ChangeLog: PR server/23158: * tdesc.h (init_target_desc) <expedite_regs>: New parameter. * tdesc.c (init_target_desc) <expedite_regs>: New parameter. Use it to set the expedite_regs field in the given tdesc. * x86-tdesc.h: New file. * linux-aarch64-tdesc.c (aarch64_linux_read_description): Adjust following the addition of the new expedite_regs parameter to init_target_desc. * linux-tic6x-low.c (tic6x_read_description): Likewise. * linux-x86-tdesc.c: #include "x86-tdesc.h". (i386_linux_read_description, amd64_linux_read_description): Adjust following the addition of the new expedite_regs parameter to init_target_desc. * lynx-i386-low.c: #include "x86-tdesc.h". (lynx_i386_arch_setup): Adjust following the addition of the new expedite_regs parameter to init_target_desc. * nto-x86-low.c: #include "x86-tdesc.h". (nto_x86_arch_setup): Adjust following the addition of the new expedite_regs parameter to init_target_desc. * win32-i386-low.c: #include "x86-tdesc.h". (i386_arch_setup): Adjust following the addition of the new expedite_regs parameter to init_target_desc.
2018-05-10gdbserver/Windows: Fix "no program to debug" errorJoel Brobecker2-0/+10
Trying to start a program with GDBserver on Windows yields the following error: $ gdbserver.exe --once :4444 simple_main.exe Killing process(es): 5008 No program to debug Exiting The error itself comes from the following code shortly after create_inferior gets called (in server.c::main): /* Wait till we are at first instruction in program. */ create_inferior (program_path.get (), program_args); [...] if (last_status.kind == TARGET_WAITKIND_EXITED || last_status.kind == TARGET_WAITKIND_SIGNALLED) was_running = 0; else was_running = 1; if (!was_running && !multi_mode) error ("No program to debug"); What happens is that the "last_status" global starts initialized as zeroes, which means last_status.kind == TARGET_WAITKIND_EXITED, and we expect create_inferior to be waiting for the inferior to start until reaching the SIGTRAP, and to set the "last_status" global to match that last event we received. I suspect this is an unintended side-effect of the following change... commit 2090129c36c7e582943b7d300968d19b46160d84 Date: Thu Dec 22 21:11:11 2016 -0500 Subject: Share fork_inferior et al with gdbserver ... which removes some code in server.c that was responsible for starting the inferior in a functin that was named start_inferior, and looked like this: signal_pid = create_inferior (new_argv[0], &new_argv[0]); [...] /* Wait till we are at 1st instruction in program, return new pid (assuming success). */ last_ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0); The code has been transitioned to using fork_inferior, but sadly, only for the targets that support it. On Windows, the calls to wait setting "last_status" simply disappeared. This patch adds it back in the Windows-specific implementation of create_inferior. gdb/gdbserver/ChangeLog: PR server/23158: * win32-low.c (win32_create_inferior): Add call to my_wait setting last_status global.