Commit Graph

117649 Commits

Author SHA1 Message Date
Nick Clifton
249e54204b Mention support for AMD/znver5 in GAS 2024-01-31 15:43:09 +00:00
Georg-Johann Lay
24f5deb64d PR31124: Addendum: Remove PROVIDE of __flmap_init_label, __flmap.
Supply these symbols as computed by the linker scripts, even when there are weak definitions.
PR 31124
  * scripttempl/avr.sc (__flmap, __flmap_init_label): Remove PROVIDE.
2024-01-31 11:23:20 +00:00
GDB Administrator
aef6ac7800 Automatic date update in version.in 2024-01-31 00:00:31 +00:00
Tom Tromey
a197d5f7eb Really fix Windows gdbserver segment registers
My earlier attempt to mask the segment registers in gdbserver for
Windows introduced some bugs.  That patch is here:

https://sourceware.org/pipermail/gdb-patches/2023-December/205306.html

The problem turned out to be that these fields in the Windows
'CONTEXT' type are just 16 bits, so while masking the values on read
is fine, writing the truncated values back then causes zeros to be
written to some subsequent field.

This patch cleans this up by arranging never to write too much data to
a field.

I also noticed that two register numbers here were never updated for
the 64-bit port.  This patch fixes this as well, and renames the "FCS"
register to follow gdb.

Finally, this patch applies the same treatment to windows-nat.c.

Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2024-01-30 10:18:38 -07:00
GDB Administrator
b960445a45 Automatic date update in version.in 2024-01-30 00:00:26 +00:00
Alan Modra
e175a2fc60 PR31314, chew crashing on use of uninitialized value
The "drop" call in wrap_comment already increments pc.  Defining DOCDD
in proto.str is a warning fix.

	PR 31314
	* chew.c (wrap_comment): Don't increment pc.
	* proto.str (DOCDD): Define.
2024-01-30 09:42:59 +10:30
Jose E. Marchesi
920d9f0b39 sim: bpf: remove support for ldinddw and ldabsdw instructions
This patch removes support for the two instructions above from the GNU
simulator, including the corresponding tests.  These instructions do
not really exist in BPF and are not recognized as such by the kernel
verifier.  This has now been pointed out during the standardization of
the BPF ISA.

Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
2024-01-29 22:25:19 +01:00
Lancelot SIX
878e894801 gdb: Use SYM_DOMAIN instead of DOMAIN when calling sym-domains.def
Since commit 6771fc6f1d "Use a .def file for domain_enum", the
sym-domains.def file has been introduced, and requires the user to
define the DOMAIN(x) macro.

On older systems (centos-7 with glibc-2.17 for example), this DOMAIN
macro conflicts with another macro defined in /usr/include/math.h.

Fix this conflict by changing sym-domains.def to use a macro named
SYM_DOMAIN instead of DOMAIN.

Change-Id: I679df30e2bd2f4333343f16bbd2a3511a37550a3
Approved-By: Tom Tromey <tom@tromey.com>
2024-01-29 20:20:30 +00:00
Jose E. Marchesi
34e222d3c2 bfd: restore Threading menu entry in bfd.texi
I mistakenly vandalized bfd.texi in the commit
0c45feb159 by removing an entry in the
manual menu.  This commit reverts that thunk.
2024-01-29 19:47:28 +01:00
Jose E. Marchesi
0c45feb159 bpf: there is no ldinddw nor ldabsdw instructions
There are no legacy ldind nor ldabs BPF instructions with BPF_SIZE_DW.
For some reason we were (incorrectly) supporting these.  This patch
updates the opcodes so the instructions get removed and modifies the
GAS manual and testsuite accordingly.

See discussion at
https://lore.kernel.org/bpf/110aad7a-f8a3-46ed-9fda-2f8ee54dcb89@linux.dev

Tested in bpf-uknonwn-none target, x86-64-linux-gnu host.

include/ChangeLog:

2024-01-29  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* opcode/bpf.h (enum bpf_insn_id): Remove BPF_INSN_LDINDDW and
	BPF_INSN_LDABSDW instructions.

opcodes/ChangeLog:

2024-01-29  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* bpf-opc.c (bpf_opcodes): Remove BPF_INSN_LDINDDW and
	BPF_INSN_LDABSDW instructions.

gas/ChangeLog:

