aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-06-30Add support for attributes using DW_FORM_GNU_strp_altNick Clifton2-0/+12
* dwarf.c (read_and_display_attr_value): Support DW_FORM_GNU_strp_alt when used with DW_AT_dwo_name and DW_AT_comp_dir.
2020-06-30[gdb/testsuite] Handle early_flags in gdb_default_target_compileTom de Vries2-7/+16
In gdb_default_target_compile, we use dejagnu's default_target_compile, unless we need support for languages that are not yet support in the used dejagnu version, in which case we use a local default_target_compile: gdb_default_target_compile_1. However, there's another reason to use the local default_target_compile: when early_flags is used, because there's no dejagnu release available yet supporting this. Fix this by detecting and handling early_flags in gdb_default_target_compile. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-06-30 Tom de Vries <tdevries@suse.de> PR testsuite/26175 * lib/future.exp (gdb_default_target_compile): Detect and handle early_flags.
2020-06-30solaris XPASS ld-elf/group1Alan Modra2-1/+6
* testsuite/ld-elf/group1.d: Don't xfail all solaris targets, just ix86 and x86_64.
2020-06-30Don't xfail nds32 for ld-elf/reloc-discard testAlan Modra2-1/+5
* testsuite/ld-elf/reloc-discard.d: Don't xfail nds32.
2020-06-30Fix nds32*-elf XPASS readelf -wiaoRlL dw5Alan Modra2-1/+6
The underlying fail was probably fixed with git commit fbaf61ad5. * testsuite/binutils-all/readelf.exp (readelf_dump_test): Remove xfail for nds32.
2020-06-30microblaze-linux XPASS ld-elf/var1Alan Modra3-1/+7
microblaze-linux uses the standard ELF script, microblaze-elf its own script lacking an input section pattern needed to make this test pass. Add the missing pattern for .data, in line with most other sections that do have .* patterns. * scripttempl/elfmicroblaze.sc (.data): Add .data.* entry. * testsuite/ld-elf/var1.d: Don't xfail microblaze.
2020-06-30RISC-V: Support debug and float CSR as the unprivileged ones.Nelson Chu22-215/+268
The unprivileged CSR should be controlled by other specific specs rather than the privileged spec. For example, the debug CSR should be controlled by the debug spec, and the float CSR should be controlled by the float spec. User may use assembler options to choose what the debug and other specs they want, or may encode the versions of specs into the architecture string directly. Since we haven't decided which one is better, we set the defined and aborted versions of unprivileged CSR to PRIV_SPEC_CLASS_NONE in the include/opcode/riscv-opc.h, to tell assembler don't check priv spec versions for them. However, these PRIV_SPEC_CLASS_NONE will be changed to FLOAT_SPEC_CLASS_* and DEBUG_SPEC_CLASS_* in the future. gas/ * config/tc-riscv.c (riscv_csr_class_check): Removed. Move the checking into riscv_csr_address. (riscv_csr_version_check): Likewise. (riscv_csr_address): New function. Return the suitable CSR address after checking the ISA dependency and versions. Issue warnings if we find any conflict and -mcsr-check is set. CSR_CLASS_F and CSR_CLASS_DEBUG are unprivileged CSR for now, so don't check the priv spec versions for them. (reg_csr_lookup_internal): Call riscv_csr_address to find the suitable CSR address. * testsuite/gas/riscv/priv-reg-fail-fext.d: Remove -mpriv-spec=1.11. * testsuite/gas/riscv/priv-reg-fail-read-only-01.d: Likewise. * testsuite/gas/riscv/priv-reg-fail-rv32-only.d: Likewise. * testsuite/gas/riscv/priv-reg-fail-fext.l: We don't care the priv spec warnings here. These warnings are added by accident. Remove them and only focus on the ISA dependency warnings. * testsuite/gas/riscv/priv-reg-fail-rv32-only.l: Likewise. * testsuite/gas/riscv/priv-reg-fail-read-only-01.l: Likewise. * testsuite/gas/riscv/priv-reg-fail-version-1p9.l: Updated since dscratch0 and dscratch1 are regarded as the unprivileged CSR rather than the privileged ones. * testsuite/gas/riscv/priv-reg-fail-version-1p9p1.l: Likewise. * testsuite/gas/riscv/priv-reg-fail-version-1p10.l: Likewise. * testsuite/gas/riscv/priv-reg-fail-version-1p11.l: Likewise. * testsuite/gas/riscv/priv-reg.s: Likewise. Add missing debug CSR. * testsuite/gas/riscv/priv-reg-version-1p9.d: Likewise. * testsuite/gas/riscv/priv-reg-version-1p9p1.d: Likewise. * testsuite/gas/riscv/priv-reg-version-1p10.d: Likewise. * testsuite/gas/riscv/priv-reg-version-1p11.d: Likewise. * testsuite/gas/riscv/csr-dw-regnums.d: Likewise. * testsuite/gas/riscv/csr-dw-regnums.s: Likewise. include/ * opcode/riscv-opc.h: Support the unprivileged CSR. The versions of the unprivileged CSR should be PRIV_SPEC_CLASS_NONE for now. * opcode/riscv.h (enum riscv_csr_class): Add CSR_CLASS_DEBUG. opcodes/ * riscv-dis.c (print_insn_args, case 'E'): Updated. Let the unprivileged CSR can also be initialized.
2020-06-30RISC-V: Cleanup the include/opcode/riscv-opc.h.Nelson Chu2-33/+30
The include/opcode/riscv-opc.h file is no longer automatically generated, so we remove the misleading comments and add new ones. Besides, the CAUSE_* macros and DECLARE_CAUSE are unused for binutils and gdb. Therefore, remove them, too. include/ * opcode/riscv-opc.h: Cleanup and remove the unused macros.
2020-06-30Automatic date update in version.inGDB Administrator1-1/+1
2020-06-29gdb: fix documentation of gdbarch_displaced_step_copy_insnSimon Marchi3-6/+7
I spotted something that looks wrong in the doc of gdbarch_displaced_step_copy_insn. It says that if the function returns NULL, it means that it has emulated the behavior of the instruction and written the result to REGS. However, it says below that the function may return NULL to indicate that the instruction can't be single-stepped out-of-line, in which case the core steps the instruction in-line. The two are contradictory. The right one is the latter, if the function returns NULL, the core falls back to in-line stepping. I checked all the implementations of this function and they all agree with this. gdb/ChangeLog: * gdbarch.sh (displaced_step_copy_insn): Update doc. * gdbarch.h: Re-generate. Change-Id: I98163cdd38970cde4c77680e249b10f5d2d5bf9b
2020-06-29gdb/testsuite: better handle failures in simavr board, reap simavr processSimon Marchi2-4/+39
This patch makes a few adjustments to the simavr.exp to handle tests that error out more gracefully. I put all the changes in the same patch because right now it's in a very bad shape, so it's very painful to do small incremental adjustements. I found that with these changes, it becomes reasonably stable. For example, the gdb.base/step-over-syscall.exp test is a bit buggy (stuff for another patch...), in that it calls gdb_load (through clean_restart) with a file that doesn't exist. The gdb_load implementation in simavr.exp gets called with a file that doesn't exist, and simavr (expectedly) fails to start. When this happens, we currently leave the $simavr_spawn_id variable set. However, because the simavr process has terminated, its spawn id is closed. When the next test tries to close the previous connection to simavr, it fails to, and this error is thrown: ERROR: close: spawn id exp86 not open while executing "close -i $simavr_spawn_id" (procedure "gdb_load" line 18) invoked from within In other words, any test ran after step-over-syscall.exp will have simavr.exp's gdb_load fail on it. This patch tries to make sure that simavr.exp's gdb_load only leaves simavr_spawn_id set if everything went fine. If we couldn't start simavr, don't see the expected output, or fail to connect to it, we close the spawn id (if needed) and unset simavr_spawn_id. As an additional precaution, I added a catch around the "close the previous connection" code. Ideally, this shouldn't be necessary, but I bet there are other similar scenarios where we might try to close an already close spawn id. So I think displaying a warning is better than messing up all following tests. Also, the board never wait'ed for the simavr process, resulting in tons of zombie simavr processes hanging around. This patch adds some calls to "wait" whenever we close the connection (or realize it is already closed), which seems to fix the problem. Finally I switched a `gdb_expect` to bare `expect`, where we wait for the "listening" message from simavr. I found it necessary because gdb_expect (through remote_expect) adds a `-i <gdb spawn id> -timeout 10`. So if for some reason the GDB process has crashed in the mean time, this expect will unexpectedly error out with a `spawn id <gdb spawn id> not open`. Therefore, change `gdb_expect` to `expect` so that we only deal with simavr's spawn id here. Here are the results on TESTS="gdb.base/*.exp" before: # of expected passes 4816 # of unexpected failures 4433 # of known failures 2 # of unresolved testcases 300 # of untested testcases 143 # of unsupported tests 7 # of paths in test names 2 # of duplicate test names 10 and after: # of expected passes 21957 # of unexpected failures 1564 # of expected failures 8 # of unknown successes 1 # of known failures 31 # of unresolved testcases 532 # of untested testcases 153 # of unsupported tests 28 # of paths in test names 2 # of duplicate test names 32 I tested using simavr's current master (7c254e2081b5). gdb/testsuite/ChangeLog: * boards/simavr.exp (gdb_load): Catch errors when closing previous connection. Close connection, wait for process and unset simavr_spawn_id on failure. Change-Id: I695fc765e1c22e1d1dc0b08e0f5141244986b868
2020-06-29x86: Support VEX base opcode length > 1H.J. Lu2-6/+7
Intel AMX instructions with 8-bit immediate opcode extension without operands: tilerelease, 0, 0x49c0, None, 2, CpuAMX_TILE|Cpu64, Vex|VexOpcode=1|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 } Update build_vex_prefix to support VEX base opcode length > 1. * tc-i386.c (build_vex_prefix): Support VEX base opcode length > 1. (md_assemble): Don't process ImmExt without operands.
2020-06-29tic6x: Call _bfd_elf_add_dynamic_tagsH.J. Lu16-72/+63
Update tic6x linker tests to expect C6000_DSBT_BASE, C6000_DSBT_SIZE and C6000_DSBT_INDEX dynamic tags immediately before NULL dynamic tag. bfd/ * elf32-tic6x.c (elf32_tic6x_size_dynamic_sections): Call _bfd_elf_add_dynamic_tags. ld/ * testsuite/ld-tic6x/shlib-1.rd: Move C6000_DSBT_BASE, C6000_DSBT_SIZE and C6000_DSBT_INDEX dynamic tags to the last. * testsuite/ld-tic6x/shlib-1b.rd: Likewise. * testsuite/ld-tic6x/shlib-1r.rd: Likewise. * testsuite/ld-tic6x/shlib-1rb.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1b.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1r.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1rb.rd: Likewise. * testsuite/ld-tic6x/shlib-noindex.rd: Likewise. * testsuite/ld-tic6x/static-app-1.rd: Likewise. * testsuite/ld-tic6x/static-app-1b.rd: Likewise. * testsuite/ld-tic6x/static-app-1r.rd: Likewise. * testsuite/ld-tic6x/static-app-1rb.rd: Likewise.
2020-06-29[gdb/testsuite] Emit unresolved for unknown procTom de Vries2-0/+6
Since commit 26783bce15 "[gdb/testsuite] Don't abort testrun for invalid command in test-case" we don't abort the testrun when encountering an invalid command. However, since we don't report errors in the summary, there's a chance that the error goes unnoticed. Make the invalid command error more visible by marking the test-case unresolved, such that we have f.i.: ... PASS: gdb.python/py-breakpoint.exp: test_bkpt_internal: Test watchpoint write UNRESOLVED: gdb.python/py-breakpoint.exp: test_bkpt_eval_funcs: \ testcase aborted due to invalid command name: gdb_py_test_multiple ERROR: tcl error sourcing py-breakpoint.exp. ERROR: invalid command name "gdb_py_test_multiple" while executing ... === gdb Summary === nr of expected passes 56 nr of unresolved testcases 1 ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-06-29 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (unknown): Make test-case unresolved.
2020-06-29[gdbserver] Add missing include of gdbsupport/agent.hTom de Vries2-0/+5
The file gdbserver/ax.h contains: ... #ifdef IN_PROCESS_AGENT #define debug_threads debug_agent #endif ... but does not declare debug_agent. Fix this by adding an include of gdbsupport/agent.h. [ If this fix would have been in place before commit 8118159c69 "[gdbserver] Fix Wlto-type-mismatch for debug_agent", we would have simply run into this build breaker with a regular, non-lto build: ... src/gdbserver/ax.cc:28:5: error: conflicting declaration 'int debug_agent' int debug_agent = 0; ^~~~~~~~~~~ In file included from src/gdbserver/ax.h:25:0, from src/gdbserver/ax.cc:20: src/gdbsupport/agent.h:47:13: note: previous declaration as 'bool debug_agent' extern bool debug_agent; ^~~~~~~~~~~ ... ] Tested on x86_64-linux. gdbserver/ChangeLog: 2020-06-29 Tom de Vries <tdevries@suse.de> * ax.h: Include gdbsupport/debug_agent.h.
2020-06-29[gdb/testsuite] Expect conformation question in gdb.server/solib-list.expTom de Vries2-0/+9
Before commit a8654e7d78 'Fixes PR 25475: ensure exec-file-mismatch "ask" always asks in case of mismatch', there was a difference in behaviour in test-case gdb.server/solib-list.exp. If the executable did not contain debug info (as is usually the case), gdb would detect a mismatch but not ask for confirmation: ... (gdb) target remote localhost:2346^M Remote debugging using localhost:2346^M warning: Mismatch between current exec-file solib-list^M and automatically determined exec-file /lib64/ld-2.26.so^M exec-file-mismatch handling is currently "ask"^M Reading symbols from /lib64/ld-2.26.so...^M Reading symbols from /usr/lib/debug/lib64/ld-2.26.so.debug...^M 0x00007ffff7dd7ea0 in _start () at rtld.c:745^M 745 }^M (gdb) PASS: gdb.server/solib-list.exp: non-stop 0: target remote ... If the executable did contain debug info (as happens to be the case for openSUSE), gdb would detect a mismatch and ask for confirmation: ... (gdb) PASS: gdb.server/solib-list.exp: non-stop 0: file binfile target remote localhost:2346^M Remote debugging using localhost:2346^M warning: Mismatch between current exec-file solib-list^M and automatically determined exec-file /lib64/ld-2.26.so^M exec-file-mismatch handling is currently "ask"^M Load new symbol table from "/lib64/ld-2.26.so"? (y or n) y^M Reading symbols from /lib64/ld-2.26.so...^M Reading symbols from /usr/lib/debug/lib64/ld-2.26.so.debug...^M 0x00007ffff7dd7ea0 in _start () at rtld.c:745^M 745 }^M (gdb) PASS: gdb.server/solib-list.exp: non-stop 0: target remote ... After commit a8654e7d78, the confirmation is now also asked in case there's no debug info. Tighten the test-case by verifying that the confirmation question is asked, as suggested in the log message of commit a8654e7d78: ... we can remove the bypass introduced by Tom in 6b9374f1, in order to always answer to the 'load' question. ... gdb/testsuite/ChangeLog: 2020-06-29 Tom de Vries <tdevries@suse.de> PR gdb/25475 * gdb.server/solib-list.exp: Verify that the symbol reload confirmation question is asked.
2020-06-29gas/testsuite: test-case for PR25331 (mmix reloc fixup bug)Hans-Peter Nilsson3-0/+482
The bug manifested "only" for a 64-bit host: pr25331.c: Assembler messages: pr25331.c:430: Error: internal error: fixup not contained within frag failed with: <pr25331.c: Assembler messages: pr25331.c:430: Error: internal error: fixup not contained within frag>, no expected output FAIL: gas/mmix/pr25331 gas: PR gas/25331 * testsuite/gas/mmix/pr25331.d, testsuite/gas/mmix/pr25331.s: New test.
2020-06-29gas: Fix mmix fixups and TC_FX_SIZE_SLACK, PR25331Hans-Peter Nilsson3-6/+27
Finally; sorry for the delay. There were a few false starts, where I misinterpreted the error-messages and the comment that Alan added: it's not the fix size that's too large (and the frag too small), it's stating the wrong size of what will be "fixed up" - that of the actual target value, not the size of the field that needs to be adjusted. Comments added for clarity. Test-suite committed separately. gas: PR gas/25331 * config/tc-mmix.c (md_assemble) <fixup for BFD_RELOC_MMIX_BASE_PLUS_OFFSET>: This fixup affects 1 byte, not 8. Also, set its fx_no_overflow. (md_convert_frag) <case ENCODE_RELAX (STATE_PUSHJSTUB, STATE_ZERO)>: Similarly this fixup affects 4 bytes, not 8 and needs its fx_no_overflow set. * config/tc-mmix.h (TC_FX_SIZE_SLACK): Don't define.
2020-06-29binutils/dwarf.c: Correct an `index' global shadowing error for pre-4.8 GCCHans-Peter Nilsson2-4/+10
In older gcc, shadowing a function name with a local variable name is flagged as an error, certainly a bug but which is usually worked around in binutils: gcc -DHAVE_CONFIG_H -I. -I$SRC/binutils -I. -I$SRC/binutils -I../bfd -I$SRC/binutils/../bfd -I$SRC/binutils/../include -DLOCALEDIR="\"/usr/local/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I$SRC/binutils/../zlib -g -O2 -MT dwarf.o -MD -MP -MF $depbase.Tpo -c -o dwarf.o $SRC/binutils/dwarf.c &&\ mv -f $depbase.Tpo $depbase.Po cc1: warnings being treated as errors $SRC/binutils/dwarf.c: In function 'display_debug_str_offsets': $SRC/binutils/dwarf.c:6913: error: declaration of 'index' shadows a global declaration /usr/include/string.h:309: error: shadowed declaration is here make[4]: *** [dwarf.o] Error 1 See also GCC PR c/53066. This is just another one that crept in since I and others last had to use an old version. The name "idx" was used in the preceding function, display_debug_addr. Also, it was declared c99 style (after a statement in the block). Committed as obvious. binutils: * dwarf.c (display_debug_str_offsets): Rename local variable index to idx. Move to top of function.
2020-06-29asan: _bfd_pei_slurp_codeview_record use of uninit valueAlan Modra2-2/+14
Fixes some seriously careless code. bfd_bread return value is (bfd_size_type)-1 on error. "if (bfd_bread (...) < 4)" does not check for an error since bfd_size_type is unsigned. In any case, I think we should be reading and checking the requested length. * peXXigen.c (_bfd_XXi_slurp_codeview_record): Properly check return value of bfd_bread. Don't read more than requested length. Sanity check length. Properly terminate file name.
2020-06-29C++ commentsAlan Modra25-53/+78
binutils isn't c99 (yet). This replaces or removes some C++ style comments. bfd/ * arc-got.h: Use C style comments. * coff-z80.c: Likewise. * elf32-csky.c: Likewise. * peXXigen.c: Likewise. * elf32-m32c.c (m32c_elf_relax_delete_bytes): Remove commented out code. binutils/ * dwarf.c: Use C style comments. * resrc.c: Likewise. gas/ * config/tc-s12z.c: Use C style comments. * config/tc-z80.c: Likewise. * config/tc-xtensa.c (emit_ld_r_n): Remove commented out code. include/ * coff/internal.h: Use C style comments. * coff/pe.h: Likewise. * elf/ppc64.h: Likewise. opcodes/ * arm-dis.c: Use C style comments. * cr16-opc.c: Likewise. * ft32-dis.c: Likewise. * moxie-opc.c: Likewise. * tic54x-dis.c: Likewise. * s12z-opc.c: Remove useless comment. * xgate-dis.c: Likewise.
2020-06-29x86_64 k1om testsAlan Modra4-0/+9
On x86_64-nacl we currently see FAIL: Absolute non-overflowing relocs FAIL: ld-x86-64/protected2-k1om FAIL: ld-x86-64/protected3-k1om This limits the tests as per the l1om variants. * testsuite/ld-x86-64/abs-k1om.d: Run only on x86_64-*-linux*. * testsuite/ld-x86-64/protected2-k1om.d: Likewise. * testsuite/ld-x86-64/protected3-k1om.d: Likewise.
2020-06-29Automatic date update in version.inGDB Administrator1-1/+1
2020-06-28Remove "cmd_type" functionTom Tromey5-34/+16
The cmd_type function only has a single caller, which is in the CLI implementation code. This patch removes the function, and moves the cmd_types enum definition from command.h to cli-decode.h, fixing an 18 year old FIXME. gdb/ChangeLog 2020-06-28 Tom Tromey <tom@tromey.com> * command.h (cmd_types): Remove. (cmd_type): Don't declare. * cli/cli-decode.h (enum cmd_types): Uncomment. No longer a typedef. * cli/cli-cmds.c (setting_cmd): Use cmd->type directly. * cli/cli-decode.c (cmd_type): Remove.
2020-06-28Automatic date update in version.inGDB Administrator1-1/+1
2020-06-27gdbsupport: add format attribute to print_xml_feature::add_lineSimon Marchi2-1/+6
Fixes this clang error: CXX tdesc.o /home/smarchi/src/binutils-gdb/gdbsupport/tdesc.cc:444:25: error: format string is not a string literal [-Werror,-Wformat-nonliteral] string_vappendf (tmp, fmt, ap); ^~~ There is already a but about GCC not emitting this warning: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82206 gdbsupport/ChangeLog: * tdesc.h (class print_xml_feature) <add_line>: Add ATTRIBUTE_PRINTF. Change-Id: I7014075e83717f6d7e19d044a3675ff9981ebe17
2020-06-27Make {get,set}_inferior_io_terminal inferior methodsPedro Alves9-54/+68
This converts the get_inferior_io_terminal and set_inferior_io_terminal free functions to inferior methods. Since the related commands are called "tty", "{set,show} inferior-tty", and MI's "-inferior-tty-{set,show}", to make the connection between the commands and the code more obvious, the methods are named set_tty/tty instead of set_io_terminal/io_terminal. gdb/ChangeLog: * fork-child.c (prefork_hook): Adjust. * infcmd.c (set_inferior_io_terminal, get_inferior_io_terminal): Delete. (set_inferior_tty_command, show_inferior_tty_command): Adjust. * inferior.c (inferior::set_tty, inferior::tty): New methods. * inferior.h (set_inferior_io_terminal, get_inferior_io_terminal): Remove declarations. (struct inferior) <set_tty, tty>: New methods. (struct inferior) <terminal>: Rename to ... (struct inferior) <m_terminal>: ... this and make private. * main.c (captured_main_1): Adjust. * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): Adjust. (mi_cmd_inferior_tty_show): Adjust. * nto-procfs.c (nto_procfs_target::create_inferior): Adjust. * windows-nat.c (windows_nat_target::create_inferior): Adjust.
2020-06-27asan: readelf: use after free in process_archiveAlan Modra2-1/+14
This tidies up in cases where fuzzed thin archives hit the error return path in setup_nested_archive. * elfcomm.c (setup_nested_archive): Set nested_arch->file to NULL after freeing. (release_archive): Set fields of arch to NULL after freeing.
2020-06-27Automatic date update in version.inGDB Administrator1-1/+1
2020-06-26Make test names unique in python.exp and guile.expPhilippe Waroquiers5-95/+95
Version 2, handles the comments of Simon and Pedro. Note that gdb_test_multiline and gdb_py_test_multiple are using the "input line" as the test name, and so when there is a duplicated input line (such as a line containing "end"), we have duplicated test names => as gdb_test_multiline and gdb_py_test_multiple are identical, as indicated in FIXME, move this to gdb.exp, and make the test name unique by adding the inputnr to the pass message for each input. 2020-06-26 Philippe Waroquiers <philippe.waroquiers@skynet.be> * lib/gdb.exp (gdb_test_multiline): New, moved from gdb-guile.exp, have a input seq nr in each pass message. * lib/gdb-guile.exp (gdb_test_multiline): Move to gdb.exp. * lib/gdb-python.exp (gdb_py_test_multiple): Remove. * gdb.python/python.exp: Make test names unique, use gdb_test_multiline instead of gdb_py_test_multiple, use $gdb_test_name. * gdb.guile/guile.exp: Make test names unique, use $gdb_test_name
2020-06-26x86: Process ImmExt without operandsH.J. Lu2-1/+10
To support Intel AMX instructions with 8-bit immediate opcode extension, but without operands: tilerelease, 0, 0x49, 0xc0, 1, CpuAMX_TILE|Cpu64, Vex|VexOpcode=1|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|ImmExt, { 0 } process ImmExt without operands. * config/tc-i386.c (md_assemble): Process ImmExt without operands.
2020-06-26i386-opc.tbl: Add a blank lineH.J. Lu2-0/+5
* i386-opc.tbl: Add a blank line.
2020-06-26x86: Correct VexSIB128 to VecSIB128H.J. Lu2-29/+29
2020-06-26x86: Rename VecSIB to SIB for Intel AMXH.J. Lu6-99/+127
Rename VecSIB to SIB to support Intel Advanced Matrix Extensions which introduces instructions with a mandatory SIB byte which isn't a vector SIB (VSIB). gas/ * config/tc-i386.c (check_VecOperands): Replace vecsib with sib. Replace VecSIB128, VecSIB256 and VecSIB512 with VECSIB128, VECSIB256 and VECSIB512, respectively. (build_modrm_byte): Replace vecsib with sib. opcodes/ * i386-gen.c (opcode_modifiers): Replace VecSIB with SIB. (VecSIB128): Renamed to ... (VECSIB128): This. (VecSIB256): Renamed to ... (VECSIB256): This. (VecSIB512): Renamed to ... (VECSIB512): This. (VecSIB): Renamed to ... (SIB): This. (i386_opcode_modifier): Replace vecsib with sib. * i386-opc.tbl (VexSIB128): New. (VecSIB256): Likewise. (VecSIB512): Likewise. Replace VecSIB=1, VecSIB=2 and VecSIB=3 with VexSIB128, VecSIB256 and VecSIB512, respectively.
2020-06-26libctf: support platforms with separate libintlNick Alcock6-2/+112
We were not using the right configure machinery to spot libintl on platforms where it was required, leading to the spurious failure of various configure tests (e.g. for things like ELF support in BFD). libctf/ * aclocal.m4: Add config/gettext-sister.m4: Shuffle into alphabetical order. * configure.ac: Add ZW_GNU_GETTEXT_SISTER_DIR. * config.h.in: Regenerated. * Makefile.in: Likewise. * configure: Likewise.
2020-06-26libctf: add some missing #includes.Nick Alcock3-0/+7
Causes warnings on (at least) recent FreeBSD. libctf/ * ctf-create.c: Include <unistd.h>. * ctf-open-bfd.c: Likewise.
2020-06-26libctf, elfcpp, gold: do not assume that <byteswap.h> contains bswap_*Nick Alcock11-59/+190
At least one C library (uclibc-ng) defines some of these only when the compiler is GCC. We might as well test for all three cases and handle any of them being missing. Very similar code exists in libctf and split between elfcpp and gold: fix both. (Also sync up elfcpp with a change made to libctf swap.h a few months ago: since there is no out-of-line definition of the bswap replacements, they should be declared static inline, not just inline, to prevent the linker generating out-of-line references to them.) PR libctf/25120 libctf/ * configure.ac: Check for bswap_16, bswap_32, and bswap_64 decls. * swap.h (bswap_16): Do not assume that presence of <byteswap.h> means this is declared. (bswap_32): Likewise. (bswap_64): Likewise. (bswap_identity_64): Remove, unused. * configure: Regenerated. * config.h.in: Likewise. gold/ * configure.ac: Check for bswap_16, bswap_32, and bswap_64 decls. * configure: Regenerated. * config.h.in: Likewise. elfcpp/ * elfcpp_swap.h (bswap_16): Do not assume that presence of <byteswap.h> means this is declared. Make static inline, matching recent change to libctf, since there is no non-inline definition of these functions. (bswap_32): Likewise. (bswap_64): Likewise.
2020-06-26libctf: work with compilers not supporting GNU C attributesNick Alcock2-0/+15
The obvious fallback __attribute__ stanza was missing. Thanks to Harald van Dijk. PR 25120 libctf/ * ctf-impl.h (_libctf_printflike_): Add non-GNU-C fallback. (_libctf_unlikely_): Likewise. (_libctf_unused): Likewise. (_libctf_malloc_): Likewise.
2020-06-26libctf: avoid nonportable __thread in CTF archive handlingNick Alcock2-9/+15
This keeps archive searching threadsafe using the new bsearch_r that was just added to libiberty. PR25120 libctf/ * ctf-archive.c (search_nametbl): No longer global: declare... (ctf_arc_open_by_name_internal): ... here. Use bsearch_r. (search_modent_by_name): Take and use ARG for the nametbl.
2020-06-26libctf, binutils: support CTF archives like objdumpNick Alcock9-109/+182
objdump and readelf have one major CTF-related behavioural difference: objdump can read .ctf sections that contain CTF archives and extract and dump their members, while readelf cannot. Since the linker often emits CTF archives, this means that readelf intermittently and (from the user's perspective) randomly fails to read CTF in files that ld emits, with a confusing error message wrongly claiming that the CTF content is corrupt. This is purely because the archive-opening code in libctf was needlessly tangled up with the BFD code, so readelf couldn't use it. Here, we disentangle it, moving ctf_new_archive_internal from ctf-open-bfd.c into ctf-archive.c and merging it with the helper function in ctf-archive.c it was already using. We add a new public API function ctf_arc_bufopen, that looks very like ctf_bufopen but returns an archive given suitable section data rather than a ctf_file_t: the archive is a ctf_archive_t, so it can be called on raw CTF dictionaries (with no archive present) and will return a single-member synthetic "archive". There is a tiny lifetime tweak here: before now, the archive code could assume that the symbol section in the ctf_archive_internal wrapper structure was always owned by BFD if it was present and should always be freed: now, the caller can pass one in via ctf_arc_bufopen, wihch has the usual lifetime rules for such sections (caller frees): so we add an extra field to track whether this is an internal call from ctf-open-bfd, in which case we still free the symbol section. include/ * ctf-api.h (ctf_arc_bufopen): New. libctf/ * ctf-impl.h (ctf_new_archive_internal): Declare. (ctf_arc_bufopen): Remove. (ctf_archive_internal) <ctfi_free_symsect>: New. * ctf-archive.c (ctf_arc_close): Use it. (ctf_arc_bufopen): Fuse into... (ctf_new_archive_internal): ... this, moved across from... * ctf-open-bfd.c: ... here. (ctf_bfdopen_ctfsect): Use ctf_arc_bufopen. * libctf.ver: Add it. binutils/ * readelf.c (dump_section_as_ctf): Support .ctf archives using ctf_arc_bufopen. Automatically load the .ctf member of such archives as the parent of all other members, unless specifically overridden via --ctf-parent. Split out dumping code into... (dump_ctf_archive_member): ... here, as in objdump, and call it once per archive member. (dump_ctf_indent_lines): Code style fix.
2020-06-26libctf: create: forwards are always in the namespace of their referentNick Alcock2-2/+14
The C namespace a forward is located in is always the same as the namespace of the corresponding complete type: 'struct foo' is in the struct namespace and does not collide with, say, 'union foo'. libctf allowed for this in many places, but inconsistently: in particular, forward *addition* never allowed for this, and was interning forwards in the default namespace, which is always wrong, since you can only forward structs, unions and enums, all of which are in their own namespaces in C. Forward removal needs corresponding adjustment to remove the names form the right namespace, as does ctf_rollback. libctf/ * ctf-create.c (ctf_add_forward): Intern in the right namespace. (ctf_dtd_delete): Remove correspondingly. (ctf_rollback): Likewise.
2020-06-26libctf: create: ctf_add_type should hand back already-added non-SoUsNick Alcock2-6/+15
When we add a type from a dictionary and then try to add it again, we should hand it back unchanged unless it is a structure, union or enum with a different number of members. That's what the comment says we do. Instead, we hand it back unchanged *only* if it is a structure, union or enum with the same number of members: non-structs, unions and enums are unconditionally added. This causes extreme type bloating and (in conjunction with the bug fixed by the next commit) can easily lead to the same type being mistakenly added to a dictionary more than once (which, for forwards, was not banned and led to dictionary corruption). libctf/ * ctf-create.c (ctf_add_type_internal): Hand back existing types unchanged.
2020-06-26libctf: create: don't add forwards if the type added already existsNick Alcock2-1/+9
This is what ctf_add_forward is documented to do, but it's not what it actually does: the code is quite happy to add forwards that duplicate existing structs, etc. This is obviously wrong and breaks both the nondeduplicating linker and the upcoming deduplicator, as well as allowing ordinary callers of ctf_add_type to corrupt the dictionary by just adding the same root- visible forward more than once. libctf/ * ctf-create.c (ctf_add_forward): Don't add forwards to types that already exist.
2020-06-26libctf: create: non-root-visible types should not appear in name tablesNick Alcock4-17/+53
We were accidentally interning newly-added and newly-opened non-root-visible types into name tables, and removing names from name tables when such types were removed. This is very wrong: the whole point of non-root-visible types is they do not go in name tables and cannot be looked up by name. This bug made non-root-visible types basically identical to root-visible types, right back to the earliest days of libctf in the Solaris era. libctf/ * ctf-open.c (init_types): Only intern root-visible types. * ctf-create.c (ctf_dtd_insert): Likewise. (ctf_dtd_delete): Only remove root-visible types. (ctf_rollback): Likewise. (ctf_add_generic): Adjust. (ctf_add_struct_sized): Adjust comment. (ctf_add_union_sized): Likewise. (ctf_add_enum): Likewise. * ctf-impl.h (ctf_dtd_insert): Adjust prototype.
2020-06-26binutils, ld: work with --disable-libctfNick Alcock19-10/+257
This unfortunately means conditionalizing out all the libctf code, but the result is not too unbearably ugly, if a bit repetitive. I have stubbed out code in the !ENABLE_LIBCTF path to avoid extra redundant ifdefs where it seems that might be helpful. (The stubs are not too disruptive, but I've tried to keep them on one line where possible to avoid filling up the screen with stubs that nobody would care about. If this is too much of a coding style violation I can change it.) Changes since v2: use GCC_ENABLE rather than repeating all the AC_ARG_ENABLE stuff over and over again. ld/ * configure.ac [--enable-libctf]: New, default yes. Set ENABLE_LIBCTF accordingly. * Makefile.am [!ENABLE_LIBCTF]: Empty LIBCTF. * configure: Regenerate. * config.in: Regenerate. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * ldlang.c (ctf_output): Conditionalize on ENABLE_LIBCTF. (ldlang_open_ctf): Likewise. (lang_merge_ctf): Likewise. (ldlang_ctf_apply_strsym): Likewise. (lang_write_ctf): Likewise. (ldlang_write_ctf_late): Likewise. (ldlang_open_ctf) [!ENABLE_LIBCTF]: Warn about the presence of CTF sections. (lang_merge_ctf) [!ENABLE_LIBCTF]: New stub. (ldlang_ctf_apply_strsym) [!ENABLE_LIBCTF]: Likewise. (lang_write_ctf) [!ENABLE_LIBCTF]: Likewise. (ldlang_write_ctf_late) [!ENABLE_LIBCTF]: Likewise. * ldelfgen.c (ldelf_emit_ctf_early): Conditionalize on ENABLE_LIBCTF. (struct ctf_strsym_iter_cb_arg): Likewise. (ldelf_ctf_strtab_iter_cb): Likewise. (ldelf_ctf_symbols_iter_cb): Likewise. (ldelf_examine_strtab_for_ctf): Likewise. (ldelf_emit_ctf_early) [!ENABLE_LIBCTF]: New stub. (ldelf_examine_strtab_for_ctf) [!ENABLE_LIBCTF]: New stub. binutils/ * configure.ac [--enable-libctf]: New, default yes. Set ENABLE_LIBCTF accordingly. * Makefile.am [!ENABLE_LIBCTF]: Empty LIBCTF and LIBCTF_NOBFD. * configure: Regenerate. * config.in: Regenerate. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * objdump.c (usage): Conditionalize portions on ENABLE_LIBCTF. (option_values): Likewise. (long_options): Likewise. (main): Likewise. (dump_ctf_indent_lines): Conditionalize out when !ENABLE_LIBCTF. (make_ctfsect): Likewise. (dump_ctf_archive_member): Likewise. (dump_ctf) [ENABLE_LIBCTF]: Likewise. (dump_ctf) [!ENABLE_LIBCTF]: New empty stub. * readelf.c (options): Conditionalize portions on ENABLE_LIBCTF. (usage): Likewise. (process_section_contents): Likewise. (shdr_to_ctf_sect): Conditionalize out when !ENABLE_LIBCTF. (dump_ctf_indent_lines): Likewise. (dump_section_as_ctf) [ENABLE_LIBCTF]: Likewise.
2020-06-26Fix --enable-libctf and --disable-staticNick Alcock15-6/+146
This fixes test runs and compilation when --disable-libctf, --disable-static, or --enable-shared are passed. Changes since v2: Use GCC_ENABLE and fix indentation. Fix prototype using 'void'. Use 'unsupported' and gdb_caching_proc. Changes since v3: Adapt to upstream changes providing skip_ctf_tests. Changes since v4: Adapt to upstream changes in the seven months (!) since I last looked at this. gdb/ChangeLog * configure.ac: Add --enable-libctf: handle --disable-static properly. * acinclude.m4: sinclude ../config/enable.m4. * Makefile.in (aclocal_m4_deps): Adjust accordingly. (LIBCTF): Substitute in. (CTF_DEPS): New, likewise. (CLIBS): libctf needs symbols from libbfd: move earlier. (CDEPS): Use CTF_DEPS, not LIBCTF, now LIBCTF can include rpath flags. * ctfread.c: Surround in ENABLE_LIBCTF. (elfctf_build_psymtabs) [!ENABLE_LIBCTF]: New stub. * configure: Regenerate. * config.in: Likewise. gdb/testsuite/ChangeLog * configure.ac: Add --enable-libctf. * aclocal.m4: sinclude ../config/enable.m4. * Makefile.in (site.exp): Add enable_libctf to site.exp. * lib/gdb.exp (skip_ctf_tests): Use it. * gdb.base/ctf-constvars.exp: Error message tweak. * gdb.base/ctf-ptype.exp: Likewise. * configure: Regenerate.
2020-06-26x86: make I disassembler macro available for new useJan Beulich2-13/+17
The {Q|Q} construct on lgdt/lidt and the slightly different {Q|IQ} struck me as odd when encountering. Realizing they both have the same effect, let's free up the I macro by using the former form of construct where needed (there aren't that many uses overall). With there now being several multi-character macros also re-do "alt" handling slightly: Terminate it when finding the closing brace, rather than after the next single character. Also set the flag only when actually in Intel syntax mode.
2020-06-26ld/x86: actually invoke k1om testsJan Beulich2-0/+7
Unlike claimed by the ChangeLog entries added by 7a9068fe1646 ("Add initial Intel K1OM support") these tests did never get enabled.
2020-06-26x86: fix processing of -M disassembler optionJan Beulich7-7/+84
Multiple -M options can be specified in any order. Therefore stright assignment to fields affected needs to be avoided, such that earlier options' effects won't be discarded. This was in particular a problem for -Msuffix followed by certain of the other sub-options. While updating documentation, take the liberty and also drop the redundant mentioning of being able to comma-separate multiple options.
2020-06-26Fix -Wstring-compare testcase build failureGary Benson3-2/+16
Clang fails to compile the file gdb/testsuite/gdb.cp/try_catch.cc with the following error: warning: result of comparison against a string literal is unspecified (use strncmp instead) [-Wstring-compare] This commit fixes the error, replacing the pointer comparison with a call to strcmp. This commit also adds a final check: the test program is run to the final return statement, and the value of "test" is checked to ensure it is still "true" at that point. gdb/testsuite/ChangeLog: * gdb.cp/try_catch.cc: Include string.h. (main): Replace comparison against string literal with strcmp, avoiding build failure with -Wstring-compare. Add "marker test-complete". * gdb.cp/try_catch.exp: Run the test to the above marker, then verify that the value of "test" is still true.