Alan Modra [Wed, 21 Jun 2023 13:14:09 +0000 (22:44 +0930)]
PR30536, ppc64el gold linker produces unusable clang-16 binary
In commit
0961e631575b, the fix for PR30217, make_lplt_section and
make_brlt_section were changed to use rela_dyn_ rather than their own
separate dynamic reloc sections. This fails miserably whenever brlt_
is needed for long branches, due to needing to iterate sizing and thus
reset brlt_ sizes.
PR 30536
PR 30217
* powerpc.cc (Target_powerpc::make_brlt_section): Don't use
rela_dyn_.
Tom de Vries [Wed, 21 Jun 2023 13:31:37 +0000 (15:31 +0200)]
[gdb/testsuite] Reimplement Term::command_no_prompt_prefix
Say we run test-case gdb.tui/basic.exp. It calls Term::enter_tui, which does:
...
command_no_prompt_prefix "tui enable"
...
The proc command_no_prompt_prefix is documented as:
...
# As proc command, but don't wait for an initial prompt. This is used for
# initial terminal commands, where there's no prompt yet.
...
Indeed, before the "tui enable" command, the tuiterm is empty, so there is no
prompt and just before switching to TUI we have in the tuiterm:
...
tui enable
...
The reason that there is no prompt, is that:
- in order for tuiterm to show something, its input processing procs need to
be called, and
- the initial gdb prompt, and subsequent prompts generated by gdb_test-style
procs, are all consumed by those procs instead.
This is in principle not a problem, but the absence of a prompt makes a
tuiterm session look less like a session on an actual xterm.
Add a new proc gen_prompt, that:
- generates a prompt using echo
- consumes the response before the prompt using gdb_expect
- consumes the prompt using Term::wait_for "".
This allows us to reimplement Term::command_no_prompt_prefix using
Term::command, and just before switching to TUI we have in the tuiterm:
...
(gdb) tui enable
...
Tested on x86_64-linux.
Tom de Vries [Wed, 21 Jun 2023 13:31:37 +0000 (15:31 +0200)]
[gdb/testsuite] Make Term::wait_for "" match only a prompt
The semantics of Term::wait_for is:
...
# Accept some output from gdb and update the screen. WAIT_FOR is
# a regexp matching the line to wait for. Return 0 on timeout, 1
# on success.
proc wait_for {wait_for} {
...
Note that besides the regexp, also a subsequent gdb prompt is matched.
I recently used wait_for "" in a few test-cases, thinking that this would
match just a prompt, but in fact that's not the case.
Fix this in wait_for, and add a corresponding test in gdb.tui/tuiterm-2.exp.
Tested on x86_64-linux.
Nick Clifton [Wed, 21 Jun 2023 11:10:03 +0000 (12:10 +0100)]
Prune linker warnings about an executable stack being created with the -z execstack option.
* testsuite/lib/binutils-common.exp (prune_warnings_extra): Prune warnings about -z execstack creating an executable stack.
Nick Clifton [Wed, 21 Jun 2023 10:47:19 +0000 (11:47 +0100)]
For test for PR 29072 when the linker is configured with --enable-default-execstack=no.
PR 29072
* testsuite/ld-elf/elf.exp (target_defaults_to_execstack): Always return false for linkers configured with the --enable-default-execstack=no option.
Tankut Baris Aktemur [Wed, 21 Jun 2023 06:47:01 +0000 (08:47 +0200)]
gdbserver: use target_waitstatus::to_string in 'prepare_resume_reply'
Use the to_string method of target_waitstatus in
'prepare_resume_reply' for a more readable log message.
Approved-By: Tom Tromey <tom@tromey.com>
Jan Beulich [Wed, 21 Jun 2023 06:32:13 +0000 (08:32 +0200)]
x86: fix expansion of %XV
Only %LV should continue on to S handling; avoid emitting a stray 'l'
(typically) in suffix-always mode.
Alan Modra [Wed, 21 Jun 2023 05:03:59 +0000 (14:33 +0930)]
elf32_arm_get_synthetic_symtab memory leak
ARM get_synthetic_symtab reads .plt and caches that data. Caching the
data doesn't make a lot of sense since get_synthetic_symtab is only
called once per bfd, and the memory might be put to better use. It
also leaks on closing the bfd.
* elf32-arm.c (elf32_arm_get_synthetic_symtab): Don't cache
plt contents. Free plt data before returning.
Alan Modra [Tue, 20 Jun 2023 23:51:54 +0000 (09:21 +0930)]
macho-o.c don't leak strtab
* mach-o.c (bfd_mach_o_write_symtab_content): Free strtab on
success path.
GDB Administrator [Wed, 21 Jun 2023 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 20 Jun 2023 17:11:06 +0000 (11:11 -0600)]
Use ARRAY_SIZE in ax-general.c
This changes a couple of spots in ax-general.c to use ARRAY_SIZE.
While making this change, I noticed that one of the bounds checks was
incorrect.
Reviewed-by: John Baldwin <jhb@FreeBSD.org>
Tom Tromey [Tue, 20 Jun 2023 17:09:18 +0000 (11:09 -0600)]
Remove aop_last
aop_last is only used for an assertion. However, due to the '.def'
construct in the sources, this assert could never plausibly trigger
(the assert predates the use of a .def file here). This patch removes
the constant and the assert.
Reviewed-by: John Baldwin <jhb@FreeBSD.org>
Tom Tromey [Mon, 19 Jun 2023 20:44:43 +0000 (14:44 -0600)]
Make aop_map 'static'
This changes aop_map to be 'static'.
Reviewed-by: John Baldwin <jhb@FreeBSD.org>
Tom Tromey [Sat, 17 Jun 2023 18:56:54 +0000 (12:56 -0600)]
Use bool for agent_expr::tracing
This changese agent_expr::tracing to have type bool, allowing inline
initialization and cleaning up the code a little.
Reviewed-by: John Baldwin <jhb@FreeBSD.org>
Tom Tromey [Sat, 17 Jun 2023 18:53:58 +0000 (12:53 -0600)]
Simplify agent_expr constructor
This simplifies the agent_expr constructor a bit, and removes the
destructor entirely.
Reviewed-by: John Baldwin <jhb@FreeBSD.org>
Tom Tromey [Sat, 17 Jun 2023 18:52:11 +0000 (12:52 -0600)]
Use std::vector<bool> for agent_expr::reg_mask
agent_expr::reg_mask implements its own packed boolean vector. This
patch replaces it with a std::vector<bool>, simplifying the code.
Reviewed-by: John Baldwin <jhb@FreeBSD.org>
Tom Tromey [Sat, 17 Jun 2023 18:43:04 +0000 (12:43 -0600)]
Use gdb::byte_vector in agent_expr
This changes agent_expr to use gdb::byte_vector rather than manually
reimplementing a vector.
Reviewed-by: John Baldwin <jhb@FreeBSD.org>
Tom Tromey [Mon, 19 Jun 2023 17:53:10 +0000 (11:53 -0600)]
Remove mem2hex
tracepoint.c has a 'mem2hex' function that is functionally equivalent
to bin2hex. This patch removes the redundancy.
Reviewed-by: John Baldwin <jhb@FreeBSD.org>
H.J. Lu [Tue, 20 Jun 2023 16:32:19 +0000 (09:32 -0700)]
x86: Don't check if AVX512 template requires AVX512VL
If the ZMM operand in an AVX12 template also allows XMM or ZMM, this
template must require AVX512VL. Drop the AVX512VL requirement check
on such AVX512 templates.
* config/tc-i386.c (check_VecOperands): Don't check if AVX512
template requires AVX512VL.
Tom Tromey [Mon, 19 Jun 2023 04:06:05 +0000 (22:06 -0600)]
Use std::string in do_set_command
do_set_command manually updates a string, only to copy it to a
std::string and free the working copy. This patch changes this code
to use std::string for everything, simplifying the code and removing a
copy.
Reviewed-by: John Baldwin <jhb@FreeBSD.org>
Tom Tromey [Sat, 17 Jun 2023 19:36:40 +0000 (13:36 -0600)]
Use byte_vector in remote.c:readahead_cache
This patch changes the remote.c readahead_cache to use
gdb::byte_vector. This simplifies the code by removing manual memory
management.
Reviewed-by: John Baldwin <jhb@FreeBSD.org>
Tom Tromey [Sat, 17 Jun 2023 19:32:09 +0000 (13:32 -0600)]
Use std::string in linux-osdata.c
I found some code in linux-osdata that manually managed a string.
Replacing this with std::string simplifies it.
Reviewed-by: John Baldwin <jhb@FreeBSD.org>
Tom Tromey [Fri, 9 Jun 2023 16:35:20 +0000 (10:35 -0600)]
Use unique_xmalloc_ptr for mi_parse::command
This changes mi_parse::command to be a unique_xmalloc_ptr and fixes up
all the uses. This avoids some manual memory management. std::string
is not used here due to how the Python API works -- this approach
avoids an extra copy there.
Reviewed-by: Keith Seitz <keiths@redhat.com>
Tom Tromey [Fri, 9 Jun 2023 16:27:18 +0000 (10:27 -0600)]
Use std::string for MI token
This changes the MI "token" to be a std::string, removing some manual
memory management. It also makes current_token 'const' in order to
support this change.
Reviewed-by: Keith Seitz <keiths@redhat.com>
Alan Modra [Tue, 20 Jun 2023 00:16:03 +0000 (09:46 +0930)]
Don't segfault in mips reloc special_functions
A symbol defined in a section from a shared library will have a NULL
section->output_section during linking.
* elf32-mips.c (gprel32_with_gp): Don't segfault on NULL
symbol->section->output_section.
* elf64-mips.c (mips_elf64_gprel32_reloc): Likewise.
* elfn32-mips.c (mips_elf_gprel16_reloc): Likewise.
(mips_elf_literal_reloc, mips_elf_gprel32_reloc): Likewise.
(gprel32_with_gp, mips16_gprel_reloc): Likewise.
* elfxx-mips.c (_bfd_mips_elf_gprel16_with_gp): Likewise.
(_bfd_mips_elf_generic_reloc): Likewise.
GDB Administrator [Tue, 20 Jun 2023 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Mon, 19 Jun 2023 17:09:58 +0000 (19:09 +0200)]
Revert "[gdb/testsuite] Clean standard_output_file dir in gdb_init"
This reverts commit
b7b77500dc56e5bc21473dd4f3dde2543d894557.
Simon Farre [Mon, 19 Jun 2023 15:13:05 +0000 (17:13 +0200)]
Fixes
28ab59607ef40b9571c0702ffba8f6aa6fb1b033
Python formatting errors fixed, introduced by this commit.
Simon Farre [Mon, 19 Jun 2023 15:03:32 +0000 (17:03 +0200)]
Fixes
f1a614dc8f015743e9fe7fe5f3f019303f8db718
Fixes failure reported by buildbot regarding ill-formatted Python code.
Simon Farre [Wed, 20 Apr 2022 08:25:47 +0000 (10:25 +0200)]
gdb/Python: Added ThreadExitedEvent
v6:
Fix comments.
Fix copyright
Remove unnecessary test suite stuff. save_var had to stay, as it mutates
some test suite state that otherwise fails.
v5:
Did what Tom Tromey requested in v4; which can be found here: https://pi.simark.ca/gdb-patches/87pmjm0xar.fsf@tromey.com/
v4:
Doc formatting fixed.
v3:
Eli:
Updated docs & NEWS to reflect new changes. Added
a reference from the .ptid attribute of the ThreadExitedEvent
to the ptid attribute of InferiorThread. To do this,
I've added an anchor to that attribute.
Tom:
Tom requested that I should probably just emit the thread object;
I ran into two issues for this, which I could not resolve in this patch;
1 - The Thread Object (the python type) checks it's own validity
by doing a comparison of it's `thread_info* thread` to nullptr. This
means that any access of it's attributes may (probably, since we are
in "async" land) throw Python exceptions because the thread has been
removed from the thread object. Therefore I've decided in v3 of this
patch to just emit most of the same fields that gdb.InferiorThread has, namely
global_num, name, num and ptid (the 3-attribute tuple provided by
gdb.InferiorThread.ptid).
2 - A python user can hold a global reference to an exiting thread. Thus
in order to have a ThreadExit event that can provide attribute access
reliably (both as a global reference, but also inside the thread exit
handler, as we can never guarantee that it's executed _before_ the
thread_info pointer is removed from the gdbpy thread object),
the `thread_info *` thread pointer must not be null. However, this
comes at the cost of gdb.InferiorThread believing it is "valid" - which means,
that if a user holds takes a global reference to that
exiting event thread object, they can some time later do `t.switch()` at which
point GDB will 'explode' so to speak.
v2:
Fixed white space issues and NULL/nullptr stuff,
as requested by Tom Tromey.
v1:
Currently no event is emitted for a thread exit.
This adds this functionality by emitting a new gdb.ThreadExitedEvent.
It currently provides four attributes:
- global_num: The GDB assigned global thread number
- num: the per-inferior thread number
- name: name of the thread or none if not set
- ptid: the PTID of the thread, a 3-attribute tuple, identical to
InferiorThread.ptid attribute
Added info to docs & the NEWS file as well.
Added test to test suite.
Fixed formatting.
Feedback wanted and appreciated.
Simon Farre [Mon, 12 Jun 2023 19:32:46 +0000 (21:32 +0200)]
gdb/dap - Getting thread names
Renamed thread_name according to convention (_ first)
When testing firefox tests, it is apparent that
_get_threads returns threads with name field = None.
I had initially thought that this was due to Firefox setting the names
using /proc/pid/task/tid/comm, by writing directly to the proc fs the
names, but apparently GDB seems to catch this, because I re-wrote
the basic-dap.exp/c to do this specifically and it saw the changes.
So I couldn't determine right now, what operation of name change that
GDB does not pick up, but with this patch, GDB will pick up the thread
names for an applications that set the name of a thread in ways that
aren't obvious.
Nick Clifton [Mon, 19 Jun 2023 11:09:11 +0000 (12:09 +0100)]
Fix illegal memory access implementing relocs in a fuzzed x86_64 object file.
PR 30560
* elf64-x86-64.c (elf_x86_64_relocate_section): Add more checks for a valid relocation offset.
Tom de Vries [Mon, 19 Jun 2023 09:47:29 +0000 (11:47 +0200)]
[gdb/testsuite] Add shared_gnat_runtime_has_debug_info
Test-case gdb.ada/catch_ex_std.exp passes for me with package
libada7-debuginfo installed, but after removing it I get:
...
(gdb) catch exception some_kind_of_error^M
Your Ada runtime appears to be missing some debugging information.^M
Cannot insert Ada exception catchpoint in this configuration.^M
(gdb) FAIL: gdb.ada/catch_ex_std.exp: catch exception some_kind_of_error
...
The test-case contains a require gnat_runtime_has_debug_info to deal with
this, but the problem is that this checks the static gnat runtime, while this
test-case uses the shared one.
Fix this by introducing shared_gnat_runtime_has_debug_info, and requiring that
one instead.
Tested on x86_64-linux.
PR testsuite/30094
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30094
Tom de Vries [Mon, 19 Jun 2023 09:15:56 +0000 (11:15 +0200)]
[gdb/tui] Simplify tui_update_variables
Simplify tui_update_variables by using template function
assign_return_if_changed.
Tested on x86_64-linux.
Tom de Vries [Mon, 19 Jun 2023 09:15:56 +0000 (11:15 +0200)]
[gdb] Add template functions assign_return/set_if_changed
Add template functions assign_return_if_changed and assign_set_if_changed in
gdb/utils.h:
...
template<typename T> void assign_set_if_changed (T &lval, const T &val, bool &changed)
{ ... }
template<typename T> bool assign_return_if_changed (T &lval, const T &val)
{ ... }
...
This allows us to rewrite code like this:
...
if (tui_border_attrs != entry->value)
{
tui_border_attrs = entry->value;
need_redraw = true;
}
...
into this:
...
need_redraw |= assign_return_if_changed<int> (tui_border_attrs, entry->value);
...
or:
...
assign_set_if_changed<int> (tui_border_attrs, entry->value, need_redraw);
...
The names are a composition of the functionality. The functions:
- assign VAL to LVAL, and either
- return true if the assignment changed LVAL, or
- set CHANGED to true if the assignment changed LVAL.
Tested on x86_64-linux.
Andreas Schwab [Tue, 13 Jun 2023 12:49:38 +0000 (14:49 +0200)]
riscv: Use run-time endianess for floating point literals
gas/
PR binutils/30551
* config/tc-riscv.c (md_atof): Use target_big_endian instead of
TARGET_BYTES_BIG_ENDIAN.
* testsuite/gas/riscv/float-be.d: New file.
* testsuite/gas/riscv/float-le.d: New file.
* testsuite/gas/riscv/float.s: New file.
GDB Administrator [Mon, 19 Jun 2023 00:00:12 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Sun, 18 Jun 2023 09:05:31 +0000 (11:05 +0200)]
[gdb/testsuite] Clean standard_output_file dir in gdb_init
In commit
e2adba909e7 ("[gdb/testsuite] Clean up before compilation in
gdb.ada/call-no-debug.exp") I added some code in the test-case to remove some
files at the start of the test-case:
...
remote_file host delete [standard_output_file prog.o]
remote_file host delete [standard_output_file prog.ali]
...
Replace this with cleaning up the entire directory instead, for all
test-cases.
Tested on x86_64-linux.
Suggested-By: Tom Tromey <tom@tromey.com>
Reviewed-By: Tom Tromey <tom@tromey.com>
GDB Administrator [Sun, 18 Jun 2023 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Sat, 17 Jun 2023 10:28:58 +0000 (12:28 +0200)]
[gdb/testsuite] Remove f-string in gdb.python/py-unwind.py
on openSUSE Leap 42.3, with python 3.4, I run into a
"SyntaxError: invalid syntax" due to usage of an f-string in test-case
gdb.python/py-unwind.py.
Fix this by using string concatenation using '+' instead.
Tested on x86_64-linux.
Tom de Vries [Sat, 17 Jun 2023 10:28:58 +0000 (12:28 +0200)]
[gdb/testsuite] Add nopie in a few test-cases
When running test-case gdb.arch/i386-disp-step.exp with target board
unix/-m32/-fPIE/-pie we run into:
...
gdb compile failed, ld: i386-disp-step0.o: warning: relocation in read-only section `.text'
ld: warning: creating DT_TEXTREL in a PIE
...
Fix this by adding nopie in the compilation flags.
Likewise in a few other test-cases.
Tested on x86_64-linux.
Tom de Vries [Sat, 17 Jun 2023 10:28:58 +0000 (12:28 +0200)]
[gdb/testsuite] Use require in gdb.dwarf2/implptr.exp
In test-case gdb.dwarf2/implptr.exp I noticed:
...
} elseif {![is_x86_like_target]} {
# This test can only be run on x86 targets.
unsupported "needs x86-like target"
return 0
}
...
Use instead "require is_x86_like_target".
Tested on x86_64-linux.
GDB Administrator [Sat, 17 Jun 2023 00:00:11 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Fri, 16 Jun 2023 11:32:43 +0000 (13:32 +0200)]
[gdb/testsuite] Clean up before compilation in gdb.ada/call-no-debug.exp
Running test-case gdb.ada/call-no-debug.exp with target board unix/-m64 works
fine, but if we run it again with target board unix-m32, we run into:
...
gnatlink prog.ali -m32 -g -o prog^M
ld: i386:x86-64 architecture of input file `b~prog.o' is incompatible with \
i386 output^M
...
This is due to compiling with no-force.
The test-case:
- first compiles pck.adb into pck.o (without debug info), and
- then compiles prog.adb and pck.o into prog (with debug info).
Using no-force in the second compilation make sure that pck.adb is not
compiled again, with debug info.
But it also means it will pick up intermediate files related to prog.adb from
a previous compilation.
Fix this by removing prog.o and prog.ali before compilation.
Tested on x86_64-linux.
Tom de Vries [Fri, 16 Jun 2023 10:56:32 +0000 (12:56 +0200)]
[gdb/testsuite] Use %progbits in gdb.arch/thumb*.S
In commit
0f2cd53cf4f ("[gdb/testsuite] Handle missing .note.GNU-stack") I
updated a gdb.arch/arm*.S test-case to use %progbits rather than @progbits,
but failed to do so for gdb.arch/thumb*.S. Fix this oversight.
Tested on arm-linux-gnueabihf.
mengqinggang [Tue, 13 Jun 2023 08:07:12 +0000 (16:07 +0800)]
LoongArch: Fix ld "undefined reference" error with --enable-shared
Because _bfd_read_unsigned_leb128 is hidden visibility, so it can't
be referenced out of shared object.
The new function loongarch_get_uleb128_length just used to call
_bfd_read_unsigned_leb128.
bfd/ChangeLog:
* elfxx-loongarch.c (loongarch_get_uleb128_length): New function.
* elfxx-loongarch.h (loongarch_get_uleb128_length): New function.
gas/ChangeLog:
* config/tc-loongarch.c (md_apply_fix): Use
loongarch_get_uleb128_length.
Andrew Burgess [Fri, 16 Jun 2023 09:12:24 +0000 (10:12 +0100)]
gdb: update IRC reference from Freenode to Libera.Chat
It's been some time since the switch from Freenode to Libera.Chat,
however, there's still a reference to Freenode in the 'gdb --help'
output. Lets update that.
Jan Beulich [Fri, 16 Jun 2023 07:23:26 +0000 (09:23 +0200)]
x86: shrink Masking insn attribute to a single bit (boolean)
The logic can actually be expressed with less code that way, utilizing
that there are common patterns of when which form of masking is
permitted. This then also eliminates the large set of open-codings of
BOTH_MASKING in the opcode table.
Alan Modra [Fri, 16 Jun 2023 03:16:49 +0000 (12:46 +0930)]
Correct ld-elf/eh5 test for hppa64
Commit
3c0afdb78988 regressed this test for hppa64, because the test
had been enabled for hppa64 in the time between the mips changes and
their reversion. This patch isn't just a simple reapply, I recreated
the testsuite change by hand for hppa64: Two lines in eh5.d might need
further changes for mips.
GDB Administrator [Fri, 16 Jun 2023 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Thu, 15 Jun 2023 14:17:38 +0000 (15:17 +0100)]
binutils/NEWS: Mention Sony Allegrex MIPS CPU support
Mention the addition of Sony Allegrex processor support to the MIPS port.
binutils/
* NEWS: Mention Sony Allegrex MIPS CPU support.
Maciej W. Rozycki [Thu, 15 Jun 2023 03:45:03 +0000 (04:45 +0100)]
MIPS/GAS/testsuite: Fix `-modd-spreg'/`-mno-odd-spreg' test invocations
Reformat `-modd-spreg'/`-mno-odd-spreg' test invocations in mips.exp to
fit in 79 columns
gas/
* testsuite/gas/mips/mips.exp: Reformat
`-modd-spreg'/`-mno-odd-spreg' test invocations.
David Guillen Fandos [Thu, 15 Jun 2023 03:45:03 +0000 (04:45 +0100)]
Add additional missing Allegrex CPU instructions
Allegrex supports some MIPS32 and MIPS32r2 instructions (albeit with
some encoding differences) such as bit manipulation (ins/ext) and MLA
(madd/msub). It also features some new instructions like wsbw and
min/max or device-specific ones such as mfic.
Signed-off-by: David Guillen Fandos <david@davidgf.net>
David Guillen Fandos [Thu, 15 Jun 2023 03:45:03 +0000 (04:45 +0100)]
Add rotation instructions to MIPS Allegrex CPU
The Allegrex CPU supports bit rotation instructions as described in the
MIPS32 release 2 CPU (even though it is a MIPS-2 based CPU).
Signed-off-by: David Guillen Fandos <david@davidgf.net>
David Guillen Fandos [Thu, 15 Jun 2023 03:45:03 +0000 (04:45 +0100)]
Add MIPS Allegrex CPU as a MIPS2-based CPU
The Allegrex CPU was created by Sony Interactive Entertainment to power
their portable console, the PlayStation Portable.
The pspdev organization maintains all sorts of tools to create software
for said device including documentation.
Signed-off-by: David Guillen Fandos <david@davidgf.net>
Maciej W. Rozycki [Thu, 15 Jun 2023 03:45:03 +0000 (04:45 +0100)]
GAS/doc: Correct Tag_GNU_MIPS_ABI_MSA attribute description
Rewrite the paragraph to match the style of Tag_GNU_MIPS_ABI_FP text
immediately above, correcting grammar and formatting at the same time.
gas/
* doc/as.texi (MIPS Attributes): Correct Tag_GNU_MIPS_ABI_MSA
attribute description.
Maciej W. Rozycki [Thu, 15 Jun 2023 03:45:03 +0000 (04:45 +0100)]
Revert "MIPS: gas: alter 64 or 32 for mipsisa triples if march is implicit"
This reverts commit
094025a30bb2da19df3990e0c0ff8167af823aa1. It was
applied unapproved.
Maciej W. Rozycki [Thu, 15 Jun 2023 03:45:03 +0000 (04:45 +0100)]
Revert "MIPS: default r6 if vendor is img"
This reverts commit
be0d391f22fe6009c3be907753975a984cbbcc23. It was
applied unapproved.
Maciej W. Rozycki [Thu, 15 Jun 2023 03:45:03 +0000 (04:45 +0100)]
Revert "MIPS: fix r6 testsuites"
This reverts commit
ffc528aed56b9e2c171137da28690a9bb6861b0b. It was
applied unapproved.
Maciej W. Rozycki [Thu, 15 Jun 2023 03:45:03 +0000 (04:45 +0100)]
Revert "MIPS: fix -gnuabi64 testsuite"
This reverts commit
cb81e84c72933a7fad10b75b7e270d92d8d65251. It was
applied unapproved.
Maciej W. Rozycki [Thu, 15 Jun 2023 03:45:03 +0000 (04:45 +0100)]
Revert "MIPS: fix some ld testcases with compiler"
This reverts commit
a0631c1501c113c04891c9a24a9ff5276257f28d. It was
applied unapproved.
Maciej W. Rozycki [Thu, 15 Jun 2023 03:45:03 +0000 (04:45 +0100)]
Revert "MIPS: add MT ASE support for micromips32"
This reverts commit
acce83dacff0ce43677410c67aaae32817afe991. It was
applied unapproved.
Maciej W. Rozycki [Thu, 15 Jun 2023 03:45:03 +0000 (04:45 +0100)]
Revert "MIPS: sync oprand char usage between mips and micromips"
This reverts commit
5b207b919483f67311a73dfc1de8897ecfd8e776. It was
applied unapproved.
Alan Modra [Thu, 15 Jun 2023 02:15:03 +0000 (11:45 +0930)]
Re: Add some expected failures for bfin linker tests
After commit
7ade0f1582c4 I was seeing bfin-elf +XPASS: weak symbols,
and on looking into the bfin targets a little, discovered we have two
bfin-linux targets. One, bfin-uclinux, is like bfin-elf in that
ld -m elf32bfin is the default, and the other, bfin-linux-uclibc where
ld -m elf32bfinfd is the default. So putting bfin-*-*linux* in test
xfails or elsewhere is wrong. We want bfin-*-linux* instead to just
select the fdpic bfin target.
This patch corrects wrong bfin target triples in the ld testsuite,
not just the recent change but others I'd added to xfails too.
It also fixes the bfin-linux-uclibc ld-elf/64ksec fail
Alan Modra [Thu, 15 Jun 2023 00:32:31 +0000 (10:02 +0930)]
vms write_archive memory leaks
This fixes two memory leaks in the vms archive handling.
* vms-lib.c (_bfd_vms_lib_build_map): Free input symbols.
(_bfd_vms_lib_write_archive_contents): Free archive map symbols.
GDB Administrator [Thu, 15 Jun 2023 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Wed, 14 Jun 2023 15:39:34 +0000 (17:39 +0200)]
[gdb/testsuite] Fix gdb.base/step-over-exit.exp with glibc debuginfo
In test-case gdb.base/step-over-exit.exp, we set a breakpoint on _exit and
continue, expecting to hit the breakpoint.
Without glibc debug info installed, we have with target board unix/-m64:
...
Thread 2.1 "step-over-exit" hit Breakpoint 2.2, 0x00007ffff7d46aee in \
_exit () from /lib64/libc.so.6^M
(gdb) PASS: gdb.base/step-over-exit.exp: continue to exit
...
and with target board unix/-m32:
...
Thread 2.1 "step-over-exit" hit Breakpoint 2.2, 0xf7d84c25 in _exit () from \
/lib/libc.so.6^M
(gdb) PASS: gdb.base/step-over-exit.exp: continue to exit
...
However after installing debug info (packages glibc-debuginfo and
glibc-32bit-debuginfo), we have for -m64 (note: __GI__exit instead of _exit):
...
Thread 2.1 "step-over-exit" hit Breakpoint 2.2, \
__GI__exit (status=<optimized out>) at \
../sysdeps/unix/sysv/linux/_exit.c:27^M
27 {^M
(gdb) PASS: gdb.base/step-over-exit.exp: continue to exit
...
and -m32 (note: _Exit instead of _exit):
...
Thread 2.1 "step-over-exit" hit Breakpoint 2.2, _Exit () at \
../sysdeps/unix/sysv/linux/i386/_exit.S:24^M
24 ../sysdeps/unix/sysv/linux/i386/_exit.S: No such file or directory.^M
(gdb) FAIL: gdb.base/step-over-exit.exp: continue to exit
...
The gdb_test allows for both _exit and __GI__exit, but not _Exit:
...
gdb_test "continue" \
"Continuing\\..*Breakpoint $decimal.*_exit \\(.*\\).*" \
"continue to exit"
...
Fix this by allowing _Exit as well.
Tested on x86_64-linux.
Nick Clifton [Wed, 14 Jun 2023 14:54:29 +0000 (15:54 +0100)]
Add some expected failures for bfin linker tests
Nick Clifton [Wed, 14 Jun 2023 12:39:03 +0000 (13:39 +0100)]
Add --remap-inputs option to the BFD linker.
PR 30374
* ldfile.c (struct input_remap): New structure. (ldfile_add_remap): New function. (ldfile_remap_input_free): New function. (ldfile_add_remap_file): New function. (ldfile_possibly_remap_input): New function. (ldfile_print_input_remaps): New function. * ldfile.h: Add prototypes for new functions.
* ldlang.c (new_afile): Call ldfile_possibly_remap_input. (lang_finish): Call ldfile_remap_input_free. (lang_map): Call ldfile_print_input_remaps.
* ldlex.h (OPTION_REMAP_INPUTS, OPTION_REMAP_INPUTS_FILE): Define.
* lexsup.c (ld_options): Add --remap-inputs-file and --remap-inputs. (parse_args): Handle new options.
* NEWS: Mention the new feature.
* ld.texi: Document the new options.
* testsuite/ld-misc/input-remap.exp: New test driver.
* testsuite/ld-misc/remaps.r: New file: Expected linker output.
* testsuite/ld-misc/remaps.txt: New file. Input remaps file.
Alan Modra [Wed, 14 Jun 2023 04:54:50 +0000 (14:24 +0930)]
asprintf memory leaks
A number of backends want to return bfd_reloc_dangerous messaqes from
relocation special_function, and construct the message using asprintf.
Such messages are not freed anywhere, leading to small memory leaks
inside libbfd. To limit the leaks, I'd implemented a static buffer in
the ppc backends that was freed before use in asprintf output. This
patch extends that scheme to other backends using a shared static
buffer and goes further in freeing the buffer on any bfd_close.
The patch also fixes a few other cases where asprintf output was not
freed after use.
bfd/
* bfd.c (_input_error_msg): Make global and rename to..
(_bfd_error_buf): ..this.
(bfd_asprintf): New function.
(bfd_errmsg): Use bfd_asprintf.
* opncls.c (bfd_close_all_done): Free _buf_error_buf.
* elf32-arm.c (find_thumb_glue, find_arm_glue): Use bfd_asprintf.
* elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
* elf32-ppc.c (ppc_elf_unhandled_reloc): Likewise.
* elf64-ppc.c (ppc64_elf_unhandled_reloc): Likewise.
* elfnn-riscv.c (riscv_resolve_pcrel_lo_relocs): Likewise.
(riscv_elf_relocate_section): Likewise.
* libbfd.h: Regenerate.
gas/
* read.c (read_end): Free current_name and current_label.
(do_s_func): Likewise on error path. strdup label.
ld/
* pe-dll.c (make_head, make_tail, make_one),
(make_singleton_name_thunk, make_import_fixup_entry),
(make_runtime_pseudo_reloc),
(pe_create_runtime_relocator_reference: Free oname after use.
Alan Modra [Wed, 14 Jun 2023 04:16:56 +0000 (13:46 +0930)]
Re: bfd/elf.c strtab memory leak
There are other places that leak the strtab.
* elf.c (_bfd_elf_compute_section_file_positions): Free strtab
on error paths.
GDB Administrator [Wed, 14 Jun 2023 00:00:11 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Tue, 13 Jun 2023 11:21:09 +0000 (13:21 +0200)]
[gdb/testsuite] Fix gdb.tui/long-prompt.exp with read1
When running test-case gdb.tui/long-prompt.exp with check-read1, we get:
...
(gdb) FAIL: gdb.tui/long-prompt.exp: prompt size == width + 1: \
end of screen: at last line
...
The problem is in these commands:
...
Term::command "echo \\n"
Term::command "echo \\n"
Term::command "echo \\n"
Term::command "echo \\n"
...
The last one makes the terminal scroll, and the scrolling makes the expected
output match on a different line.
Fix this by replacing the sequence with a single command:
...
Term::command "echo \\n\\n\\n\\n\\n\\n"
...
which avoids scrolling.
Tested on x86_64-linux.
Tom de Vries [Tue, 13 Jun 2023 10:24:17 +0000 (12:24 +0200)]
[gdb/testsuite] Fix and add prompt anchoring in tuiterm
There is a test-case that contains a unit test for tuiterm:
gdb.tui/tuiterm.exp.
However, this only excercises the tuiterm itself, and not the functions that
interact with it, like Term::command.
Add a new test-case gdb.tui/tuiterm-2.exp that:
- overrides proc accept_gdb_output (to be able simulate incorrect responses
while avoiding the timeout),
- overrides proc send_gdb (to be able to call Term::command without a gdb
instance, such that all tuiterm input is generated by the test-case).
- issues Term::command calls, and
- checks whether they behave correctly.
This exposes a problem in Term::command. The "prompt before command" regexp
starts with a bit that is supposed to anchor the prompt to the border:
...
set str "(^|\|)$gdb_prompt $str"
...
but that doesn't work due to insufficient escaping. Fix this by adding the
missing escape:
...
set str "(^|\\|)$gdb_prompt $str"
...
Futhermore, the "prompt after command" regexp in Term::wait_for has no
anchoring at all:
...
set prompt_wait_for "$gdb_prompt \$"
...
so add that as well.
Tested on x86_64-linux.
Tom de Vries [Tue, 13 Jun 2023 10:24:17 +0000 (12:24 +0200)]
[gdb/testsuite] Allow procs with default value args in with_override
Currently proc with_override does not work with procs with default value args.
Fix this, and add a test-case excercising this scenario.
Tested on x86_64-linux.
Tom de Vries [Tue, 13 Jun 2023 10:21:45 +0000 (12:21 +0200)]
[gdb/testsuite] Fix gdb.dap/type_check.exp with older python
On openSUSE Leap 15.4 with system python 3.6, I run into:
...
(gdb) python check_everything()^M
(gdb) FAIL: gdb.dap/type_check.exp: type checker
...
In check_everything, the hasattr test fails silently:
...
def check_everything():
# Older versions of Python can't really implement this.
if hasattr(typing, "get_origin"):
...
and that makes the gdb_test in the test-case fail.
Fix this by emitting UNSUPPORTED instead in check_everything, and detecting
this in the test-case.
Tested on x86_64-linux.
Lancelot SIX [Thu, 8 Jun 2023 14:24:55 +0000 (15:24 +0100)]
gdb/testsuite: use proper int size for gdb.dwarf2/symbol_needs_eval*.exp
We recently realized that symbol_needs_eval_fail.exp and
symbol_needs_eval_timeout.exp invalidly dereference an int (4 bytes on
x86_64) by reading 8 bytes (the size of a pointer).
Here how it goes:
In gdb/testsuite/gdb.dwarf2/symbol_needs_eval.c a global variable is
defined:
int exec_mask = 1;
and later both tests build some DWARF using the assembler doing:
set exec_mask_var [gdb_target_symbol exec_mask]
...
DW_TAG_variable {
{DW_AT_name a}
{DW_AT_type :$int_type_label}
{DW_AT_location {
DW_OP_addr $exec_mask_var
DW_OP_deref
...
}
}
The definition of the DW_OP_deref (from Dwarf5 2.5.1.3 Stack Operations)
says that "The size of the data retrieved from the dereferenced address
is the size of an address on the target machine."
On x86_64, the size of an int is 4 while the size of an address is 8.
The result is that when evaluating this expression, the debugger reads
outside of the `a` variable.
Fix this by using `DW_OP_deref_size $int_size` instead. To achieve
this, this patch adds the necessary steps so we can figure out what
`sizeof(int)` evaluates to for the current target.
While at it, also change the definition of the int type in the assembled
DWARF information so we use the actual target's size for an int instead
of the literal 4.
Tested on x86_64 Linux.
Approved-By: Tom Tromey <tom@tromey.com>
GDB Administrator [Tue, 13 Jun 2023 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in
Kevin Buettner [Mon, 12 Jun 2023 22:21:06 +0000 (15:21 -0700)]
Simplify case DW_OP_GNU_uninit in dwarf_expr_context::execute_stack_op
Tom Tromey pointed out that the test and call to error() for the
DW_OP_GNU_uninit case in dwarf_expr_context::execute_stack_op (in
gdb/dwarf2/expr.c)...
if (op_ptr != op_end && *op_ptr != DW_OP_piece
&& *op_ptr != DW_OP_bit_piece)
error (_("DWARF-2 expression error: DW_OP_GNU_uninit must always "
"be the very last op in a DWARF expression or "
"DW_OP_piece/DW_OP_bit_piece piece."));
...could be replaced by a call to dwarf_expr_require_composition which
performs a similar check and outputs a suitable error message.
Simon Farre [Mon, 12 Jun 2023 19:45:03 +0000 (21:45 +0200)]
Added self to W.A.A. maintainers
Richard Bunt [Mon, 12 Jun 2023 08:27:14 +0000 (09:27 +0100)]
gdb/testsuite: Testing with the armflang compiler
Currently the Fortran test suite does not run with armflang because the
compiler detection fails. This in turn means fortran_runto_main does not
know which main method to use to start a test case.
Fortran compiler detection was added in
44d469c5f85; however, the commit
message notes that it was not tested with armflang.
This commit tests and fixes up a minor issue to get the detection
working.
The goal here is to get the tests running and preventing further
regressions during future work. This change does not do anything to fix
existing failures.
>From what I can understand, the auto detection leverages the
preprocessor to extract the Fortran compiler identity from the defines.
This preprocessor output is then evaluated by the test suite to import
these defines.
In the case of armflang, this evaluation step is disrupted by the
presence of the following warning:
$ armflang -E -fdiagnostics-color=never testsuite/lib/compiler.F90 -o compiler.exp
$ clang-13: warning: argument unused during compilation: '-fdiagnostics-color=never' [-Wunused-command-line-argument]
The evaluation logic is already set up to filter this warning, but the
prefix differs.
This commit fixes the issue by updating the filter to exclude the
armflang flavour of warning.
gdb.fortran regression tests run with GNU, Intel and Intel LLVM. No
regressions detected.
The gdb.fortran test results with ACfL 23.04.1 are as follows.
Before:
# of expected passes 560
# of unexpected failures 113
# of unresolved testcases 2
# of untested testcases 5
# of duplicate test names 2
After:
# of expected passes 5388
# of unexpected failures 628
# of known failures 10
# of untested testcases 8
# of unsupported tests 5
# of duplicate test names 5
As can be seen from the above, there are now considerably more passing
assertions.
Reviewed-By: Luis Machado <luis.machado@arm.com>
Approved-By: Tom Tromey <tom@tromey.com>
Tom Tromey [Fri, 2 Jun 2023 15:43:01 +0000 (09:43 -0600)]
Remove f-strings from DAP
Kévin pointed out that gdb claims a minimum Python version of 3.2, but
the DAP code uses f-strings, which were added in 3.6.
This patch removes the uses of f-strings from the DAP code. I can't
test an older version of Python, but I did confirm that this still
works with the version I have.
Tom Tromey [Thu, 18 May 2023 17:14:08 +0000 (11:14 -0600)]
Implement DAP conditional breakpoints
I realized that I had only implemented DAP breakpoint conditions for
exception breakpoints, and not other kinds of breakpoints. This patch
corrects the oversight.
Tom Tromey [Fri, 19 May 2023 15:00:52 +0000 (09:00 -0600)]
Do not report totalFrames from DAP stackTrace request
Currently, gdb will unwind the entire stack in response to the
stackTrace request. I had erroneously thought that the totalFrames
attribute was required in the response. However, the spec says:
If omitted or if `totalFrames` is larger than the available
frames, a client is expected to request frames until a request
returns less frames than requested (which indicates the end of the
stack).
This patch removes this from the response in order to improve
performance when the stack trace is very long.
Tom Tromey [Wed, 17 May 2023 13:43:52 +0000 (07:43 -0600)]
Implement DAP breakpointLocations request
This implements the DAP breakpointLocations request.
Tom Tromey [Tue, 16 May 2023 15:51:51 +0000 (09:51 -0600)]
Add "stop at main" extension to DAP launch request
Co-workers who work on a program that uses DAP asked for the ability
to have gdb stop at the main subprogram when launching. This patch
implements this extension.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Tom Tromey [Tue, 16 May 2023 15:34:20 +0000 (09:34 -0600)]
Add "target" parameter to DAP attach request
This adds a new "target" to the DAP attach request. This is passed to
"target remote". I thought "attach" made the most sense for this,
because in some sense gdb is attaching to a running process. It's
worth noting that all DAP "attach" parameters are defined by the
implementation.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Tom Tromey [Tue, 16 May 2023 13:36:08 +0000 (07:36 -0600)]
Handle DAP supportsVariableType capability
A DAP client can report the supportsVariableType capability in the
initialize request. In this case, gdb can include the type of a
variable or expression in various results.
Tom Tromey [Tue, 16 May 2023 13:14:22 +0000 (07:14 -0600)]
Implement DAP setExpression request
This implements the DAP setExpression request.
Tom Tromey [Fri, 12 May 2023 20:10:56 +0000 (14:10 -0600)]
Add gdb.Value.assign method
This adds an 'assign' method to gdb.Value. This allows for assignment
without requiring the use of parse_and_eval.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Tom Tromey [Thu, 11 May 2023 18:20:05 +0000 (12:20 -0600)]
Add type-checking to DAP requests
It occurred to me recently that gdb's DAP implementation should
probably check the types of objects coming from the client. This
patch implements this idea by reusing Python's existing type
annotations, and supplying a decorator that verifies these at runtime.
Python doesn't make it very easy to do runtime type-checking, so the
core of the checker is written by hand. I haven't tried to make a
fully generic runtime type checker. Instead, this only checks the
subset that is needed by DAP. For example, only keyword-only
functions are handled.
Furthermore, in a few spots, it wasn't convenient to spell out the
type that is accepted. I've added a couple of comments to this effect
in breakpoint.py.
I've tried to make this code compatible with older versions of Python,
but I've only been able to try it with 3.9 and 3.10.
Tom Tromey [Fri, 12 May 2023 14:28:28 +0000 (08:28 -0600)]
Use tuples for default arguments in DAP
My co-worker Kévin taught me that using a mutable object as a default
argument in Python is somewhat dangerous, because the object is
created a single time (when the function is defined), and so if it is
mutated in the body of the function, the changes will stick around.
This patch changes the cases like this in DAP to use () rather than []
as the default. This patch is merely preventative, as no bugs like
this are in the code.
Tom Tromey [Thu, 11 May 2023 20:25:07 +0000 (14:25 -0600)]
Fix a latent bug in DAP request decorator
The 'request' decorator is intended to also ensure that the request
function runs in the DAP thread. However, the unwrapped function is
installed in the global request map, so the wrapped version is never
called. This patch fixes the bug.
Tom Tromey [Wed, 10 May 2023 19:05:54 +0000 (13:05 -0600)]
Add test for DAP pause request
I neglected to write a test for the DAP "pause" request. This patch
adds one.
Tom Tromey [Tue, 9 May 2023 20:38:45 +0000 (14:38 -0600)]
Rename one DAP function
When I first started implementing DAP, I had some vague plan of having
the implementation functions use the same name as the request. I
abandoned this idea, but one vestige remained. This patch renames the
one remaining function to be gdb-ish.
Tom Tromey [Tue, 9 May 2023 20:33:42 +0000 (14:33 -0600)]
Add singleThread support to some DAP requests
A few DAP requests support a "singleThread" parameter, which is
somewhat similar to scheduler-locking. This patch implements support
for this.
Tom Tromey [Tue, 9 May 2023 20:29:45 +0000 (14:29 -0600)]
Implement DAP stepOut request
This implements the DAP "stepOut" request.
Tom Tromey [Tue, 9 May 2023 20:20:31 +0000 (14:20 -0600)]
Implement DAP attach request
This implements the DAP "attach" request.
Note that the copyright dates on the new test source file are not
incorrect -- this was copied verbatim from another directory.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Tom Tromey [Mon, 17 Apr 2023 14:08:54 +0000 (08:08 -0600)]
Implement DAP setExceptionBreakpoints request
This implements the DAP setExceptionBreakpoints request for Ada. This
is a somewhat minimal implementation, in that "exceptionOptions" are
not implemented (or advertised) -- I wasn't completely sure how this
feature is supposed to work.
I haven't added C++ exception handling here, but it's easy to do if
needed.
This patch relies on the new MI command execution support to do its
work.
Tom Tromey [Thu, 16 Feb 2023 17:42:22 +0000 (10:42 -0700)]
Don't require inferior execution for Ada catchpoints
Currently, Ada catchpoints require that the inferior be running.
However, there's no deep reason for this -- for example, C++ exception
catchpoints do not have this requirement. Instead, those work like
ordinary breakpoints: they are pending until the needed runtime
locations are seen.
This patch changes Ada catchpoints to work the same way.