aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-08-29[gdb/testsuite] Require have_compile_flag -mavx512f in gdb.arch/i386-avx512.expTom de Vries1-0/+1
When running test-case gdb.arch/i386-avx512.exp with gcc 4.8.4, I run into: ... Running gdb.arch/i386-avx512.exp ... gdb compile failed, gcc: error: unrecognized command line option '-mavx512f' ... Fix this by requiring have_compile_flag -mavx512f. Tested on x86_64-linux.
2023-08-29[gdb/testsuite] Require gcc >= 5 in gdb.linespec/cpls-abi-tag.expTom de Vries1-0/+8
When running test-case gdb.linespec/cpls-abi-tag.exp with gcc 4.8.4, we run into: ... cpls-abi-tag.cc:71:26: error: ‘abi_tag’ attribute applied to non-function ‘s’ ABI3 test_abi_tag_struct s; ^ ... The test-case is supported starting gcc 5. Fix this by requiring gcc >= 5, if a gcc compiler is used. Tested on x86_64-linux.
2023-08-29[gdb/testsuite] Handle some test-cases with older compilerTom de Vries5-5/+23
When running test-case gdb.mi/print-simple-values.exp with gcc 4.8.4, I run into a compilation failure due to the test-case requiring c++11 and the compiler defaulting to less than that. Fix this by compiling with -std=c++11. Likewise in a few other test-cases. Tested on x86_64-linux.
2023-08-29[gdb/testsuite] Fix false negative in have_host_localeTom de Vries1-0/+2
In test-case gdb.tui/pr30056.exp we check for: ... require {have_host_locale C.UTF-8} ... The "C.UTF-8" is normalized by have_host_locale to "c.utf8", before trying to find it in the list returned by host_locales. On my development platform, "locale -a" lists C.utf8, which is normalized to "c.utf8" by host_locales, so there's a match and have_host_locale returns true. On another platform however, "locale -a" lists C.UTF-8, which is normalized to "c.utf-8" by host_locales, so there's no match and have_host_locale returns false. Fix this by also dropping the dash in host_locales. Tested on x86_64-linux.
2023-08-29readelf: typos in user messagesNicolas Boulenguez1-2/+2
2023-08-29Default getpkt 'forever' parameter to 'false'Tom Tromey1-80/+81
This patch changes remote.c so that the getpkt 'forever' parameter now defaults to 'false' and fixes up all the callers. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-08-29Unify getpkt and getpkt_or_notif_saneTom Tromey1-30/+5
getpkt and getpkt_or_notif_sane are just wrappers for getpkt_or_notif_sane_1. This patch adds the is_notif parameter to getpkt, with a suitable default, and removes the wrappers. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-08-29Use bool in getpktTom Tromey1-102/+102
This changes getpkt and related functions to use bool rather than int. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-08-29Remove expecting_notif parameter from getpkt_or_notif_sane_1Tom Tromey1-11/+12
For getpkt_or_notif_sane_1, expecting_notif is redundant, because it always reflects whether the is_notif parameter is non-NULL. This patch removes the redundant parameter. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-08-29Remove getpkt_saneTom Tromey1-26/+14
I noticed that getpkt is just a wrapper around getpk_sane, so this patch unifies the two of them. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-08-29[gdb/testsuite] Check for sys/random.h in gdb.reverse/getrandom.expTom de Vries2-0/+9
When running test-case gdb.reverse/getrandom.exp on a system with eglibc 2.19, we run into: ... gdb compile failed, gdb.reverse/getrandom.c:18:24: fatal error: \ sys/random.h: No such file or directory #include <sys/random.h> ^ compilation terminated. === gdb Summary === # of untested testcases 1 ... and: ... UNTESTED: gdb.reverse/getrandom.exp: failed to prepare ... Fix this by testing for the presence of the header, such that we have instead: ... UNSUPPORTED: gdb.reverse/getrandom.exp: require failed: \ have_system_header sys/random.h ... Tested on x86_64-linux and i686-linux.
2023-08-29Automatic date update in version.inGDB Administrator1-1/+1
2023-08-28[gdb/testsuite] Improve xfail in gdb.cp/nsusing.expTom de Vries1-4/+16
In test-case gdb.cp/nsusing.exp I came across these xfails without PRMS mentioned: ... XFAIL: gdb.cp/nsusing.exp: print x, before using statement XFAIL: gdb.cp/nsusing.exp: print x, only using M ... Add the missing PRMS, such that we have: ... XFAIL: gdb.cp/nsusing.exp: print x, before using statement (PRMS gcc/108716) XFAIL: gdb.cp/nsusing.exp: print x, only using M (PRMS gcc/108716) ... and limit the xfail to unfixed versions. The PR is fixed starting gcc 13, but it has been backported to release branches stretching back to gcc 10. For simplicity we just stick to testing for the major version and ignore the backported fixes. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com>
2023-08-28gdbserver: Fix style of struct declarations in i387-fp.ccJohn Baldwin1-3/+6
2023-08-28gdbserver: Simplify handling of ZMM registers.John Baldwin1-81/+41
- Reuse num_xmm_registers directly for the count of ZMM0-15 registers as is already done for the YMM registers for AVX rather than using a new variable that is always the same. - Replace 3 identical variables for the count of upper ZMM16-31 registers with a single variable. Make use of this to merge various loops working on the ZMM XSAVE region so that all of the handling for the various sub-registers in this region are always handled in a single loop. - While here, fix some bugs in i387_cache_to_xsave where if X86_XSTATE_ZMM was set on i386 (e.g. a 32-bit process on a 64-bit kernel), the -1 register nums would wrap around and store the value of GPRs in the XSAVE area. This should be harmless, but is definitely odd. Instead, check num_zmm_high_registers directly when checking X86_XSTATE_ZMM and skip the ZMM region handling entirely if the register count is 0. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-08-28x86: Remove X86_XSTATE_SIZE and related constants.John Baldwin1-12/+0
Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-08-28gdbserver: Use x86_xstate_layout to parse the XSAVE extended state area.Aleksandar Paunovic1-51/+74
Replace the extended state area fields of i387_xsave with methods which return an offset into the XSAVE buffer. The two changed functions are called within all tests which runs gdbserver. Signed-off-by: Aleksandar Paunovic <aleksandar.paunovic@intel.com> Co-authored-by: John Baldwin <jhb@FreeBSD.org> Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-08-28gdbserver: Refactor the legacy region within the xsave structAleksandar Paunovic1-25/+2
Legacy fields of the XSAVE area are already defined within fx_save struct. Use class inheritance to remove code duplication. The two changed functions are called within all tests which run gdbserver. Signed-off-by: Aleksandar Paunovic <aleksandar.paunovic@intel.com> Co-authored-by: John Baldwin <jhb@FreeBSD.org> Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-08-28gdbserver: Add a function to set the XSAVE mask and size.John Baldwin4-11/+31
Make x86_xcr0 private to i387-fp.cc and use i387_set_xsave_mask to set the value instead. Add a static global instance of x86_xsave_layout and initialize it in the new function as well to be used in a future commit to parse XSAVE extended state regions. Update the Linux port to use this function rather than setting x86_xcr0 directly. In the case that XML is not supported, don't bother setting x86_xcr0 to the default value but just omit the call to i387_set_xsave_mask as i387-fp.cc defaults to the SSE case used for non-XML. In addition, use x86_xsave_length to determine the size of the XSAVE register set via CPUID. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-08-28gdb: Use x86_xstate_layout to parse the XSAVE extended state area.John Baldwin2-190/+278
All of the tables describing the offsets of individual registers for XSAVE state components now hold relative offsets rather than absolute offsets. Some tables (those for MPX registers and ZMMH registers) had to be split into separate tables as they held entries that spanned multiple state components. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-08-28gdb: Support XSAVE layouts for the current host in the Linux x86 targets.John Baldwin5-5/+22
Note that this uses the CPUID instruction to determine the total size of the XSAVE register set. If there is a way to fetch the register set size using ptrace that would probably be better. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-08-28gdb: Update x86 Linux architectures to support XSAVE layouts.John Baldwin3-43/+61
Refactor i386_linux_core_read_xcr0 to fetch and return a corresponding x86_xsave_layout as well as xcr0 using the size of an existing NT_X86_XSTATE core dump to determine the offsets via i387_guess_xsave_layout. Use this to add an implementation of gdbarch_core_xfer_x86_xsave_layout. Use tdep->xsave_layout.sizeof_xsave as the size of the XSTATE register set. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-08-28gdb: Support XSAVE layouts for the current host in the FreeBSD x86 targets.John Baldwin5-62/+62
Use the CPUID instruction to fetch the offsets of supported state components. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-08-28gdb: Update x86 FreeBSD architectures to support XSAVE layouts.John Baldwin3-36/+64
Refactor i386fbsd_core_read_xcr0 to fetch and return a corresponding x86_xsave_layout as well as xcr0 using the size of an existing NT_X86_XSTATE core dump to determine the offsets via i387_guess_xsave_layout. Use this to add an implementation of gdbarch_core_xfer_x86_xsave_layout. Use tdep->xsave_layout.sizeof_xsave as the size of the XSTATE register set and only fetch/store the register set if this size is non-zero. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-08-28x86 nat: Add helper functions to save the XSAVE layout for the host.John Baldwin2-0/+102
x86_xsave_length returns the total length of the XSAVE state area standard format as queried from CPUID. x86_fetch_xsave_layout uses CPUID to query the offsets of XSAVE extended regions from the running host. The total length of the XSAVE state area can either be supplied by the caller if known (e.g. from FreeBSD's PT_GETXSTATEINFO) or it can be queried from the running host using x86_xsave_length. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-08-28nat/x86-cpuid.h: Add x86_cpuid_count wrapper around __get_cpuid_count.John Baldwin1-0/+32
Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-08-28core: Support fetching x86 XSAVE layout from architectures.John Baldwin7-0/+137
Add gdbarch_core_read_x86_xsave_layout to fetch the x86 XSAVE layout structure from a core file. Current OS's do not export the offsets of XSAVE state components in core dumps, so provide an i387_guess_xsave_layout helper function to set offsets based on known combinations of XCR0 masks and total state sizes. Eventually when core dumps do contain this information this function should only be used as a fall back for older core dumps. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-08-28gdb: Store an x86_xsave_layout in i386_gdbarch_tdep.John Baldwin6-3/+79
This structure is fetched from the current target in i386_gdbarch_init via a new "fetch_x86_xsave_layout" target method. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-08-28x86: Add an x86_xsave_layout structure to handle variable XSAVE layouts.John Baldwin1-9/+56
The standard layout of the XSAVE extended state area consists of three regions. The first 512 bytes (legacy region) match the layout of the FXSAVE instruction including floating point registers, MMX registers, and SSE registers. The next 64 bytes (XSAVE header) contains a header with a fixed layout. The final region (extended region) contains zero or more optional state components. Examples of these include the upper 128 bits of YMM registers for AVX. These optional state components generally have an architecturally-fixed size, but they are not assigned architectural offsets in the extended region. Instead, processors provide additional CPUID leafs describing the size and offset of each component in the "standard" layout for a given CPU. (There is also a "compact" format which uses an alternate layout, but existing OS's currently export the "standard" layout when exporting XSAVE data via ptrace() and core dumps.) To date, GDB has assumed the layout used on current Intel processors for state components in the extended region and hardcoded those offsets in the tables in i387-tdep.c and i387-fp.cc. However, this fails on recent AMD processors which use a different layout. Specifically, AMD Zen3 and later processors do not leave space for the MPX register set in between the AVX and AVX512 register sets. To rectify this, add an x86_xsave_layout structure which contains the total size of the XSAVE extended state area as well as the offset of each known optional state component. Subsequent commits will modify XSAVE parsing in both gdb and gdbserver to use x86_xsave_layout. Co-authored-by: Aleksandar Paunovic <aleksandar.paunovic@intel.com> Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-08-28Use sect_offset_str in cooked_index::dumpTom Tromey1-2/+1
Mark Wielaard pointed out that cooked_index::dump uses PRIx64, and Andreas Schwab pointed out that gdb already has sect_offset_str. This patch applies both these observations.
2023-08-28Use hex_string in gdb/coffread.c instead of PRIxPTRMark Wielaard1-2/+2
The getsymname function uses PRIxPTR to print and uintptr_t value in an error message. Use hex_string instead. Approved-By: Tom Tromey <tom@tromey.com>
2023-08-28[gdb/symtab] Handle self-reference in inherit_abstract_diesTom de Vries2-1/+22
Building gdb with gcc 7.5.0 and -flto -O2 -flto-partition=one generates a self-referencing DIE: ... <2><91dace>: Abbrev Number: 405 (DW_TAG_label) <91dad0> DW_AT_abstract_origin: <0x91dace> ... When encountering the self-reference DIE in inherit_abstract_dies we loop following the abstract origin, effectively hanging gdb. Fix this by handling self-referencing DIEs in the loop in inherit_abstract_dies. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com> PR symtab/30799 https://sourceware.org/bugzilla/show_bug.cgi?id=30799
2023-08-28COFF swap_aux_inAlan Modra3-101/+77
A low level function like coff_swap_aux_in really has no business concatenating multiple auxents for the old PE multi-aux scheme of handling long file names. In doing so, it assumes multiple internal auxent buffers are available, which they are not in most calls to bfd_coff_swap_aux_in, both inside BFD and outside, eg. GDB. Buffer overflow fun. Concatenating multiple auxents belongs at a higher level. This required some changes to coff_get_normalized_symtab, which now uses the external auxents to access the concatenated file name. (Internal auxents are larger than the x_fname array, so the pieces of the file name are not adjacent as they are in the external auxents.) * coffswap.h (coff_swap_aux_in): Do not write more than one internal auxent. * coffcode.h (coff_bigobj_swap_aux_in): Likewise. * coffgen.c (coff_get_normalized_symtab): Normalize strings after swapping in each symbol so that external auxents are available. Use external auxents for multi-aux long file names. Formatting. Wrap long lines. Remove excess parens and unnecessary casts. Don't zalloc when only the string terminator needs zeroing, and memcpy rather than strncpy. Delete unnecessary sanity check with unsigned _n_offset. Return with failure if debug section can't be read, to avoid trying to read it multiple times. Correct sanity check against debug section size.
2023-08-28Re: comdat_hash memory leaksAlan Modra1-1/+2
I missed another field that needs freeing. Also, oss-fuzz found a case with a C_FILE sym using multiple auxents for a long file name which overflowed the single auxent buffer. I'm going to fix that problem in swap_aux_in too, but we may as well avoid it here too, saving unnecessary work. * coffcode.h (comdat_delf): Free comdat_name. (fill_comdat_hash): Only look at symbols with one auxent.
2023-08-28[gdb/testsuite] Add xfail in gdb.cp/subtypes.expTom de Vries1-2/+26
When running test-case gdb.cp/subtypes.exp with gcc 4.8.4, we run into: ... FAIL: gdb.cp/subtypes.exp: ptype main::Foo FAIL: gdb.cp/subtypes.exp: ptype main::Bar FAIL: gdb.cp/subtypes.exp: ptype main::Baz FAIL: gdb.cp/subtypes.exp: ptype foobar<int>::Foo FAIL: gdb.cp/subtypes.exp: ptype foobar<int>::Bar FAIL: gdb.cp/subtypes.exp: ptype foobar<int>::Baz FAIL: gdb.cp/subtypes.exp: ptype foobar<char>::Foo FAIL: gdb.cp/subtypes.exp: ptype foobar<char>::Bar FAIL: gdb.cp/subtypes.exp: ptype foobar<char>::Baz ... The problem is gcc PR debug/55541, which generates a superfluous DW_TAG_lexical_block. Add a corresponding xfail. Tested on x86_64-linux.
2023-08-28[gdb/testsuite] Refactor gdb.cp/subtypes.expTom de Vries1-18/+22
Make test-case gdb.cp/subtypes.exp less repetitive by using foreach. Tested on x86_64-linux.
2023-08-28[gdb/testsuite] Handle gdb.cp/*.exp with older compilerTom de Vries8-9/+65
When running test-cases gdb.cp/*.exp with gcc 4.8.4, I run into compilation failures due to the test-cases requiring c++11 and the compiler defaulting to less than that. Fix this by compiling with -std=c++11. This exposes two FAILs in gdb/testsuite/gdb.cp/empty-enum.exp due to gcc PR debug/16063, so xfail those. Also require have_compile_flag -std=c++17 in gdb.cp/constexpr-field.exp to prevent compilation failure. Tested on x86_64-linux.
2023-08-27MIPS: Use 64-bit a ABI by default for `mipsisa64*-*-linux*' targetsYunQiang Su5-16/+18
Following the arrangement in GCC select a 64-bit ABI by default, either n32 or n64, rather than o32 for `mipsisa64*-*-linux*' targets, just as with the corresponding `mips64*-*-linux*' targets.
2023-08-27Gold/MIPS: Add mips64*/mips64*el triple supportYunQiang Su1-0/+16
Use targ_size=64 and targ_extra_size=32
2023-08-27Gold/MIPS: Add targ_extra_size=64 for mips32 triplesYunQiang Su1-0/+2
So we can enable 64bit ELF support for MIPS32 toolchain.
2023-08-27Gold/MIPS: Drop mips*le/mips*el* triple patternYunQiang Su1-1/+1
Only mips*el triples are supported by binutils. The mips*le or mips*el* may cause some problem with other components of binutils, since they will consider them as big endian.
2023-08-27Gold/MIPS: Use EM_MIPS instead of EM_MIPS_RS3_LE for little endianYunQiang Su1-1/+1
EM_MIPS_RS3_LE has been deprecated quite long ago, and in fact most of current LE ELF files are using EM_MIPS. This problem didn't make some trouble for us, is due to that gold is a linker, and all of the inputs to it has right EM values.
2023-08-27Gold: Add targ_extra_little_endian to configure.acYunQiang Su3-1/+17
This option will be used by architectures which is big endian by default, while little-endian support is also needed. Mips(eb) ports are the examples.
2023-08-28Automatic date update in version.inGDB Administrator1-1/+1
2023-08-27PE dos_messageAlan Modra7-35/+22
I was looking at dos_message and wondering why we have H_PUT_32 in _bfd_XXi_only_swap_filehdr_out but no H_GET_32 in pe_bfd_object_p. On a big-endian machine this would result in scrambling the code and strings constained in dos_message. Rather than fix the lack of H_GET_32 in pe_bfd_object_p, I decided it doesn't make sense to store dos_message internally as an array of ints. include/ * coff/internal.h (struct internal_extra_pe_filehdr): Make dos_message a char array. * coff/msdos.h (struct external_DOS_hdr): Flatten dos_message. * coff/pe.h (struct external_PEI_filehdr): Likewise. bfd/ * libcoff-in.h (struct pe_tdata): Make dos_message a char array. * libcoff.h: Regenerate. * peXXigen.c (_bfd_XXi_only_swap_filehdr_out): memcpy dos_message to output. * peicode.h (pe_mkobject): Don't memset already zeroed pe_opthdr. Tidy allocation of tdata.pe_obj_data. Set up dos_message from.. (default_dos_message): ..this. New static array.
2023-08-27comdat_hash memory leaksAlan Modra2-17/+31
Entries added to the hash table with bfd_malloc ought to be freed when the hash table is deleted. This patch adds the necessary del_f to the htab_create call, and delays creating the table until an IMAGE_SCN_LNK_COMDAT symbol is read. * peicode.h (pe_mkobject): Move comdat_hash creation.. (htab_hash_flags, htab_eq_flags): ..and these support functions.. * coffcode.h (handle_COMDAT): ..to here, renaming support to (comdat_hashf, comdat_eqf): ..this and adding.. (comdat_delf): ..this new function.
2023-08-27Confusion in coff_object_cleanupAlan Modra2-11/+10
A bfd_cleanup function needs to run when only tdata is correct for the bfd. The xvec may have changed during bfd_check_format and thus the flavour may be incorrect. The format won't have changed but checking is superfluous. (In contrast to _bfd_free_cached_info or _close_and_cleanup where we do need to check things.) Not getting this correct leaked comdat_hash. Also, pe_ILF_cleanup ought to call coff_object_cleanup as do all PE files. * coffgen.c (coff_object_cleanup): Don't check bfd flavour or format. * peicode.h (pe_ILF_cleanup): Call coff_object_cleanup.
2023-08-27sanity check n_numauxAlan Modra1-90/+70
Sanity check aux entries used by PE to extend a C_FILE name. See coffswap.h:coff_swap_aux_in. The existing check only catered for n_numaux == 1. * coffcode.h (fill_comdat_hash): Properly sanity check n_numaux. Formatting. (handle_COMDAT): Formatting.
2023-08-27Re: ld STRINGIFYAlan Modra1-1/+1
Oops there was a reference to the old name. * emultempl/aix.em: Use stringify.sed.
2023-08-27Automatic date update in version.inGDB Administrator1-1/+1