Age | Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
A comment in gdbthread.h refers to a global that no longer exists.
Approved-By: Pedro Alves <pedro@palves.net>
|
|
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>
|
|
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>
|
|
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>
|
|
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.
|
|
This ensures that 'unset tdesc filename' does not generate any output
on a "bare" native target inferior without an attached process.
|
|
Move logic from auto-connect-native-target.exp into this helper.
|
|
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.
|
|
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.
|
|
Fix "make pdf".
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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.
|
|
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.
|
|
* loongarch-opc.c (loongarch_alias_opcodes): Don't trigger
gcc-4.5 bug in handling of struct initialisation.
|
|
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.
|
|
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.
|
|
|
|
This patch implements the Ada 2022 attributes 'Enum_Val and 'Enum_Rep.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
|
|
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.
|
|
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.
|
|
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.
|
|
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
|
|
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>
|
|
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).
|
|
There's nothing 0f-ish in XOP encodings.
|
|
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.
|
|
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.
|
|
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.
|
|
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).
|
|
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.
|
|
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.
|
|
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).
|
|
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.
|
|
Copying one too many bytes can corrupt memory, detected/reported by
glibc on a 32-bit distro.
|
|
|
|
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>
|