2024-01-29  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* doc/c-bpf.texi (BPF Instructions): There is no indirect 64-bit
	load instruction.
	(BPF Instructions): There is no absolute 64-bit load instruction.
	* testsuite/gas/bpf/mem.s: Update test accordingly.
	* testsuite/gas/bpf/mem-be-pseudoc.d: Likewise.
	* testsuite/gas/bpf/mem-be.d: Likewise.
	* testsuite/gas/bpf/mem-pseudoc.d: Likewise.
	* testsuite/gas/bpf/mem-pseudoc.s: Likewise.
	* testsuite/gas/bpf/mem.d: Likewise.
	* testsuite/gas/bpf/mem.s: Likewise.
2024-01-29 19:22:41 +01:00
Nick Clifton
f3911963c5 Update release making documentation after 2.42 release 2024-01-29 16:11:52 +00:00
Nick Clifton
bd3828b0de Remove support for the beos file format 2024-01-29 16:07:45 +00:00
Hannes Domani
633680620b Fix backtrace limit stopping on inline frame
If you have set up a backtrace limit, and the backtrace stops
because of this in an inline frame with arguments, you get an
assertion failure:
```
(gdb) bt
(gdb) set backtrace limit 2
(gdb) bt
C:/src/repos/binutils-gdb.git/gdb/frame.c:3346: internal-error: reinflate: Assertion `m_cached_level >= -1' failed.
```

And if this one is fixed, there is another one as well:
```
(gdb) bt
C:/src/repos/binutils-gdb.git/gdb/dwarf2/loc.c:1160: internal-error: dwarf_expr_reg_to_entry_parameter: Assertion `frame != NULL' failed.
```

The reason for both of them is this kind of loop:
```
  while (get_frame_type (frame) == INLINE_FRAME)
    frame = get_prev_frame (frame);
```
Since get_prev_frame respects the backtrace limit, it will return
NULL, and from there on you can't continue.
This changes these loops to use get_prev_frame_always instead, so
you always get a non-inline frame in the end.

With this backtrace works:
```
(gdb) bt
(gdb)
```

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29865
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-01-29 15:33:01 +01:00
Nick Clifton
fff48b7cb0 Updated French translations for GOLD and LD 2024-01-29 11:32:15 +00:00
GDB Administrator
1cb2b3dfd8 Automatic date update in version.in 2024-01-29 00:00:28 +00:00
Tom Tromey
7065f0735e Document new Python and Guile constants
This documents the new Python and Guile constants introduced earlier
in this series.

Approved-By: Eli Zaretskii <eliz@gnu.org>
2024-01-28 11:19:18 -07:00
Tom Tromey
415ea5e3e5 Refine search in cp_search_static_and_baseclasses
This changes cp_search_static_and_baseclasses to only search for
types, functions, and modules.  The latter two cases were discovered
by regression testing.  I found it somewhat surprising the Fortran
name lookup ends up in this code, but did not attempt to change this.
2024-01-28 10:58:17 -07:00
Tom Tromey
6cd92f3b86 Only search for functions in rust_structop::evaluate_funcall
This changes rust_structop::evaluate_funcall to only search for
functions.
2024-01-28 10:58:17 -07:00
Tom Tromey
9edce54e75 Only search types in lookup_typename
This changes lookup_typename to only look for types.  The check for
LOC_TYPEDEF can now also be removed, because only types will appear in
TYPE_DOMAIN.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24870
2024-01-28 10:58:17 -07:00
Tom Tromey
033bc67bdb Only search types in cp_lookup_rtti_type
This changes cp_lookup_rtti_type to only search for types -- not
functions or variables.  Due to the symbol-matching hack, this could
just use SEARCH_TYPE_DOMAIN, but I think it's better to be clear; also
I hold on to some hope that perhaps the hack can someday be removed.
2024-01-28 10:58:17 -07:00
Tom Tromey
e11de080a3 Use a function-domain search in inside_main_func
This changes inside_main_func to search only for functions.
2024-01-28 10:58:17 -07:00
Tom Tromey
8068710e13 Only look for functions in expand_symtabs_for_function
This changes expand_symtabs_for_function to only look in the function
domain.
2024-01-28 10:58:17 -07:00
Tom Tromey
b63eb1f39d Only search for "main" as a function
This changes find_main_name to restrict its search to the function
domain.
2024-01-28 10:58:17 -07:00
Tom Tromey
b5c7440b44 Simplify some symbol searches in linespec.c
This simplifies some symbol searches in linespec.c.  In particular,
two separate searches here can now be combined into one, due to the
new use of flags.

