aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-09-08sim: ppc: align format string settings with common codeMike Frysinger3-1/+13
This copies logic used in the common sim warning configure code to fix build errors for mingw targets. Turning format warnings on triggers a failure in the debug.c file, so apply a minor fix at the same time.
2021-09-08sim: ppc: drop unnecessary config includesMike Frysinger1-4/+0
This file is compiled for the --host & --build system which leads to including the configure generated config.h in both environments. This obviously doesn't work when the two targets don't look alike at all and can cause build failures here (e.g. a mingw host & a linux build). Since we don't actually need any config settings in this very simple file, drop the includes entirely.
2021-09-09Automatic date update in version.inGDB Administrator1-1/+1
2021-09-08gnulib: import various network functionsMike Frysinger13-1043/+1711
Some sim ports use these to provide networking functionality via the dv-sockser module or via direct emulation for a few ports. Gdb seems to build just fine still too.
2021-09-08Fix unit test build on WindowsTom Tromey1-1/+2
Like Tom de Vries' earlier patch to fix the no-CXX_STD_THREAD case in maint.c, this patch fixes a similar problem in parallel-for-selftests.c. This fixes a build failure on Windows.
2021-09-08PowerPC64, sanity check r_offset in relocate_sectionAlan Modra1-49/+119
This hardens the powerpc64 linker code transformations. * elf64-ppc.c (is_8byte_reloc, offset_in_range): New functions. (ppc64_elf_relocate_section): Sanity check r_offset before accessing section contents for various code transformations.
2021-09-08PowerPC64: Avoid useless work on R_PPC64_TPREL34Alan Modra1-1/+3
_bfd_elf_ppc_at_tprel_transform doesn't handle prefix instructions, and I'm not inclined to implement code editing for them. * elf64-ppc.c (ppc64_elf_relocate_section): Don't attempt tprel transform for R_PPC64_TPREL34.
2021-09-08gdb: make thread_suspend_state::stop_pc optionalAndrew Burgess4-8/+31
Currently the stop_pc field of thread_suspect_state is a CORE_ADDR and when we want to indicate that there is no stop_pc available we set this field back to a special value. There are actually two special values used, in post_create_inferior the stop_pc is set to 0. This is a little unfortunate, there are plenty of embedded targets where 0 is a valid pc value. The more common special value for stop_pc though, is set in thread_info::set_executing, where the value (~(CORE_ADDR) 0) is used. This commit changes things so that the stop_pc is instead a gdb::optional. We can now explicitly reset the field to an uninitialised state, we also have asserts that we don't read the stop_pc when its in an uninitialised state (both in gdbsupport/gdb_optional.h, when compiling with _GLIBCXX_DEBUG defined, and in thread_info::stop_pc). One situation where a thread will not have a stop_pc value is when the thread is stopped as a consequence of GDB being in all stop mode, and some other thread stopped at an interesting event. When GDB brings all the other threads to a stop those other threads will not have a stop_pc set (thus avoiding an unnecessary read of the pc register). Previously, when GDB passed through handle_one (in infrun.c) the threads executing flag was set to false and the stop_pc field was left unchanged, i.e. it would (previous) have been left as ~0. Now, handle_one leaves the stop_pc with no value. This caused a problem when we later try to set these threads running again, in proceed() we compare the current pc with the cached stop_pc. If the thread was stopped via handle_one then the stop_pc would have been left as ~0, and the compare (in proceed) would (likely) fail. Now however, this compare tries to read the stop_pc when it has no value and this would trigger an assert. To resolve this I've added thread_info::stop_pc_p() which returns true if the thread has a cached stop_pc. We should only ever call thread_info::stop_pc() if we know that there is a cached stop_pc, however, this doesn't mean that every call to thread_info::stop_pc() needs to be guarded with a call to thread_info::stop_pc_p(), in most cases we know that the thread we are looking at stopped due to some interesting event in that thread, and so, we know that the stop_pc is valid. After running the testsuite I've seen no other situations where stop_pc is read uninitialised. There should be no user visible changes after this commit.
2021-09-08[gdb/build] Fix build with undefined CXX_STD_THREADTom de Vries1-7/+16
When building gdb on openSUSE Leap 42.3, we trigger the case that CXX_STD_THREAD is undefined, and run into: ... gdb/maint.c: In function 'void maintenance_show_worker_threads \ (ui_file*, int, cmd_list_element*, const char*)': gdb/maint.c:877:14: error: 'gdb::thread_pool' has not been declared gdb::thread_pool::g_thread_pool->thread_count ()); ^ Makefile:1647: recipe for target 'maint.o' failed make[1]: *** [maint.o] Error 1 ... Fix this by handling the undefined CXX_STD_THREAD case in maintenance_show_worker_threads, such that we get: ... $ gdb -q -batch -ex "maint show worker-thread" The number of worker threads GDB can use is 0. ... Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28312
2021-09-08sim: update configure target listMike Frysinger2-26/+29
Fix sorting of the list, and update the globs to match the list used in gdb's configure script.
2021-09-07gdb: cris: enable sim integrationMike Frysinger1-0/+1
The sim side is already ready to go for cris, so wire it up.
2021-09-07gdb: aarch64: enable sim integrationMike Frysinger1-0/+1
The sim side is already ready to go for aarch64, so wire it up.
2021-09-07gdb: sim: consolidate configure settingsMike Frysinger1-40/+35
Moving all the sim settings to one section makes it easier to track, and makes it easier to keep it aligned with the sim target tests. The gdb logic was duplicating this when handling different OS targets instead of having a single cpu check. Now it's more obvious that the sim is tied to a cpu and not related to the OS.
2021-09-08Automatic date update in version.inGDB Administrator1-1/+1
2021-09-07Remove unused declaration from gdbserver/win32-low.hTom Tromey1-3/+0
I noticed that gdbserver/win32-low.h has an unused declaration. This code was changed a while ago, but this declaration slipped through. This patch removes it. Tested by rebuilding.
2021-09-07gdb: make use of std::string in utils.cAndrew Burgess1-29/+25
Replace some of the manual string management (malloc/free) with std::string when creating commands in utils.c. Things are a little bit messy as, creating the prefix commands (using add_basic_prefix_cmd and add_show_prefix_cmd), doesn't copy the doc string, while creating the actual set/show commands (using add_setshow_enum_cmd) does copy the doc string. As a result, I have retained the use of xstrprintf when creating the prefix command doc strings, but switched to using std::string when creating the actual set/show commands. There should be no user visible changes after this commit.
2021-09-07Revert: [AArch64] MTE corefile supportLuis Machado6-27/+26
bfd * elf.c (elfcore_make_memtag_note_section): New function. (elfcore_grok_note): Handle NT_MEMTAG note types. binutils* readelf.c (get_note_type): Handle NT_MEMTAG note types. include * elf/common.h (NT_MEMTAG): New constant. (NT_MEMTAG_TYPE_AARCH_MTE): New constant.
2021-09-07gdb: use bool instead of int in struct internal_problemAndrew Burgess1-8/+21
Change struct internal_problem (gdb/utils.c) to use bool instead of int, update the 3 static instances of this structure that we create to use true/false instead of 1/0. I've also updated the comments on struct internal_problem as the existing comment doesn't seem to be referring to the structure, it talks about returning something, which doesn't make sense in this context. There should be no user visible changes after this commit.
2021-09-07gdb: make thread_info::executing privateAndrew Burgess11-48/+55
Rename thread_info::executing to thread_info::m_executing, and make it private. Add a new get/set member functions, and convert GDB to make use of these. The only real change of interest in this patch is in thread.c where I have deleted the helper function set_executing_thread, and now just use the new set function thread_info::set_executing. However, the old helper function set_executing_thread included some code to reset the thread's stop_pc, so I moved this code into the new function thread_info::set_executing. However, I don't believe there is anywhere that this results in a change of behaviour, previously the executing flag was always set true through a call to set_executing_thread anyway.
2021-09-07Fix an illegal memory access triggered by an atempt to disassemble a corrupt ↵Nick Clifton3-1/+6
xtensa binary. PR 28305 * elf32-xtensa.c (elf_xtensa_do_reloc): Add check for put of range reloc.
2021-09-07gdb/python: new function to add values into GDB's historyAndrew Burgess6-0/+77
The guile API has (history-append! <value>) to add values into GDB's history list. There is currently no equivalent in the Python API. This commit adds gdb.add_history(<value>) to the Python API, this function takes <value> a gdb.Value (or anything that can be passed to the constructor of gdb.Value), and adds the value it represents to GDB's history list. The index of the newly added value is returned.
2021-09-07Fix illegal memory access triggered by an attempt to disassemble a corrupt ↵Nick Clifton2-0/+13
RISC-V binary. PR 28303 * elfxx-riscv.c (riscv_elf_add_sub_reloc): Add check for out of range relocs.
2021-09-07[gdb/testsuite] Handle internal-error in gdb_unloadTom de Vries1-0/+5
When reverting commit 5a20fadc841 and using gdb_unload instead of runto "bar" to trigger the internal-error in test-case gdb.dwarf2/locexpr-data-member-location.exp, we run into: ... ERROR: couldn't unload file in $gdb (timeout). ... and the test-case takes about 1 minute. Fix this by handling internal-error in gdb_unload, such that we have: ... ERROR: Couldn't unload file in $gdb (GDB internal error). ERROR: Could not resync from internal error (eof) ... within 2 seconds. Tested on x86_64-linux.
2021-09-07PR28307, segfault in ppc64_elf_toc64_relocAlan Modra2-5/+27
Adds missing bfd_reloc_offset_in_range checks to various relocation special_functions. PR 28307 * elf32-ppc.c (ppc_elf_addr16_ha_reloc): Range check reloc offset. * elf64-ppc.c (ppc64_elf_ha_reloc, ppc64_elf_brtaken_reloc): Likewise. (ppc64_elf_toc64_reloc, ppc64_elf_prefix_reloc): Likewise.
2021-09-07Automatic date update in version.inGDB Administrator1-1/+1
2021-09-07[gdb/testsuite] Handle internal-error in gdb_run_cmdTom de Vries1-0/+3
When reverting commit 5a20fadc841 the test-case gdb.dwarf2/locexpr-data-member-location.exp fails like this: ... FAIL: gdb.dwarf2/locexpr-data-member-location.exp: running to bar in runto \ (GDB internal error) ERROR: Could not resync from internal error (eof) ... and takes 1 minute to run. The long running time is caused by running into a timeout in gdb_run_cmd, at this point: ... (gdb) run ^M The program being debugged has been started already.^M Start it from the beginning? (y or n) y^M /home/vries/gdb_versions/devel/src/gdb/gdbtypes.c:5583: internal-error: \ Unexpected type field location kind: 4^M A problem internal to GDB has been detected,^M further debugging may prove unreliable.^M Quit this debugging session? (y or n) ... Fix this by detecting the internal-error in gdb_run_cmd. We don't handle it in gdb_run_cmd, but stash the gdb output back into the buffer using -notransfer, and let the caller proc runto deal with it. After the fix, the test-case just takes 2 seconds. Tested on x86_64-linux.
2021-09-06gdb: rename gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.cLancelot SIX2-1/+1
A previous commit added the gdb.arch/riscv64-unwind-prologue-with-ld-lw.exp testcase, but one of its associated file was named after a previous version of the test. This commit fixes this and makes sure that all the files linked to this testcase share the same prefix in the name. Tested on riscv64 GNU/Linux.
2021-09-06[gdb/testsuite] Handle eof in gdb_internal_error_resyncTom de Vries1-0/+4
Before commit 5a20fadc841 the test-case gdb.dwarf2/locexpr-data-member-location.exp fails like this: ... FAIL: gdb.dwarf2/locexpr-data-member-location.exp: running to bar in runto \ (GDB internal error) ERROR: : spawn id exp9 not open while executing "expect { -i exp9 -timeout 10 -re "Quit this debugging session\\? \\(y or n\\) $" { send_gdb "n\n" answer incr count } -re "Create ..." ("uplevel" body line 1) invoked from within "uplevel $body" NONE : spawn id exp9 not open ERROR: Could not resync from internal error (timeout) ... Fix the: ... ERROR: : spawn id exp9 not open ... by handling eof in gdb_internal_error_resync, such that we have instead: ... FAIL: gdb.dwarf2/locexpr-data-member-location.exp: running to bar in runto \ (GDB internal error) ERROR: Could not resync from internal error (eof) ... Tested on x86_64-linux.
2021-09-06Remove some complaints.h includesTom Tromey3-3/+0
There are a few includes of complaints.h that aren't necessary. This patch removes them. Tested by rebuilding.
2021-09-06Fix an illegal memory access triggered by disassembling corrupt s390x binaries.Nick Clifton1-1/+3
PR 28304 * elfxx-score7.c (score_elf_gprel15_reloc): If there is no output bfd treat the reloc as undefined.
2021-09-06Fix potential use on an uninitialised vairable in the MCore assembler.Nick Clifton1-3/+6
2021-09-06Fix potential uninitialised variable in microblaze assembler code.Nick Clifton1-1/+1
2021-09-06Add a sanity check to the init_nfp6000_mecsr_sec() function in the NFP ↵Yinjun Zhang1-2/+5
disassembler.
2021-09-06gdbtypes.c: Add the case for FIELD_LOC_KIND_DWARF_BLOCKAlexandra Hájková1-0/+4
The case for FIELD_LOC_KIND_DWARF_BLOCK was missing for switch TYPE_FIELD_LOC_KIND. Thas caused an internal-error under some circumstances. Fixes bug 28030.
2021-09-06Automatic date update in version.inGDB Administrator1-1/+1
2021-09-05Automatic date update in version.inGDB Administrator1-1/+1
2021-09-04[gdb/testsuite] Check avx support in gdb.arch/amd64-disp-step-avx.expTom de Vries4-83/+103
On a machine on Open Build Service I'm running into a SIGILL for test-case gdb.arch/amd64-disp-step-avx.exp: ... Program received signal SIGILL, Illegal instruction.^M test_rip_vex2 () at gdb.arch/amd64-disp-step-avx.S:40^M 40 vmovsd ro_var(%rip),%xmm0^M (gdb) FAIL: gdb.arch/amd64-disp-step-avx.exp: vex2: \ continue to test_rip_vex2_end ... The SIGILL happens when trying to execute the first avx instruction in the executable. I can't directly access the machine, but looking at the log for test-case gdb.arch/i386-avx.exp, it seems that there's no avx support: ... Breakpoint 1, main (argc=1, argv=0x7fffffffd6b8) at gdb.arch/i386-avx.c:68^M 68 if (have_avx ())^M (gdb) print have_avx ()^M $1 = 0^M ... Fix this by: - adding a gdb_caching_proc have_avx, similar to have_mpx, using the have_avx function from gdb.arch/i386-avx.c - using proc have_avx in both gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp and gdb/testsuite/gdb.arch/i386-avx.exp. Tested on my x86_64-linux laptop with avx support, where both test-cases pass. gdb/testsuite/ChangeLog: 2021-09-04 Tom de Vries <tdevries@suse.de> PR testsuite/26950 * gdb/testsuite/gdb.arch/i386-avx.c (main): Remove call to have_avx. (have_avx): Move ... * gdb/testsuite/lib/gdb.exp (have_avx): ... here. New proc. * gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp: Use have_avx. * gdb/testsuite/gdb.arch/i386-avx.exp: Same.
2021-09-04gnulib: import sys_waitMike Frysinger11-6/+340
A few sims use this to emulate process syscalls. Gdb builds seem to still be fine.
2021-09-04Automatic date update in version.inGDB Administrator1-1/+1
2021-09-03Use CORE_ADDR as return type from x86_dr_low_get_addrTom Tromey1-1/+1
On a Windows build locally, watchpoints started failing. I tracked this down to x86_dr_low_get_addr returning an 'unsigned long'... in this particular build, this is a 32-bit type, but the inferior is a 64-bit program. This patch fixes the problem by changing the return type. No other change is required, because this matches the function pointer in struct x86_dr_low_type.
2021-09-03Test case reproducing PR28030 bugKevin Buettner4-0/+454
The original reproducer for PR28030 required use of a specific compiler version - gcc-c++-11.1.1-3.fc34 is mentioned in the PR, though it seems probable that other gcc versions might also be able to reproduce the bug as well. This commit introduces a test case which, using the DWARF assembler, provides a reproducer which is independent of the compiler version. (Well, it'll work with whatever compilers the DWARF assembler works with.) To the best of my knowledge, it's also the first test case which uses the DWARF assembler to provide debug info for a shared object. That being the case, I provided more than the usual commentary which should allow this case to be used as a template when a combo shared library / DWARF assembler test case is required in the future. I provide some details regarding the bug in a comment near the beginning of locexpr-dml.exp. This problem was difficult to reproduce; I found myself constantly referring to the backtrace while trying to figure out what (else) I might be missing while trying to create a reproducer. Below is a partial backtrace which I include for posterity. #0 internal_error ( file=0xc50110 "/ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c", line=5575, fmt=0xc520c0 "Unexpected type field location kind: %d") at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdbsupport/errors.cc:51 #1 0x00000000006ef0c5 in copy_type_recursive (objfile=0x1635930, type=0x274c260, copied_types=0x30bb290) at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c:5575 #2 0x00000000006ef382 in copy_type_recursive (objfile=0x1635930, type=0x274ca10, copied_types=0x30bb290) at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c:5602 #3 0x0000000000a7409a in preserve_one_value (value=0x24269f0, objfile=0x1635930, copied_types=0x30bb290) at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/value.c:2529 #4 0x000000000072012a in gdbscm_preserve_values ( extlang=0xc55720 <extension_language_guile>, objfile=0x1635930, copied_types=0x30bb290) at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/guile/scm-value.c:94 #5 0x00000000006a3f82 in preserve_ext_lang_values (objfile=0x1635930, copied_types=0x30bb290) at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/extension.c:568 #6 0x0000000000a7428d in preserve_values (objfile=0x1635930) at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/value.c:2579 #7 0x000000000082d514 in objfile::~objfile (this=0x1635930, __in_chrg=<optimized out>) at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:549 #8 0x0000000000831cc8 in std::_Sp_counted_ptr<objfile*, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x1654580) at /usr/include/c++/11/bits/shared_ptr_base.h:348 #9 0x00000000004e6617 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x1654580) at /usr/include/c++/11/bits/shared_ptr_base.h:168 #10 0x00000000004e1d2f in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x190bb88, __in_chrg=<optimized out>) at /usr/include/c++/11/bits/shared_ptr_base.h:705 #11 0x000000000082feee in std::__shared_ptr<objfile, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x190bb80, __in_chrg=<optimized out>) at /usr/include/c++/11/bits/shared_ptr_base.h:1154 #12 0x000000000082ff0a in std::shared_ptr<objfile>::~shared_ptr ( this=0x190bb80, __in_chrg=<optimized out>) at /usr/include/c++/11/bits/shared_ptr.h:122 #13 0x000000000085ed7e in __gnu_cxx::new_allocator<std::_List_node<std::shared_ptr<objfile> > >::destroy<std::shared_ptr<objfile> > (this=0x114bc00, __p=0x190bb80) at /usr/include/c++/11/ext/new_allocator.h:168 #14 0x000000000085e88d in std::allocator_traits<std::allocator<std::_List_node<std::shared_ptr<objfile> > > >::destroy<std::shared_ptr<objfile> > (__a=..., __p=0x190bb80) at /usr/include/c++/11/bits/alloc_traits.h:531 #15 0x000000000085e50c in std::__cxx11::list<std::shared_ptr<objfile>, std::allocator<std::shared_ptr<objfile> > >::_M_erase (this=0x114bc00, __position= std::shared_ptr<objfile> (expired, weak count 1) = {get() = 0x1635930}) at /usr/include/c++/11/bits/stl_list.h:1925 #16 0x000000000085df0e in std::__cxx11::list<std::shared_ptr<objfile>, std::allocator<std::shared_ptr<objfile> > >::erase (this=0x114bc00, __position= std::shared_ptr<objfile> (expired, weak count 1) = {get() = 0x1635930}) at /usr/include/c++/11/bits/list.tcc:158 #17 0x000000000085c748 in program_space::remove_objfile (this=0x114bbc0, objfile=0x1635930) at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/progspace.c:210 #18 0x000000000082d3ae in objfile::unlink (this=0x1635930) at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:487 #19 0x000000000082e68c in objfile_purge_solibs () at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:875 #20 0x000000000092dd37 in no_shared_libraries (ignored=0x0, from_tty=1) at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/solib.c:1236 #21 0x00000000009a37fe in target_pre_inferior (from_tty=1) at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/target.c:2496 #22 0x00000000007454d6 in run_command_1 (args=0x0, from_tty=1, run_how=RUN_NORMAL) at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/infcmd.c:437 I'll note a few points regarding this backtrace: Frame #1 is where the internal error occurs. It's caused by an unhandled case for FIELD_LOC_KIND_DWARF_BLOCK. The fix for this bug adds support for this case. Frame #22 - it's a partial backtrace - shows that GDB is attempting to (re)run the program. You can see the exact command sequence that was used for reproducing this problem in the PR (at https://sourceware.org/bugzilla/show_bug.cgi?id=28030), but in a nutshell, after starting the program and advancing to the appropriate source line, GDB was asked to step into libstdc++; a "finish" command was issued, returning a value. The fact that a value was returned is very important. GDB was then used to step back into libstdc++. A breakpoint was set on a source line in the library after which a "run" command was issued. Frame #19 shows a call to objfile_purge_solibs. It's aptly named. Frame #7 is a call to the destructor for one of the objfile solibs; it turned out to be the one for libstdc++. Frames #6 thru #3 show various value preservation frames. If you look at preserve_values() in gdb/value.c, the value history is preserved first, followed by internal variables, followed by values for the extension languages (python and guile).
2021-09-03[gdb/testsuite] Add untested case in gdb.gdb/complaints.expTom de Vries1-0/+20
When building gdb with "-Wall -O2 -g -flto=auto", I run into: ... (gdb) call clear_complaints()^M No symbol "clear_complaints" in current context.^M (gdb) FAIL: gdb.gdb/complaints.exp: clear complaints ... The problem is that lto has optimized away clear_complaints, and consequently the selftests cannot run. Fix this by: - using info function to detect presence of clear_complaints - handling the absence of clear_complaints by calling untested ... (gdb) UNTESTED: gdb.gdb/complaints.exp: \ Cannot find clear_complaints, skipping test ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-09-03 Tom de Vries <tdevries@suse.de> * gdb.gdb/complaints.exp: Use untested if clear_complaints cannot be found.
2021-09-03gdb: Enable finish command and inferior calls for _Float16 on amd64 and i386.Felix Willgerodt4-7/+115
Values of type _Float16 and _Float16 _Complex can now be used on CPUs with AVX512-FP16 support. Return values of those types are located in XMM0. Compiler support for gcc and clang is in progress, see e.g.: https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574117.html gdb/ChangeLog: 2021-07-21 Felix Willgerodt <Felix.Willgerodt@intel.com> * amd64-tdep.c (amd64_classify): Classify _Float16 and _Float16 _Complex as AMD64_SSE. * i386-tdep.c (i386_extract_return_value): Read _Float16 and _Float16 _Complex from xmm0. gdb/testsuite/ChangeLog: 2021-07-21 Felix Willgerodt <Felix.Willgerodt@intel.com> * gdb.arch/x86-avx512fp16-abi.c: New file. * gdb.arch/x86-avx512fp16-abi.exp: New file.
2021-09-03Add half support for AVX512 register view.Felix Willgerodt10-0/+310
This adds support for the half datatype, FP16, to the AVX512 register printing. gdb/ChangeLog: 2020-07-21 Felix Willgerodt <Felix.Willgerodt@intel.com> * i386-tdep.c (i386_zmm_type) <v32_half>: New field. (i386_ymm_type) <v16_half>: New field. (i386_gdbarch_init): Add set_gdbarch_half_format. * features/i386/64bit-avx512.xml: Add half type. * features/i386/64bit-avx512.c: Regenerated. * features/i386/64bit-sse.xml: Add half type. * features/i386/64bit-sse.c: Regenerated. gdb/testsuite/ChangeLog: 2021-07-21 Felix Willgerodt <Felix.Willgerodt@intel.com> * gdb.arch/x86-avx512fp16.c: New file. * gdb.arch/x86-avx512fp16.exp: New file. * lib/gdb.exp (skip_avx512fp16_tests): New function.
2021-09-03gdb, i386: Enable AVX512-bfloat16 for i386 targets.Felix Willgerodt3-6/+13
Values of type bfloat16 can also be used on 32-bit targets, which was missed in the original enablement. This also adjusts the testcase to pass with "unix/-m32", where only the lower 8 AVX registers are available. gdb/ChangeLog: 2021-07-21 Felix Willgerodt <Felix.Willgerodt@intel.com> * features/i386/32bit-sse.xml: Add bfloat16 type. * features/i386/32bit-sse.c: Regenerated. gdb/testsuite/ChangeLog: 2021-07-21 Felix Willgerodt <Felix.Willgerodt@intel.com> * gdb.arch/x86-avx512bf16.exp: Only use x/z/ymm 0-7.
2021-09-03[gdb/testsuite] Add untested case in selftest_setupTom de Vries1-7/+9
When building gdb with "-Wall -O2 -g -flto=auto", I run into: ... FAIL: gdb.gdb/python-helper.exp: breakpoint in captured_main \ (got interactive prompt) FAIL: gdb.gdb/python-helper.exp: run until breakpoint at captured_main WARNING: Couldn't test self ... and similar in gdb.gdb/selftest.exp. The first FAIL in more detail: ... (gdb) break captured_main^M Function "captured_main" not defined.^M Make breakpoint pending on future shared library load? (y or [n]) n^M (gdb) FAIL: gdb.gdb/python-helper.exp: breakpoint in captured_main \ (got interactive prompt) ... The problem is that lto has optimized away the captured_main function and consequently the selftests dependent on that cannot run. Fix this by: - using gdb_breakpoint to detect failure to set the breakpoint - handling the failure to set a breakpoint by calling untested - not emitting the warning if we've already got untested such that we have: ... (gdb) UNTESTED: gdb.gdb/python-helper.exp: Cannot set breakpoint at \ captured_main, skipping testcase. ... gdb/testsuite/ChangeLog: 2021-09-02 Tom de Vries <tdevries@suse.de> * lib/selftest-support.exp: Emit untested when not being able to set breakpoint.
2021-09-03ld testsuite tidyAlan Modra18-115/+95
Fixes a few issues: 1) If you use "-fsanitize=address,undefined" in CFLAGS, the Makefile attempt to trim off -fsanitize options left us with ",undefined". 2) ld_compile adds CFLAGS_FOR_TARGET itself, no need to pass it. 3) CFLAGS might be needed linking bootstrap test. * Makefile.am (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Trim off all -fsanitize=*. * Makefile.in: Regenerate. * testsuite/ld-bootstrap/bootstrap.exp: Use CFLAGS when linking. * testsuite/ld-cdtest/cdtest.exp: Use CFLAGS_FOR_TARGET when linking. * testsuite/ld-auto-import/auto-import.exp: Don't pass CFLAGS_FOR_TARGET to ld_compile. * testsuite/ld-cygwin/exe-export.exp: Likewise. * testsuite/ld-elfvers/vers.exp: Likewise. * testsuite/ld-elfvsb/elfvsb.exp: Likewise. * testsuite/ld-elfweak/elfweak.exp: Likewise. * testsuite/ld-gc/gc.exp: Likewise. * testsuite/ld-pe/pe-compile.exp: Likewise. * testsuite/ld-pe/pe-run.exp: Likewise. * testsuite/ld-pe/pe-run2.exp: Likewise. * testsuite/ld-plugin/plugin.exp: Likewise. * testsuite/ld-shared/shared.exp: Likewise. * testsuite/ld-elfcomm/elfcomm.exp: Likewise, and don't allow nios2 testing to trash CFLAGS_FOR_TARGET. * testsuite/ld-scripts/crossref.exp: Don't pass options in CC_FOR_TARGET, do so in CFLAGS_FOR_TARGET instead. * testsuite/ld-srec/srec.exp: Likewise, and for CXX.
2021-09-03CC_FOR_TARGET et alAlan Modra36-340/+353
The top level Makefile, the ld Makefile and others, define CC_FOR_TARGET to be a compiler for the binutils target machine. This is the compiler that should be used for almost all tests with C source. There are _FOR_TARGET versions of CFLAGS, CXX, and CXXFLAGS too. This was all supposed to work with the testsuite .exp files using CC for the target compiler, and CC_FOR_HOST for the host compiler, with the makefiles passing CC=$CC_FOR_TARGET and CC_FOR_HOST=$CC to the runtest invocation. One exception to the rule of using CC_FOR_TARGET is the native-only ld bootstrap test, which uses the newly built ld to link a copy of itself. Since the files being linked were created with the host compiler, the boostrap test should use CC and CFLAGS, in case some host compiler option provides needed libraries automatically. However, bootstrap.exp used CC where it should have used CC_FOR_HOST. I set about fixing that problem, then decided that playing games in the makefiles with CC was a bad idea. Not only is it confusing, but other dejagnu code knows about CC_FOR_TARGET. See dejagnu/target.exp. So this patch gets rid of the makefile variable renaming and changes all the .exp files to use the correct _FOR_TARGET variables. CC_FOR_HOST and CFLAGS_FOR_HOST disappear. A followup patch will correct bootstrap.exp to use CFLAGS, and a number of other things I noticed. binutils/ * testsuite/lib/binutils-common.exp (run_dump_test): Use CC_FOR_TARGET and CFLAGS_FOR_TARGET rather than CC and CFLAGS. ld/ * Makefile.am (check-DEJAGNU): Don't set CC to CC_FOR_TARGET and similar. Pass variables with unchanged names. Don't set CC_FOR_HOST or CFLAGS_FOR_HOST. * Makefile.in: Regenerate. * testsuite/config/default.exp: Update default CC and similar. (compiler_supports, plug_opt): Use CC_FOR_TARGET. * testsuite/ld-cdtest/cdtest.exp: Replace all uses of CC with CC_FOR_TARGET, and similarly for CFLAGS, CXX and CXXFLAGS. * testsuite/ld-auto-import/auto-import.exp: Likewise. * testsuite/ld-cygwin/exe-export.exp: Likewise. * testsuite/ld-elf/dwarf.exp: Likewise. * testsuite/ld-elf/indirect.exp: Likewise. * testsuite/ld-elf/shared.exp: Likewise. * testsuite/ld-elfcomm/elfcomm.exp: Likewise. * testsuite/ld-elfvers/vers.exp: Likewise. * testsuite/ld-elfvsb/elfvsb.exp: Likewise. * testsuite/ld-elfweak/elfweak.exp: Likewise. * testsuite/ld-gc/gc.exp: Likewise. * testsuite/ld-ifunc/ifunc.exp: Likewise. * testsuite/ld-mn10300/mn10300.exp: Likewise. * testsuite/ld-pe/pe-compile.exp: Likewise. * testsuite/ld-pe/pe-run.exp: Likewise. * testsuite/ld-pe/pe-run2.exp: Likewise. * testsuite/ld-pie/pie.exp: Likewise. * testsuite/ld-plugin/lto.exp: Likewise. * testsuite/ld-plugin/plugin.exp: Likewise. * testsuite/ld-scripts/crossref.exp: Likewise. * testsuite/ld-selective/selective.exp: Likewise. * testsuite/ld-sh/sh.exp: Likewise. * testsuite/ld-shared/shared.exp: Likewise. * testsuite/ld-srec/srec.exp: Likewise. * testsuite/ld-undefined/undefined.exp: Likewise. * testsuite/ld-unique/unique.exp: Likewise. * testsuite/ld-x86-64/tls.exp: Likewise. * testsuite/lib/ld-lib.exp: Likewise. libctf/ * Makefile.am (check-DEJAGNU): Don't set CC to CC_FOR_TARGET. Pass CC and CC_FOR_TARGET. Don't set CC_FOR_HOST. * Makefile.in: Regenerate. * testsuite/config/default.exp: Update default CC and similar. * testsuite/lib/ctf-lib.exp (run_native_host_cmd): Use CC rather than CC_FOR_HOST. (run_lookup_test): Use CC_FOR_TARGET and CFLAGS_FOR_TARGET.
2021-09-03pj: asan: out of bounds, ubsan: left shift of negativeAlan Modra1-3/+4
* pj-dis.c: Include libiberty.h. (print_insn_pj): Don't index op->arg past array bound. Don't left shift negative int.
2021-09-03ubsan: alpha: member access within null pointerAlan Modra1-1/+2
* elf64-alpha.c (elf64_alpha_relax_with_lituse): Avoid UB.