aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-07-20guile: Add support for Guile 3.0.Ludovic Courtès10-10/+29
gdb/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> * guile/scm-math.c (vlscm_integer_fits_p): Use 'uintmax_t' and 'intmax_t' instead of 'scm_t_uintmax' and 'scm_t_intmax', which are deprecated in Guile 3.0. * configure.ac (try_guile_versions): Add "guile-3.0". * configure (try_guile_versions): Regenerate. * NEWS: Update entry. gdb/testsuite/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> * gdb.guile/source2.scm: Add #f first argument to 'format'. * gdb.guile/types-module.exp: Remove "ERROR:" from regexps since Guile 3.0 no longer prints that. gdb/doc/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> * doc/guile.texi (Guile Introduction): Mention Guile 3.0. Change-Id: Iff116c2e40f334e4e0ca4e759a097bfd23634679
2020-07-20guile: Add support for Guile 2.2.Ludovic Courtès9-175/+542
This primarily updates code that uses the I/O port API of Guile. gdb/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> Doug Evans <dje@google.com> PR gdb/21104 * guile/scm-ports.c (USING_GUILE_BEFORE_2_2): New macro. (ioscm_memory_port)[read_buf_size, write_buf_size]: Wrap in #if USING_GUILE_BEFORE_2_2. (stdio_port_desc, memory_port_desc) [!USING_GUILE_BEFORE_2_2]: Change type to 'scm_t_port_type *'. (natural_buffer_size) [!USING_GUILE_BEFORE_2_2]: New variable. (ioscm_open_port) [USING_GUILE_BEFORE_2_2]: Add 'stream' parameter and honor it. Update callers. (ioscm_open_port) [!USING_GUILE_BEFORE_2_2]: New function. (ioscm_read_from_port, ioscm_write) [!USING_GUILE_BEFORE_2_2]: New functions. (ioscm_fill_input, ioscm_input_waiting, ioscm_flush): Wrap in #if USING_GUILE_BEFORE_2_2. (ioscm_init_gdb_stdio_port) [!USING_GUILE_BEFORE_2_2]: Use 'ioscm_read_from_port'. Call 'scm_set_port_read_wait_fd'. (ioscm_init_stdio_buffers) [!USING_GUILE_BEFORE_2_2]: New function. (gdbscm_stdio_port_p) [!USING_GUILE_BEFORE_2_2]: Use 'SCM_PORTP' and 'SCM_PORT_TYPE'. (gdbscm_memory_port_end_input, gdbscm_memory_port_seek) (ioscm_reinit_memory_port): Wrap in #if USING_GUILE_BEFORE_2_2. (gdbscm_memory_port_read, gdbscm_memory_port_write) (gdbscm_memory_port_seek, gdbscm_memory_port_close) [!USING_GUILE_BEFORE_2_2]: New functions. (gdbscm_memory_port_print): Remove use of 'SCM_PTOB_NAME'. (ioscm_init_memory_port_type) [!USING_GUILE_BEFORE_2_2]: Use 'gdbscm_memory_port_read'. Wrap 'scm_set_port_end_input', 'scm_set_port_flush', and 'scm_set_port_free' calls in #if USING_GUILE_BEFORE_2_2. (gdbscm_get_natural_buffer_sizes) [!USING_GUILE_BEFORE_2_2]: New function. (ioscm_init_memory_port): Remove. (ioscm_init_memory_port_stream): New function (ioscm_init_memory_port_buffers) [USING_GUILE_BEFORE_2_2]: New function. (gdbscm_memory_port_read_buffer_size) [!USING_GUILE_BEFORE_2_2]: Return scm_from_uint (0). (gdbscm_set_memory_port_read_buffer_size_x) [!USING_GUILE_BEFORE_2_2]: Call 'scm_setvbuf'. (gdbscm_memory_port_write_buffer_size) [!USING_GUILE_BEFORE_2_2]: Return scm_from_uint (0). (gdbscm_set_memory_port_write_buffer_size_x) [!USING_GUILE_BEFORE_2_2]: Call 'scm_setvbuf'. * configure.ac (try_guile_versions): Add "guile-2.2". * configure: Regenerate. * NEWS: Add entry. gdb/testsuite/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> * gdb.guile/scm-error.exp ("source $remote_guile_file_1"): Relax error regexp to match on Guile 2.2. gdb/doc/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> * guile.texi (Memory Ports in Guile): Mark 'memory-port-read-buffer-size', 'set-memory-port-read-buffer-size!', 'memory-port-write-buffer-size', 'set-memory-port-read-buffer-size!' as deprecated. * doc/guile.texi (Guile Introduction): Clarify which Guile versions are supported. Change-Id: Ib119b10a2787446e0ae482a5e1b36d809c44bb31
2020-07-20Skip tests requiring "alignof (void)" when compiling using clangGary Benson2-1/+17
As an extension, GCC allows void pointer arithmetic, with sizeof(void) and alignof(void) both 1. GDB supports this extension, but clang does not, and fails to compile the generated output of gdb.cp/align.exp with the following error: gdb compile failed, /gdbtest/build/gdb/testsuite/outputs/gdb.cp/align/align.cc:28:23: error: invalid application of 'alignof' to an incomplete type 'void' unsigned a_void = alignof (void); ^ ~~~~~~ 1 error generated. This commit adds preprocessor conditionals to the generated output, to omit the unsupported code when using clang, and supplies the expected value so the test can complete. gdb/testsuite/ChangeLog: * gdb.cp/align.exp: Fix "alignof (void)" tests when compiling with clang.
2020-07-20Fix problem running a few PowerPC linker tests when the .data section is ↵Nick Clifton2-3/+8
retained. * testsuite/ld-powerpc/powerpc.exp (ppcelftests): Use section name .PPC.EMB.apuinfo instead of section number 2 in apuinfo tests.
2020-07-20PR26265, Spurious 'gc-sections requires ... when --init or --finiAlan Modra5-10/+34
bfd/ * elflink.c (_bfd_elf_gc_keep): Use bfd_is_const_section. ld/ PR 26265 * ldlang.c (undef_from_cmdline): Delete. (ldlang_add_undef): Mark "cmdline" param unused. (lang_end): Traverse gc_sym_list to determine whether a symbol root has been specified. Update error message. * testsuite/ld-gc/noent.d: Adjust for changed error message.
2020-07-20[gdb/testsuite] Stabilize execution order in omp-par-scope.cTom de Vries2-0/+55
In openmp test-case gdb.threads/omp-par-scope.exp we xfail and kfail dependent on omp_get_thread_num (). Since execution order of the threads can vary from execution to execution, this can cause changes in test results. F.i., we can see this difference between two test runs: ... -KFAIL: single_scope: first thread: print i3 (PRMS: gdb/22214) +PASS: single_scope: first thread: print i3 -PASS: single_scope: second thread: print i3 +KFAIL: single_scope: second thread: print i3 (PRMS: gdb/22214) ... In both cases, the KFAIL is for omp_get_thread_num () == 1, but in one case that corresponds to the first thread executing that bit of code, and in the other case to the second thread. Get rid of this difference by stabilizing execution order. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-07-20 Tom de Vries <tdevries@suse.de> * gdb.threads/omp-par-scope.c (lock, lock2): New variable. (omp_set_lock_in_order): New function. (single_scope, multi_scope, nested_func, nested_parallel): Use omp_set_lock_in_order and omp_unset_lock. (main): Init and destroy lock and lock2.
2020-07-20x86: Update PR gas/26263 linker testsH.J. Lu4-9/+17
Update and run PR gas/26263 linker tests for all x86 ELF targets to accept any program header layout. PR gas/26263 * testsuite/ld-i386/pr26263.d: Updated. * testsuite/ld-x86-64/pr26263.d: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run gas/26263 test for all ELF targets.
2020-07-20[gdb/testsuite] Fix valgrind-infcall-2.exp without libc debug infoTom de Vries2-1/+5
When running test-case gdb.base/valgrind-infcall-2.exp on a system without libc debug info installed, I run into: ... (gdb) p printf ("bla")^M 'printf' has unknown return type; cast the call to its declared return type^M (gdb) FAIL: gdb.base/valgrind-infcall-2.exp: do printf ... Fix this by casting the result of the printf call to int. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-07-20 Tom de Vries <tdevries@suse.de> * gdb.base/valgrind-infcall-2.exp: Handle printf unknown return type.
2020-07-20[gdb/testsuite] Bail out after gdb_start error in ↵Tom de Vries2-1/+10
gdb.threads/attach-slow-waitpid.exp When building gdb using CFLAGS/CXXFLAGS+=-fsanitizer=address and LDFLAGS+=-lasan, and running test-case gdb.threads/attach-slow-waitpid.exp, we get: ... spawn gdb -nw -nx -data-directory data-directory^M ==16079==ASan runtime does not come first in initial library list; \ you should either link runtime to your application or manually preload \ it with LD_PRELOAD.^M ERROR: (eof) GDB never initialized. ERROR: : spawn id exp10 not open while executing "expect { -i exp10 -timeout 120 -re "Kill the program being debugged. .y or n. $" { send_gdb "y\n" answer verbose "\t\tKilling previous pro..." ("uplevel" body line 1) invoked from within "uplevel $body" NONE : spawn id exp10 not open WARNING: remote_expect statement without a default case ERROR: : spawn id exp10 not open while executing "expect { -i exp10 -timeout 120 -re "Reading symbols from.*LZMA support was disabled.*$gdb_prompt $" { verbose "\t\tLoaded $arg into $GDB; .gnu_..." ("uplevel" body line 1) invoked from within "uplevel $body" NONE : spawn id exp10 not open ERROR: Couldn't load attach-slow-waitpid into GDB (eof). ERROR: Couldn't send attach 16070 to GDB. UNRESOLVED: gdb.threads/attach-slow-waitpid.exp: attach to target ... Bail out at the first ERROR, such that we have instead: ... ERROR: (eof) GDB never initialized. UNTESTED: gdb.threads/attach-slow-waitpid.exp: \ Couldn't start GDB with preloaded lib ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-07-20 Tom de Vries <tdevries@suse.de> * gdb.threads/attach-slow-waitpid.exp: Bail out if gdb_start fails.
2020-07-20x86: handle SVR4 escaped binary operatorsJan Beulich6-7/+95
PR gas/4572 When / is a comment character, its use as binary "divide" operator needs escaping by a backslash. Besides the scrubber needing to support this (addressed in an earlier change), there are also a few provisions needed in target specific operator handling. As the spec calls for % and * to also be escaped because of being "overloaded", also recognize these, despite the overloading there not really preventing their use as operators in most (%) or all (*) cases, given the way how the rest of the assembler works. To bring source and testsuite in line, also drop the TE_I386AIX part of the respective conditional, as i?86-*-aix* support had been removed a while ago.
2020-07-20gas: generalize comment character escaping recognitionJan Beulich2-18/+15
PR gas/4572 Generalize what ab1fadc6b2f0 ("PR22714, Assembler preprocessor loses track of \@") did to always honor escaped comment chars. Use this then to support escaped /, %, and * operators on x86, when / is a comment char (to match the Sun assembler's behavior).
2020-07-20x86: honor absolute section when emitting codeJan Beulich6-32/+189
Various provisions exist for insns to be placed in the absolute section, yet actually trying to do so didn't work. While data emission (of non- zero values) is not allowed by generic code, I think this functionality is useful for the programmer to be able to determine the size of insns. Therefore, rather than turning the silnet failure into a verbose one, make things mostly work; the one class of insns not supported (yet) are branches (JMP and Jcc) with dynamically determined displacement widths. In this one case, an error now gets reported instead of silently ignoring the code. Also avoid recording ISA / feature usage for insns emitted to the absolute section.
2020-07-20ix86: enable more ELF tests for VxWorksJan Beulich2-9/+19
The tree-wide is_elf_format predicate excludes VxWorks, but the majority of ELF specific tests is quite fine for this target.
2020-07-20Automatic date update in version.inGDB Administrator1-1/+1
2020-07-19gold: Update x32 testH.J. Lu2-4/+5
* testsuite/split_x32.sh: Likewise.
2020-07-19gold: Update x86-64 testsH.J. Lu5-14/+21
commit 36938cabf0efcb053d1585e8580a4b3db438ca4e Author: Jan Beulich <jbeulich@suse.com> Date: Wed Jul 15 08:53:55 2020 +0200 x86: avoid attaching suffixes to unambiguous insns removed the 'a' suffix on call and jmp from disassembler output. Update gold x86-64 tests. * testsuite/bnd_ifunc_1.sh: Updated. * testsuite/bnd_plt_1.sh: Likewise. * testsuite/split_x86_64.sh: Likewise. * testsuite/x86_64_indirect_call_to_direct.sh: Likewise.
2020-07-19x86: Change PLT32 reloc against section to PC32H.J. Lu10-6/+81
Commit 292676c1 resolved PLT32 reloc aganst local symbol to section. Since PLT32 relocation must be against symbols, turn such PLT32 relocation into PC32 relocation. gas/ PR gas/26263 * config/tc-i386.c (i386_validate_fix): Change PLT32 reloc against section to PC32 reloc. * testsuite/gas/i386/relax-5.d: Updated. * testsuite/gas/i386/x86-64-relax-4.d: Likewise. ld/ PR gas/26263 * testsuite/ld-i386/i386.exp: Run PR gas/26263 test. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr26263.d: New file. * testsuite/ld-x86-64/pr26263.d: Likewise. * testsuite/ld-x86-64/pr26263.s: Likewise.
2020-07-19ld: optionally emit _etext last, before .dataHans-Peter Nilsson4-4/+21
So, here's my suggestion for making _init .. __etext cover .text + .rodata (including things like the read-only exception tables) for elf64mmix. A quick web search gives that __etext (and friends) isn't well defined, so each target can interpret the "end of text segment" to their own liking. It seems likely this change is also a better fit than the default for other ports, at least those with .rodata after .text in the same segment. The presence of a separate rodata-segment is optional (and not true for elf64mmix). This is reflected in the name as SEPARATE_TEXT / SEPARATE_CODE isn't considered, to keep it simple; each target has to make sure their settings of variables make sense. ld: * scripttempl/elf.sc (ETEXT_LAST_IN_RODATA_SEGMENT): New variable. * emulparams/elf64mmix.sh (ETEXT_LAST_IN_RODATA_SEGMENT): Define. * testsuite/ld-mmix/sec-1.d: Adjust.
2020-07-19Power10 stub selectionAlan Modra13-34/+359
This patch better supports mixing of power10 and non-power10 code, as might be seen in a cpu-optimized library using ifuncs to select functions optimized for a given cpu. Using -Wl,--no-power10-stubs isn't that good in this situation since non-power10 notoc stubs are slower and larger than the power10 variants, which you'd like to use on power10 code paths. With this change, power10 pc-relative code that makes calls marked @notoc uses power10 stubs if stubs are necessary, and other calls use non-power10 instructions in stubs. This will mean that if gcc is generating code for -mcpu=power10 but with pc-rel disabled then you'll get the older stubs even on power10 (unless you force with -Wl,--power10-stubs). That shouldn't be too big a problem: stubs that use r2 are reasonable. It's just the ones that set up addressing using "mflr 12; bcl 20,31,.+4; mflr 11; mtlr 12" that should be avoided if possible. bfd/ * elf64-ppc.c (struct ppc_link_hash_table): Add has_power10_relocs. (select_alt_stub): New function. (ppc_get_stub_entry): Use it here. (ppc64_elf_check_relocs): Set had_power10_relocs rather than power10_stubs. (ppc64_elf_size_stubs): Clear power10_stubs here instead. Don't merge notoc stubs with other varieties when power10_stubs is "auto". Instead dup the stub hash table entry. (plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust tests of power10_stubs. ld/ * emultempl/ppc64elf.em (power10-stubs): Accept optional "auto" arg. * ld.texi (power10-stubs): Update. * testsuite/ld-powerpc/callstub-1.d: Force --power10-stubs. * testsuite/ld-powerpc/callstub-2.d: Relax branch offset comparison. * testsuite/ld-powerpc/callstub-4.d: New test. * testsuite/ld-powerpc/notoc.d: Force --no-power10-stubs. * testsuite/ld-powerpc/notoc3.d, * testsuite/ld-powerpc/notoc3.s, * testsuite/ld-powerpc/notoc3.wf: New test. * testsuite/ld-powerpc/powerpc.exp: Run new tests. Pass --no-power10-stubs for notoc link.
2020-07-19Automatic date update in version.inGDB Administrator1-1/+1
2020-07-18Remove "linux_multi_process" globalTom Tromey2-6/+6
The "linux_multi_process" is initialized but never modified. I discussed this with Pedro on irc, and he said that, while it was useful when developing this feature, it is now no longer needed. So, this removes it. gdb/ChangeLog 2020-07-18 Tom Tromey <tom@tromey.com> * linux-nat.c (linux_multi_process): Remove. (linux_nat_target::supports_multi_process): Return true.
2020-07-18Automatic date update in version.inGDB Administrator1-1/+1
2020-07-17gdb/riscv: delete target descriptions when gdb exitsAndrew Burgess9-16/+58
It was pointed out on IRC that the RISC-V target allocates target descriptions and stores them in a global map, and doesn't delete these target descriptions when GDB shuts down. This isn't a particular problem, the total number of target descriptions we can create is very limited so creating these on demand and holding them for the entire run on GDB seems reasonable. However, not deleting these objects on GDB exit means extra warnings are printed from tools like valgrind, and the address sanitiser, making it harder to spot real issues. As it's reasonably easy to have GDB correctly delete these objects on exit, lets just do that. I started by noticing that we already have a target_desc_up type, a wrapper around unique_ptr that calls a function that will correctly delete target descriptions, so I want to use that, but.... ...that type is declared in gdb/target-descriptions.h. If I try to include that file in gdb/arch/riscv.c I run into a problem, that file is compiled into both GDB and GDBServer. OK, I could guard the include with #ifdef, but surely we can do better. So then I decided to move the target_desc_up type into gdbsupport/tdesc.h, this is the interface file for generic code shared between GDB and GDBserver (relating to target descriptions). The actual implementation for the delete function still lives in gdb/target-description.c, but now gdb/arch/riscv.c can see the declaration. Problem solved.... ... but, though RISC-V doesn't use it I've now exposed the target_desc_up type to gdbserver, so in future someone _might_ start using it, which is fine, except right now there's no definition of the delete function - remember the delete I used is only defined in GDB code. No problem, I add an implementation of the delete operator into gdbserver/tdesc.cc, and all is good..... except.... I start getting this error from GCC: tdesc.cc:109:10: error: deleting object of polymorphic class type ‘target_desc’ which has non-virtual destructor might cause undefined behavior [-Werror=delete-non-virtual-dtor] Which is caused because gdbserver's target_desc type inherits from tdesc_element which has a virtual method, and so GCC worries that target_desc might be used as a base class. The solution is to declare gdbserver's target_desc class as final. This is fine so long as we never intent to inherit from target_desc (in gdbserver). But if we did then we'd want to make target_desc's destructor virtual anyway, so the error above would be resolved, and there wouldn't be an issue. gdb/ChangeLog: * arch/riscv.c (riscv_tdesc_cache): Change map type. (riscv_lookup_target_description): Return pointer out of unique_ptr. * target-descriptions.c (allocate_target_description): Add comment. (target_desc_deleter::operator()): Likewise. * target-descriptions.h (struct target_desc_deleter): Moved to gdbsupport/tdesc.h. (target_desc_up): Likewise. gdbserver/ChangeLog: * tdesc.cc (allocate_target_description): Add header comment. (target_desc_deleter::operator()): New function. * tdesc.h (struct target_desc): Declare as final. gdbsupport/ChangeLog: * tdesc.h (struct target_desc_deleter): Moved here from gdb/target-descriptions.h, extend comment. (target_desc_up): Likewise.
2020-07-17[gdb/testsuite] Add gdb.base/valgrind-infcall-2.expTom de Vries4-13/+131
In commit ee3c5f8968 "Fix GDB crash when registers cannot be modified", we fix a GDB crash: ... $ valgrind /usr/bin/sleep 10000 ==31595== Memcheck, a memory error detector ==31595== Command: /usr/bin/sleep 10000 ==31595== $ gdb /usr/bin/sleep (gdb) target remote | vgdb --pid=31595 Remote debugging using | vgdb --pid=31595 ... $hex in __GI___nanosleep () at nanosleep.c:27 27 return SYSCALL_CANCEL (nanosleep, requested_time, remaining); (gdb) p printf ("bla") terminate called after throwing an instance of 'gdb_exception_error' Aborted (core dumped) ... This patch adds a test-case for it. Unfortunately, I was not able to trigger the error condition using a regular vgdb_start, so I've added a parameter active_at_startup, and when set to 0 this causes valgrind to be started without --vgdb-error=0. Tested on x86_64-linux. Tested with the commit mentioned above reverted, resulting in: ... (gdb) p printf ("bla")^M terminate called after throwing an instance of 'gdb_exception_error'^M ERROR: GDB process no longer exists GDB process exited with wait status 6152 exp10 0 0 CHILDKILLED SIGABRT SIGABRT UNRESOLVED: gdb.base/valgrind-infcall-2.exp: do printf ... gdb/testsuite/ChangeLog: 2020-07-17 Tom de Vries <tdevries@suse.de> * gdb.base/valgrind-infcall-2.c: New test. * gdb.base/valgrind-infcall-2.exp: New file. * lib/valgrind.exp (vgdb_start): Add and handle active_at_startup.
2020-07-17Use boolean literals in linux-nat.cTom Tromey2-4/+11
I noticed a couple of spots in linux-nat.c that use 0/1 where boolean literals would be more idiomatic. This patch makes this change. gdb/ChangeLog 2020-07-17 Tom Tromey <tromey@adacore.com> * linux-nat.c (linux_nat_target::supports_non_stop) (linux_nat_target::always_non_stop_p): Use "true". (linux_nat_target::supports_disable_randomization): Use "true" and "false".
2020-07-17[gdb/testsuite] Use MACRO_AT_{func,range}Tom de Vries23-198/+64
Use dwarf assembly procs MACRO_AT_func and MACRO_AT_range in test-cases where that's appropriate. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-07-17 Tom de Vries <tdevries@suse.de> * gdb.dlang/circular.c (found): Use found_label as label name. * gdb.dwarf2/arr-subrange.c (main): Use main_label as label name. * gdb.dwarf2/comp-unit-lang.c (func): Use func_label as label name. * gdb.dlang/circular.exp: Use MACRO_AT_func and MACRO_AT_range. * gdb.dwarf2/ada-linkage-name.exp: Same. * gdb.dwarf2/arr-subrange.exp: Same. * gdb.dwarf2/atomic-type.exp: Same. * gdb.dwarf2/comp-unit-lang.exp: Same. * gdb.dwarf2/cpp-linkage-name.exp: Same. * gdb.dwarf2/dw2-bad-mips-linkage-name.exp: Same. * gdb.dwarf2/dw2-lexical-block-bare.exp: Same. * gdb.dwarf2/dw2-regno-invalid.exp: Same. * gdb.dwarf2/implptr-64bit.exp: Same. * gdb.dwarf2/imported-unit-abstract-const-value.exp: Same. * gdb.dwarf2/imported-unit-runto-main.exp: Same. * gdb.dwarf2/imported-unit.exp: Same. * gdb.dwarf2/main-subprogram.exp: Same. * gdb.dwarf2/missing-type-name.exp: Same. * gdb.dwarf2/nonvar-access.exp: Same. * gdb.dwarf2/struct-with-sig.exp: Same. * gdb.dwarf2/typedef-void-finish.exp: Same. * gdb.dwarf2/void-type.exp: Same.
2020-07-17[gdb/testsuite] Drop src arg of MACRO_AT_{func,range}Tom de Vries17-45/+47
The dwarf assembly procs MACRO_AT_func and MACRO_AT_range have a src parameter, which is set to $srcdir/$subdir/$srcfile in every single call. Drop the src parameter and hardcode usage of $srcdir/$subdir/$srcfile in the procs. Build and reg-tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-07-17 Tom de Vries <tdevries@suse.de> * lib/dwarf.exp (Dwarf::MACRO_AT_func, Dwarf::MACRO_AT_range): Drop src parameter. * gdb.dlang/watch-loc.exp: Update MACRO_AT_{func,range} calls. * gdb.dwarf2/bitfield-parent-optimized-out.exp: Same. * gdb.dwarf2/dw2-ifort-parameter.exp: Same. * gdb.dwarf2/dw2-opt-structptr.exp: Same. * gdb.dwarf2/dwz.exp: Same. * gdb.dwarf2/implptr-optimized-out.exp: Same. * gdb.dwarf2/implref-array.exp: Same. * gdb.dwarf2/implref-const.exp: Same. * gdb.dwarf2/implref-global.exp: Same. * gdb.dwarf2/implref-struct.exp: Same. * gdb.dwarf2/info-locals-optimized-out.exp: Same. * gdb.dwarf2/opaque-type-lookup.exp: Same. * gdb.dwarf2/var-access.exp: Same. * gdb.dwarf2/varval.exp: Same. * gdb.trace/entry-values.exp: Same.
2020-07-17[gdb/testsuite] Remove Dwarf::externTom de Vries12-28/+14
The file lib/dwarf.exp contains: ... # Declare a global label. This is typically used to refer to # labels defined in other files, for example a function defined in # a .c file. proc extern {args} { foreach name $args { _op .global $name } } ... The assembler directive to refer to labels defined in other files is not .global, but .extern, and that one is ignored by gas. Since we require gas for all dwarf assembly test-cases, remove the proc and all it's uses. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-07-17 Tom de Vries <tdevries@suse.de> * lib/dwarf.exp (Dwarf::extern): Remove. * gdb.compile/compile-ops.exp: Remove use of Dwarf::extern. * gdb.dlang/circular.exp: Same. * gdb.dwarf2/comp-unit-lang.exp: Same. * gdb.dwarf2/dw2-ifort-parameter.exp: Same. * gdb.dwarf2/dw2-symtab-includes.exp: Same. * gdb.dwarf2/dwz.exp: Same. * gdb.dwarf2/imported-unit-abstract-const-value.exp: Same. * gdb.dwarf2/imported-unit-runto-main.exp: Same. * gdb.dwarf2/imported-unit.exp: Same. * gdb.dwarf2/opaque-type-lookup.exp: Same.
2020-07-17Automatic date update in version.inGDB Administrator1-1/+1
2020-07-17mmix ld: move .init (and _init) first.Hans-Peter Nilsson3-12/+17
This both makes the section layout more similar to that of the general default for ELF and fixes (makes true) an assumption that code and rodata is located between _init and __etext, in libgcc/config/mmix/crti.S. Sadly, that's not actually true for ELF (generally and for elf64mmix), where exception-tables and .rodata is after _etext; I'm pondering what to do about that. The original mmix simulator behavior is that memory magically appears on access, initialized with 0, which is not preferable when chasing bugs by throwing code the size of the gcc test-suite to the simulator. The code in crti.S compatibly enables simulator machinery to identify undefined memory and instead stopping the simulator with an error (going to interactive mode for interactive runs). See http://gcc.gnu.org/legacy-ml/gcc-patches/2012-10/msg01871.html for more, including the mmix-sim.ch "patch file". This fixes only one error in the gcc testsuite, gcc.c-torture/execute/pr20621-1.c with LTO, where for some reason gcc/lto chooses to move (writable) data that is only used to read 0 to .rodata. An access (sufficiently far inside a block) in an unregistered place is flagged as an invalid access. The bpo-9m test that I had to adjust, actually exposes a wart: mmo does not have the notion of symbol types (or sections) and the test-case now has leading zeros at "Main" eventually leading to it being misdiagnosed as being outside .text and .data, thus here mapped to BFD as an absolute symbol. The test is not intended to check the mmo symbol-type machinery, so I'm just tweaking it to be symbol-type-neutral for "Main". Since you have to jump through hoops to see the problem, I don't think this commit is worth putting on the 2.35-branch. ld: * scripttempt/mmo.sc: Move .init first in .text output section. * testsuite/ld-mmix/bpo-9m.d: Adjust accordingly.
2020-07-16Fix POSIX-isms in gdb.base/shell.expSandra Loosemore2-10/+21
Some recent tests added to gdb.base/shell.exp have been failing on Windows host due to assumptions that the shell is a POSIX variant. On Windows, GDB uses CMD.EXE via the system() call to run shell commands instead. There seems to be no obvious CMD.EXE equivalent for "kill -2 $$" to signal the shell process, so this patch skips those tests on Windows host. The second problem addressed here is that CMD.EXE only recognizes double quotes, not single quotes; that change can be made unconditionally since POSIX shells recognize double quotes as well. 2020-07-16 Sandra Loosemore <sandra@codesourcery.com> gdb/testsuite/ * gdb.base/shell.exp: Skip pipe tests dependent on sh on Windows host. Use double quotes instead of single quotes.
2020-07-16gdb: fix issues with handling DWARF v5 rnglists & .dwo files.Caroline Tice5-48/+398
While experimenting with GDB on DWARF 5 with split debug (dwo files), I discovered that GDB was not reading the rnglist index properly (it needed to be reprocessed in the same way the loclist index does), and that there was no code for reading rnglists out of dwo files at all. Also, the rnglist address reading function (dwarf2_rnglists_process) was adding the base address to all rnglist entries, when it's only supposed to add it to the DW_RLE_offset_pair entries (http://dwarfstd.org/doc/DWARF5.pdf, p. 53), and was not handling several entry types. - Added 'reprocessing' for reading rnglist index (as is done for loclist index). - Added code for reading rnglists out of .dwo files. - Added several missing rnglist forms to dwarf2_rnglists_process. - Fixed bug that was alwayas adding base address for rnglists (only one form needs that). - Updated dwarf2_rnglists_process to read rnglist out of dwo file when appropriate. - Added new functions cu_debug_rnglist_section & read_rnglist_index. - Added new testcase, dw5-rnglist-test.{cc,exp} Special note about the new testcase: In order for the test case to test anything meaningful, it must be compiled with clang, not GCC. The way to do this is as follows: $ make check RUNTESTFLAGS="CC_FOR_TARGET=/path/to/clang CXX_FOR_TARGET=/path/to/clang++ dw5-rnglist-test.exp" This following version of clang was used for this testing: clang version 9.0.1-11 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin Change-Id: I3053c5ddc345720b8ed81e23a88fe537ab38748d
2020-07-16[gdb/testsuite] Add pseudo line number program instruction: lineTom de Vries8-99/+100
There's an idiom in dwarf assembly test-cases: ... set line1 [gdb_get_line_number "line 1"] set line2 [gdb_get_line_number "line 2"] set line3 [gdb_get_line_number "line 3"] ... {DW_LNS_advance_line [expr $line1 - 1]} ... {DW_LNS_advance_line [expr $line2 - $line1]} ... {DW_LNS_advance_line [expr $line3 - $line2]} ... Add a pseudo line number program instruction "line", such that we can simply write: ... {line $line1} ... {line $line2} ... {line $line3} ... Build and reg-tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-07-16 Tom de Vries <tdevries@suse.de> * lib/dwarf.exp (program): Initialize _line. (DW_LNE_end_sequence): Reinitialize _line. (DW_LNS_advance_line): Update _line. (line): New proc. * gdb.dwarf2/dw2-inline-many-frames.exp: Use line. * gdb.dwarf2/dw2-inline-small-func.exp: Same. * gdb.dwarf2/dw2-inline-stepping.exp: Same. * gdb.dwarf2/dw2-is-stmt-2.exp: Same. * gdb.dwarf2/dw2-is-stmt.exp: Same. * gdb.dwarf2/dw2-ranges-func.exp: Same.
2020-07-16Automatic date update in version.inGDB Administrator1-1/+1
2020-07-15gdb/testsuite: Update test pattern in ptype-on-functions.expAndrew Burgess2-1/+6
It was pointed out that the recently added test gdb.fortran/ptype-on-functions.exp fails on older versions of gfortran. This is because the ABI for passing string lengths changed from a 4-byte to 8-byte value (on some targets). This change is documented here: https://gcc.gnu.org/gcc-8/changes.html. Character variables longer than HUGE(0) elements are now possible on 64-bit targets. Note that this changes the procedure call ABI for all procedures with character arguments on 64-bit targets, as the type of the hidden character length argument has changed. The hidden character length argument is now of type INTEGER(C_SIZE_T). This commit just relaxes the pattern to accept any size of integer for the string length argument. gdb/testsuite/ChangeLog: * gdb.fortran/ptype-on-functions.exp: Make the result pattern more generic.
2020-07-15x86: Don't display eiz with no scaleH.J. Lu6-14/+28
Change 67 48 8b 1c 25 ef cd ab 89 mov 0x89abcdef(,%eiz,1),%rbx to 67 48 8b 1c 25 ef cd ab 89 mov 0x89abcdef,%rbx in AT&T syntax and 67 48 8b 1c 25 ef cd ab 89 mov rbx,QWORD PTR [eiz*1+0x89abcdef] to 67 48 8b 1c 25 ef cd ab 89 mov rbx,QWORD PTR ds:0x89abcdef in Intel syntax. gas/ PR gas/26237 * testsuite/gas/i386/evex-no-scale-64.d: Updated. * testsuite/gas/i386/addr32.d: Likewise. * testsuite/gas/i386/x86-64-addr32-intel.d: Likewise. * testsuite/gas/i386/x86-64-addr32.d: Likewise. opcodes/ PR gas/26237 * i386-dis.c (OP_E_memory): Don't display eiz with no scale without base nor index registers.
2020-07-15Fix the generation of relocs for missing build notes.Nick Clifton2-9/+24
* write.c (create_note_reloc): Add desc2_size parameter. Zero out the addend field of REL relocations. Store the full addend into the note for REL relocations.
2020-07-15PR26239, memory leak in _bfd_dwarf2_slurp_debug_infoAlan Modra2-4/+15
PR 26239 * coffgen.c (_bfd_coff_close_and_cleanup): Free dwarf2 info.
2020-07-15Fix an illegal memory access in the BFD library which can be triggered by ↵Nick Clifton2-1/+7
attempting to parse a corrupt PE format file. PR26240 * coffgen.c (coff_get_normalized_symtab): Fix off-by-one error in check for aux entries that overflow the buufer.
2020-07-15[gdb/testsuite] Handle callq -> call disassembly changeTom de Vries2-2/+5
We're currently running into: ... FAIL: gdb.trace/entry-values.exp: disassemble bar ... Since commit 36938cabf0 "x86: avoid attaching suffixes to unambiguous insns", "callq" is disassembled as "call", and the test-case expects "callq". Fix this by expecting "call" instead. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-07-15 Tom de Vries <tdevries@suse.de> * gdb.trace/entry-values.exp: Expect "call" instead of "callq" if is_amd64_regs_target.
2020-07-15gdb/fortran: Handle dynamic string types when printing typesAndrew Burgess5-4/+47
After commit: commit 8c2e4e0689ea244d0ed979171a3d09c9176b8175 Date: Sun Jul 12 22:58:51 2020 -0400 gdb: add accessors to struct dynamic_prop An existing bug was exposed in the Fortran type printing code. When GDB is asked to print the type of a function that takes a dynamic string argument GDB will try to read the upper bound of the string. The read of the upper bound is written as: if (type->bounds ()->high.kind () == PROP_UNDEFINED) // Treat the upper bound as unknown. else // Treat the upper bound as known and constant. However, this is not good enough. When printing a function type the dynamic argument types will not have been resolved. As a result the dynamic property is not PROP_UNDEFINED, but nor is it constant. By rewriting this code to specifically check for the PROP_CONST case, and treating all other cases as the upper bound being unknown we avoid incorrectly treating the dynamic property as being constant. gdb/ChangeLog: * f-typeprint.c (f_type_print_base): Allow for dynamic types not being resolved. gdb/testsuite/ChangeLog: * gdb.fortran/ptype-on-functions.exp: Add more tests. * gdb.fortran/ptype-on-functions.f90: Likewise.
2020-07-15x86: move putop() case labels to restore alphabetic sortingJan Beulich2-49/+52
... as far as non-fall-through behavior permits.
2020-07-15x86: make PUSH/POP disassembly uniformJan Beulich2-30/+27
Irrespective of their encoding the resulting output should look the same. Therefore wire the handling of PUSH/POP with GPR operands encoded in the main opcode byte to the same logic used for other operands. This frees up yet another macro character.
2020-07-15x86-64: adjust stack insn test caseJan Beulich5-17/+25
The value chosen for the 16-/32-bit immediate cases didn't work well with the subsequent insn's REX prefix - we ought to pick a value the upper two bytes of which evaluate to a 2-byte insn. Bump the values accordingly, allowing the subsequent insn to actually have the intended REX.W.
2020-07-15x86: avoid attaching suffixes to unambiguous insnsJan Beulich196-1170/+1308
"Unambiguous" is is in particular taking as reference the assembler, which also accepts certain insns - despite them allowing for varying operand size, and hence in principle being ambiguous - without any suffix. For example, from the very beginning of the life of x86-64 I had trouble understanding why a plain and simple RET had to be printed as RETQ. In case someone really used the 16-bit form, RETW disambiguates the two quite fine.
2020-07-15mmix bfd: fix bfd_assert for R_MMIX_PUSHJ_STUBBABLE against undef'd symbolHans-Peter Nilsson7-5/+24
Spotted when inspecting gcc testsuite logs, but this already is covered by the ld-mmix testsuite, it's just that the assert is ignored since the regexp match is for a substring and not anchored. With the anchors added but not the bugfix, the ld.log shows that the asserts cause a non-match as intended: Executing on host: sh -c {./ld-new -LX/src/ld/testsuite/ld-mmix -m elf64mmix -o tmpdir/dump tmpdir/undef-2.o tmpdir/start.o 2>&1} /dev/null dump.tmp (timeout = 300) ./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845 ./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845 ./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845 ./ld-new: tmpdir/undef-2.o:(.text+0x0): undefined reference to `undefd' failed with: <./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845 ./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845 ./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845 ./ld-new: tmpdir/undef-2.o:(.text+0x0): undefined reference to `undefd'>, expected: <\A[^\n\r]*undefined reference to `undefd'\Z> FAIL: ld-mmix/undef-2 Gone with the fix of course, leaving just the intended "undefined reference" like. I'm not going to add anchors manually for all the "error:" strings in the test-suite, not even in the mmix parts. Sorry, but I'll just do it for *these* specific undefined-reference tests. Just a thought: maybe the run_dump_test "error:" string should *automatically* get anchor marks prepended and appended for a single line match as in the patch, "\A[^\n\r]*" prepended and \Z appended unless either anchor mark or \r or \n is present in the regexp? Committed. bfd: * elf64-mmix.c (mmix_elf_relax_section): Improve accounting for R_MMIX_PUSHJ_STUBBABLE relocs against undefined symbols. ld/testsuite: * testsuite/ld-mmix/undef-1.d, testsuite/ld-mmix/undef-1m.d, testsuite/ld-mmix/undef-2.d, testsuite/ld-mmix/undef-2m.d: Add start- and end-anchors to error-string to match just a single-line error-message.
2020-07-14gdb/testsuite/lib/dwarf.exp: fix addr_size parameter commentsSimon Marchi2-3/+8
The comments modified in this patch claim that the addr_size parameters can take the value 32 or 64 (suggesting the value is in bits). In fact, the expected value is in bytes, either 4 or 8. The actual value in the DWARF info is in bytes. And we can see that the default values used (if addr_size == "default") are: if {$_cu_addr_size == "default"} { if {[is_64_target]} { set _cu_addr_size 8 } else { set _cu_addr_size 4 } } gdb/testsuite/ChangeLog: * lib/dwarf.exp (Dwarf::cu, Dwarf::tu, Dwarf::lines): Change valid values in documentation for addr_size to 4 and 8. Change-Id: I4a02dca2bb7992198864e545ef099f020f54ff2f
2020-07-15Automatic date update in version.inGDB Administrator1-1/+1
2020-07-15PR26198 MinGW failure to link regular object file and LTO object fileMarkus Böck3-2/+12
PR 26198 * coffgen.c (_bfd_coff_section_already_linked): Allow for plugin objects both before and after normal object files. * elflink.c (_bfd_elf_section_already_linked): Likewise.
2020-07-14x86-64: Zero-extend lower 32 bits displacement to 64 bitsH.J. Lu10-56/+61
Since the addr32 (0x67) prefix zero-extends the lower 32 bits address to 64 bits, change disassembler to zero-extend the lower 32 bits displacement to 64 bits when there is no base nor index registers. gas/ PR gas/26237 * testsuite/gas/i386/addr32.s: Add tests for 32-bit wrapped around address. * testsuite/gas/i386/x86-64-addr32.s: Likewise. * testsuite/gas/i386/addr32.d: Updated. * testsuite/gas/i386/x86-64-addr32-intel.d: Likewise. * testsuite/gas/i386/x86-64-addr32.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-addr32-intel.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-addr32.d: Likewise. opcodes/ PR gas/26237 * i386-dis.c (OP_E_memory): Without base nor index registers, 32-bit displacement to 64 bits.