Arguably the STRUCT_DOMAIN searches should perhaps not even be done.
Only C really has these, and C doesn't have member functions.
However, it seems relatively harmless -- and clearly compatible -- to
leave this in.
2024-01-28 10:58:16 -07:00
Tom Tromey
54d186cf65 Simplify some symbol searches in Ada code
This changes some of the Ada code to simplify symbol searches.  For
example, if a function is being looked for, the search is narrowed to
use SEARCH_FUNCTION_DOMAIN rather than SEARCH_VFT.  In one spot, a
search of the "struct" domain is removed, because Ada does not have a
tag domain.
2024-01-28 10:58:16 -07:00
Tom Tromey
974b36c2ae Use the new symbol domains
This patch changes the DWARF reader to use the new symbol domains.  It
also adjusts many bits of associated code to adapt to this change.

The non-DWARF readers are updated on a best-effort basis.  This is
somewhat simpler since most of them only support C and C++.  I have no
way to test a few of these.

I went back and forth a few times on how to handle the "tag"
situation.  The basic problem is that C has a special namespace for
tags, which is separate from the type namespace.  Other languages
don't do this.  So, the question is, should a DW_TAG_structure_type
end up in the tag domain, or the type domain, or should it be
language-dependent?

I settled on making it language-dependent using a thought experiment.
Suppose there was a Rust compiler that only emitted nameless
DW_TAG_structure_type objects, and specified all structure type names
using DW_TAG_typedef.  This DWARF would be correct, in that it
faithfully represents the source language -- but would not work with a
purely struct-domain implementation in gdb.  Therefore gdb would be
wrong.

Now, this approach is a little tricky for C++, which uses tags but
also enters a typedef for them.  I notice that some other readers --
like stabsread -- actually emit a typedef symbol as well.  And, I
think this is a reasonable approach.  It uses more memory, but it
makes the internals simpler.  However, DWARF never did this for
whatever reason, and so in the interest of keeping the series slightly
shorter, I've left some C++-specific hacks in place here.

Note that this patch includes language_minimal as a language that uses
tags.  I did this to avoid regressing gdb.dwarf2/debug-names-tu.exp,
which doesn't specify the language for a type unit.  Arguably this
test case is wrong.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30164
2024-01-28 10:58:16 -07:00
Tom Tromey
10d6e9413e Remove old symbol_matches_domain
Nothing calls the variant of symbol_matches_domain that accepts a
domain_enum for searching, so this patch removes it and the
corresponding symbol::matches.
2024-01-28 10:58:16 -07:00
Tom Tromey
880e58fbc2 Remove some obsolete Python constants
The Python code has exported some constants, but they are no longer
documented, and were never useful.  This patch removes them.
2024-01-28 10:58:16 -07:00
Tom Tromey
ccf41c2487 Use domain_search_flags in lookup_symbol et al
This changes lookup_symbol and associated APIs to accept
domain_search_flags rather than a domain_enum.

Note that this introduces some new constants to Python and Guile.  I
chose to break out the documentation patch for this, because the
internals here do not change until a later patch, and it seemed
simpler to patch the docs just once, rather than twice.
2024-01-28 10:58:16 -07:00
Tom Tromey
6c01521494 Use domain_search_flags in lookup_global_symbol_language
This changes quick_symbol_functions::lookup_global_symbol_language to
accept domain_search_flags rather than just a domain_enum, and fixes
up the fallout.

To avoid introducing any regressions, any code passing VAR_DOMAIN now
uses SEARCH_VFT.

That is, no visible changes should result from this patch.  However,
it sets the stage to refine some searches later on.
2024-01-28 10:58:16 -07:00
Tom Tromey
88ff5355ad Introduce "scripting" domains
The Python and Guile code exposed the internal domain constants both
as attributes of symbols and as values to pass to lookup functions.

Now, perfect backward compatibility here can't be achieved: some
symbols are going to have domain changes by the end of this series.
However, it seemed to me that we can preserve lookups using the basic
domain values.

