summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* arc: Update ARC specific linker tests.Claudiu Zissulescu2023-04-135-5/+12
| | | | | | | | All the tests are designed for a little-endian ARC system. Thus, update the arc predicate in arc.exp, improve the matching pattern for linker relaxation test, and add linker scripts to nps-1x tests. Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
* arc: Update ARC's CFI tests.Claudiu Zissulescu2023-04-133-11/+16
| | | | | | | | The double store/loads instructions (e.g. STD/LDD) are not baseline ARC ISA. The same holds for some short instructions. Update the tests to use base ARC ISA. Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
* arc: Update GAS testClaudiu Zissulescu2023-04-133-8/+5
| | | | Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
* Preserve a few more bfd fields in check_format_matchesAlan Modra2023-04-131-2/+14
| | | | | | | | | | | | | AOUT and COFF targets set symcount and start_address in their object_p functions. If these are used anywhere then it would pay to save and restore them so that a successful match gets the values expected rather than that for a later unsuccessful target match. * format.c (struct bfd_preserve): Move some fields. Add symcount, read_only and start_address. (bfd_preserve_save): Save.. (bfd_preserve_restore): ..and restore.. (bfd_reinit): ..and zero new fields.
* Re: pe_ILF_object_p and bfd_check_format_matchesAlan Modra2023-04-131-15/+29
| | | | | | | | | | | | | | | | | | The last patch wasn't quite correct. bfd_preserve_restore also needs to handle an in-memory to file backed transition, seen in a testcase ILF object matching both pei-arm-little and pei-arm-wince-little. There the first match is saved in preserve_match, and restored at the end of the bfd_check_format_matches loop making the bfd in-memory. On finding more than one match the function wants to restore the bfd back to its original state with another bfd_preserve_restore call before exiting with a bfd_error_file_ambiguously_recognized error. It is also not correct to restore abfd->iostream unless the iovec changes. abfd->iostream is a FILE* when using cache_iovec, and if the file has been closed and reopened the iostream may have changed. * format.c (io_reinit): New function. (bfd_reinit, bfd_preserve_restore): Use it.
* Automatic date update in version.inGDB Administrator2023-04-131-1/+1
|
* [gdb/tui] Revert workaround in tui_source_window::show_line_numberTom de Vries2023-04-131-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | The m_digits member of tui_source_window is documented as having semantics: ... /* How many digits to use when formatting the line number. This includes the trailing space. */ ... The commit 1b6d4bb2232 ("Redraw both spaces between line numbers and source code") started printing two trailing spaces instead: ... - xsnprintf (text, sizeof (text), "%*d ", m_digits - 1, lineno); + xsnprintf (text, sizeof (text), "%*d ", m_digits - 1, lineno); ... Now that PR30325 is fixed, this no longer has any effect. Fix this by reverting to the original behaviour: print one trailing space char. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com>
* [gdb/tui] Fix left margin in disassembly windowTom de Vries2023-04-132-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With a hello world a.out, and maint set tui-left-margin-verbose on, we have this disassembly window: ... ┌───────────────────────────────────────────────────────────┐ │___ 0x555555555149 <main> endbr64 │ │___ 0x55555555514d <main+4> push %rbp │ │___ 0x55555555514e <main+5> mov %rsp,%rbp │ │B+> 0x555555555151 <main+8> lea 0xeac(%rip),%rax│ │___ 0x555555555158 <main+15> mov %rax,%rdi │ ... Note the space between "B+>" and 0x555555555151. The space shows that a bit of the left margin is not written, which is a problem because that location is showing a character previously written, which happens to be a space, but also may be something else, for instance a '[' as reported in PR tui/30325. The problem is caused by confusion about the meaning of: ... #define TUI_EXECINFO_SIZE 4 ... There's the meaning of defining the size of this zero-terminated char array: ... char element[TUI_EXECINFO_SIZE]; ... which is used to print the "B+>" bit, which is 3 chars wide. And there's the meaning of defining part of the size of the left margin: ... int left_margin () const { return 1 + TUI_EXECINFO_SIZE + extra_margin (); } ... where it represents 4 chars. The discrepancy between the two causes the space between "B+>" and "0x555555555151". Fix this by redefining TUI_EXECINFO_SIZE to 3, and using: ... char element[TUI_EXECINFO_SIZE + 1]; ... such that we have: ... |B+>0x555555555151 <main+8> lea 0xeac(%rip),%rax │ ... This changes the layout of the disassembly window back to what it was before commit 9e820dec13e ("Use a curses pad for source and disassembly windows"), the commit that introduced the PR30325 regression. This also changes the source window from: ... │___000005__{ | ... to: ... │___000005_{ | ... Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30325 Approved-By: Tom Tromey <tom@tromey.com>
* [gdb/tui] Add maint set/show tui-left-margin-verboseTom de Vries2023-04-135-2/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The TUI has two types of windows derived from tui_source_window_base: - tui_source_window (the source window), and - tui_disasm_window (the disassembly window). The two windows share a common concept: the left margin. With a hello world a.out, we can see the source window: ... ┌─/home/vries/hello.c───────────────────────────────────────┐ │ 5 { │ │B+> 6 printf ("hello\n"); │ │ 7 return 0; │ │ 8 } │ │ 9 │ │ ... where the left margin is the part holding "B+>" and the line number, and the disassembly window: ... ┌───────────────────────────────────────────────────────────┐ │ 0x555555555149 <main> endbr64 │ │ 0x55555555514d <main+4> push %rbp │ │ 0x55555555514e <main+5> mov %rsp,%rbp │ │B+> 0x555555555151 <main+8> lea 0xeac(%rip),%rax│ │ 0x555555555158 <main+15> mov %rax,%rdi │ ... where the left margin is just the bit holding "B+>". Because the left margin contains some spaces, it's not clear where it starts and ends, making it harder to observe problems related to it. Add a new maintenance command "maint set tui-left-margin-verbose", that when set to on replaces the spaces in the left margin with either '_' or '0', giving us this for the source window: ... ┌─/home/vries/hello.c───────────────────────────────────────┐ │___000005__{ │ │B+>000006__ printf ("hello\n"); │ │___000007__ return 0; │ │___000008__} │ ... and this for the disassembly window: ... ┌───────────────────────────────────────────────────────────┐ │___ 0x555555555149 <main> endbr64 │ │___ 0x55555555514d <main+4> push %rbp │ │___ 0x55555555514e <main+5> mov %rsp,%rbp │ │B+> 0x555555555151 <main+8> lea 0xeac(%rip),%rax│ │___ 0x555555555158 <main+15> mov %rax,%rdi │ ... Note the space between "B+>" and 0x555555555151. The space shows that a bit of the left margin is not written, a problem reported as PR tui/30325. Specifically, PR tui/30325 is about the fact that the '[' character from the string "[ No Assembly Available ]" ends up in that same spot: ... │B+>[0x555555555151 <main+8> lea 0xeac(%rip),%rax│ ... which only happens for certain window widths. The new command allows us to spot the problem with any window width. Likewise, when we revert the fix from commit 1b6d4bb2232 ("Redraw both spaces between line numbers and source code"), we have: ... ┌─/home/vries/hello.c───────────────────────────────────────┐ │___000005_ { │ │B+>000006_ printf ("hello\n"); │ │___000007_ return 0; │ │___000008_ } │ ... showing a similar problem at the space between '_' and '{'. Tested on x86_64-linux. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Tom Tromey <tom@tromey.com>
* Use SELF_CHECK in all unit testsTom Tromey2023-04-122-40/+40
| | | | | | | | I noticed a few unit tests are using gdb_assert. I think this was an older style, before SELF_CHECK was added. This patch switches them over. Approved-By: Simon Marchi <simon.marchi@efficios.com>
* arc: remove faulty instructionsClaudiu Zissulescu2023-04-122-720/+6
| | | | Clean not implemented ARC instruction from ARC instruction table.
* Use 'require' with gnatmake_version_at_leastTom Tromey2023-04-122-6/+2
| | | | | | | | I found a couple of tests that check gnatmake_version_at_least using "if" where "require" would be a little cleaner. This patch converts these.
* MIPS: make mipsisa32 and mipsisa64 link more systematicYunQiang Su2023-04-121-8/+26
| | | | | | | | | | | | | | | | | | | Introduce `static const struct mips_mach_extension mips_mach_32_64[]` and `mips_mach_extends_32_64 (unsigned long base, unsigned long extension)`, to make mipsisa32 and mipsisa64 interlink more systemtic. Normally, the ISA mipsisa64rN has two subset: mipsisa64r(N-1) and mipsisa32rN. `mips_mach_extensions` can hold only mipsisa64r(N-1), so we need to introduce a new instruction `mips_mach_32_64`, which holds the pair 32vs64. Note: R6 is not compatible with pre-R6. bfd/ChangeLog: * elfxx-mips.c (mips_mach_extends_p): make mipsisa32 and mipsisa64 interlink more systematic. (mips_mach_32_64): new struct added. (mips_mach_extends_32_64): new function added.
* Fix typos in the linker's documentation of the ↵Nick Clifton2023-04-122-3/+8
| | | | --enable-non-contiguous-regions option.
* PR30326, uninitialised value in objdump compare_relocsAlan Modra2023-04-125-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is a fuzzing PR, with a testcase involving a SHF_ALLOC and SHF_COMPRESSED SHT_RELA section, ie. a compressed dynamic reloc section. BFD doesn't handle compressed relocation sections, with most of the code reading relocs using sh_size (often no bfd section is created) but in the case of SHF_ALLOC dynamic relocs we had some code using the bfd section size. This led to a mismatch, sh_size is compressed, size is uncompressed, and from that some uninitialised memory. Consistently using sh_size is enough to fix this PR, but I've also added tests to exclude SHF_COMPRESSED reloc sections from consideration. PR 30362 * elf.c (bfd_section_from_shdr): Exclude reloc sections with SHF_COMPRESSED flag from normal reloc processing. (_bfd_elf_get_dynamic_reloc_upper_bound): Similarly exclude SHF_COMPRESSED sections from consideration. Use sh_size when sizing to match slurp_relocs. (_bfd_elf_canonicalize_dynamic_reloc): Likewise. (_bfd_elf_get_synthetic_symtab): Use NUM_SHDR_ENTRIES to size plt relocs. * elf32-arm.c (elf32_arm_get_synthetic_symtab): Likewise. * elf32-ppc.c (ppc_elf_get_synthetic_symtab): Likewise. * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Likewise. * elfxx-mips.c (_bfd_mips_elf_get_synthetic_symtab): Likewise.
* ubsan: dwarf2.c:2232:7: runtime error: index 16 out of boundsAlan Modra2023-04-121-5/+5
| | | | | | | | Except it isn't out of bounds because space for a larger array has been allocated. * dwarf2.c (struct trie_leaf): Make ranges a C99 flexible array. (alloc_trie_leaf, insert_arange_in_trie): Adjust sizing.
* Fail of x86_64 AMX-COMPLEX insns (Intel disassembly)Alan Modra2023-04-121-0/+1
| | | | | | | x86_64-w64-mingw32 pads sections. * testsuite/gas/i386/x86-64-amx-complex-intel.d: Don't fail due to nop padding.
* pe_ILF_object_p and bfd_check_format_matchesAlan Modra2023-04-125-21/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If pe_ILF_object_p succeeds, pe_ILF_build_a_bfd will have changed the bfd from being file backed to in-memory. This can have unfortunate results for targets checked by bfd_check_format_matches after that point as they will be matching against the created in-memory image rather than the file. bfd_preserve_restore also has a problem if it flips the BFD_IN_MEMORY flag, because the flag affects iostream meaning and should be set if using _bfd_memory_iovec. To fix these problems, save and restore iostream and iovec along with flags, and modify bfd_reinit to make the bfd file backed again. Restoring the iovec and iostream allows the hack in bfd_reinit keeping BFD_IN_MEMORY (part of BFD_FLAGS_SAVED) to be removed. One more detail: If restoring from file backed to in-memory then the bfd needs to be forcibly removed from the cache lru list, since after the bfd becomes in-memory a bfd_close will delete the bfd's memory leaving the lru list pointing into freed memory. * cache.c (bfd_cache_init): Clear BFD_CLOSED_BY_CACHE here.. (bfd_cache_lookup_worker): ..rather than here. (bfd_cache_close): Comment. * format.c (struct bfd_preserve): Add iovec and iostream fields. (bfd_preserve_save): Save them.. (bfd_preserve_restore): ..and restore them, calling bfd_cache_close if the iovec differs. (bfd_reinit): Add preserve param. If the bfd has been flipped to in-memory, reopen the file. Restore flags. * peicode.h (pe_ILF_cleanup): New function. (pe_ILF_object_p): Return it. * bfd.c (BFD_FLAGS_SAVED): Delete. * bfd-in2.h: Regenerate.
* Comment typo fixAlan Modra2023-04-121-1/+1
|
* Automatic date update in version.inGDB Administrator2023-04-121-1/+1
|
* bfd: optimize bfd_elf_hashNathan Sidwell2023-04-111-20/+11
| | | | | | | | | | | | | | | | | | | | | | The bfd_elf_hash loop is taken straight from the sysV document, but it is poorly optimized. This refactoring removes about 5 x86 insns from the 15 insn loop. 1) The if (..) is meaningless -- we're xoring with that value, and of course xor 0 is a nop. On x86 (at least) we actually compute the xor'd value and then cmov. Removing the if test removes the cmov. 2) The 'h ^ g' to clear the top 4 bits is not needed, as those 4 bits will be shifted out in the next iteration. All we need to do is sink a mask of those 4 bits out of the loop. 3) anding with 0xf0 after shifting by 24 bits can allow betterin encoding on RISC ISAs than masking with '0xf0 << 24' before shifting. RISC ISAs often require materializing larger constants. bfd/ * elf.c (bfd_elf_hash): Refactor to optimize loop. (bfd_elf_gnu_hash): Refactor to use 32-bit type.
* gdb, doc: correct argument description for info connections/inferiorsNils-Christian Kempke2023-04-111-6/+13
| | | | | | | | | | | It said for 'info inferiors' and 'info connections' that the argument could be 'a space separated list of inferior numbers' which is correct but incomplete. In fact the arguments can be any space separated combination of numbers and (ascending) ranges. The beginning of the section now describes the ID list as a new keyword. Co-Authored-By: Christina Schimpe <christina.schimpe@intel.com>
* Replace an assertion in the dwarf code with a warning message.Nick Clifton2023-04-112-2/+12
| | | | | PR 30327 * dwarf.c (read_and_display_attr_value): Warn if the number of views is greater than the number of locations.
* Fix an illegal memorty access when running gprof over corrupt data.Nick Clifton2023-04-112-1/+7
| | | | | PR 30324 * symtab.c (symtab_finalize): Only change the end address if dst has been updated.
* Fix an attempt to allocate an excessive amount of memory when parsing a ↵Nick Clifton2023-04-112-0/+17
| | | | | | | corrupt DWARF file. PR 30313 * dwarf.c (display_debug_lines_decoded): Check for an overlarge number of files or directories.
* Fix a potential illegal memory access when displaying corrupt DWARF information.Nick Clifton2023-04-112-10/+18
| | | | | PR 30312 * dwarf.c (prealloc_cu_tu_list): Always allocate at least one entry.
* Fix an attempt to allocate an overlarge amount of memory when decoding a ↵Nick Clifton2023-04-112-6/+27
| | | | | | | corrupt ELF format file. PR 30311 * readelf.c (uncompress_section_contents): Check for a suspiciously large uncompressed size.
* Fix illegal memory access when disassembling corrupt NFP binaries.Nick Clifton2023-04-112-1/+9
| | | | | PR 30310 * nfp-dis.c (init_nfp6000_priv): Check that the output section exists.
* gdb: fix indentation within print_one_breakpoint_locationAndrew Burgess2023-04-111-9/+9
| | | | | | | Spotted some code in print_one_breakpoint_location that was not indented correctly, this commit just changes the indentation. There should be no user visible changes after this commit.
* gdb/testsuite: fix typo gdb_name_name -> gdb_test_nameAndrew Burgess2023-04-111-1/+1
| | | | | Spotted a small typo in gdb_breakpoint proc, we use $gdb_name_name instead of $gdb_test_name in one place. Fixed in this commit.
* gdb: warn when converting h/w watchpoints to s/wAndrew Burgess2023-04-114-14/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On amd64 (at least) if a user sets a watchpoint before the inferior has started then GDB will assume that a hardware watchpoint can be created. When the inferior starts there is a chance that the watchpoint can't actually be create as a hardware watchpoint, in which case (currently) GDB will silently convert the watchpoint to a software watchpoint. Here's an example session: (gdb) p sizeof var $1 = 4000 (gdb) watch var Hardware watchpoint 1: var (gdb) info watchpoints Num Type Disp Enb Address What 1 hw watchpoint keep y var (gdb) starti Starting program: /home/andrew/tmp/watch Program stopped. 0x00007ffff7fd3110 in _start () from /lib64/ld-linux-x86-64.so.2 (gdb) info watchpoints Num Type Disp Enb Address What 1 watchpoint keep y var (gdb) Notice that before the `starti` command the watchpoint is showing as a hardware watchpoint, but afterwards it is showing as a software watchpoint. Additionally, note that we clearly told the user we created a hardware watchpoint: (gdb) watch var Hardware watchpoint 1: var I think this is bad. I used `starti`, but if the user did `start` or even `run` then the inferior is going to be _very_ slow, which will be unexpected -- after all, we clearly told the user that we created a hardware watchpoint, and the manual clearly says that hardware watchpoints are fast (at least compared to s/w watchpoints). In this patch I propose adding a new warning which will be emitted when GDB downgrades a h/w watchpoint to s/w. The session now looks like this: (gdb) p sizeof var $1 = 4000 (gdb) watch var Hardware watchpoint 1: var (gdb) info watchpoints Num Type Disp Enb Address What 1 hw watchpoint keep y var (gdb) starti Starting program: /home/andrew/tmp/watch warning: watchpoint 1 downgraded to software watchpoint Program stopped. 0x00007ffff7fd3110 in _start () from /lib64/ld-linux-x86-64.so.2 (gdb) info watchpoints Num Type Disp Enb Address What 1 watchpoint keep y var (gdb) The important line is: warning: watchpoint 1 downgraded to software watchpoint It's not much, but hopefully it will be enough to indicate to the user that something unexpected has occurred, and hopefully, they will not be surprised when the inferior runs much slower than they expected. I've added an amd64 only test in gdb.arch/, I didn't want to try adding this as a global test as other architectures might be able to support the watchpoint request in h/w. Also the test is skipped for extended-remote boards as there's a different set of options for limiting hardware watchpoints on remote targets, and this test isn't about them. Reviewed-By: Lancelot Six <lancelot.six@amd.com>
* gdb/riscv: Support c.li in prologue unwinderAndrew Burgess2023-04-114-2/+124
| | | | | | | | | | | | | | | | | | | | | | I was seeing some failures in gdb.threads/omp-par-scope.exp when run on a riscv64 target. It turns out the cause of the problem is that I didn't have debug information installed for libgomp.so, which this test makes use of. The test requires GDB to backtrace through a libgomp function, and the riscv prologue unwinder was failing to unwind this particular stack frame. The reason for the failure to unwind was that the function prologue includes a c.li (compressed load immediate) instruction, and the riscv prologue scanning unwinder doesn't know what to do with this instruction, though the unwinder does understand c.lui (compressed load unsigned immediate). This commit adds support for c.li. After this GDB is able to unwind through libgomp, and I no longer see any unexpected failures in gdb.threads/omp-par-scope.exp. I've also included a new test in gdb.arch/ which specifically checks for our c.li support.
* Automatic date update in version.inGDB Administrator2023-04-111-1/+1
|
* gdb/dwarf: Fix MinGW buildThiago Jung Bauermann2023-04-101-1/+1
| | | | | | | | | Unfortunately MinGW doesn't support std::future yet, so this causes the build to fail. Use GDB's version which provides a fallback for this case. Tested for regressions on native aarch64-linux. Approved-By: Tom Tromey <tromey@adacore.com>
* Handle unwinding from SEGV on WindowsTom Tromey2023-04-101-4/+5
| | | | | | | | | | | | | | | | | | | PR win32/30255 points out that a call to a NULL function pointer will leave gdb unable to "bt" on Windows. I tracked this down to the amd64 windows unwinder. If we treat this scenario as if it were a leaf function, unwinding works fine. I'm not completely sure this patch is the best way. I considered having it check for 'pc==0' -- but then I figured this could affect any inaccessible PC, not just the special 0 value. No test case because I can't run dejagnu tests on Windows. I tested this by hand using the test case in the bug. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30255
* x86: Add inval tests for AMX instructionsHaochen Jiang2023-04-107-8/+60
| | | | | | | | | | | | | gas/ChangeLog: * testsuite/gas/i386/i386.exp: Run AMX-FP16 and AMX-COMPLEX inval testcases. * testsuite/gas/i386/x86-64-amx-inval.l: Add AMX-BF16 tests. * testsuite/gas/i386/x86-64-amx-inval.s: Ditto. * testsuite/gas/i386/x86-64-amx-complex-inval.l: New test. * testsuite/gas/i386/x86-64-amx-complex-inval.s: Ditto. * testsuite/gas/i386/x86-64-amx-fp16-inval.l: Ditto. * testsuite/gas/i386/x86-64-amx-fp16-inval.s: Ditto.
* Automatic date update in version.inGDB Administrator2023-04-101-1/+1
|
* Automatic date update in version.inGDB Administrator2023-04-091-1/+1
|
* Fix typos in previous commit of gdb.texinfo.Philippe Blain2023-04-081-4/+5
| | | | * gdb/doc/gdb.texinfo (Requirements): Fix typos.
* libctf, link: fix CU-mapped links with CTF_LINK_EMPTY_CU_MAPPINGSNick Alcock2023-04-081-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a bug in the intersection of two obscure options that cannot even be invoked from ld with a feature added to stop ld of the same input file repeatedly from crashing the linker. The latter fix involved tracking input files (internally to libctf) not just with their input CU name but with a version of their input CU name that was augmented with a numeric prefix if their linker input file name was changed, to prevent distinct CTF dicts with the same cuname from overwriting each other. (We can't use just the linker input file name because one linker input can contain many CU dicts, particularly under ld -r). If these inputs then produced conflicting types, those types were emitted into similarly-named output dicts, so we needed similar machinery to detect clashing output dicts and add a numeric prefix to them as well. This works fine, except that if you used the cu-mapping feature to force double-linking of CTF (so that your CTF can be grouped into output dicts larger than a single translation unit) and then also used CTF_LINK_EMPTY_CU_MAPPINGS to force every possible output dict in the mapping to be created (even if empty), we did the creation of empty dicts first, and then all the actual content got considered to be a clash. So you ended up with a pile of useless empty dicts and then all the content was in full dicts with the same names suffixed with a #0. This seems likely to confuse consumers that use this facility. Fixed by generating all the EMPTY_CU_MAPPINGS empty dicts after linking is complete, not before it runs. No impact on ld, which does not do cu-mapped links or pass CTF_LINK_EMPTY_CU_MAPPINGS to ctf_link(). libctf/ * ctf-link.c (ctf_create_per_cu): Don't create new dicts iff one already exists and we are making one for no input in particular. (ctf_link): Emit empty CTF dicts corresponding to no input in particular only after linkiing is complete.
* libctf: propagate errors from parents correctlyNick Alcock2023-04-085-13/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CTF dicts have per-dict errno values: as with other errno values these are set on error and left unchanged on success. This means that all errors *must* set the CTF errno: if a call leaves it unchanged, the caller is apt to find a previous, lingering error and misinterpret it as the real error. There are many places in libctf where we carry out operations on parent dicts as a result of carrying out other user-requested operations on child dicts (e.g. looking up information on a pointer to a type will look up the type as well: the pointer might well be in a child and the type it's a pointer to in the parent). Those operations on the parent might fail; if they do, the error must be correctly reflected on the child that the user-visible operation was carried out on. In many places this was not happening. So, audit and fix all those places. Add tests for as many of those cases as possible so they don't regress. libctf/ * ctf-create.c (ctf_add_slice): Use the original dict. * ctf-lookup.c (ctf_lookup_variable): Propagate errors. (ctf_lookup_symbol_idx): Likewise. * ctf-types.c (ctf_member_next): Likewise. (ctf_type_resolve_unsliced): Likewise. (ctf_type_aname): Likewise. (ctf_member_info): Likewise. (ctf_type_rvisit): Likewise. (ctf_func_type_info): Set the error on the right dict. (ctf_type_encoding): Use the original dict. * testsuite/libctf-writable/error-propagation.*: New test.
* libctf, tests: do not assume host and target have identical field offsetsNick Alcock2023-04-084-3/+24
| | | | | | | | | | | | | | | | | | | | | | The newly-introduced libctf-lookup unnamed-field-info test checks C compiler-observed field offsets against libctf-computed ones by #including the testcase in the lookup runner as well as generating CTF for it. This only works if the host, on which the lookup runner is compiled and executed, is the same architecture as the target, for which the CTF is generated: when crossing, the trick may fail. So pass down an indication of whether this is a cross into the testsuite, and add a new no_cross flag to .lk files that is used to suppress test execution when a cross-compiler is being tested. libctf/ * Makefile.am (check_DEJAGNU): Pass down TEST_CROSS. * Makefile.in: Regenerated. * testsuite/lib/ctf-lib.exp (run_lookup_test): Use it to implement the new no_cross option. * testsuite/libctf-lookup/unnamed-field-info.lk: Mark as no_cross.
* Automatic date update in version.inGDB Administrator2023-04-081-1/+1
|
* Rewrite Ada symbol cacheTom Tromey2023-04-071-104/+82
| | | | | | | | | | In an experiment I'm trying, I needed Ada symbol cache entries to be allocated with 'new'. This patch reimplements the symbol cache to use the libiberty hash table and to use new and delete. A couple of other minor cleanups are done.
* Add Ada test case for break using a labelTom Tromey2023-04-074-0/+91
| | | | | | | | I noticed there aren't any Ada test cases for setting a breakpoint using a label. This patch adds one, adapted from the AdaCore test suite.
* Use ui_out for "maint info frame-unwinders"Tom Tromey2023-04-071-1/+10
| | | | | | | | This changes "maint info frame-unwinders" to use ui-out. This makes the table slightly nicer. In general I think it's better to use ui-out for tables.
* [gdb/testsuite] Add -q to INTERNAL_GDBFLAGSTom de Vries2023-04-078-97/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever we start gdb in the testsuite, we have the rather verbose: ... $ gdb GNU gdb (GDB) 14.0.50.20230405-git Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word". (gdb) ... This makes gdb.log longer than necessary and harder to read. We do need to test that the output is produced, but that should be limited to one or a few test-cases. Fix this by adding -q to INTERNAL_GDBFLAGS, such that we simply have: ... $ gdb -q (gdb) ... Tested on x86_64-linux.
* [gdb/testsuite] Add missing .note.GNU-stack in ↵Tom de Vries2023-04-072-0/+2
| | | | | | | | | | | | | | | | | | gdb.arch/amd64-disp-step-self-call.exp For test-case gdb.arch/amd64-disp-step-self-call.exp I get: ... gdb compile failed, ld: warning: amd64-disp-step-self-call0.o: \ missing .note.GNU-stack section implies executable stack ld: NOTE: This behaviour is deprecated and will be removed in a future \ version of the linker ... Fix this by adding the missing .note.GNU-stack. Likewise for gdb.arch/i386-disp-step-self-call.exp. Tested on x86_64-linux.
* Support Intel AMX-COMPLEXHaochen Jiang2023-04-0718-4712/+4912
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gas/ChangeLog: * NEWS: Support Intel AMX-COMPLEX. * config/tc-i386.c: Add amx_complex. * doc/c-i386.texi: Document .amx_complex. * testsuite/gas/i386/i386.exp: Run AMX-COMPLEX tests. * testsuite/gas/i386/amx-complex-inval.l: New test. * testsuite/gas/i386/amx-complex-inval.s: Ditto. * testsuite/gas/i386/x86-64-amx-complex-bad.d: Ditto. * testsuite/gas/i386/x86-64-amx-complex-bad.s: Ditto. * testsuite/gas/i386/x86-64-amx-complex-intel.d: Ditto. * testsuite/gas/i386/x86-64-amx-complex.d: Ditto. * testsuite/gas/i386/x86-64-amx-complex.s: Ditto. opcodes/ChangeLog: * i386-dis.c (MOD_VEX_0F386C_X86_64_W_0): New. (PREFIX_VEX_0F386C_X86_64_W_0_M_1_L_0): Ditto. (X86_64_VEX_0F386C): Ditto. (VEX_LEN_0F386C_X86_64_W_0_M_1): Ditto. (VEX_W_0F386C_X86_64): Ditto. (mod_table): Add MOD_VEX_0F386C_X86_64_W_0. (prefix_table): Add PREFIX_VEX_0F386C_X86_64_W_0_M_1_L_0. (x86_64_table): Add X86_64_VEX_0F386C. (vex_len_table): Add VEX_LEN_0F386C_X86_64_W_0_M_1. (vex_w_table): Add VEX_W_0F386C_X86_64. * i386-gen.c (cpu_flag_init): Add CPU_AMX_COMPLEX_FLAGS and CPU_ANY_AMX_COMPLEX_FLAGS. * i386-init.h: Regenerated. * i386-mnem.h: Ditto. * i386-opc.h (CpuAMX_COMPLEX): New. (i386_cpu_flags): Add cpuamx_complex. * i386-opc.tbl: Add AMX-COMPLEX instructions. * i386-tbl.h: Regenerated.
* gdb/testsuite: updates for gdb.arch/{amd64,i386}-disp-step-self-call.expAndrew Burgess2023-04-072-2/+4
| | | | | | | | | | | | | | | | | | | | | This commit: commit cf141dd8ccd36efe833aae3ccdb060b517cc1112 Date: Wed Feb 22 12:15:34 2023 +0000 gdb: fix reg corruption from displaced stepping on amd64 Added two test scripts gdb.arch/amd64-disp-step-self-call.exp and gdb.arch/i386-disp-step-self-call.exp. These scripts contained a test that included a stack address in the test name, this makes it harder to compare results between runs. This commit gives the tests proper names that doesn't include an address. Also in gdb.arch/i386-disp-step-self-call.exp I noticed that we were writing 8-bytes rather than 4 in order to clear the return address entry on the stack. This is also fixed in this commit.