PR gas/27217
Prior to trying to address PR gas/28888 I noticed anomalies in how
certain insns would / wouldn't be affected in similar ways.
Commit eac4eb8ecb ("Fix a problem assembling AArch64 sources when a
relocation is generated against a symbol that has a defined value") had
two copy-and-paste mistakes, passing the wrong type to
aarch64_force_reloc().
It further failed to add placeholder relocation types to that function's
block of case labels leading to a return of 1. While not of interest for
aarch64_force_relocation() (these placeholders are resolved right in
parse_operands()), calls to aarch64_force_reloc() happen before that
resolution would take place.
* config/tc-arm.c (parse_reg_list): Add handling of mixed register
types.
(reg_names): Enumerate pseudoregister according to mapped physical
register number.
(s_arm_unwind_save_pseudo): Modify function signature.
(s_arm_unwind_save_core): Likewise.
(s_arm_unwind_save_mixed): New function.
(s_arm_unwind_save): Generate register list mask to pass to nested
functions.
* testsuite/gas/arm/unwind-pacbti-m.s: Expand test for mixed
register type lists.
* testsuite/gas/arm/unwind-pacbti-m.d: Likewise.
* testsuite/gas/arm/unwind-pacbti-m-readelf.d: Likewise.
Fix changes that didn't make it into commit:
dd9cd55e99.
Fix missing -wrap on gdb_test_multiple in gdb.base/kill-after-signal.exp
that is causing regression test on x86_64-linux with taskset -c 0.
It is only ever initialized from a boolean, so it as well as related
variables' types can simply be bool and there's no masking to 32 bits
needed in set_op().
PR 29135
* nm.c (non_weak): New variable.
(filter_symbols): When non-weak is true, ignore weak symbols.
(long_options): Add --no-weak.
(usage): Mention --no-weak.
(main): Handle -W/--no-weak.
* doc/binutils.texi: Document new feature.
* NEWS: Mention the new feature.
* testsuite/binutils-all/nm.exp: Add test of new feature.
* testsuite/binutils-all/no-weak.s: New test source file.
This teaches gdb_test to forward the -prompt and -lbl options to
gdb_test_multiple.
The option parsing is done with parse_args.
As a cleanup, instead of using llength and lindex to get at the
positional arguments, use lassign, and check whether the corresponding
variable is empty.
Convert gdb.base/ui-redirect.exp and gdb.xml/tdesc-reload.exp to use
gdb_test -prompt/-lbl instead of gdb_test_multiple as examples.
Change-Id: I243e1296d32c05a421ccef30b63d43a89eaeb4a0
The AARCH64_DWARF_PAUTH_DMASK and AARCH64_DWARF_PAUTH_CMASK DWARF registers
never made their way into the aadwarf64. The following patch removes these
constants and their use.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=26295
Move testing of language unknown out of the $supported_archs loop in
gdb.base/parse_number.exp. This reduces total amount of tests from 18466 to
17744.
Tested on x86_64-linux.
Add a new script gdb/syscalls/update-linux-from-src.sh, that can be used to
generate *-linux.xml.in files from linux kernel sources, like so:
...
$ ./update-linux-from-src.sh ~/upstream/linux-stable.git
Skipping aarch64-linux.xml.in, no syscall.tbl
Generating amd64-linux.xml.in
Skipping arm-linux.xml.in, use arm-linux.py instead
Skipping bfin-linux.xml.in, no longer supported
Generating i386-linux.xml.in
Generating mips-n32-linux.xml.in
Generating mips-n64-linux.xml.in
Generating mips-o32-linux.xml.in
Generating ppc64-linux.xml.in
Generating ppc-linux.xml.in
Generating s390-linux.xml.in
Generating s390x-linux.xml.in
Generating sparc64-linux.xml.in
Generating sparc-linux.xml.in
...
Update *-linux.xml.in and *-linux.xml using linux kernel tag v5.18-rc6.
In Armv9-A SVE is mandatory, and for SVE FP16 is mandatory. This fixes a disconnect
between GCC and binutils where GCC has FP16 on by default and gas doesn't.
include/ChangeLog:
2022-05-16 Tamar Christina <tamar.christina@arm.com>
* opcode/aarch64.h (AARCH64_ARCH_V9_FEATURES): Add AARCH64_FEATURE_F16.
Compilers would put decimal numbers there, so I think we should treat
finding octal numbers the same as finding bignums - ignore them as
actually being comments of some very specific form.
Any construct which to the scrubber looks like a C preprocessor
line/file "directive" is converted to .linefile, but the amount of
checking the scrubber does is minimal (albeit it does let through only
decimal digits for the line part of the contruct). Since the scrubber
conversion is further tied to # being a line comment character, anything
which upon closer inspection turns out not to be a line/file "directive"
is supposed to be treated as a comment, i.e. ignored. Therefore we
cannot use get_absolute_expression(), as this may raise errors. Open-
code the function instead, treating everything not resulting in
O_constant as a comment as well.
Furthermore also bounds-check the parsed value. This bounds check tries
to avoid implementation defined behavior (which may be the raising of an
implementation defined signal), but for now makes the assumption that
int has less than 64 bits. The way bfd_signed_vma (which is what offsetT
aliases) is defined in bfd.h for the BFD64 case I cannot really see a
clean way of avoiding this assumption. Omitting the #ifdef, otoh, would
risk "condition is always false" warnings by compilers.
Convert get_linefile_number() to return bool at this occasion as well.
do_repeat_with_expander() already deals with the "no expander" case
quite fine, so there's really little point having two functions. What it
lacks compared with do_repeat() is a call to sb_build(), which can
simply be moved (and the then redundant sb_new() be avoided). Along with
this moving also flip if the main if()'s condition such that the "no
expander" case is handled first.
When assembling code previously pre-processed by a C compiler, long
enough comments may have been collapsed into "# <line> <file>"
constructs. If we skip these, line numbers (and possibly even file
names) will be off / wrong in both diagnostics and debug info.
First of all convert to switch(), in preparation of adding another
directive here which may not be ignored. While doing so drop dead code:
A string the first two characters of which do not match "if" also wont
match "ifdef" or "ifndef".
pr17704a_test.s is a x86_64 assembly file, but it invokes IA32 exit
syscall with "int 0x80". This causes a segfault on kernels with
CONFIG_IA32_EMULATION disabled.
gold/
* testsuite/pr17704a_test.s (_start): Invoke x86_64 exit syscall
instead of its IA32 counterpart.
After the patch to make gdb_test's question non-optional when
specified, gdb.python/py-connection.exp started failing like so:
$ make check TESTS="gdb.python/py-connection.exp" RUNTESTFLAGS="--target_board=native-gdbserver"
(gdb) PASS: gdb.python/py-connection.exp: info connections while the connection is still around
disconnect^M
Ending remote debugging.^M
(gdb) FAIL: gdb.python/py-connection.exp: kill the inferior
The problem is that "disconnect" when debugging with the native target
asks the user whether to kill the program, while with remote targets,
it doesn't.
Fix it by explicitly killing before disconnecting.
Tested with --target_board unix, native-gdbserver, and native-extended-gdbserver.
Change-Id: Icd85015c76deb84b71894715d43853c1087eba0b
gdb_test supports handling scenarios where GDB asks a question before
finishing handling some command. The full prototype of gdb_test is:
# gdb_test COMMAND PATTERN MESSAGE QUESTION RESPONSE
However, QUESTION is a question that GDB _may_ ask, not one that GDB
_must_ ask:
# QUESTION is a question GDB may ask in response to COMMAND, like
# "are you sure?"
# RESPONSE is the response to send if QUESTION appears.
If GDB doesn't raise the question, the test still passes.
I think that this is a misfeature. If GDB regresses and stops asking
a question, the testsuite won't notice. So I think that if a QUESTION
is specified, gdb_test should ensure it comes out of GDB.
Running the testsuite exposed a number of tests that pass
QUESTION/RESPONSE to GDB, but no question comes out. The previous
commits fixed them all, so this commit changes gdb_test's behavior.
A related issue is that gdb_test doesn't enforce that if you specify
QUESTION, that you also specify RESPONSE. I.e., you should pass 1, 2,
3, or 5 arguments to gdb_test, but never 4, or more than 5. Making
gdb_test detect bogus arguments actually regressed some testcases,
also all fixed in previous commits.
Change-Id: I47c39c9034e6a6841129312037a5ca4c5811f0db
gdb.base/skip.exp abuses gdb_test's support for answering a GDB
question to do this:
# With gcc 9.2.0 we jump once back to main before entering foo here.
# If that happens try to step a second time.
gdb_test "step" "foo \\(\\) at.*" "step 3" \
"main \\(\\) at .*\r\n$gdb_prompt " "step"
After a patch later in this series, gdb_test will FAIL if GDB does NOT
issue the question, so this test would start failing on older GCCs.
Switch to using gdb_test_multiple instead. There are three spots in
the file that have the same pattern, and they're actually in a
sequence of commands that is repeated those 3 times. Factor all that
out to a procedure.
I don't have gcc 9.2 handy, but I do have gcc 6.5, and that one is
affected as well, so update the comment.
Change-Id: If0a7e3cdf5191b4eec95ce0c8845c3a4d801c39e
gdb.server/connect-with-no-symbol-file.exp's connect_no_symbol_file
does:
gdb_test "file" ".*" "discard symbol table" \
{Discard symbol table from `.*'\? \(y or n\) } "y"
A following patch will make gdb_test expect the question out of GDB if
one is passed down as argument to gdb_test. With that, this test
starts failing. This is because connect_no_symbol_file is called in a
loop, and the first time around, there's a loaded file, so "file" asks
the "Discard symbol table ... ?" question, while in the following
iterations there's no file, so there's no question.
Fix this by not loading a file into GDB in the first place.
Change-Id: I810c036b57842c4c5b47faf340466b0d446d1abc
A following patch will make gdb_test error out if bogus arguments are
passed, which exposed bugs in a few testcases:
- gdb.python/py-parameter.exp, passing a spurious "1" as extra
parameter, resulting in:
ERROR: Unexpected arguments: {set test-file-param bar.txt} {The name of the file has been changed to bar.txt} {set new file parameter} 1
- gdb.python/py-xmethods.exp, a missing test message, resulting in
the next gdb_test being interpreted as message, question and
response! With the enforcing patch, this was caught with:
ERROR: Unexpected arguments: {p g.mul<char>('a')} {From Python G<>::mul.*} gdb_test {p g_ptr->mul<char>('a')} {From Python G<>::mul.*} {after: g_ptr->mul<char>('a')}
- gdb.base/pointers.exp, missing a quote.
Change-Id: I66f2db4412025a64121db7347dfb0b48240d46d4
This test is abusing the QUESTION/RESPONSE feature to send an
alternative command to GDB if the first command fails. Like so:
gdb_test "print 'scope0.c'::filelocal" \
"\\\$$decimal = 1" "print 'scope0.c'::filelocal at main" \
"No symbol \"scope0.c\" in current context.*" \
"print '$srcdir/$subdir/scope0.c'::filelocal"
So if 'scope0.c' doesn't work, we try again with
'$srcdir/$subdir/scope0.c'. I strongly suspect this is really an
obsolete test. I think that if '$srcdir/$subdir/scope0.c' works, then
'scope0.c' should have worked too, thus I'd think that if we pass due
to the question path, then it's a bug. So just remove the question
part passed to gdb_test.
Change-Id: I2acc99285f1d519284051b49693b5441fbdfe3cd
s390_insert_operand ()'s val, min and max are encoded PCRel32 values
and need to be left-shifted by 1 before being shown to the user.
Left-shifting negative values is undefined behavior in C, but the
current code does not try to prevent it, causing UBSan to complain.
Fix by casting the values to their unsigned equivalents before
shifting.
The handle_file_event function has a few unnecessary {} lexical
blocks, presumably because they were originally if blocks, and the
conditions were removed, or something along those lines.
Remove the unnecessary blocks, and reindent.
Change-Id: Iaecbe5c9f4940a80b81dbbc42e51ce506f6aafb2
gdbsupport/event-loop.cc throughout handles the case of use_poll being
true on a system where HAVE_POLL is not defined, by calling
internal_error if that situation ever happens.
Simplify this by moving the "use_poll" global itself under HAVE_POLL,
so that it's way more unlikely to ever end up in such a situation.
Then, move the code that checks the value of use_poll under HAVE_POLL
too, and remove the internal_error calls. Like, from:
if (use_poll)
{
#ifdef HAVE_POLL
// poll code
#else
internal_error (....);
#endif /* HAVE_POLL */
}
else
{
// select code
}
to
#ifdef HAVE_POLL
if (use_poll)
{
// poll code
}
else
#endif /* HAVE_POLL */
{
// select code
}
While at it, make use_poll be a bool. The current code is using
unsigned char most probably to save space, but I don't think it really
matters here.
Co-Authored-By: Youling Tang <tangyouling@loongson.cn>
Change-Id: I0dd74fdd4d393ccd057906df4cd75e8e83c1cdb4
The breakpoint c++-ification series introduced another bug in Ada --
it caused "catch exception" and related commands to fail on Windows.
The problem is that the re_set method calls the wrong superclass
method, so the breakpoint doesn't get correctly re-set when the
runtime offsets change. This patch fixes the problem.
Many test cases had a few lines in the beginning that look like:
if { condition } {
continue
}
Where conditions varied, but were mostly in the form of ![runto_main] or
[skip_*_tests], making it quite clear that this code block was supposed
to finish the test if it entered the code block. This generates TCL
errors, as most of these tests are not inside loops. All cases on which
this was an obvious mistake are changed in this patch.
cooked_index::m_start is unused and can be removed. I think this was
a leftover from a previous approach in the index finalization code,
and then when rewriting it I forgot to remove it.
Tested by rebuilding.
I noticed that gdbserver did not implement pid_to_exec_file for
Windows, while gdb did implement it. This patch moves the code to
nat/windows-nat.c, so that it can be shared. This makes the gdbserver
implementation trivial.
This changes target_pid_to_exec_file and target_ops::pid_to_exec_file
to return a "const char *". I couldn't build many of these targets,
but did examine the code by hand -- also, as this only affects the
return type, it's normally pretty safe. This brings gdb and gdbserver
a bit closer, and allows for the removal of a const_cast as well.
I noticed that corefile-run.core ends up in the 'runtest' directory.
It's better, when at all possible, for test files to end up in the
test's designated subdirectory. This patch makes this change.
This changes coffread.c to avoid re-reading minimal symbols when
possible. This only works when there are no COFF symbols to be read,
but at least for my mingw builds of gdb, this seems to be the case.
Tested using the AdaCore internal test suite on Windows. I also did
some local builds to ensure that no warnings crept in.