This patch implements this by exporting the "or"-able search constants
with an extra bit set.  Then it introduces some functions to convert
such constants to domain_search_flags.  This will be used by the
Python and Guile code, so that both old- and new-style lookups will
work properly; and while preserving the idea that the domain constants
can be compared to a symbol's domain.
2024-01-28 10:58:16 -07:00
Tom Tromey
8370bcc7b7 Remove a check of VAR_DOMAIN
completion_list_add_symbol checks that the returned symbol has
VAR_DOMAIN, but also checks that its address class is LOC_BLOCK.  The
domain check is redundant -- only functions can possibly be LOC_BLOCK
-- and leaving this in place will cause a regression when combined
with a later patch in this series.  This patch preemptively removes
the redundant check.
2024-01-28 10:58:16 -07:00
Tom Tromey
c92d4de16a Replace search_domain with domain_search_flags
This patch changes gdb to replace search_domain with
domain_search_flags everywhere.  search_domain is removed.
2024-01-28 10:58:16 -07:00
Tom Tromey
25f31e1820 Add domain_search_flags
This adds a new flag enum type, domain_search_flags, which is the flag
version of domain_enum.  Nothing uses this yet, but the goal here is
to have all symbol searches and lookups use these flags.  The new
names are chosen to exactly parallel domain_enum.
2024-01-28 10:58:16 -07:00
Tom Tromey
2711578788 Add two new symbol domains
This adds two new symbol domain constants, TYPE_DOMAIN and
FUNCTION_DOMAIN.

Historically, gdb was a C debugger, and the symbol tables continue to
reflect this.  In particular, symbol domains match the C language,
with VAR_DOMAIN including variables, functions, and types.

However, other languages have other approaches to namespacing.  And,
in any case, it is often useful for other parts of gdb to be able to
distinguish between some domains at lookup time, without resorting to
examining a symbol's location -- in some situations, this sort of
filtering happens too late.

Nothing uses these new domains yet, but the idea behind the patch is
to separate symbols into more domains and then let the
language-specific parts of gdb implement their semantics in terms of
these categories.
2024-01-28 10:58:16 -07:00
Tom Tromey
6771fc6f1d Use a .def file for domain_enum
Future patches will change and reuse the names from domain_enum.  This
patch makes this less error-prone by having a single point to define
these names, using the typical gdb ".def" file.
2024-01-28 10:58:16 -07:00
Tom Tromey
d4f48c1e26 Split up a big 'if' in symtab.c
global_symbol_searcher::add_matching_symbols in symtab.c has a
gigantic 'if' statement -- 33 lines of conditional expression.  This
patch splits it up into a series of separate 'if's.
2024-01-28 10:58:16 -07:00
Tom Tromey
d4bf9040be Simplify symbol_to_info_string
Thi simplifies symbol_to_info_string, removing the 'kind' parameter
and instead having it use the symbol's domain.
2024-01-28 10:58:16 -07:00
Tom Tromey
0ff2d66b1f Remove NR_DOMAINS
NR_DOMAINS is only used for a static assert, but we no longer need it
now.  If we add too many constants to this enum, GCC will warn about
the bitfield overflow:

    error: ‘symbol::m_domain’ is too small to hold all values of ‘enum domain_enum’
2024-01-28 10:58:16 -07:00
Tom Tromey
790948cb09 Give names to unspecified types
A patch later in this series will change check_typedef to also look in
the type domain.  This change by itself caused a regression, but one
that revealed some peculiar behavior.

The regression is in nullptr_t.exp, where examining a std::nullptr_t
will change from the correct:

    typedef decltype(nullptr) std::nullptr_t;

to

    typedef void std::nullptr_t;

Right now, the DWARF reader marks all unspecified types as stub types.
However, this interacts weirdly with check_typedef, which currently
does not try to resolve types -- only struct-domain objects.

My first attempt here was to fix this by changing void types not to be
stub types, as I didn't see what value that provided.  However, this
caused another regression, because call_function_by_hand_dummy checks
for stub-ness:

  if (values_type == NULL || values_type->is_stub ())
    values_type = default_return_type;

I'm not really sure why it does this rather than check for
TYPE_CODE_VOID.

While looking into this, I found another oddity: the DWARF reader
correctly creates a type named 'decltype(nullptr)' when it seems a
DW_TAG_unspecified_type -- but it creates a symbol named "void"
instead.

This patch changes the DWARF reader to give the symbol the correct
name.  This avoids the regression.
2024-01-28 10:58:16 -07:00
Tom Tromey
13eade6a10 Fix latent bug in mdebugread.c
mdebugread.c makes a label symbol but puts it into VAR_DOMAIN.  I
think LABEL_DOMAIN is more appropriate.

I don't have a way to test this.
2024-01-28 10:58:16 -07:00
Tom Tromey
83c8b5eb33 Make nsalias.exp more reliable
nsalias.exp tries to detect a complaint that is issued when expanding
a CU.  However, the test is a bit funny in that, while gdb does
currently expand the CU and issue the complaint, it also emits this
error:

    No symbol "N100" in current context.

This series will change gdb such that this CU is not expanded -- which
makes sense, the symbol in question doesn't actually match the lookups
that are done.

