aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-02-11Fix building the bfd/elf32-msp430.c file on a 32-bit host.Nick Clifton2-20/+34
* elf32-msp430.c (msp430_final_link_relocate): Always use longs for addresses in print statements. (msp430_elf_relax_delete_bytes): Likewise. (msp430_elf_relax_add_words): Likewise. (msp430_elf_relax_section): Likewise.
2020-02-11Clear plugin_data memoryH.J. Lu2-0/+6
Clear plugin_data memory since it may be uninitialized. * plugin.c (add_symbols): Clear plugin_data memory.
2020-02-11x86: drop ShortForm attributeJan Beulich7-10947/+10968
It is very simple to derive from other template properties, and hence there's little point wasting storage for it.
2020-02-11x86: drop stray ShortForm attributesJan Beulich3-12/+18
This attribute is meaningless when there are no operands to encode.
2020-02-11[binutils][gas] Fix build failure with -std=c89Matthew Malcomson2-2/+7
My previous patch introduced the use of a C99 feature. C99 standard is not required for gas, so this feature should be removed. Committed as obvious. gas/ChangeLog: 2020-02-11 Matthew Malcomson <matthew.malcomson@arm.com> * config/tc-arm.c (vcx_handle_register_arguments): Remove `for` loop initial declaration.
2020-02-11[gdb/testsuite] Fix UNRESOLVED in gdb.server/server-kill-python.expTom de Vries2-0/+9
The test-case gdb.server/server-kill-python.exp runs fine by itself: ... Running src/gdb/testsuite/gdb.server/server-kill-python.exp ... === gdb Summary === nr of expected passes 3 ... But if we run f.i. gdb.server/file-transfer.exp before it, we get instead: ... Running src/gdb/testsuite/gdb.server/server-kill-python.exp ... ERROR: GDB process no longer exists === gdb Summary === nr of expected passes 13 nr of unresolved testcases 1 ... We can see the origin of the problem here: ... spawn gdbserver --once localhost:2347 \ build/gdb/testsuite/outputs/gdb.server/file-transfer/file-transfer \ build/gdb/testsuite/outputs/gdb.server/server-kill-python/server-kill-python^M Process build/gdb/testsuite/outputs/gdb.server/file-transfer/file-transfer \ created; pid = 9464^M Listening on port 2347^M ... The spawn of the gdbserver for the server-kill-python test-case gets as executable argument the file-transfer binary. This is caused by proc gdbserver_spawn attempting to load the exec file in $file_last_loaded. This is something that is meant to load the same exec in the gdbserver that was earlier loaded into gdb. In this test-case however, nothing has been loaded into gdb by the test-case, and consequently we load the file that was loaded into gdb in the previous test-case. Fix this by unsetting $file_last_loaded in gdb_init. Build and reg-tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-02-11 Tom de Vries <tdevries@suse.de> PR testsuite/25488 * lib/gdb.exp (gdb_init): Unset $file_last_loaded. Change-Id: Ic385e08cbd34cbf85518720cf5695b4ff6619f4b
2020-02-10Use GCC LTO wrapper to get real symbols from LTO IR objectsH.J. Lu11-23/+554
GCC LTO wrapper is needed to extract real symbols from LTO IR objects. This patch does the following: 1. Set up GCC LTO wrapper for each LTO IR object. 2. Run GCC LTO wrapper to get the real object. 3. Extract symbol info from the real object. 4. Cleanup afterwards. bfd/ PR binutils/25355 * configure.ac (HAVE_EXECUTABLE_SUFFIX): New AC_DEFINE. (EXECUTABLE_SUFFIX): Likewise. * config.in: Regenerated. * configure: Likewise. * plugin.c (bfd_plugin_close_and_cleanup): Removed. (plugin_list_entry): Add all_symbols_read, cleanup_handler, gcc, lto_wrapper, resolution_file, resolution_option, gcc_env, real_bfd, real_nsyms, real_syms, lto_nsyms and lto_syms. (get_lto_wrapper): New. (setup_lto_wrapper_env): Likewise. (current_plugin): Likewise. (register_all_symbols_read): Likewise. (register_cleanup): Likewise. (get_symbols): Likewise. (add_input_file): Likewise. (bfd_plugin_close_and_cleanup): Likewise. (claim_file): Removed. (register_claim_file): Set current_plugin->claim_file. (add_symbols): Make a copy of LTO symbols. Set lto_nsyms and lto_syms in current_plugin. (try_claim): Use current_plugin->claim_file. Call LTO plugin all_symbols_read handler. Copy real symbols to plugin_data. Call LTO plugin cleanup handler. Clean up for LTO wrapper. (try_load_plugin): Don't reuse the previous plugin for LTO wrapper. Set up GCC LTO wrapper if possible. Don't set plugin_list_iter->claim_file. (bfd_plugin_canonicalize_symtab): Use real LTO symbols if possible. * plugin.h (plugin_data_struct): Add real_bfd, real_nsyms and real_syms. ld/ PR binutils/25355 * testsuite/ld-plugin/lto.exp: Run PR binutils/25355 test. * testsuite/ld-plugin/pr25355.c: New file. * testsuite/ld-plugin/pr25355.d: Likewise. * testsuite/lib/ld-lib.exp (run_cc_link_tests): Support compile only dump.
2020-02-11Ensure *valuep always written by extract_normal returnAlan Modra16-15/+68
* cgen-ibld.in (extract_normal): Set *valuep on all return paths. * bpf-ibld.c, * epiphany-ibld.c, * fr30-ibld.c, * frv-ibld.c, * ip2k-ibld.c, * iq2000-ibld.c, * lm32-ibld.c, * m32c-ibld.c, * m32r-ibld.c, * mep-ibld.c, * mt-ibld.c, * or1k-ibld.c, * xc16x-ibld.c, * xstormy16-ibld.c: Regenerate.
2020-02-11Automatic date update in version.inGDB Administrator1-1/+1
2020-02-10MSP430: Enable relaxation of jump instructions to hard-coded pcrel offsetsJozef Lawrynowicz2-11/+65
This patch fixes execution failures which occur when the BR in a sequence such as: J<cond> 1f BR 1: is relaxed to a JMP, and the pc-relative offset for the destination of the J<cond> instruction is hard-coded to be 2 words ahead of the instruction. The hard-coded offset will cause execution to jump 1 word ahead of where it should actually go. Instead we now detect the hard-coded offset is one we inserted earlier, and invert the condition, allowing us to remove the BR entirely. bfd/ChangeLog: 2020-02-10 Jozef Lawrynowicz <jozef.l@mittosystems.com> * elf32-msp430.c (msp430_elf_relax_section): Before relaxing a branch, check if previous instruction matches a conditional jump inserted earlier. Invert conditional jump and delete branch in this case.
2020-02-10MSP430: Enable relaxation of relocs in JMP instructionsJozef Lawrynowicz2-30/+75
This patch fixes relocation overflows caused by an inability to relax unconditional JMP instructions to BR instructions. bfd/ChangeLog: 2020-02-10 Jozef Lawrynowicz <jozef.l@mittosystems.com> * elf32-msp430.c (msp430_elf_relax_add_two_words): Rename to msp430_elf_relax_add_words. Support insertion of either one or two words. (msp430_elf_relax_section): Catch opcode of 0x3c00 when relocation needs to be grown. Handle insertion of branch instruction to replace jump.
2020-02-10MSP430: Add printf statements to assist with debugging during relaxationJozef Lawrynowicz2-5/+98
bfd/ChangeLog: 2020-02-10 Jozef Lawrynowicz <jozef.l@mittosystems.com> * elf32-msp430.c (msp430_final_link_relocate): Add printf statements for debugging relocations. (msp430_elf_relax_delete_bytes): Likewise. (msp430_elf_relax_add_two_words): Likewise. (msp430_elf_relax_section): Likewise.
2020-02-10[binutils][arm] Implement Custom Datapath Extensions for MVEMatthew Malcomson15-4/+1438
Here we implement the custom datapath extensions for MVE. This required the following changes: - Adding a new register argument type (that takes either an MVE vector or a Neon S or D register). - Adding two new immediate operands types (0-127 and 0-4095). - Using the Neon type machinery to distinguish between instruction types. This required the introduction of new neon shapes to account for the coprocessor operands to these instructions. - Adding a new disassembly character to `print_insn_cde` to handle the new register types. Specification can be found at https://developer.arm.com/docs/ddi0607/latest Successfully regression tested on arm-none-eabi, and arm-wince-pe. gas/ChangeLog: 2020-02-10 Matthew Malcomson <matthew.malcomson@arm.com> * config/tc-arm.c (NEON_MAX_TYPE_ELS): Increment to account for instructions that can have 5 arguments. (enum operand_parse_code): Add new operands. (parse_operands): Account for new operands. (S5): New macro. (enum neon_shape_el): Introduce P suffixes for coprocessor. (neon_select_shape): Account for P suffix. (LOW1): Move macro to global position. (HI4): Move macro to global position. (vcx_assign_vec_d): New. (vcx_assign_vec_m): New. (vcx_assign_vec_n): New. (enum vcx_reg_type): New. (vcx_get_reg_type): New. (vcx_size_pos): New. (vcx_vec_pos): New. (vcx_handle_shape): New. (vcx_ensure_register_in_range): New. (vcx_handle_register_arguments): New. (vcx_handle_insn_block): New. (vcx_handle_common_checks): New. (do_vcx1): New. (do_vcx2): New. (do_vcx3): New. * testsuite/gas/arm/cde-missing-fp.d: New test. * testsuite/gas/arm/cde-missing-fp.l: New test. * testsuite/gas/arm/cde-missing-mve.d: New test. * testsuite/gas/arm/cde-missing-mve.l: New test. * testsuite/gas/arm/cde-mve-or-neon.d: New test. * testsuite/gas/arm/cde-mve-or-neon.s: New test. * testsuite/gas/arm/cde-mve.s: New test. * testsuite/gas/arm/cde-warnings.l: * testsuite/gas/arm/cde-warnings.s: * testsuite/gas/arm/cde.d: * testsuite/gas/arm/cde.s: opcodes/ChangeLog: 2020-02-10 Matthew Malcomson <matthew.malcomson@arm.com> * arm-dis.c (print_insn_cde): Define 'V' parse character. (cde_opcodes): Add VCX* instructions.
2020-02-10[binutils][arm] arm support for ARMv8.m Custom Datapath ExtensionMatthew Malcomson14-4/+1573
This patch is part of a series that adds support for the Armv8.m ARMv8.m Custom Datapath Extension to binutils. This patch introduces the Custom Instructions Class 1/2/3 (Single/ Dual, Accumulator/Non-accumulator varianats) to the arm backend. The following Custom Instructions are added: cx1, cx1a, cx1d, cx1da, cx2, cx2a, cx2d, cx2da, cx3, cx3a, cx3d, cx3da. Specification can be found at https://developer.arm.com/docs/ddi0607/latest This patch distinguishes between enabling CDE for different coprocessor numbers by defining multiple architecture flags. This means that the parsing of the architecture extension flags is kept entirely in the existing code path. We introduce a new IT block state to indicate the behaviour of these instructions. This new state allows being used in an IT block or outside an IT block, but does not allow the instruction to be used inside a VPT block. We need this since the CX*A instruction versions can be used in IT blocks, but they aren't to have the conditional suffixes on them. Hence we need to mark an instruction as allowed in either position. We also need a new flag to objdump, in order to determine whether to disassemble an instruction as CDE related or not. Successfully regression tested on arm-none-eabi, and arm-wince-pe. gas/ChangeLog: 2020-02-10 Stam Markianos-Wright <stam.markianos-wright@arm.com> Matthew Malcomson <matthew.malcomson@arm.com> * config/tc-arm.c (arm_ext_cde*): New feature sets for each CDE coprocessor that can be enabled. (enum pred_instruction_type): New pred type. (BAD_NO_VPT): New error message. (BAD_CDE): New error message. (BAD_CDE_COPROC): New error message. (enum operand_parse_code): Add new immediate operands. (parse_operands): Account for new immediate operands. (check_cde_operand): New. (cde_coproc_enabled): New. (cde_coproc_pos): New. (cde_handle_coproc): New. (cxn_handle_predication): New. (do_custom_instruction_1): New. (do_custom_instruction_2): New. (do_custom_instruction_3): New. (do_cx1): New. (do_cx1a): New. (do_cx1d): New. (do_cx1da): New. (do_cx2): New. (do_cx2a): New. (do_cx2d): New. (do_cx2da): New. (do_cx3): New. (do_cx3a): New. (do_cx3d): New. (do_cx3da): New. (handle_pred_state): Define new IT block behaviour. (insns): Add newn CX*{,d}{,a} instructions. (CDE_EXTENSIONS,armv8m_main_ext_table,armv8_1m_main_ext_table): Define new cdecp extension strings. * doc/c-arm.texi: Document new cdecp extension arguments. * testsuite/gas/arm/cde-scalar.d: New test. * testsuite/gas/arm/cde-scalar.s: New test. * testsuite/gas/arm/cde-warnings.d: New test. * testsuite/gas/arm/cde-warnings.l: New test. * testsuite/gas/arm/cde-warnings.s: New test. * testsuite/gas/arm/cde.d: New test. * testsuite/gas/arm/cde.s: New test. include/ChangeLog: 2020-02-10 Stam Markianos-Wright <stam.markianos-wright@arm.com> Matthew Malcomson <matthew.malcomson@arm.com> * opcode/arm.h (ARM_EXT2_CDE): New extension macro. (ARM_EXT2_CDE0): New extension macro. (ARM_EXT2_CDE1): New extension macro. (ARM_EXT2_CDE2): New extension macro. (ARM_EXT2_CDE3): New extension macro. (ARM_EXT2_CDE4): New extension macro. (ARM_EXT2_CDE5): New extension macro. (ARM_EXT2_CDE6): New extension macro. (ARM_EXT2_CDE7): New extension macro. opcodes/ChangeLog: 2020-02-10 Stam Markianos-Wright <stam.markianos-wright@arm.com> Matthew Malcomson <matthew.malcomson@arm.com> * arm-dis.c (struct cdeopcode32): New. (CDE_OPCODE): New macro. (cde_opcodes): New disassembly table. (regnames): New option to table. (cde_coprocs): New global variable. (print_insn_cde): New (print_insn_thumb32): Use print_insn_cde. (parse_arm_disassembler_options): Parse coprocN args.
2020-02-10x86: Accept Intel64 only instruction by defaultH.J. Lu10-3960/+4026
Commit d835a58baae720 disabled sysenter/sysenter in 64-bit mode by default. By default, assembler should accept common, Intel64 only and AMD64 ISAs since there are no conflicts. gas/ PR gas/25516 * config/tc-i386.c (intel64): Renamed to ... (isa64): This. (match_template): Accept Intel64 only instruction by default. (i386_displacement): Updated. (md_parse_option): Updated. * c-i386.texi: Update -mamd64/-mintel64 documentation. * testsuite/gas/i386/i386.exp: Run x86-64-sysenter. Pass -mamd64 to x86-64-sysenter-amd. * testsuite/gas/i386/x86-64-sysenter.d: New file. opcodes/ PR gas/25516 * i386-gen.c (opcode_modifiers): Replace AMD64 and Intel64 with ISA64. * i386-opc.h (AMD64): Removed. (Intel64): Likewose. (AMD64): New. (INTEL64): Likewise. (INTEL64ONLY): Likewise. (i386_opcode_modifier): Replace amd64 and intel64 with isa64. * i386-opc.tbl (Amd64): New. (Intel64): Likewise. (Intel64Only): Likewise. Replace AMD64 with Amd64. Update sysenter/sysenter with Cpu64 and Intel64Only. Remove AMD64 from sysenter/sysenter. * i386-tbl.h: Regenerated.
2020-02-10Allow objcopy's --set-section-flags options to add or remove the SHF_EXCLUDE ↵Fangrui Song3-5/+11
flag of ELF sections. * objcopy.c (parse_flags): Handle "exclude". * doc/binutils.texi: Document the support.
2020-02-10More debuginfod tests fixes.Aaron Merey2-15/+30
Start server before setting environment variable. Specify tmpdir as the location of the server's database. Check additional server metrics at start-up.
2020-02-10Fix potential problem with binutils debuginfod tests.Aaron Merey2-3/+8
* binutils/testsuite/binutils-all/debuginfod.exp: Replace set ::env with setenv.
2020-02-10[gdb] Fix -Wstrict-null-sentinel warningsTom de Vries4-2/+12
When passed in CXXFLAGS, -Wstrict-null-sentinel triggers twice in a gdb/gdbserver build. Fix the two occurrences. Build and reg-tested on x86_64-linux. gdb/ChangeLog: 2020-02-10 Tom de Vries <tdevries@suse.de> * dwarf2/read.c (process_psymtab_comp_unit_reader): Cast concat NULL sentinel to char *. gdbsupport/ChangeLog: 2020-02-10 Tom de Vries <tdevries@suse.de> * environ.c (gdb_environ::set): Cast concat NULL sentinel to char *.
2020-02-10[gdb/testsuite] Skip multi-target.exp without gdbserverTom de Vries2-0/+8
Pre-commit 919adfe840 "Move gdbserver to top level", if we build gdb with --disable-gdbserver, and run test-case gdb.multi/multi-target.exp, we run into: ... (gdb) PASS: gdb.multi/multi-target.exp: continue: non-stop=off: set remote-exec file in inferior 2 spawn of --once --multi localhost:2346 failed ERROR: tcl error sourcing /data/gdb_versions/devel/src/gdb/testsuite/gdb.multi/multi-target.exp. ERROR: Timeout waiting for gdbserver response. ... Fix this by using skip_gdbserver_tests in multi-target.exp. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-02-10 Tom de Vries <tdevries@suse.de> * gdb.multi/multi-target.exp: Skip if skip_gdbserver_tests.
2020-02-10GDB/testsuite: Fix a catastrophic step-over-no-symbols.exp failureMaciej W. Rozycki2-1/+8
Fix a catastrophic failure in gdb.base/step-over-no-symbols.exp where remote target communication issues cause the value of the PC retrieved to be empty: (gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: stepi p /x $pc Remote 'g' packet reply is too long (expected 264 bytes, got 532 bytes): 00000000000000002a6f61551500000080faffff3f0000000028010000000000b03857551500000060ad5f5515000000906e615515000000802401000000000090faffff3f00000000000000000000000100000000000000e8fbffff3f000000f8fbffff3f0000000000000000000000b8faffff3f0000008a05010000000000589c6f551500000056424d40435c2f7c1809575515000000f0e0baaa2a0000000000000000000000f0ffbaaa2a000000f0e0baaa2a0000006804baaa2a000000000000000000000000000000000000007053baaa2a0000008252b2aa2a00000090fe01000000000048e056551500000004000000000000004000000000000000920501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xxxxxxxxxxxxxxxx00000000 (gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC ERROR: tcl error sourcing .../gdb/testsuite/gdb.base/step-over-no-symbols.exp. ERROR: missing operand at _@_ in expression " _@_!= " (parsing expression " != ") invoked from within "expr $before_addr != $after_addr" ("uplevel" body line 1) invoked from within "uplevel 1 expr $condition" (procedure "gdb_assert" line 6) invoked from within "gdb_assert {$before_addr != $after_addr} "advanced"" (procedure "test_step_over" line 36) invoked from within "test_step_over $displaced" ("uplevel" body line 2) invoked from within "uplevel 1 $body" invoked from within "with_test_prefix "displaced=$displaced" { test_step_over $displaced }" ("foreach" body line 6) invoked from within "foreach displaced { "off" "on" "auto" } { if { $displaced != "off" && ![support_displaced_stepping] } { continue } with_test_prefix "dis..." (file ".../gdb/testsuite/gdb.base/step-over-no-symbols.exp" line 84) invoked from within "source .../gdb/testsuite/gdb.base/step-over-no-symbols.exp" ("uplevel" body line 1) invoked from within "uplevel #0 source .../gdb/testsuite/gdb.base/step-over-no-symbols.exp" invoked from within "catch "uplevel #0 source $test_file_name"" Remote debugging from host xxx.xxx.xxx.xxx, port 47130 monitor exit Killing process(es): 1092 Remote communication error. Target disconnected.: Connection reset by peer. (gdb) To do so verify first, before making an arithmetic comparison, that the values to compare are actually integers (using a string comparison would result in a false PASS if both operands were empty, as in this case), making the test script proceed normally: (gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: stepi p /x $pc Remote 'g' packet reply is too long (expected 264 bytes, got 532 bytes): 00000000000000002a6f61551500000080faffff3f0000000028010000000000b03857551500000060ad5f5515000000906e615515000000802401000000000090faffff3f00000000000000000000000100000000000000e8fbffff3f000000f8fbffff3f0000000000000000000000b8faffff3f0000008a05010000000000589c6f5515000000424d40435c2f7c7c1809575515000000f0e0baaa2a0000000000000000000000f0ffbaaa2a000000f0e0baaa2a0000006804baaa2a000000000000000000000000000000000000007053baaa2a0000008252b2aa2a00000090fe01000000000048e056551500000004000000000000004000000000000000920501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xxxxxxxxxxxxxxxx00000000 (gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: advanced Remote debugging from host xxx.xxx.xxx.xxx, port 48404 monitor exit Killing process(es): 1795 Remote communication error. Target disconnected.: Connection reset by peer. (gdb) Note the double curly braces, to take advantage of `&&' operator's lazy evaluation. gdb/testsuite/ * gdb.base/step-over-no-symbols.exp: Verify that $before_addr and $after_addr are both integers before making a comparison.
2020-02-10gas: error for section type, attr, or entsize changeAlan Modra4-8/+31
* config/obj-elf.c (obj_elf_change_section): Error for section type, attr or entsize changes in assembly. * testsuite/gas/elf/elf.exp: Pass -Z to gas for section5 test. * testsuite/gas/elf/section5.l: Update.
2020-02-10gas -Z flagAlan Modra3-2/+9
-Z is supposed to "generate object file even after errors". It doesn't do so at the moment, unless you count a zero length object file as useful output. Fixed for most targets as follows. I suspect avr and pru need target patches. * output-file.c (output_file_close): Do a normal close when flag_always_generate_output. * write.c (write_object_file): Don't stop output when flag_always_generate_output.
2020-02-10z80 comments in archures.cAlan Modra3-19/+44
bfd-in2.h didn't match what was in archures.c and reloc.c. This fixes overlong comment lines and regenerates bfd-in2.h. * archures.c: Wrap overlong z80 comments. * bfd-in2.h: Regenerate.
2020-02-10Automatic date update in version.inGDB Administrator1-1/+1
2020-02-09[gdb] Mention CU offset for <artifical> if verboseTom de Vries2-0/+13
Say we're debugging a test-case with CUs with name "<artificial>", meaning not originating from a single file compilation, and use the verbose setting: ... $ gdb -iex "set verbose on" -batch cc1 Reading symbols from cc1... Reading in symbols for <artificial>... \ and /tmp/trunk/gcc/attribs.c... \ ... and /tmp/trunk/gcc/tree-ssa-reassoc.c... \ done. ... From the "/tmp/trunk/gcc/attribs.c" message, it's clear which CU is loaded. But that's not the case for the "<artificial>" message. The message uses the filename field of struct partial_symtab, which is documented like this: ... /* Name of the source file which this partial_symtab defines, or if the psymtab is anonymous then a descriptive name for debugging purposes, or "". It must not be NULL. */ ... So, fix this by setting the filename field to a more descriptive name than "<artificial>", by appending the CU offset. This way, we print instead: ... $ gdb -iex "set verbose on" -batch cc1 Reading symbols from cc1... Reading in symbols for <artificial>@0x41146d9 \ and /tmp/trunk/gcc/attribs.c... \ ... \ and /tmp/trunk/gcc/tree-ssa-reassoc.c... \ done. ... Build and reg-tested on x86_64-linux. gdb/ChangeLog: 2020-02-09 Tom de Vries <tdevries@suse.de> * dwarf2read.c (process_psymtab_comp_unit_reader): Append CU offset to filename if it matches "<artificial>".
2020-02-09[gdb/testsuite] Capture many-headers.exp progress and output in gdb.logTom de Vries2-5/+20
When running test-case gdb.base/many-headers.exp, we have test output on stdout/stderr: ... Running src/gdb/testsuite/gdb.base/many-headers.exp ... [New LWP 759] Core was generated by `outputs/gdb.base/many-headers/many'. Program terminated with signal SIGSEGV, Segmentation fault. \#0 0x0000000000400688 in ?? () === gdb Summary === nr of expected passes 1 ... Furthermore, the only trace in gdb.log that we have of the gdb command issued is: ... PASS: gdb.base/many-headers.exp: read core file ... Fix this by echoing the gdb command in gdb.log, and capturing the command output and pasting it into gdb.log: ... ( ulimit -s 4096; \ gdb -nw -nx -data-directory data-directory -batch -core=many-headers.core ) [New LWP 1542] Core was generated by `many'. Program terminated with signal SIGSEGV, Segmentation fault. \#0 0x0000000000400688 in ?? () PASS: gdb.base/many-headers.exp: read core file ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-02-09 Tom de Vries <tdevries@suse.de> * gdb.base/many-headers.exp: Echo gdb command to gdb.log. Capture gdb command output and paste it into gdb.log. If any, paste catch message to gdb.log.
2020-02-09Use enums for human-readable exception information.Hannes Domani2-6/+102
Changes to $_siginfo type to this: (gdb) pt $_siginfo type = struct EXCEPTION_RECORD { enum ExceptionCode ExceptionCode; DWORD ExceptionFlags; struct EXCEPTION_RECORD *ExceptionRecord; PVOID ExceptionAddress; DWORD NumberParameters; union { ULONG_PTR ExceptionInformation[15]; struct {...} AccessViolationInformation; }; } (gdb) pt $_siginfo.ExceptionCode type = enum ExceptionCode {FATAL_APP_EXIT = 1073741845, DBG_CONTROL_C = 1073807365, DBG_CONTROL_BREAK = 1073807368, DATATYPE_MISALIGNMENT = 2147483650, BREAKPOINT, SINGLE_STEP, ACCESS_VIOLATION = 3221225477, IN_PAGE_ERROR, ILLEGAL_INSTRUCTION = 3221225501, NONCONTINUABLE_EXCEPTION = 3221225509, INVALID_DISPOSITION, ARRAY_BOUNDS_EXCEEDED = 3221225612, FLOAT_DENORMAL_OPERAND, FLOAT_DIVIDE_BY_ZERO, FLOAT_INEXACT_RESULT, FLOAT_INVALID_OPERATION, FLOAT_OVERFLOW, FLOAT_STACK_CHECK, FLOAT_UNDERFLOW, INTEGER_DIVIDE_BY_ZERO, INTEGER_OVERFLOW, PRIV_INSTRUCTION, STACK_OVERFLOW = 3221225725, FAST_FAIL = 3221226505} (gdb) pt $_siginfo.AccessViolationInformation type = struct { enum ViolationType Type; PVOID Address; } (gdb) pt $_siginfo.AccessViolationInformation.Type type = enum ViolationType {READ_ACCESS_VIOLATION, WRITE_ACCESS_VIOLATION, DATA_EXECUTION_PREVENTION_VIOLATION = 8} Which makes it easier to understand the reason of the exception: (gdb) p $_siginfo $1 = { ExceptionCode = ACCESS_VIOLATION, ExceptionFlags = 0, ExceptionRecord = 0x0, ExceptionAddress = 0x401632 <main+18>, NumberParameters = 2, { ExceptionInformation = {1, 291, 0 <repeats 13 times>}, AccessViolationInformation = { Type = WRITE_ACCESS_VIOLATION, Address = 0x123 } } } gdb/ChangeLog: 2020-02-09 Hannes Domani <ssbssa@yahoo.de> * windows-tdep.c (struct enum_value_name): New struct. (create_enum): New function. (windows_get_siginfo_type): Create and use enum types.
2020-02-09Display ExceptionRecord for $_siginfoHannes Domani6-1/+155
Uses the $_siginfo convenience variable to show the last exception. The type looks like this: (gdb) pt $_siginfo type = struct EXCEPTION_RECORD { DWORD ExceptionCode; DWORD ExceptionFlags; struct EXCEPTION_RECORD *ExceptionRecord; PVOID ExceptionAddress; DWORD NumberParameters; ULONG_PTR ExceptionInformation[15]; } EXCEPTION_RECORD is documented at [1]. Example: Program received signal SIGSEGV, Segmentation fault. main () at crasher.c:4 4 *(int*)0x123 = 0; (gdb) p $_siginfo $1 = { ExceptionCode = 3221225477, ExceptionFlags = 0, ExceptionRecord = 0x0, ExceptionAddress = 0x401632 <main+18>, NumberParameters = 2, ExceptionInformation = {1, 291, 0 <repeats 13 times>} } (gdb) p/x $_siginfo.ExceptionCode $2 = 0xc0000005 (gdb) p/x $_siginfo.ExceptionInformation[1] $3 = 0x123 And 0xc0000005 is the value of EXCEPTION_ACCESS_VIOLATION. [1] https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-exception_record gdb/ChangeLog: 2020-02-09 Hannes Domani <ssbssa@yahoo.de> * NEWS: Mention $_siginfo support for Windows. * windows-nat.c (handle_exception): Set siginfo_er. (windows_nat_target::mourn_inferior): Reset siginfo_er. (windows_xfer_siginfo): New function. (windows_nat_target::xfer_partial): Call windows_xfer_siginfo. * windows-tdep.c (struct windows_gdbarch_data): New struct. (init_windows_gdbarch_data): New function. (get_windows_gdbarch_data): New function. (windows_get_siginfo_type): New function. (windows_init_abi): Register windows_get_siginfo_type. (_initialize_windows_tdep): Register init_windows_gdbarch_data. gdbserver/ChangeLog: 2020-02-09 Hannes Domani <ssbssa@yahoo.de> * win32-low.c (win32_clear_inferiors): Reset siginfo_er. (handle_exception): Set siginfo_er. (win32_xfer_siginfo): New function.
2020-02-09Automatic date update in version.inGDB Administrator1-1/+1
2020-02-08Remove "keep" parameter from cutu_reader constructorTom Tromey2-27/+43
cutu_reader has a "keep" parameter, which is used to decide what to do with a new CU when the reader is destroyed. Most code does not try to preserve the CU, so this patch removes this parameter and instead adds a new method that users can call to preserve the CU on the chain. gdb/ChangeLog 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (class cutu_reader) <cutu_reader, init_tu_and_read_dwo_dies>: Remove "keep" parameter. <keep>: Declare method. <m_keep>: Remove member. <~cutu_reader>: Remove. (cutu_reader::init_tu_and_read_dwo_dies): Update. (cutu_reader::cutu_reader): Update. (cutu_reader::keep): Rename from ~cutu_reader. (process_psymtab_comp_unit, build_type_psymtabs_1) (process_skeletonless_type_unit, load_partial_comp_unit) (load_full_comp_unit, dwarf2_read_addr_index) (read_signatured_type): Update. Change-Id: I859b1c64313569d76d46317c14e9b077ebc3a27b
2020-02-08Simplify "want_partial_unit" handlingTom Tromey2-9/+13
This changes the "want_partial_unit" parameters to have type bool, and also removes the parameter from process_psymtab_comp_unit_reader. This latter change seemed like an improvement, because it avoids a pointless function call in the case where we are not planning to read a partial unit. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (process_psymtab_comp_unit_reader): Remove "want_partial_unit" parameter. (process_psymtab_comp_unit): Change want_partial_unit to bool. Inline check for DW_TAG_partial_unit. (dwarf2_build_psymtabs_hard, scan_partial_symbols): Update. Change-Id: I99e647f0c4faa3346e90a6e7bacc82af57eccff1
2020-02-08Move two more functions to dwarf2/leb.hTom Tromey3-31/+34
This moves read_n_bytes and read_direct_string to be with the the low-level value-reading code. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (read_n_bytes, read_direct_string): Move to read.c. * dwarf2/leb.h (read_n_bytes, read_direct_string): Move from read.c. Change-Id: Id07bfa13d93c0ac1f47a385749a8f01f4755b818
2020-02-08Convert read_address to a method on comp_unit_headTom Tromey4-69/+83
This changes read_address to be a method on comp_unit_head. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (read_address): Move to comp-unit.c. (dwarf2_rnglists_process, dwarf2_ranges_process) (read_attribute_value, dwarf_decode_lines_1) (var_decode_location, decode_locdesc): Update. * dwarf2/comp-unit.c (comp_unit_head::read_address): Move from read.c. Remove "cu" parameter. * dwarf2/comp-unit.h (struct comp_unit_head) <read_address>: New method. Change-Id: Ibd6c7235f2e4d5fd88c272cfd2c3d3328618cc56
2020-02-08Convert read_offset to method on comp_unit_headTom Tromey4-32/+32
This changes one of the read_offset overloads to be a method on comp_unit_head. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (read_attribute_value, read_indirect_string) (read_indirect_line_string): Update. * dwarf2/comp-unit.c (read_offset): Remove. (read_comp_unit_head): Update. * dwarf2/comp-unit.h (struct comp_unit_head) <read_offset>: New method. (read_offset): Don't declare. Change-Id: Ia595702a5748337b7c031352bc437956baab9990
2020-02-08Create dwarf2/comp-unit.[ch]Tom Tromey5-293/+378
This creates the new files dwarf2/comp-unit.[ch], moving comp_unit_head and helpers to those files. A couple of functions are turned into methods, because it was convenient to do so now. 2020-02-08 Tom Tromey <tom@tromey.com> * Makefile.in (COMMON_SFILES): Add dwarf2/comp-unit.c. * dwarf2/read.c (struct comp_unit_head): Move to dwarf2/comp-unit.h. (enum class rcuh_kind): Move to comp-unit.h. (get_cu_length, offset_in_cu_p): Now methods on comp_unit_head. (read_comp_unit_head, error_check_comp_unit_head) (read_and_check_comp_unit_head): Move to comp-unit.c. (read_offset, dwarf_unit_type_name): Likewise. (create_debug_type_hash_table, read_cutu_die_from_dwo) (cutu_reader::cutu_reader, read_call_site_scope) (find_partial_die, follow_die_offset): Update. * dwarf2/comp-unit.h: New file, from dwarf2read.c. Change-Id: Id961b9674c0081ed061083c8152c38b27b27388a
2020-02-08Move read_offset_1 to leb.cTom Tromey4-31/+41
This moves read_offset_1 to leb.c, as it is a low-level data-reading function. It is also renamed to remove the "_1", because gdb can use overloading now, and this is clearer. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (read_offset_1): Move to leb.c. (read_abbrev_offset, read_offset, dwarf_decode_line_header) (dwarf_decode_macro_bytes): Update. * dwarf2/leb.c (read_offset): Rename; move from read.c. * dwarf2/leb.h (read_offset): Declare. Change-Id: I048140598acfa76eade2cc529ab7933d4b9ca0b3
2020-02-08Convert dwarf2_section_size to a methodTom Tromey3-18/+22
This changes dwarf2_section_size to be a method on dwarf2_section_info. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (dwarf2_section_size): Remove. (error_check_comp_unit_head, dwarf2_symbol_mark_computed): Update. * dwarf2/section.h (struct dwarf2_section_info) <get_size>: New method. Change-Id: I12928fee5c84350ce98883e329357b86888d639b
2020-02-08Unify read_initial_length implementationsTom Tromey5-83/+78
There are two implementations of read_initial_length in gdb. This merges them and moves the resulting function to leb.c. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (read_initial_length): Move to leb.c. * dwarf2/leb.h (read_initial_length): Declare. * dwarf2/leb.c (read_initial_length): Move from read.c. Add handle_nonstd parameter. * dwarf2/frame.c (read_initial_length): Remove. (decode_frame_entry_1): Update. Change-Id: I34d37bad0f8a584bfa781432cba25e05e1bd5750
2020-02-08Add some methods to dwarf2_per_cu_dataTom Tromey6-134/+157
This changes a few helper functions to be methods on dwarf2_per_cu_data. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/loc.c (dwarf2_find_location_expression) (dwarf_evaluate_loc_desc::get_tls_address) (dwarf_evaluate_loc_desc::push_dwarf_reg_entry_value) (rw_pieced_value, dwarf2_evaluate_loc_desc_full) (dwarf2_locexpr_baton_eval, dwarf2_evaluate_property) (dwarf2_compile_property_to_c) (dwarf2_loc_desc_get_symbol_read_needs) (dwarf2_compile_expr_to_ax, locexpr_describe_location) (locexpr_tracepoint_var_ref, locexpr_generate_c_location) (loclist_describe_location, loclist_tracepoint_var_ref) (loclist_generate_c_location): Update. * compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Update. * dwarf2/loc.h (dwarf2_per_cu_objfile, dwarf2_per_cu_addr_size) (dwarf2_per_cu_ref_addr_size, dwarf2_per_cu_offset_size) (dwarf2_per_cu_text_offset, dwarf2_version): Don't declare. * dwarf2/read.c (dwarf2_per_cu_data::objfile) (dwarf2_per_cu_data::addr_size) (dwarf2_per_cu_data::ref_addr_size) (dwarf2_per_cu_data::text_offset) (dwarf2_per_cu_data::addr_type): Now methods. (per_cu_header_read_in): Make per_cu "const". (dwarf2_version): Remove. (dwarf2_per_cu_data::int_type): Now a method. (dwarf2_per_cu_data::_addr_sized_int_type): Likewise. (set_die_type, read_array_type, read_subrange_index_type) (read_tag_string_type, read_subrange_type): Update. * dwarf2/read.h (struct dwarf2_per_cu_data) <addr_size, offset_size, ref_addr_size, text_offset, addr_type, version, objfile, int_type, addr_sized_int_type>: Declare methods. Change-Id: I07a42fa26e00795352389fa7a0cc1c12997d26f7
2020-02-08Move dwarf2_per_cu_data::imported_symtabs earlierTom Tromey2-26/+31
This moves dwarf2_per_cu_data::imported_symtabs earlier, near where the other data members are located. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.h (struct dwarf2_per_cu_data) <imported_symtabs>: Move earlier. Change-Id: I314ddaa6f67c53a848e513b3f6d42913bd957833
2020-02-08Move DWARF line_header to new fileTom Tromey6-253/+317
This moves the line_header class to a pair of new files, making dwarf2/read.c somewhat smaller. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.h (dwarf_line_debug): Declare. * Makefile.in (COMMON_SFILES): Add dwarf2/line-header.c. * dwarf2/read.c: Move line_header code to new files. (dwarf_line_debug): No longer static. * dwarf2/line-header.c: New file. * dwarf2/line-header.h: New file. Change-Id: I8d9d8a2398b4e888e20cc5dd68d041c28b5a06e3
2020-02-08Change line_table methods to return unique_xmalloc_ptrTom Tromey2-17/+29
This changes the two new line_table methods to return unique_xmalloc_ptr. This removes a bit of manual memory management. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (struct line_header) <file_full_name, file_file_name>: Return unique_xmalloc_ptr. (line_header::file_file_name): Update. (line_header::file_full_name): Update. (dw2_get_file_names_reader): Update. (macro_start_file): Update. Change-Id: I9442dba43882fb26097d0770a291eea2b03913a4
2020-02-08Change file_full_name and file_file_name methodsTom Tromey2-23/+33
This changes file_full_name and file_file_name methods to be methods on line_header. This seems more clear to me. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (struct line_header) <file_full_name, file_file_name>: Declare methods. (dw2_get_file_names_reader): Update. (file_file_name): Now a method. (file_full_name): Likewise. (macro_start_file): Update. Change-Id: I50d3e91665a9637c732e1e8d8e4263764c766d9c
2020-02-08Move dwarf_always_disassemble to dwarf2/loc.cTom Tromey4-26/+36
dwarf_always_disassemble is only used in dwarf2/loc.c, so move the definition and the command infrastructure to that file. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (dwarf_always_disassemble) (show_dwarf_always_disassemble): Move to loc.c. (_initialize_dwarf2_read): Move "always-disassemble" registration to loc.c. * dwarf2/read.h (dwarf_always_disassemble): Don't declare. * dwarf2/loc.c (dwarf_always_disassemble): Move from read.c. Now static. (show_dwarf_always_disassemble): Move from read.c. (_initialize_dwarf2loc): Move always-disassemble from read.c. Change-Id: I33fb88112e98e583c3f4919d20e4d100f2ea0124
2020-02-08Change dwarf2_per_objfile::quick_file_names_table to htab_upTom Tromey3-10/+16
This changes dwarf2_per_objfile::quick_file_names_table to be an htab_up. This just removes a bit of manual management. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (~dwarf2_per_objfile): Update. (create_quick_file_names_table): Return htab_up. (dw2_get_file_names_reader, dw2_forget_cached_source_info): Update. * dwarf2/read.h (struct dwarf2_per_objfile) <quick_file_names_table>: Now htab_up. Change-Id: I4ff2fce8b8af27f4bfe01a11b97a889edfd23151
2020-02-08Minor simplification in abbrev_table::readTom Tromey2-1/+5
abbrev_table::read increments cur_abbrev->num_attrs in the inner loop, but there's no need to do this, as the information is already stored in the temporary vector. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/abbrev.c (abbrev_table::read): Simplify. Change-Id: I765f12850ffa1c6066e884bb22c94468d1abdba4
2020-02-08Use htab_up in abbrev_tableTom Tromey3-33/+44
This changes abbrev_table to use an htab_up rather than an ad hoc, bucket-based hash table. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/abbrev.c (abbrev_table): Move constructor from header. Rewrite. (abbrev_table::add_abbrev, abbrev_table::lookup_abbrev): Rewrite. * dwarf2/abbrev.h (struct abbrev_info) <next>: Remove. (abbrev_table::abbrev_table): No longer inline. (ABBREV_HASH_SIZE): Remove. (abbrev_table::m_abbrevs): Now an htab_up. Change-Id: Icbaa8e49501f9c43218d6a81a7e8c4d3a77d65dc
2020-02-08Minor cleanups in abbrev_tableTom Tromey4-37/+52
This cleans up the DWARF abbrev_table API a bit, primarily by making various methods and members private. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (read_cutu_die_from_dwo): Update. (cutu_reader): Update. (build_type_psymtabs_1): Update. * dwarf2/abbrev.c (abbrev_table::read): Rename. (abbrev_table::alloc_abbrev): Update. * dwarf2/abbrev.h (abbrev_table_up): Move earlier. (abbrev_table::read): New static method, renamed from abbrev_table_read_table. (abbrev_table::alloc_abbrev) (abbrev_table::add_abbrev): Now private. (abbrev_table::abbrev_table): Now private. (abbrev_table::m_abbrev_obstack): Now private. Rename. Change-Id: I320dca83b799f672909ae66f73b7aca266adbaf9
2020-02-08Change dwarf2_per_objfile::die_type_hash to htab_upTom Tromey3-13/+14
This changes dwarf2_per_objfile::die_type_hash to be an htab_up, moving its contents off the objfile obstack. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (set_die_type, get_die_type_at_offset): Update. * dwarf2/read.h (struct dwarf2_per_objfile) <die_type_hash>: Now htab_up. Change-Id: Ic651f99ebf71bf7ad2dc2880192adacf7b60964a