Relocs like PC32DBL require a right shift of the symbol value. There
is no situation where dropping symbol value bits with the right shift
is a good thing. Hence we now issue an error to detect such problems.
In the downstream ROCm GDB port, we would create multiple register
groups with duplicate names. While it did not really hurt, it certainly
wasn't the intent. And I don't think it ever makes sense to do so.
To catch these, change the assert in reggroups::add to check for
duplicate names. It's no longer necessary to check for duplicate
reggroup pointers, because adding the same group twice would be caught
by the duplicate name check.
Change-Id: Id216a58acf91f1b314d3cba2d02de73656f8851d
Approved-By: Tom Tromey <tom@tromey.com>
PR python/16324 points out that comparing a frame id to null_frame_id
can never succeed, and proposes simply removing the dead code. That
is what this patch does.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16324
The hardware watchpoint check has been updated in a couple of recent
patches. This patch updates the hardware watchpoint test in the remaining
gdb tests.
The issue is the PowerPC processors support hardware watchpoints with the
exception of Power 9. The hardware watchpoint support is disabled on
Power 9. The test skip_hw_watchpoint_tests must be used to correctly
determine if the PowerPC processor supports hardware watchpoints.
This patch fixes 6 test failures in test gdb.threads/watchpoint-fork.exp.
Test gdb.base/watch-vfork.exp runs with can-use-hw-watchpoints set to
true and false. When the test is run with can-use-hw-watchpoints set to
true, gdb just falls back to using software watchpoints. The
patch reduces the number of expected passes by 2 since because it now
only runs once with can-use-hw-watchpoints set to false.
Test gdb.mi/mi-watch.exp runs the test with argument hw and sw. If the
argument is hw and hardware watchpoints are not supported the test exits.
The number of expected passes is cut in half with the patch as it now only
runs the test using software breakpoints. Previously the pass to use
hardware watchpoints was not skipped and the test actually ran using
software watchpoints.
The following tests run the same with and without the patch. The tests
are supposed to execute the gdb command "set can-use-hw-watchpoints 0" if
the processor does not support hardware bwatchpoints. However the command
was not being executed and gdb was falling back to using software
watchpoints since the Power 9 watchpoint resource check fails. With the
patch, the tests now execute the command and the test runs using software
watchpoints as it did previously. The tests are:
gdb.base/commands.exp
gdb.base/cond-eval-mode.exp
gdb.base/display.exp
gdb.base/gdb11531.exp
gdb.base/recurse.exp
gdb.base/value-double-free.exp
gdb.base/watch-bitfields.exp
gdb.base/watch-cond-infcall.exp
gdb.base/watch-cond.exp
gdb.base/watchpoint-solib.exp
gdb.base/watchpoints.exp
The following two tests are not supported on the Power 9 system used to
test the changes. The patch does not change the tests results for these
tests:
gdb.python/py-breakpoint.exp
gdb.mi/mi-watch-nonstop.exp
With test-case gdb.base/included.exp and host board local-remote-host.exp with
tentative fix for PR29697 I run into:
...
included.c:18:10: fatal error: included.h: No such file or directory
#include "included.h"
^~~~~~~~~~~~
compilation terminated.
...
Fix this by adding the missing gdb_remote_download calls.
Likewise in a few other test-cases.
Tested on x86_64-linux.
With test-case gdb.server/no-thread-db.exp and host board local-remote-host.exp
with a tentative fix for PR29697 I run into:
...
(gdb) print foo^M
Cannot find thread-local storage for Thread 29613.29613, executable file \
$HOME/no-thread-db:^M
Remote target failed to process qGetTLSAddr request^M
(gdb) FAIL: gdb.server/no-thread-db.exp: print foo
...
The regexp in the test-case expects the full $binfile pathname, but we have
instead $HOME/no-thread-db.
Fix this by making the regexp less strict.
Tested on x86_64-linux.
With host board local-remote-host.exp and test-case
gdb.base/return-nodebug.exp, I run into:
...
Executing on host: gcc -fno-stack-protector -fdiagnostics-color=never \
-DTYPE=signed\ char -c -g -o return-nodebug-signed-char0.o \
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/return-nodebug.c \
(timeout = 300)
builtin_spawn [open ...]^M
gcc: error: char: No such file or directory
...
Avoid the quoting problem by not using spaces in the define.
Tested on x86_64-linux.
When running test-case gdb.server/file-transfer.exp with host
board local-remote-host.exp, I get:
...
Executing on host: cmp -s $outputs/gdb.server/file-transfer/file-transfer \
down-server (timeout = 300)
builtin_spawn [open ...]^M
XYZ2ZYX
FAIL: gdb.server/file-transfer.exp: compare intermediate binary file
...
The remote host and remote target cases are handled here together here in proc
test_file_transfer:
...
if {![is_remote host] && ![is_remote target]} {
set up_server [standard_output_file $up_server]
set down_server [standard_output_file $down_server]
}
...
Fix this by handling them separately.
Tested on x86_64-linux.
Update gdb/testsuite/boards/README to reflect recent commit c4c8c27263
("[gdb/testsuite] Fix host board local-remote-host-notty.exp timeouts"), which
means the board now uses a pseudo-tty, but with editing disabled.
When looking up names, GDB needs to stay within one linker namespace to
find the correct instance in case the same name is provided in more than
one namespace.
Modify svr4_iterate_over_objfiles_in_search_order() to stay within the
namespace of the current_objfile argument. If no current_objfile is
provided (i.e. it is nullptr), iterate over objfiles in the initial
namespace.
For objfiles that do not have a corresponding so_list to provide the
namespace, assume that the objfile was loaded into the initial namespace.
This would cover the main executable objfile (which is indeed loaded into
the initial namespace) as well as manually added symbol files.
Expected fails:
- gdb.base/non-lazy-array-index.exp: the expression parser may lookup
global symbols, which may result in xfers to read auxv for determining
the debug base as part of svr4_iterate_over_objfiles_in_search_order().
- gdb.server/non-lazy-array-index.exp: symbol lookup may access the
target to read AUXV in order to determine the debug base for SVR4
linker namespaces.
Known issues:
- get_symbol_address() and get_msymbol_address() search objfiles for a
'better' match. This was introduced by
4b610737f0 Handle copy relocations
to handle copy relocations but it now causes a wrong address to be
read after symbol lookup actually cound the correct symbol. This can
be seen, for example, with gdb.base/dlmopen.exp when compiled with
clang.
- gnu ifuncs are only looked up in the initial namespace.
- lookup_minimal_symbol() and lookup_minimal_symbol_text() directly
iterate over objfiles and are not aware of linker namespaces.
Update elf_gnu_ifunc_resolve_by_cache() and elf_gnu_ifunc_resolve_by_got()
to use gdbarch_iterate_over_objfiles_in_search_order() in order to
restrict the objfile traversal to the initial namespace.
In order to extend this to other namespaces, we'd need to provide context,
e.g. via an objfile inside that namespace.
There is only one use of find_quick_global_symbol_language that calls it
for the special symbol "main".
Inline the function as it is probably not correct in the general case
where we may have multiple instances of global symbols with the same name
but different languages in different libraries in different linker
namespaces.
Further, change the objfiles iteration into a call to
gdbarch_iterate_over_objfiles_in_search_order, which would only search the
initial linker namespace, where we expect "main" to be located.
I stumbled over this while reviewing all objfiles traversals with regards
to impact of linker namespaces.
Recursive grep only finds two occurrences of hppa_lookup_stub_minimal_symbol:
- the declaration in hppa-tdep.h.
- the definition in hppa-tdep.c.
There appear to be no calls to this function. Remove it.
Iterate over objfiles in search order using the objfile of the selected
block as current_objfile so the iteration can stay inside the block's
linker namespace.
Iterate over objfile in search order using the objfile of the context
block as current_objfile so the iteration can stay inside the block's
linker namespace.
When searching for standard exceptions for Ada, we lookup the minimal
symbol of each exception. With linker namespaces there can be multiple
instances in different namespaces. Collect them all.
The implementation of gdb.lookup_objfile() iterates over all objfiles and
compares their name or build id to the user-provided search string.
This will cause problems when supporting linker namespaces as the first
objfile in any namespace will be found. Instead, use
gdbarch_iterate_over_objfiles_in_search_order to only consider the
namespace of gdb.current_objfile() for the search, which defaults to the
initial namespace when gdb.current_objfile() is None.
When cleaning up after a compile command, we iterate over all objfiles and
unlink the first objfile with the same name as the one we compiled.
Since we already store a pointer to that objfile in the module and use it
to get the name we're comparing against, there's no reason to iterate, at
all. We can simply use that objfile.
This further avoids potential issues when an objfile with the same name is
loaded into a different linker namespace.
Introduce a new qXfer:libraries-svr4:read annex key/value pair
lmid=<namespace identifier>
to be used together with start and prev to provide the namespace of start
and prev to gdbserver.
Unknown key/value pairs are ignored by gdbserver so no new supports check
is needed.
Introduce a new library-list-svr4 library attribute
lmid
to provide the namespace of a library entry to GDB.
This implementation uses the address of a namespace's r_debug object as
namespace identifier.
This should have incremented the minor version but since unknown XML
attributes are ignored, anyway, and since changing the version results in
a warning from GDB, the version is left at 1.0.
When listing SVR4 shared libraries, special care has to be taken about the
first library in the default namespace as that refers to the main
executable. The load map address of this main executable is provided in
an attribute of the library-list-svr4 element.
Move that code from where we enumerate libraries inside a single namespace
to where we generate the rest of the library-list-svr4 element. This
allows us to complete the library-list-svr4 element inside one function.
There should be no functional change.
In glibc, the r_debug structure contains (amongst others) the following
fields:
int r_version:
Version number for this protocol. It should be greater than 0.
If r_version is 2, struct r_debug is extended to struct r_debug_extended
with one additional field:
struct r_debug_extended *r_next;
Link to the next r_debug_extended structure. Each r_debug_extended
structure represents a different namespace. The first r_debug_extended
structure is for the default namespace.
1. Change solib_svr4_r_map argument to take the debug base.
2. Add solib_svr4_r_next to find the link map in the next namespace from
the r_next field.
3. Update svr4_current_sos_direct to get the link map in the next namespace
from the r_next field.
4. Don't check shared libraries in other namespaces when updating shared
libraries in a new namespace.
5. Update svr4_same to check the load offset in addition to the name
6. Update svr4_default_sos to also set l_addr_inferior
7. Change the flat solib_list into a per-namespace list using the
namespace's r_debug address to identify the namespace.
Add gdb.base/dlmopen.exp to test this.
To remain backwards compatible with older gdbserver, we reserve the
namespace zero for a flat list of solibs from all namespaces. Subsequent
patches will extend RSP to allow listing libraries grouped by namespace.
This fixes PR 11839.
Co-authored-by: Lu, Hongjiu <hongjiu.lu@intel.com>
Whenever we call locate_base(), we clear info->debug_base directly before
the call. Thus, we never cache the base location as locate_base() had
intended.
Move the svr4_have_link_map_offsets() check into elf_locate_base(), inline
locate_base() at all call sites, and remove it.
Check for
warning: Corrupted shared library list
and for
Invalid cast.
warning: Probes-based dynamic linker interface failed.
Reverting to original interface.
in gdb_test_multiple.
As of commit ae89daecb1 ("x86: generalize disabling of sub-
architectures") there's no arbitrary subset of ISAs which can also be
disabled. This should have been reflected in documentation right away.
Since I failed to do so, correct this now.
AMX-TILE is a prereq to these, as already correctly expressed by
CPU_ANY_AMX_TILE_FLAGS. Express the dependency also in the reverse
("positive") direction.
I noticed one particular Ada test was failing on Fedora 34, but works
when I switch to GCC 12. This patch arranges to kfail the test when
an older compiler is used.
I tested this with GCC 11, 12, and 13. I'm going to check it in.
If you run gdbarch.py today, you'll get local modifications compared
to what's in the tree, like:
--- c/gdb/gdbarch-gen.h
+++ w/gdb/gdbarch-gen.h
@@ -315,8 +315,8 @@ extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_register
should match the address at which the breakpoint was set in the dummy
frame. */
-typedef struct frame_id (gdbarch_dummy_id_ftype) (struct gdbarch *gdbarch, frame_info_ptr this_frame);
-extern struct frame_id gdbarch_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame);
+typedef struct frame_id (gdbarch_dummy_id_ftype) (struct gdbarch *gdbarch, frame_info_ptr this_frame);
+extern struct frame_id gdbarch_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame);
extern void set_gdbarch_dummy_id (struct gdbarch *gdbarch, gdbarch_dummy_id_ftype *dummy_id);
etc.
The extra space comes from the "frame_info_ptr " param that appears in
a number of gdbarch methods in gdbarch-components.py. With the extra
space removed, running ./gdbarch.py generates the exact code that's in
the tree already.
Change-Id: If7d20b8c6b2fd9ff466142a01bd2611c9ef9f53e
While investigating PR symtab/29179, I found that one Ada test failed
because, although a certain symbol was present in the index, with the
new DWARF reader it pointed to a different CU than was chosen by
earlier versions of gdb.
This patch changes how symbol de-duplication is done, deferring the
process until the entire symbol table has been constructed. This way,
it's possible to always choose the lower-numbered CU among duplicates,
which is how gdb (implicitly) previously worked.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29179
The cooked index work changed how .gdb_index is constructed, and in
the process broke .gdb_index support. This is PR symtab/29179.
This patch partially fixes the problem. It arranges for Ada names to
be encoded in the form expected by the index code. In particular,
linkage names for Ada are emitted, including the "main" name; names
are Ada-encoded; and names are no longer case-folded, something that
prevented operator names from round-tripping correctly.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29179
The compiler will sometimes emit a linkage name for a type, like:
<1d3> DW_AT_linkage_name: (indirect string, offset: 0x106f): 11__mbstate_t
These names aren't very useful, and this patch changes the DWARF
reader so that they are ignored by the cooked index.
c-linkage-name.exp started failing with the gdb-index target board due
to an earlier patch. The problem here is that some linkage names must
be in the index -- but, based on inspection, not C++ linkage names.
This patch updates the code to exclude only these.
Since "NULL" and "0" are used to represent invalid address in function
"gdbarch_find_by_info" in "binutils-gdb/gdb/arch-utils.c", I modified
them to "nullptr".
When building with clang 15 on Ubuntu 20.04, I get:
CXX cp-name-parser.o
cp-name-parser.c.tmp:1777:9: error: variable 'cpnameyynerrs' set but not used [-Werror,-Wunused-but-set-variable]
int yynerrs;
^
/home/smarchi/src/binutils-gdb/gdb/yy-remap.h:58:18: note: expanded from macro 'yynerrs'
#define yynerrs GDB_YY_REMAP (yynerrs)
^
/home/smarchi/src/binutils-gdb/gdb/yy-remap.h:40:29: note: expanded from macro 'GDB_YY_REMAP'
#define GDB_YY_REMAP(YYSYM) GDB_YY_REMAP_1 (GDB_YY_REMAP_PREFIX, YYSYM)
^
/home/smarchi/src/binutils-gdb/gdb/yy-remap.h:39:39: note: expanded from macro 'GDB_YY_REMAP_1'
#define GDB_YY_REMAP_1(PREFIX, YYSYM) GDB_YY_REMAP_2 (PREFIX, YYSYM)
^
/home/smarchi/src/binutils-gdb/gdb/yy-remap.h:38:39: note: expanded from macro 'GDB_YY_REMAP_2'
#define GDB_YY_REMAP_2(PREFIX, YYSYM) PREFIX ## YYSYM
^
<scratch space>:45:1: note: expanded from here
cpnameyynerrs
^
This is because clang 15 warns for something like this:
int n;
n = 0;
++n;
whereas previous versions do not.
yynerrs is defined in yyparse and is there for actions to use. Since
the actions in cp-name-parser.y don't use it, we get a warning. We see
this problem on this particular .y file because it uses `%pure-parser`
[1], which makes yynerrs a local rather than a global.
I initially fixed this by using
DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE (like in commit f7aa1a5acc
("gold: Suppress "unused" variable warning on Clang")), but then I
realized we could suppress the warning in a more fine-grained way using
this in a rule:
(void) yynerrs;
[1] https://www.gnu.org/software/bison/manual/html_node/Error-Reporting-Function.html
Change-Id: I6cae7a4207c19fe1b719e2ac19be69122ebe3af1
Currently, the functions checking if the compiler is available or if a
feature is available add both board_cflags and board_ldflags.
However, functions running the tests only retrieve board_cflags. This
can lead to unexpected errors when mandaratory flags are defined in
board_ldflags and not board_cflags.
ld/ChangeLog:
* testsuite/ld-unique/unique.exp: Add board_ldflags when
linking with GCC.
* testsuite/lib/ld-lib.exp: Likewise.
Omitting predicate size specifier in vector form of {sq, uq, }{decp, incp} is deprecated and will be prohibited in a future release of the aarch64,
see https://developer.arm.com/documentation/ddi0602/2021-09/SVE-Instructions/DECP--vector---Decrement-vector-by-count-of-true-predicate-elements-.
This allows explicit size specifier, e.g. `decp z0.h, p0.h`, for predicate operand of these SVE instructions.
The existing behaviour of not requiring the specifier is preserved.
And the disasembly is with the specifier with this patch.
The GAS tests passed under our local tests.
opcodes/
* aarch64-asm.c: Modify `sve_size_hsd` encoding.
* aarch64-tbl.h (aarch64_opcode_table): Add QUALS's type OP_SVE_Vv_HSD
for decp, incp, sqdecp, sqincp, uqdecp and uqincp.
gas/
* testsuite/gas/aarch64/sve-movprfx_23.s: Update movprfx_23 testcase's
test_sametwo macro, where take the predicate size specifier.
* testsuite/gas/aarch64/sve-movprfx_23.d: Update movprfx_23 testcase's
expected disassembly.
* testsuite/gas/aarch64/sve-movprfx_23.l: Update movprfx_23 testcase's
expected assembler messages.
* testsuite/gas/aarch64/sve.s: Add sve testcase's instructions for
decp, incp, sqdecp, sqincp, uqdecp and uqincp, which take the
predicate size specifier.
* testsuite/gas/aarch64/sve.d: Update sve testcase's expected
disassembly.
Signed-off-by: CaiJingtao <caijingtao@huawei.com>
Current F_STRICT qualifier checking is enforced after the fact
rather than as part of the match. This makes it impossible to
have, e.g.:
QLF2(S_D, S_D)
QLF2(S_D, NIL)
in the same list.
opcodes/
* aarch64-opc.c (aarch64_find_best_match): Handle F_STRICT here
rather than...
(match_operands_qualifier): ...here.
These require EVEX.W=0. Use %XS to facilitate the checking, even if for
the AVX512_4VNNIW ones this is kind of an abuse (as 's' there stands for
"signed", not "single").
While there also correct the 3rd operand for the AVX512_4VNNIW entries:
Only the memory form is allowed (just like for AVX512_4FMAPS, where the
correct type is already in use).
Make %XV also print the separating blank in the VEX case, while making
it do nothing for EVEX-encoded insns. This way the AVX-VNNI entries
can be re-used for AVX512-VNNI, at the same time fixing the lack of
EVEX.W decoding.
For the AVX-VNNI ones further make sure only VEX.66 forms are actually
decoded.
This patch changes a few more uses of static_cast to use
checked_static_cast. In this patch, cast-to-references are converted
by moving the dereference outside of the cast, as checked_static_cast
only handles pointers.
I noticed recently that se_rfmci, a VLE mode instruction, was being
accepted by non-VLE cpus, and also that se_rfmci by itself in a
section did not cause SHF_PPC_VLE to be set. ie. both testcases added
by this patch fail without the changes to tc-ppc.c here.
Also, VLE, SPE2 and LSP insns were not accepted by the assembler with
-many nor were SPE2 and LSP being disassembled with -Many.
gas/
* config/tc-ppc.c (ppc_setup_opcodes): Wrap long lines. Add
vle_opcodes when PPC_OPCODE_VLE or PPC_OPCODE_ANY. Simplify
disassembler index segment checks. Add LSP and SPE2 opcodes
when PPC_OPCODE_ANY too.
(md_assemble): Correct logic adding PPC_APUINFO_VLE and
SHF_PPC_VLE.
* testsuite/gas/ppc/se_rfmci.s
* testsuite/gas/ppc/se_rfmci.d,
* testsuite/gas/ppc/se_rfmci_bad.d: New tests.
* testsuite/gas/ppc/ppc.exp: Run them.
opcodes/
* ppc-dis.c (print_insn_powerpc): Disassemble SPE2 and LSP insn
when -Many.
* ppc-opc.c (vle_opcodes <se_rfmci>): Comment.
So we had a zlib-gabi .debug_info section that increased in size with
zstd, so much so that it was better to leave the section
uncompressed. Things went horribly wrong when the section was read
again later. The section was read again off disk using the
uncompressed size. So you get the zlib section again with some
garbage at the end. Fix that particular problem by setting the
section flag SEC_IN_MEMORY. Any future read will get sec->contents.
Also, if the section is to be left uncompressed, the input
SHF_COMPRESSED flag needs to be reset otherwise objcopy will copy it
to output.
Finally, bfd_convert_section_contents needed a small update to handle
zstd compressed sections, and I've deleted bfd_cache_section_contents.
* bfd.c (bfd_convert_section_contents): Handle zstd.
* compress.c (bfd_compress_section_contents): When section
contents are uncompressed set SEC_IN_MEMORY flag,
compress_status to COMRESS_SECTION_NONE, and clear
SHF_COMPRESSED. Set SEC_IN_MEMORY for compressed contents.
(bfd_get_full_section_contents): Don't check section size
against file size when SEC_IN_MEMORY.
(bfd_cache_section_contents): Delete function.
* elf32-arm.c (elf32_arm_get_synthetic_symtab): Expand
bfd_cache_section_contents here.
* bfd-in2.h: Regenerate.
Setting SP of the next frame to the same address as the current frame
is an ugly way to stop the unwinding. A cleaner way is to rely on
the frame_unwind_stop_reason function to return UNWIND_OUTERMOST.
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>