So, to make the test more robust, a direct request to expand symtabs
is done instead.
2024-01-28 10:58:16 -07:00
Tom Tromey
17841991c3 Fix latent bug in DW_TAG_entry_point handling
A DW_TAG_entry_point symbol inherits its extern/static property from
the enclosing subroutine.  This is encoded in new_symbol -- but the
cooked indexer does not agree.
2024-01-28 10:58:15 -07:00
Tom Tromey
9423d61e97 Small cleanup in DWARF reader
I noticed a couple of spots in dwarf/read.c:new_symbol that call
add_symbol_to_list.  However, this function is generally written to
set list_to_add, and then have a single call to add_symbol_to_list at
the end.  This patch cleans up this discrepancy.

Note that new_symbol is overlong and should probably be split up.
2024-01-28 10:58:15 -07:00
Tom Tromey
48f7f3751e Fix bug in cooked index scanner
Testing this entire series pointed out that the cooked index scanner
disagrees with new_symbol about certain symbols.  In particular,
new_symbol has this comment:

    Ada and Fortran subprograms, whether marked external or
    not, are always stored as a global symbol, because we want

This patch updates the scanner to match.

I don't know why the current code does not cause failures.

It's maybe worth noting that incremental CU expansion -- creating
symtabs directly from the index -- would eliminate this sort of bug.
2024-01-28 10:58:15 -07:00
GDB Administrator
3dfc29463a Automatic date update in version.in 2024-01-28 00:00:08 +00:00
GDB Administrator
e0f17bb4c7 Automatic date update in version.in 2024-01-27 00:00:30 +00:00
Indu Bhagat
91cdbed4d7 gas: scfi: untraceable control flow should be a hard error
PR gas/31284

Currently, if an indirect jump is seen, GCFG (a CFG of ginsns) cannot be
created, and the SCFI machinery bails out with a warning:
  "Warning: Untraceable control flow for func 'foo'; Skipping SCFI"

It is, however, better suited if this is a hard error.  Change it to a
hard error.  Also change the message to skip mentioning "SCFI", because
the error itself may also useful when ginsns are used for other passes
(distinct from SCFI) involving GCFG, like a pass to detect if there is
unreachable code.  Hence, simply say:
  "Error: untraceable control flow for func 'foo'"

gas/
PR gas/31284
	* ginsn.c (ginsn_data_end): Use as_bad instead of as_warn.

gas/testsuite/
PR gas/31284
	* gas/scfi/x86_64/ginsn-cofi-1.l: Adjust to the expected output
	in case of errors.
	* gas/scfi/x86_64/scfi-unsupported-cfg-1.l: Error not Warning.
2024-01-26 11:31:35 -08:00
Indu Bhagat
16cbeae1b2 x86: testsuite: scfi: adjust COFI testcase
The testcase for change of flow instructions in its current shape is not
doing much: it checks that SCFI issues an appropriate warning.  The same
warning is covered by another testcase (scfi-unsupported-cfg-1); It is
better to test the ginsn translation instead, for these 'change of flow
instructions'.

gas/testsuite/
	* gas/scfi/x86_64/scfi-cofi-1.s: Moved to...
	* gas/scfi/x86_64/ginsn-cofi-1.s: ...here.
	* gas/scfi/x86_64/scfi-x86-64.exp: Adjust tests.
	* gas/scfi/x86_64/scfi-cofi-1.d: Removed.
	* gas/scfi/x86_64/scfi-cofi-1.l: Removed.
	* gas/scfi/x86_64/ginsn-cofi-1.l: New test.
2024-01-26 11:31:17 -08:00
H.J. Lu
1b06334552 elf: Rename is_standard_elf to uses_elf_em
Rename is_standard_elf to uses_elf_em for targets which use elf.em.

binutils/

	PR ld/31289
	* testsuite/lib/binutils-common.exp (is_standard_elf): Renamed
	to ...
	(uses_elf_em): This.

ld/

	PR ld/31289
	* testsuite/ld-elf/fatal-warnings-2a.d: Replace is_standard_elf
	with uses_elf_em.
	* testsuite/ld-elf/fatal-warnings-2b.d: Likewise.
	* testsuite/ld-elf/fatal-warnings-3a.d: Likewise.
	* testsuite/ld-elf/fatal-warnings-3b.d: Likewise.
	* testsuite/ld-elf/fatal-warnings-4a.d: Likewise.
	* testsuite/ld-elf/fatal-warnings-4b.d: Likewise.
2024-01-26 07:32:03 -08:00