Tiezhu Yang [Wed, 12 Jan 2022 00:31:02 +0000 (08:31 +0800)]
gdb: testsuite: fix failed testcases in gdb.base/charset.exp
In gdb/testsuite/gdb.base/charset.c, the last argument is greater than 127
when call fill_run() in EBCDIC-US and IBM1047, but the type of string[] is
char, this will change the value due to sign extension.
For example, ebcdic_us_string[7] will be -63 instead of the original 193 in
EBCDIC-US.
Make the type of string[] as unsigned char to fix the following six failed
testcases:
$ grep FAIL gdb/testsuite/gdb.sum
FAIL: gdb.base/charset.exp: check value of parsed character literal in EBCDIC-US
FAIL: gdb.base/charset.exp: check value of parsed string literal in EBCDIC-US
FAIL: gdb.base/charset.exp: check value of escape that doesn't exist in EBCDIC-US
FAIL: gdb.base/charset.exp: check value of parsed character literal in IBM1047
FAIL: gdb.base/charset.exp: check value of parsed string literal in IBM1047
FAIL: gdb.base/charset.exp: check value of escape that doesn't exist in IBM1047
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Fangrui Song [Tue, 11 Jan 2022 16:59:40 +0000 (08:59 -0800)]
ar: Add --thin for creating thin archives
In many ar implementations (FreeBSD, elfutils, etc), -T has the X/Open
System Interface specified semantics. Therefore -T for thin archives is
not recommended for portability. -T is deprecated without diagnostics.
Martin Storsj [Tue, 11 Jan 2022 15:43:59 +0000 (15:43 +0000)]
Fix multiple problems with DLL generation.
ld * pe-dll.c (make_head): Prefix the symbol name with the dll name.
(make_tail, make_one, make_singleton_name_thunk): Likewise.
(make_import_fixup_entry, make_runtime_pseudo_reloc): Likewise.
(pe_create_runtime_relocator_reference): Likewise.
(pe_dll_generate_implib): Set dll_symname_len.
(pe_process_import_defs): Likewise.
binutils
* dlltool.c (main): If a prefix has not been provided, attempt to
use a deterministic one based upon the dll name.
Andrew Burgess [Mon, 10 Jan 2022 17:42:06 +0000 (17:42 +0000)]
gdbsupport: regenerate Makefile.in
I had cause to regenerate gdbsupport/Makefile.in, and noticed some
unexpected changes in the copyright header dates.
I suspect that this was caused by the end of year date range update
process.
The Makefile.in contains two date ranges. The first range appears to
be the date range for the version of automake being used, that is the
range runs up to 2017 only, when automake 1.15.1 was released.
The second date range in Makefile.in represents the date range for the
generated file, and so, now runs up to 2022.
Anyway, this is the result of running autoreconf (using automake
1.15.1) in the gdbsupport directory.
Clément Chigot [Fri, 17 Dec 2021 13:46:01 +0000 (14:46 +0100)]
XCOFF: add support for TLS relocations on hidden symbols
This patch adds support for TLS relocation targeting C_HIDEXT symbols.
In gas, TLS relocations, except R_TLSM and R_TLMSL, must keep the value
of their target symbol.
In ld, it simply ensures that internal TLS symbols are added to the
linker hash table for xcoff_reloc_type_tls.
It also improves the tests made by both.
bfd/ChangeLog:
* coff-rs6000.c (xcoff_howto_table): Fix name of R_TLSML.
(xcoff_reloc_type_tls): Replace the error when h is NULL by
an assert.
(xcoff_complain_overflow_unsigned_func): Adjust comments.
* coff64-rs6000.c (xcoff64_howto_table): Fix name of R_TLSML.
* xcofflink.c (xcoff_link_add_symbols_to_hash_table): New
function.
(xcoff_link_add_symbols): Add C_HIDEXT TLS symbols to the linker
hash table.
gas/ChangeLog:
* config/tc-ppc.c (md_apply_fix): Enable support for TLS
relocation over internal symbols.
* testsuite/gas/ppc/aix.exp: Replace xcoff-tlms by xcoff-tls.
* testsuite/gas/ppc/xcoff-tlsm-32.d: Removed.
* testsuite/gas/ppc/xcoff-tlsm-64.d: Removed.
* testsuite/gas/ppc/xcoff-tlsm.s: Removed.
* testsuite/gas/ppc/xcoff-tls-32.d: New test.
* testsuite/gas/ppc/xcoff-tls-64.d: New test.
* testsuite/gas/ppc/xcoff-tls.s: New test.
ld/ChangeLog:
* testsuite/ld-powerpc/aix52.exp: Improve aix-tls-reloc test.
* testsuite/ld-powerpc/aix-tls-reloc.s: Likewise.
* testsuite/ld-powerpc/aix-tls-reloc-32.d: Removed.
* testsuite/ld-powerpc/aix-tls-reloc-64.d: Removed.
* testsuite/ld-powerpc/aix-tls-reloc-32.dd: New test.
* testsuite/ld-powerpc/aix-tls-reloc-32.dt: New test.
* testsuite/ld-powerpc/aix-tls-reloc-64.dd: New test.
* testsuite/ld-powerpc/aix-tls-reloc-64.dt: New test.
Tom Tromey [Mon, 27 Dec 2021 04:38:34 +0000 (21:38 -0700)]
Reduce use of unfiltered output in Darwin code
The Darwin code uses unfiltered output liberally. This patch changes
this code to send some output to gdb_stdlog (in some cases via the use
of debug_prefixed_printf_cond_nofunc), or to gdb_stderr, or to simply
switch to filtered output.
Note that I didn't switch inferior_debug to use
debug_prefixed_printf_cond_nofunc, because that would affect the
output by removing the information about the inferior. I wasn't sure
if this was important or not, so I left it in.
v2 of this patch uses warning rather than prints to gdb_stderr, and
removes some trailing whitespace.
I can't compile this patch, so it's "best effort".
gdb/remote: Restore support for 'S' stop reply packet
Unfortunately, the GNU/Hurd target is still relying on the value of
inferior_ptid in the case where an inferior exits - we return the
value of inferior_ptid as the pid of the process that exited. This
was fine in the single target world, where inferior_ptid identified
the one running inferior, but this is no longer good enough.
Instead, we should return a ptid containing the pid of the process
that exited, as obtained from the wait event, and this is what this
commit does.
I've not run the full testsuite on GNU/Hurd as there appear to be lots
of other issues with this target that makes running the full testsuite
very painful, but I think this looks like a small easy improvement.
Hannes Domani [Tue, 7 Apr 2020 18:57:07 +0000 (20:57 +0200)]
Add _sigsys info to siginfo struct
This patch adds information about _sigsys structure from newer
kernels, so that $_siginfo decoding can show information about
_sigsys, making it easier for developers to debug seccomp failures.
Requested in PR gdb/24283.
Tiezhu Yang [Sat, 8 Jan 2022 10:43:00 +0000 (14:43 +0400)]
gdb: testsuite: show print array-indexes after set in arrayidx.exp
Add "show print array-indexes" testcases after set print array-indexes
to off or on.
Without this patch:
PASS: gdb.base/arrayidx.exp: set print array-indexes to off
PASS: gdb.base/arrayidx.exp: print array with array-indexes off
PASS: gdb.base/arrayidx.exp: set print array-indexes to on
PASS: gdb.base/arrayidx.exp: print array with array-indexes on
With this patch:
PASS: gdb.base/arrayidx.exp: set print array-indexes to off
PASS: gdb.base/arrayidx.exp: show print array-indexes is off
PASS: gdb.base/arrayidx.exp: print array with array-indexes off
PASS: gdb.base/arrayidx.exp: set print array-indexes to on
PASS: gdb.base/arrayidx.exp: show print array-indexes is on
PASS: gdb.base/arrayidx.exp: print array with array-indexes on
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
On some targets, R_*_RELATIVE relocations are counted and the GOT offsets
are allocated when setting the dynamic section sizes after seeing all
relocations. R_*_RELATIVE relocations are generated while relocating
sections after section layout has been finalized.
To prepare for DT_RELR implementation on these targets, extract
_bfd_elf_link_iterate_on_relocs from _bfd_elf_link_check_relocs so
that a backend can scan relocations in elf_backend_always_size_sections
For x86 targets, the old check_relocs is renamed to scan_relocs and a
new check_relocs is added to chek input sections and create dynamic
relocation sections so that they will be mapped to output sections.
scan_relocs is now called from elf_backend_always_size_sections.
Since relocations are scanned after __start, __stop, .startof. and
.sizeof. symbols have been finalized on x86, __[start|stop]_SECNAME for
--gc-sections -z start-stop-gc are now zero when all SECNAME sections
been garbage collected. This is no need for elf_x86_start_stop_gc_p.
Lancelot SIX [Mon, 22 Nov 2021 22:36:47 +0000 (22:36 +0000)]
gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp
When I run the testsuite, I have:
Running .../gdb/testsuite/gdb.mi/mi-catch-load.exp ...
DUPLICATE: gdb.mi/mi-catch-load.exp: breakpoint at main
DUPLICATE: gdb.mi/mi-catch-load.exp: mi runto main
Fix by grouping the various phases in with_test_prefix blocks. Since
the tests now have a prefix, remove the manually written prefixes in
testnames.
Also change some messages with the pattern "(timeout) $testname" into
"$estname (timeout)" since tools will handle this as $testname[1] (which
is what we want in this particular scenario).
Lancelot SIX [Tue, 23 Nov 2021 15:15:57 +0000 (15:15 +0000)]
gdb/testsuite: Remove duplicates from gdb.mi/mi-language.exp
When running the testsuite, I have:
Running .../gdb/testsuite/gdb.mi/mi-language.exp ...
DUPLICATE: gdb.mi/mi-language.exp: set lang ada
This is due to an erroneous explicit test name. This explicit test name
also happens to be useless (at least it would have been if it was
correct) since it only repeats the command, so just remove the explicit
test name and let the command be used as default test name. Also remove
explicit test name at another location in the file since it also just
repeat the command.
Lancelot SIX [Tue, 23 Nov 2021 13:42:13 +0000 (13:42 +0000)]
gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop-exit.exp
When running the testsuite, I have:
Running .../gdb/testsuite/gdb.mi/mi-nonstop-exit.exp ...
DUPLICATE: gdb.mi/mi-nonstop-exit.exp: breakpoint at main
DUPLICATE: gdb.mi/mi-nonstop-exit.exp: mi runto main
This test runs the same sequence of operations twice. Refactor the code
by running both of those sequences within a foreach_with_prefix block to
ensure that the commands have unique test names.
Lancelot SIX [Sun, 21 Nov 2021 01:33:13 +0000 (01:33 +0000)]
gdb/testsuite: Remove duplicates from gdb.base/shlib-call.exp
When I run the testsuite, I have:
Running .../gdb/testsuite/gdb.base/shlib-call.exp ...
DUPLICATE: gdb.base/shlib-call.exp: print g
DUPLICATE: gdb.base/shlib-call.exp: set print sevenbit-strings
DUPLICATE: gdb.base/shlib-call.exp: set print address off
DUPLICATE: gdb.base/shlib-call.exp: set width 0
DUPLICATE: gdb.base/shlib-call.exp: continue until exit
Fix by adjusting the test names when required, and by removing
un-necessary commands.
While at it, do some cleanup:
- Replace an explicit GDB restart sequence with a call to clean_restart.
- Remove trailing whitespaces.
- Use $gdb_test_name in gdb_test_multiple.
Lancelot SIX [Sun, 21 Nov 2021 00:20:56 +0000 (00:20 +0000)]
gdb/testsuite: Remove duplicates from gdb.base/ui-redirect.exp
When running the testsuite, I have:
Running .../gdb/testsuite/gdb.base/ui-redirect.exp ...
DUPLICATE: gdb.base/ui-redirect.exp: redirect while already logging: set logging redirect off
Fix by moving the first 'set logging redirect off' to the end of the
previous [with_test_prefix] test block. The statement's purpose is to
clean the on flag set in this previous block, so moving it there makes
sense and does not change the sequence of commands in the test file.
Lancelot SIX [Sat, 20 Nov 2021 23:20:23 +0000 (23:20 +0000)]
gdb: completion-support.exp: improve leading whitespace support
There is a expect support library in the source tree designed to help
developers test the auto-completion capabilities of GDB.
One of the functions is test_gdb_complete_unique_re. It is used
(usually indirectly via test_gdb_complete_unique) to test that a given
input line is completed as a given output line. The test checks for two
ways to do the completion: using tab-completion, or using the
'complete' command. To do this, calls to two dedicated functions are
performed. If we omit few details, we can consider that a call to
When using the tab-completion, everything works as expected, but some
care must be taken when using the 'complete' command if the given input
has leading whitespaces. In such situation, the output of the
'complete' command will drop the leading whitespaces.
The current approach is that in such situation, the input and expected
outputs are right trimmed (i.e. all leading whitespaces are removed)
when performing the command completion check.
This means that the following call:
test_gdb_complete_unique " $input" " $expected"
is almost equivalent to (again, omitting few details and arguments):
We see that the lines 2 and 4 are now the same, and for this reason the
testing framework complains about DUPLICATE test names.
To fix that, this commit proposes that instead of left trimming both
input and expected outputs, only the expected output is trimmed.
Care must be taken in the case the completion gives more possibilities
than allowed by the max-completions setting. In this case, the input
will be repeated in the output in its left trimmed version. This commit
also ensures that this is taken care of.
With this commit, the gdb.base/complete-empty.exp still passes all its
tests but does not report the DUPLICATE anymore.
Pedro Alves [Fri, 10 Dec 2021 22:41:54 +0000 (22:41 +0000)]
gdb/testsuite: Remove duplicates from gdb.base/dfp-exprs.exp
When I run the testsuite, I have:
Running ../gdb/testsuite/gdb.base/dfp-exprs.exp ...
DUPLICATE: gdb.base/dfp-exprs.exp: p 1.2dl < 1.3df
Replace hand-written tests checking various comparison operators between
various decimal floating point types with a loop to programmatically
generate all the combinations. This removes the need to eyeball for all
suffixes, which lead to the original duplication.
Also add a lot more combinations, testing all comparison operators
comprehensively. The result is 262 unique tests vs 104 before this
patch.
Lancelot SIX [Sat, 20 Nov 2021 00:10:07 +0000 (00:10 +0000)]
gdb/testsuite: Remove duplicates from gdb.base/dfp-test.exp
When running the testsuite, I have:
Running .../gdb/testsuite/gdb.base/dfp-test.exp ...
DUPLICATE: gdb.base/dfp-test.exp: 1.23E is an invalid number
DUPLICATE: gdb.base/dfp-test.exp: 1.23E45A is an invalid number
DUPLICATE: gdb.base/dfp-test.exp: 1.23E is an invalid number
DUPLICATE: gdb.base/dfp-test.exp: 1.23E45A is an invalid number
Fix by using proc_with_prefix where appropriate.
Tested on x86_64-linux. Co-Authored-By: Andrew Burgess <aburgess@redhat.com>
Lancelot SIX [Fri, 19 Nov 2021 23:55:05 +0000 (23:55 +0000)]
gdb/testsuite: Remove duplicates from gdb.base/del.exp
When running the testsuite, I have:
Running .../gdb/testsuite/gdb.base/del.exp ...
DUPLICATE: gdb.base/del.exp: info break after removing break on main
Refactor slightly this test to run the various configurations under
foreach_with_prefix so each variant is automatically prefixed, ensuring
that the forgotten custom test name cannot happen.
Lancelot SIX [Fri, 19 Nov 2021 22:48:59 +0000 (22:48 +0000)]
gdb/testsuite: Remove duplicates from gdb.base/realname-expand.exp
When running the testsuite, I have:
Running .../gdb/testsuite/gdb.base/realname-expand.exp ...
DUPLICATE: gdb.base/realname-expand.exp: set basenames-may-differ on
This is due to the fact that the test restarts GDB twice and each time
sets the basenames-may-differ setting. This patch proposes to fix this
by not restarting GDB so the setting is maintained. It just clears the
breakpoints between the two tests and updates the breakpoints number as
required.
This patch also perform some minor refactorings to improve visibility.
Lancelot SIX [Fri, 19 Nov 2021 19:55:05 +0000 (19:55 +0000)]
gdb/testsuite: Remove duplicates from gdb.base/interp.exp
When running the testsuite I have:
Running .../gdb/testsuite/gdb.base/interp.exp ...
DUPLICATE: gdb.base/interp.exp: interpreter-exec mi "-var-update *"
This is due to the fact that multiple successive instances of
gdb_test_multiple use 'pass $cmd', but one of them forgets to reset $cmd
to a new test name.
Fix by using 'pass $gdb_test_name', given that the gdb_test_name is set
by gdb_test_multiple.
While fixing this, this patch refactors all occurrences of the following
pattern:
Lancelot SIX [Fri, 19 Nov 2021 19:05:37 +0000 (19:05 +0000)]
gdb/testsuite: Remove duplicates from gdb.base/miscexprs.exp
When running the testsuite I see:
Running .../gdb/testsuite/gdb.base/miscexprs.exp ...
DUPLICATE: gdb.base/miscexprs.exp: print value of !ibig.i[100]
DUPLICATE: gdb.base/miscexprs.exp: print value of !ibig.i[100]
This is due to an explicit test name repeated across multiple tests.
The actual test explicit names do not add much over the command from
wich default test names are derived.
Fix by removing the explicit test names across the file where they do
not add value. While at doing some cleaning, also use $gdb_test_name in
the various uses of gdb_test_multiple.
Philipp Tomsich [Wed, 5 Jan 2022 13:57:28 +0000 (14:57 +0100)]
RISC-V: update docs to reflect privileged spec v1.9 has been dropped
After commit d8af286fffa ("RISC-V: Drop the privileged spec v1.9
support.") has removed support for privileged spec v1.9, this removes
it from the documentation.
References: d8af286fffa ("RISC-V: Drop the privileged spec v1.9 support.")
Philipp Tomsich [Tue, 4 Jan 2022 17:12:32 +0000 (18:12 +0100)]
RISC-V: update docs for -mpriv-spec/--with-priv-spec for 1.12
While support for the privileged spec was added in a63375ac337
("RISC-V: Hypervisor ext: support Privileged Spec 1.12"), the
documentation has not been updated. Add 1.12 to the relevant
documentation.
References: a63375ac337 ("RISC-V: Hypervisor ext: support Privileged Spec 1.12")
gas/ChangeLog:
* config/tc-riscv.c: Add 1.12 to the usage message.
* configure: Regenerate.
* configure.ac: Add 1.12 to the help/usage message.
* po/fr.po: Same.
* po/ru.po: Same.
* po/uk.po: Same.
Tom Tromey [Fri, 7 Jan 2022 21:00:33 +0000 (14:00 -0700)]
Do not use CC_HAS_LONG_LONG
ax.cc checks CC_HAS_LONG_LONG, but nothing defines this. However,
PRINTF_HAS_LONG_LONG is checked in configure. This patch removes the
former and keeps the latter. This is PR remote/14976 (filed by me in
2012, lol).
Andrew Burgess [Wed, 22 Dec 2021 16:47:29 +0000 (16:47 +0000)]
gdb/doc: shorten some source lines, and prevent some line breaks
Building on the previous commit, this makes use of a trailing @ to
split long @deffn lines in the guile.texi source file. This splitting
doesn't change how the document is laid out by texinfo.
I have also wrapped keyword and argument name pairs in @w{...} to
prevent line breaks appearing between the two. I've currently only
done this for the longer @deffn lines, where a line break is
possible. This makes the @deffn lines much nicer to read in the
generated pdf.
Andrew Burgess [Wed, 22 Dec 2021 16:04:56 +0000 (16:04 +0000)]
gdb/doc: Remove (...) around guile procedure names in @deffn lines
Most guile procedures in the guile.texi file are defined like:
@deffn {Scheme Procedure} name arg1 arg2 arg3
But there are two places where we do this:
@deffn {Scheme Procedure} (name arg1 arg2 arg3)
Notice the added (...). Though this does represent how a procedure
call is written in scheme, it's not the normal style throughout the
manual. I also checked the 'info guile' info page to see how they
wrote there declarations, and they use the first style too.
The second style also has the drawback that index entries are added as
'(name', and so they are grouped in the '(' section of the index,
which is not very user friendly.
In this commit I've changed the definitions of make-command and
make-parameter to use the first style.
The procedure declaration lines can get pretty long with all of the
arguments, and this was true for both of the procedures I am changing
in this commit. I have made use of a trailing '@' to split the deffn
lines, and keep them under 80 characters in the texi source. This
makes no difference to how the final document looks.
Finally, our current style for keyword arguments, appears to be:
[#:keyword-name argument-name]
I don't really understand the reason for this, 'info guile' just seems
to use:
[#:keyword-name]
which seems just as good to me. But I don't propose to change
that just now. What I do notice though, is that sometimes, texinfo
will place a line break between the keyword-name and the
argument-name, for example, the pdf of make-command is:
Notice the line break after '#:command-class' and after '#:doc',
neither of which are ideal. And so, for the two commands I am
changing in this commit, I have made use of @w{...} to prevent line
breaks between the keyword-name and the argument-name. Now the pdf
looks like this:
Update the default ISA spec from 2.2 to 20191213 will change the default
version of i from 2.0 to 2.1. Since zicsr and zifencei are separated
from i 2.1, users need to add them in the architecture string if they need
fence.i and csr instructions. Besides, we also allow old ISA spec can
recognize zicsr and zifencei, but we won't output them since they are
already included in the i extension when i's version is less than 2.1.
bfd/
* elfxx-riscv.c (riscv_parse_add_subset): Allow old ISA spec can
recognize zicsr and zifencei.
gas/
* config/tc-riscv.c (DEFAULT_RISCV_ISA_SPEC): Updated to 20191213.
* testsuite/gas/riscv/csr-version-1p10.d: Added zicsr to -march since
the default version of i is 2.1.
* testsuite/gas/riscv/csr-version-1p11.d: Likewise.
* testsuite/gas/riscv/csr-version-1p12.d: Likewise.
* testsuite/gas/riscv/csr-version-1p9p1.d: Likewise.
* testsuite/gas/riscv/option-arch-03.d: Updated i's version to 2.1.
* testsuite/gas/riscv/option-arch-03.s: Likewise.
ld/
* testsuite/ld-riscv-elf/call-relax.d: Added zicsr to -march since
the default version of i is 2.1.
* testsuite/ld-riscv-elf/attr-merge-arch-01.d: Updated i's version to 2.1.
* testsuite/ld-riscv-elf/attr-merge-arch-01a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-01b.: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-02.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-02a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-02b.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-03.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-03a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-03b.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02.d: Added zifencei
into Tag_RISCV_arch since it is added implied when i's version is
larger than 2.1.
This patch adds support for three new SME instructions: ADDSPL,
ADDSVL and RDSVL. They behave like ADDPL, ADDVL and RDVL, but read
the streaming vector length instead of the current vector length.
Tom Tromey [Mon, 27 Dec 2021 05:03:09 +0000 (22:03 -0700)]
Use target_announce_detach in more targets
target_announce_detach was added in commit 0f48b757 ("Factor out
"Detaching from program" message printing"). There, Pedro wrote:
(For now, I left the couple targets that print this a bit differently
alone. Maybe this could be further pulled out into infcmd.c. If we
did that, and those targets want to continue printing differently,
this new function could be converted to a target method.)
It seems to me that the differences aren't very big, and in some cases
other targets handled the output a bit more nicely. In particular,
some targets will print a different message when exec_file==NULL,
rather than printing the same output with an empty string as
exec_file.
This patch incorporates the nicer output into target_announce_detach,
then changes the remaining ports to use this function.
Tom Tromey [Mon, 27 Dec 2021 04:49:48 +0000 (21:49 -0700)]
Introduce target_announce_attach
This introduces target_announce_attach, by analog with
target_announce_detach. Then it converts existing targets to use
this, rather than emitting their own output by hand.
Andrew Burgess [Thu, 6 Jan 2022 12:53:20 +0000 (12:53 +0000)]
gdb: make use add_setshow_prefix_cmd in gnu-nat.c
In gnu-nat.c we currently implement some set/show prefix commands
"manually", that is, we call add_prefix_cmd, and assign a set and show
function to each prefix command.
These set/show functions print an error indicating that the user
didn't type a complete command.
If we instead switch to using add_setshow_prefix_cmd then we can
delete the set/show functions, GDB provides some default functions,
which give a nice help style summary that lists all of the available
sub-commands, along with a one line summary of what each does.
Though this clearly changes the existing behaviour, I think this
change is acceptable as the new behaviour is more inline with other
set/show prefix commands, and the new behaviour is more informative.
Where Tom changes the set/show functions that I delete. My suggestion
is that the set/show functions still be deleted even after Tom's
patch (or instead of Tom's patch).
For testing I've build GDB on GNU/Hurd, and manually tested these
functions. I did a grep over the testsuite, and don't believe the
existing error messages are being checked for in any tests.
Tom Tromey [Sun, 26 Dec 2021 20:49:22 +0000 (13:49 -0700)]
Clean up some dead code in windows-tdep.c
windows-tdep.c checks the result of xmalloc, which isn't necessary. I
initially removed this dead check, but then went a bit further and
modified the code so that some "goto"s and explicit memory management
could be removed. Then, I added a couple of missing bounds checks.
I believe this also fixes a possible bug with a missing 0-termination
of a string. I am not certain, but that is why I think the existing
code allocates a buffer that is 1 byte too long -- but then it fails
to set this byte to 0.
Tom Tromey [Wed, 5 Jan 2022 17:42:25 +0000 (10:42 -0700)]
Avoid crash in language_info
language_info calls:
show_language_command (NULL, 1, NULL, NULL);
... "knowing" that show_language_command does not use its ui_file
parameter. However, this was changed in commit 7514a661
("Consistently Use ui_file parameter to show callbacks").
This patch changes language_info to pass a ui_file.
It took a while to write the test -- this function is only called when
'verbose' is on and when switching the "expected" language in auto
mode.
Tom Tromey [Thu, 6 Jan 2022 14:34:44 +0000 (07:34 -0700)]
Fix some failures in langs.exp
langs.exp currently has some fails for me because the stack trace
includes full paths to the source files.
FAIL: gdb.base/langs.exp: up to foo in langs.exp
FAIL: gdb.base/langs.exp: up to cppsub_ in langs.exp
FAIL: gdb.base/langs.exp: up to fsub in langs.exp
This fixes the failures by making the filename regexps a bit more lax.
Jan Beulich [Thu, 6 Jan 2022 13:19:56 +0000 (14:19 +0100)]
x86: drop NoAVX insn attribute
To avoid issues like that addressed by 6e3e5c9e4181 ("x86: extend SSE
check to PCLMULQDQ, AES, and GFNI insns"), base the check on opcode
attributes and operand types.
Jan Beulich [Thu, 6 Jan 2022 13:18:54 +0000 (14:18 +0100)]
x86: drop some "comm" template parameters
As already indicated in a remark when introducing these templates, the
"commutative" attribute is ignored for legacy encoding templates. Hence
it is possible to shorten a number of templates by specifying C directly
rather than through a template parameter. I think this helps readability
a bit.
Jan Beulich [Thu, 6 Jan 2022 13:17:40 +0000 (14:17 +0100)]
x86-64: restrict PC32 -> PLT32 conversion
Neither non-64-bit code nor uses with a non-zero offset from a symbol
should be converted to PLT32, as an eventual PLT entry would not express
what was requested.
Lancelot SIX [Thu, 6 Jan 2022 11:53:29 +0000 (06:53 -0500)]
gdb: Fix copyright year in gdb/testsuite/gdb.base/inferior-clone.exp
I just realized that I forgot to update the year before pushing the
patch that created this file. Since it landed after the global
copyright year update have been done, this file’s copyright year is
updated.
Tom Tromey [Tue, 14 Dec 2021 15:46:59 +0000 (08:46 -0700)]
Change riscv_return_value to use RETURN_VALUE_ABI_PRESERVES_ADDRESS
Internally, AdaCore has a test that is equivalent to (really a direct
translation of) gdb.base/gnu_vector.exp. On 32-bit RISC-V, the
"return" part of this test fails.
Joel tracked this down to riscv_return_value returning
RETURN_VALUE_ABI_RETURNS_ADDRESS. Using
RETURN_VALUE_ABI_PRESERVES_ADDRESS is more correct here, and fixes the
bug.
I tested this for both 32- and 64-bit RISC-V using the AdaCore
internal test suite, and Andrew Burgess tested it using
gnu_vector.exp.
Tom Tromey [Thu, 30 Dec 2021 19:34:15 +0000 (12:34 -0700)]
Filtered output cleanup in expression dumping
Most of the expression-dumping code uses filtered output, but a few
functions did not. This patch cleans up these instance.
Note that this won't cause any behavior change, because the only calls
to dump_prefix_expression pass in gdb_stdlog. However, in the long
run it's easier to audit the code if the number of uses of _unfiltered
is reduced.