aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-07-14Introduce scoped_restore_current_inferior_for_memoryTom Tromey3-22/+35
This introduces a new class, scoped_restore_current_inferior_for_memory, and arranges to use it in a few places. This class is intended to handle setting up and restoring the various globals that are needed to read or write memory -- but without invalidating the frame cache. I wasn't able to test the change to aix-thread.c. Approved-By: Pedro Alves <pedro@palves.net>
2023-07-14Remove obsolete comment from gdbthread.hTom Tromey1-1/+1
A comment in gdbthread.h refers to a global that no longer exists. Approved-By: Pedro Alves <pedro@palves.net>
2023-07-14Rename Python variable in py-inferior.expTom Tromey1-5/+6
py-inferior.exp creates a Python variable named 'str'. This clashes with the built-in type of the same name and can be confusing when trying to evaluate Python code when debugging the test case. This patch renames it. Approved-By: Pedro Alves <pedro@palves.net>
2023-07-14Refactor py-inferior.expTom Tromey1-14/+29
This changes py-inferior.exp to make it a bit more robust when adding new inferiors during the course of the test. Approved-By: Pedro Alves <pedro@palves.net>
2023-07-14Minor cleanups in py-inferior.expTom Tromey1-4/+3
While working on this series, I noticed a some oddities in py-inferior.exp. One is an obviously incorrect comment, and the others are confusing test names. This patch fixes these. Approved-By: Pedro Alves <pedro@palves.net>
2023-07-14Revert "Simplify auto_load_expand_dir_vars and remove substitute_path_component"Tom Tromey5-21/+121
This reverts commit 02601231fdd91a7bd4837ce202906ea2ce661489. This commit was a refactoring to remove an xrealloc and simplify utils.[ch]. However, it has a flaw -- it mishandles a substitution like "$datadir/subdir". I am backing out the patch in the interests of fixing the regression before GDB 14. It can be reinstated (with modifications) later if we like. Regression tested on x86-64 Fedora 36.
2023-07-14Test that native targets can read a tdesc without a process attached.John Baldwin1-0/+27
This ensures that 'unset tdesc filename' does not generate any output on a "bare" native target inferior without an attached process.
2023-07-14Add a have_native_target helper function for use with require.John Baldwin2-17/+15
Move logic from auto-connect-native-target.exp into this helper.
2023-07-14*-linux-nat: Handle null inferior in read_description.John Baldwin7-0/+22
Don't invoke ptrace in the target read_description method if there is not an active inferior to query via ptrace. Instead, use the default register set for the architecture. Previously the native target could report an error from a failed ptrace operation when fetching a tdesc without an attached process. For example on Linux x86-64: (gdb) target native Done. Use the "run" command to start a process. (gdb) unset tdesc filename Couldn't get CS register: No such process.
2023-07-14*-fbsd-nat: Handle null inferior in read_description.John Baldwin4-0/+12
Don't invoke ptrace in the target read_description method if there is not an active inferior to query via ptrace. Instead, use the default register set for the architecture. Previously the native target could report an error from a failed ptrace operation when fetching a tdesc without an attached process. For example on FreeBSD/amd64: (gdb) target native Done. Use the "run" command to start a process. (gdb) unset tdesc filename Couldn't get registers: Operation not permitted.
2023-07-15Re: Let '^' through the lexerTobias Burnus1-1/+1
Fix "make pdf".
2023-07-14gdb/doc: document '+' argument for 'list' commandBruno Larsen2-0/+4
The command 'list' has accepted the argument '+' for many years already, but this option wasn't documented either in the texinfo docs or in the help text for the command. This commit documents it. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Tom Tromey <tom@tromey.com>
2023-07-14gdb/cli: Improve UX when using list with no argsBruno Larsen6-9/+48
When using "list" with no arguments, GDB will first print the lines around where the inferior is stopped, then print the next N lines until reaching the end of file, at which point it warns the user "Line X out of range, file Y only has X-1 lines.". This is usually desirable, but if the user can no longer see the original line, they may have forgotten the current line or that a list command was used at all, making GDB's error message look cryptic. It was reported in bugzilla as PR cli/30497. This commit improves the user experience by changing the behavior of "list" slightly when a user passes no arguments. It now prints that the end of the file has been reached and recommends that the user use the command "list ." instead. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30497 Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Tom Tromey <tom@tromey.com>
2023-07-14gdb/cli: add '.' as an argument for 'list' commandBruno Larsen5-3/+78
Currently, after the user has used the list command once, there is no self-contained way to ask GDB to print the location where the inferior is stopped. The current best options require either using a separate command to scope out where the inferior is stopped, or using "list *$pc" requiring knowledge of GDB standard registers. This commit adds a way to do that using '.' as a new argument for the 'list' command. If the inferior isn't running, the command prints around the main function. Because this necessitated having the inferior running and the test was (seemingly unnecessarily) using printf in a non-essential way and it would make the resulting log harder to read for no benefit, it was replaced by a different statement. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Tom Tromey <tom@tromey.com>
2023-07-14gdb/cli: Factor out code to list lines around a given lineBruno Larsen1-13/+23
A future patch will add more situations that calculates "lines around a certain point" to be printed using print_source_lines, and the logic could be re-used. As a preparation for those commits, this one factors out that part of the logic of the list command into its own function. No functional changes are expected Approved-By: Tom Tromey <tom@tromey.com>
2023-07-13gprofng: 30602 [2.41] gprofng test hangs on i686-linux-gnuVladimir Mezentsev9-58/+44
There were several problems in the gprofng testing: - we did not catch a timeout for each test. - we used exit() to stop a failed test. But this stops all other tests. - we used a time_t (long) type in smalltest.c instead of a long long type. PR gprofng/30602 * configure.ac: Launch only native testing. * configure: Rebuild. * testsuite/config/default.exp: Set TEST_TIMEOUT. * testsuite/gprofng.display/setpath_map.exp: Use return instead of exit. * testsuite/gprofng.display/gp-archive.exp: Likewise. * testsuite/gprofng.display/gp-collect-app_F.exp: Likewise. * testsuite/gprofng.display/display.exp: Delete an unnecessary test for native testing. * testsuite/lib/display-lib.exp (run_native_host_cmd): Add timeout. * testsuite/lib/smalltest.c: Use a long long type instead of time_t.
2023-07-14Make the default gas symbol hash table largerAlan Modra1-1/+1
We may as well start with the symbol table a little larger, saving time resizing. Even a simple C hello world compiled with -O2 -g will exceed 16 symbols (by well over 3 times with gcc-11). * symbols.c (symbol_begin): Create sy_hash with more entries.
2023-07-14Fix loongarch build with gcc-4.5Alan Modra1-1/+1
* loongarch-opc.c (loongarch_alias_opcodes): Don't trigger gcc-4.5 bug in handling of struct initialisation.
2023-07-14More tidies to objcopy archive handlingAlan Modra1-28/+32
This makes sure copy_archive exits with ibfd and obfd closed. Error paths didn't do that, leading to memory leaks. None of this matters very much. * objcopy.c (copy_archive): bfd_close ibfd and obfd on error return paths. Remove braces around "list" free. (copy_file): Don't close invalid file descriptor.
2023-07-14AIX_WEAK_SUPPORTAlan Modra6-17/+26
Making target code depend on a host define like _AIX52 is never correct, so out it goes. Also, sort some config.bfd entries a little to make it more obvious there is a config difference between aix5.1 and aix5.2. These two changes should make no difference to anything in binutils. The gas define of AIX_WEAK_SUPPORT on the other hand was wrong, so fix that. Finally, fix some testsuite fails on aix < 5.2 by simply not running the tests. include/ * coff/internal.h (C_WEAKEXT): Don't depend on _AIX52. bfd/ * coffcode.h (coff_slurp_symbol_table): Don't depend on _AIX52. (coff_classify_symbol): Likewise. * config.bfd: Sort some entries. gas/ * configure.ac (AIX_WEAK_SUPPORT): Don't set for aix5.[01]. * configure: Regenerate. * testsuite/gas/ppc/aix.exp (xcoff-visibility-1*) Don't run for aix < 5.2.
2023-07-14Automatic date update in version.inGDB Administrator1-1/+1
2023-07-13Implement 'Enum_Val and 'Enum_RepTom Tromey6-16/+99
This patch implements the Ada 2022 attributes 'Enum_Val and 'Enum_Rep. Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2023-07-13Remove ada_attribute_nameTom Tromey1-32/+9
ada_attribute_name uses an array that must be kept in sync with an enum -- but the comment here refers to an enum that no longer exists. Looking at the sole caller, I see this can only be called for two opcodes. So, remove this entirely and inline it.
2023-07-13Let '^' through the lexerMichael Matz2-16/+21
so that the (existing) code in parser and expression evaluator actually get to see it and handle it as XOR. Also adjust docu to match what's there.
2023-07-13elf_object_p load of dynamic symbolsAlan Modra1-15/+26
This fixes an uninitialised memory access on a fuzzed file: 0 0xf22e9b in offset_from_vma /src/binutils-gdb/bfd/elf.c:1899:2 1 0xf1e90f in _bfd_elf_get_dynamic_symbols /src/binutils-gdb/bfd/elf.c:2099:13 2 0x10e6a54 in bfd_elf32_object_p /src/binutils-gdb/bfd/elfcode.h:851:9 Hopefully it will also stop any attempt to load dynamic symbols from eu-strip debug files. * elfcode.h (elf_object_p): Do not attempt to load dynamic symbols for a file with no section headers until all the program headers are swapped in. Do not fail on eu-strip debug files.
2023-07-13Automatic date update in version.inGDB Administrator1-1/+1
2023-07-12[gdb/tui] Assume HAVE_WBORDERTom de Vries4-9/+2
The tui border-kind setting allows values acs, ascii and space. The values ascii and space however don't work well with !HAVE_WBORDER. Fix this by removing the !HAVE_WBORDER case, which was introduced for Ultrix support, which is now obsolete. Tested on x86_64-linux. PR tui/30580 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30580 Approved-By: Tom Tromey <tom@tromey.com>
2023-07-12[gdb/tui] Make translate return entry->value instead of entryTom de Vries1-13/+11
The only use of "entry = translate (...)" is entry->value. Simplify using the function by returning entry->value instead. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com>
2023-07-12[gdb/tui] Merge tui border-kind corner translation tablesTom de Vries1-25/+7
The tables: - tui_border_kind_translate_ulcorner - tui_border_kind_translate_urcorner - tui_border_kind_translate_llcorner - tui_border_kind_translate_lrcorner are identical. Merge and rename to tui_border_kind_translate_corner. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com>
2023-07-12[gdb/tui] Introduce translate_acsTom de Vries1-25/+34
In function tui_update_variables we have the somewhat inconvenient: ... entry = translate (tui_border_kind, tui_border_kind_translate_lrcorner); int val = (entry->value < 0) ? ACS_LRCORNER : entry->value; ... Add a new function translate_acs, that allows us to do the more straighforward: ... int val = translate_acs (tui_border_kind, tui_border_kind_translate_lrcorner, ACS_LRCORNER); ... By special-casing "acs" in translate_acs, we can now remove the acs entries from the translation tables. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com>
2023-07-12[gdb/tui] Remove default entries in TUI translation tablesTom de Vries1-21/+10
The TUI translation tables contain default entries at the end: ... static struct tui_translate tui_border_kind_translate_hline[] = { { "space", ' ' }, { "ascii", '-' }, { "acs", -1 }, { 0, 0 }, { "ascii", '-' } }; ... A simpler way of implementing this would be to to declare the first (or last) entry the default, but in fact these default entries are not used. Make this explicit by removing the default entries, and asserting in translate that an entry will always be found. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com>
2023-07-12.noinit and .persistent for msp430Alan Modra1-14/+11
Similar to the previous patch, but also tidy a few more sections. * scripttempl/elf32msp430.sc (.text, .rodata, .data, .bss, .noinit), (.persistent): Align the section rather than aligning inside.
2023-07-12.noinit and .persistent alignmentAlan Modra1-4/+2
It's more elegant to make the section match up with its "_start" symbol. We could align by setting the address of the section (by using ALIGN before the colon), but this way we also set sh_addralign to at least $ALIGNMENT. * scripttempl/elf.sc (.noinit, .persistent): Align the output section rather than using ". = ALIGN();" at the beginning. Set address to zero when not a final link.
2023-07-12Re: Align linkerscript symbols according to ABIAlan Modra1-1/+2
Align dot before symbols defined outside of output sections. Before _end is already aligned. * scripttempl/elf.sc (def_symbol): Tidy excess space. (_edata): Align before emitting symbol when SYMBOL_ABI_ALIGNMENT.
2023-07-12Re: Keeping track of rs6000-coff archive element pointersAlan Modra2-19/+44
bfd/ * coff-rs6000.c (add_range): Revise comment, noting possible fail. (_bfd_xcoff_openr_next_archived_file): Start with clean ranges. binutils/ * bfdtest1.c: Enhance to catch errors on second scan.
2023-07-12Automatic date update in version.inGDB Administrator1-1/+1
2023-07-11Remove some TODOs from gdb.cp testsTom Tromey5-99/+15
This patch removes many TODOs from the gdb.cp tests. Going through the patch: * bs15503.exp - these have been commented out forever and rely on libstdc++ debuginfo. It's better to just remove these. * classes.exp - the test is wrong, I think, according to the C++ ABI that gdb understands; and the test can be fixed and comments removed with a simple change to the code. * ctti.exp - there's no need to bail out any more, as the test works. * exception.exp - the code relying on the line numbers can't work, because gdb never prints that message anyway. Reviewed-By: Bruno Larsen <blarsen@redhat.com>
2023-07-11x86: simplify table-referencing macrosJan Beulich1-17/+15
First of all it is entirely unclear why THREE_BYTE_TABLE_PREFIX() was introduced by bf890a93a7c4. Nothing uses the .prefix_requirement values from the two relevant entries. And then having VEX_Cn_TABLE() and friends take arguments is misleading. These aren't used (or pointlessly used in the case of VEX_C5_TABLE); the respective table index is decoded from the insn (or implied in the case of VEX_C5_TABLE).
2023-07-11x86: convert 0FXOP to just XOP in enumerator namesJan Beulich1-304/+304
There's nothing 0f-ish in XOP encodings.
2023-07-11x86: misc further register-only insns don't need to go through mod_table[]Jan Beulich4-163/+77
Several already use OP_R(), which rejects the memory forms of insns, and a few others can easily be converted to do so as well. Note that for it to be able to use BadOp() without forward declaration, OP_Skip_MODRM() is moved down. While there add the previously missing PREFIX_OPCODE to legacy opcode 0FD7.
2023-07-11x86: various operations on mask registers can avoid going through mod_table[]Jan Beulich8-710/+590
Now that we have OP_R(), use it here as well, while wiring memory-only operands to OP_M() at the same time. To keep the number of consumed opcode bytes similar to before, make BadOp() also account for VEX/XOP/ EVEX prefix bytes. To keep that change simple, convert need_vex to an actual count of prefix bytes (keeping intact all prior boolean uses of the field). Note how this improves disassembly of such bad encodings, by at least leaving a hint towards what a "nearby" instruction is. (For KSHIFT* change the immediates test testcases use, such that disassembly remains sufficiently in sync.) While there also use Ux for VPMOV{B,W,D,Q}2M, where decoding through mod_table[] was missing in the earlier scheme.
2023-07-11x86: slightly rework handling of some register-only insnsJan Beulich2-62/+53
Fold OP_MS() and OP_XS() into OP_R(), paralleling OP_M(). Use operand names (largely) matching those in the SDM. For 128-bit-only forms use Uxmm though, marking 256-bit forms as bad. This then allows no longer going through vex_len_table[] for two of the insns. Specifically _do not_ continue to mis-use v_mode.
2023-07-11x86: SIMD shift-by-immediate don't need to go through mod_table[]Jan Beulich1-54/+18
OP_MS() and OP_XS() reject memory forms of insns quite fine. This then also eliminates mis-named enumerators (we use M_1 for register forms).
2023-07-11x86: misc further memory-only insns don't need to go through mod_table[]Jan Beulich8-319/+128
Several already use OP_M(), which rejects the register forms of insns, and a few others can easily be converted to do so as well. (Note that FXSAVE_Fixup() wires through to OP_M(). Note further that OP_IndirE(), which wasn't placed very well anyway, is moved down to avoid the need to forward-declare BadOp().) Also adjust formatting of and drop PREFIX_OPCODE from a few adjacent entries.
2023-07-11x86: {,V}MOVNT* don't need to go through mod_table[]Jan Beulich3-64/+18
Most of them use Mx already for the memory operand, which rejects the register form of the insn. Use that operand type also for the two EVEX forms which so far have used EXEvexXNoBcst (and thus failed to reject the register forms), compensating by flagging broadcast as bad for all Mx. This way several other insns which don't permit embedded broadcast either are also covered at the same time.
2023-07-11x86: fold legacy/VEX {,V}MOV{H,L}* entriesJan Beulich2-68/+34
By changing decode order to do ModR/M.mod last (rather than VEX.L), the VEX entries (which are already reused by EVEX decoding) can be folded with their legacy counterparts as well. Note how this change of decode order also allows removing two auxiliary #define-s, which were introduced during earlier folding (because of that unhelpful order of steps).
2023-07-11x86: fold certain legacy/VEX table entriesJan Beulich2-305/+109
Introduce macro V to expand to 'v' in the VEX/EVEX case, and replace a couple of abort()s where legacy code can now legitimately make it. While there for {,V}LDDQU drop hoing through mod_table[] - OP_M() rejects register operands quite fine.
2023-07-11ld/PDB: fix off-by-1 in add_globals_ref()Jan Beulich1-1/+1
Copying one too many bytes can corrupt memory, detected/reported by glibc on a 32-bit distro.
2023-07-11Automatic date update in version.inGDB Administrator1-1/+1
2023-07-10Remove target_closeTom Tromey5-37/+19
I noticed that target_close is only called in two places: solib-svr4.c, and target_ops_ref_policy::decref. This patch fixes the former by changing target_bfd_reopen to return a target_ops_up and then fixing the sole caller. Then it removes target_close by inlining its body into the decref method. The advantage of this approach is that targets are now automatically managed. Regression tested on x86-64 Fedora 38. Approved-By: Andrew Burgess <aburgess@redhat.com>