]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
3 months agoRISC-V: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:17:12 +0000 (08:17 +0100)] 
RISC-V: use is_end_of_stmt()

... instead of open-coding it.

3 months agopru: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:16:53 +0000 (08:16 +0100)] 
pru: use is_end_of_stmt()

... instead of open-coding it.

3 months agoPPC: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:16:40 +0000 (08:16 +0100)] 
PPC: use is_end_of_stmt()

... instead of open-coding it.

3 months agoMMIX: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:14:59 +0000 (08:14 +0100)] 
MMIX: use is_end_of_stmt()

... instead of open-coding it.

3 months agoMIPS: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:14:49 +0000 (08:14 +0100)] 
MIPS: use is_end_of_stmt()

... instead of open-coding it.

3 months agoMicroBlaze: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:14:38 +0000 (08:14 +0100)] 
MicroBlaze: use is_end_of_stmt()

... instead of open-coding it.

3 months agoM68k: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:14:23 +0000 (08:14 +0100)] 
M68k: use is_end_of_stmt()

... instead of open-coding it.

3 months agoM68HC1x: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:14:11 +0000 (08:14 +0100)] 
M68HC1x: use is_end_of_stmt()

... instead of open-coding it. With this there's no need for op_end (and
hence op_start) to be other than pointer to plain char. Which in turn
eliminates the need for several questionable casts.

3 months agoIQ2000: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:13:50 +0000 (08:13 +0100)] 
IQ2000: use is_end_of_stmt()

... instead of open-coding it.

3 months agoLoongArch: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:13:37 +0000 (08:13 +0100)] 
LoongArch: use is_end_of_stmt()

... instead of open-coding it.

3 months agoHP-PA: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:13:23 +0000 (08:13 +0100)] 
HP-PA: use is_end_of_stmt()

... instead of open-coding it.

3 months agodlx: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:11:33 +0000 (08:11 +0100)] 
dlx: use is_end_of_stmt()

... instead of open-coding it.

3 months agoC-Sky: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:11:11 +0000 (08:11 +0100)] 
C-Sky: use is_end_of_stmt()

... instead of open-coding it.

3 months agocris: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:10:57 +0000 (08:10 +0100)] 
cris: use is_end_of_stmt()

Fix use of is_end_of_line[] directly instead of through the
is_end_of_stmt() macro.

3 months agoaarch64: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:10:46 +0000 (08:10 +0100)] 
aarch64: use is_end_of_stmt()

... instead of open-coding it.

3 months agoArm: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:10:35 +0000 (08:10 +0100)] 
Arm: use is_end_of_stmt()

... instead of open-coding it. This also fixes an array underrun issue:
The wrong casting to plain int could have yielded negative values when
plain char is a signed type.

3 months agoAlpha: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:10:23 +0000 (08:10 +0100)] 
Alpha: use is_end_of_stmt()

... instead of open-coding it. Note that writes to the array need to be
left alone; they can only be converted when the array is folded into
lex_type[].

3 months agoMach-O: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:08:44 +0000 (08:08 +0100)] 
Mach-O: use is_end_of_stmt()

... instead of open-coding it.

3 months agoELF: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:08:25 +0000 (08:08 +0100)] 
ELF: use is_end_of_stmt()

... instead of open-coding it.

3 months ago{,E}COFF: use is_end_of_stmt()
Jan Beulich [Fri, 7 Mar 2025 07:08:14 +0000 (08:08 +0100)] 
{,E}COFF: use is_end_of_stmt()

... instead of open-coding it. Convert a variable's type to plain char
then as well, as that's what it's really holding (and how it's used
everywhere else).

3 months agogprof: Update PR gprof/32764 test
H.J. Lu [Fri, 7 Mar 2025 05:55:06 +0000 (13:55 +0800)] 
gprof: Update PR gprof/32764 test

1. Remove gmon.out first before generating it in the configure check.
2. Make tst-gmon-gprof.out depend on the gprof binary.
3. Check that gmon.out is non-empty.
4. Don't include <sys/cdefs.h> in tst-gmon.c.

PR gprof/32764
* configure.ac: Remove gmon.out first.
* configure: Regenerated.
* testsuite/Makefile.am (tst-gmon-gprof.out): Depend on
$(GPROF).
* testsuite/Makefile.in: Regenerated.
* testsuite/tst-gmon-gprof.sh: Check that gmon.out is non-empty.
* testsuite/tst-gmon.c: Don't include <sys/cdefs.h>.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 months agoRISC-V: Go PLT for CALL/JUMP/RVC_JUMP if `h->plt.offset' isn't -1
Nelson Chu [Sat, 8 Feb 2025 08:33:37 +0000 (16:33 +0800)] 
RISC-V: Go PLT for CALL/JUMP/RVC_JUMP if `h->plt.offset' isn't -1

I got an request about the undefined behaviors, considering the following case,

$ cat test.c
void main ()
{
  foo();
}
$ cat lib.h
void foo(void);
$ riscv64-unknown-linux-gnu-gcc test.c
riscv64-unknown-linux-gnu/bin/ld: /tmp/ccRO8fJl.o: in function `main':
test.c:(.text+0x8): undefined reference to `foo'
collect2: error: ld returned 1 exit status
$ riscv64-unknown-linux-gnu-gcc test.c -Wl,--unresolved-symbols=ignore-in-object-files
$ qemu-riscv64 a.out
Segmentation fault (core dumped)

Testing with x86 and aarch64, they won't get the segfault since they go plt
for the undefined foo symbol.  So, after applying this patch, I can get the
following too,

$ qemu-riscv64 a.out
a.out: symbol lookup error: a.out: undefined symbol: foo

The change of this patch should only affect the call behavior, which refer
to an undefined (weak) symbol, when building an dynamic executable.  I think
the pic/pie behavior won't be affected as usual.

3 months agogprof: Copy a simple test from glibc
H.J. Lu [Thu, 6 Mar 2025 22:42:18 +0000 (06:42 +0800)] 
gprof: Copy a simple test from glibc

Copy a simple gprof test from glibc to test the basic gprof functionality.

1. Tested natively on Linux/x86-64 and Linux/i686.
2. Tested for the x86_64-solaris cross target without cross-compiler.
3. Tested for the aarch64-linux-gnu cross target with cross-compiler.

PR gprof/32764
* Makefile.am (SUBDIRS): Add testsuite
* configure.ac (AC_CONFIG_FILES): Removed.
(AC_OUTPUT): Add Makefile testsuite/Makefile
po/Makefile.in:po/Make-in.
(AM_CONDITIONAL): Add NATIVE.
* Makefile.in: Regenerated.
* configure: Likewise.
* testsuite/Makefile.am: New file.
* testsuite/tst-gmon-gprof.sh: Likewise.
* testsuite/tst-gmon.c: Likewise.
* testsuite/Makefile.in: Generated.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 months agoAutomatic date update in version.in
GDB Administrator [Fri, 7 Mar 2025 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 months agoRe: ld: Add a test for PR ld/25237
Alan Modra [Thu, 6 Mar 2025 22:45:29 +0000 (09:15 +1030)] 
Re: ld: Add a test for PR ld/25237

Delete the test.  It doesn't make sense to check a linker hack for
a meaningless p_offset.

3 months ago[gdb] Fix typos in NEWS
Tom de Vries [Thu, 6 Mar 2025 22:21:54 +0000 (23:21 +0100)] 
[gdb] Fix typos in NEWS

Fix typos:
...
mainenance ==> maintenance
epilgoue ==> epilogue
commnds ==> commands
readibility ==> readability
informations ==> information
throwed ==> threw
compiletime ==> compile time
namepace ==> namespace
reqired ==> required
explicity ==> explicitly
reqired ==> required
...

3 months ago[gdb/python] Fix typos
Tom de Vries [Thu, 6 Mar 2025 22:21:54 +0000 (23:21 +0100)] 
[gdb/python] Fix typos

Fix typos:
...
gdb/python/py-framefilter.c:749: indention ==> indentation
gdb/python/py-framefilter.c:837: indention ==> indentation
gdb/python/py-lazy-string.c:35: sting ==> string
gdb/python/py-progspace.c:119: Retun ==> Return
gdb/python/py-progspace.c:139: Retun ==> Return
...

3 months ago[gdb/python] Fix typos in lib
Tom de Vries [Thu, 6 Mar 2025 22:21:54 +0000 (23:21 +0100)] 
[gdb/python] Fix typos in lib

Fix typos:
...
gdb/python/lib/gdb/disassembler.py:84: dissables ==> disables
gdb/python/lib/gdb/command/xmethods.py:40: experession ==> expression
...

3 months ago[gdb/guile] Fix typos
Tom de Vries [Thu, 6 Mar 2025 22:21:54 +0000 (23:21 +0100)] 
[gdb/guile] Fix typos

Fix typos:
...
gdb/guile/scm-lazy-string.c:41: sting ==> string
gdb/guile/lib/gdb/iterator.scm:65: satify ==> satisfy
...

3 months ago[gdb/doc] Fix typos in gdb.texinfo
Tom de Vries [Thu, 6 Mar 2025 22:21:54 +0000 (23:21 +0100)] 
[gdb/doc] Fix typos in gdb.texinfo

Fix typos:
...
preprend -> prepend
wth -> with
Connnections -> Connections
...

3 months ago[gdb/doc] Fix typos in annotate.texinfo
Tom de Vries [Thu, 6 Mar 2025 22:21:54 +0000 (23:21 +0100)] 
[gdb/doc] Fix typos in annotate.texinfo

Fix typos:
...
Dependant ==> Dependent
...

3 months ago[gdb/doc] Fix typos in python.texi
Tom de Vries [Thu, 6 Mar 2025 21:41:32 +0000 (22:41 +0100)] 
[gdb/doc] Fix typos in python.texi

Fix typos:
...
atribute ==> attribute
...

3 months ago[gdb/nat] Fix typos
Tom de Vries [Thu, 6 Mar 2025 21:41:32 +0000 (22:41 +0100)] 
[gdb/nat] Fix typos

Fix typos:
...
exising ==> existing
afer ==> after
...

3 months ago[gdb/tui] Fix typos
Tom de Vries [Thu, 6 Mar 2025 21:41:32 +0000 (22:41 +0100)] 
[gdb/tui] Fix typos

Fix typos:
...
gdb/tui/tui.c:64: releated ==> related
gdb/tui/tui-io.c:50: releated ==> related
...

3 months ago[gdb/cli] Fix typos
Tom de Vries [Thu, 6 Mar 2025 21:41:32 +0000 (22:41 +0100)] 
[gdb/cli] Fix typos

Fix typos:
...
gdb/cli/cli-utils.h:85: fuction ==> function
gdb/cli/cli-decode.c:2457: Ambigous ==> Ambiguous
...

3 months ago[gdb] Fix typos in gdbarch_components.py
Tom de Vries [Thu, 6 Mar 2025 21:41:32 +0000 (22:41 +0100)] 
[gdb] Fix typos in gdbarch_components.py

Fix typos in gdbarch_components.py:
...
tranformations ==> transformations
charater ==> character
Noe -> Note
...
and regenerate gdb/gdbarch-gen.h.

3 months agoUpdate ada_add_block_renamings for compiler changes
Tom Tromey [Wed, 23 Oct 2024 17:17:51 +0000 (11:17 -0600)] 
Update ada_add_block_renamings for compiler changes

With the hierarchical name patches to GNAT, ada_add_block_renamings
must now be updated as well -- the comment there about the supported
forms of DW_TAG_imported_declaration is no longer correct, and now
full names must sometimes be constructed during the lookup process.

3 months agoAdd support for hierarchical Ada names
Tom Tromey [Fri, 6 Sep 2024 20:38:44 +0000 (14:38 -0600)] 
Add support for hierarchical Ada names

In the near future, GNAT will start emitting DWARF names in a more
standard way -- specifically, the package structure will be indicated
by nested DW_TAG_module DIEs and a given entity will be nested in its
package and only have a simple name.

This patch changes gdb to understand this style of naming, while still
supporting the existing GNAT output.

A few special cases are needed.  I've commented them.

The name-computing code for the full DWARF reader is very complicated
-- much too complicated, in my opinion.  There are already several
bugs in bugzilla about this (search for "physname"... but there are
others as well), so I haven't filed any new ones.

When I started this project, I thought it would solve some memory
overuse issues we sometimes see from how the index-sharding code
interacts with the GNAT-specific post-pass.  However, to my surprise,
the Ada code in gdb relies on some details of symbol naming, and so
I've had to add code here to synthesize "linkage" names in some cases.
This is unfortunate, but I think can eventually be fixed; I will file
a bug to track this issue.

3 months agoAdd "Ada linkage" mode to cooked_index_entry::full_name
Tom Tromey [Tue, 3 Sep 2024 18:53:07 +0000 (12:53 -0600)] 
Add "Ada linkage" mode to cooked_index_entry::full_name

Unfortunately, due to some details of how the Ada support in gdb
currently works, the DWARF reader will still have to synthesize some
"full name" entries after the cooked index has been constructed.

You can see one particular finding related to this in:

    https://sourceware.org/bugzilla/show_bug.cgi?id=32142

This patch adds a new flag to cooked_index_entry::full_name to enable
the construction of these names.

I hope to redo this part of the Ada support eventually, so that this
code can be removed and the full-name entries simply not created.

3 months agoStore new Ada entries in cooked_index_shard::m_entries
Tom Tromey [Wed, 12 Jun 2024 17:24:27 +0000 (11:24 -0600)] 
Store new Ada entries in cooked_index_shard::m_entries

handle_gnat_encoded_entry might create synthetic cooked index entries
for Ada packages.  These aren't currently kept in m_entries, but it
seems to me that they should be, particularly because a forthcoming
GNAT will emit explicit DW_TAG_module for these names -- with this
change, the indexes will be roughly equivalent regardless of which
compiler was used.

3 months agoHandle DW_TAG_module for Ada
Tom Tromey [Fri, 6 Sep 2024 18:24:41 +0000 (12:24 -0600)] 
Handle DW_TAG_module for Ada

This updates read_module_type to turn DW_TAG_module into a
TYPE_CODE_NAMESPACE when the CU represents Ada code.

Note that the GNAT that generates this isn't generally available yet
and so this shouldn't have an impact on current code.

3 months agoAdd "synthetic" marker for index entries
Tom Tromey [Tue, 10 Sep 2024 18:54:19 +0000 (12:54 -0600)] 
Add "synthetic" marker for index entries

Currently, gdb will synthesize DW_TAG_module entries for Ada names.
These entries are treated specially by the index writer,

When GNAT starts emitting DW_TAG_module, the special case will be
incorrect, because there will be non-synthetic DW_TAG_module entries
in the index.

This patch arranges to mark the synthetic entries and changes the
index writer to follow.

3 months agoUse DW_TAG_module for Ada
Tom Tromey [Wed, 12 Jun 2024 14:26:05 +0000 (08:26 -0600)] 
Use DW_TAG_module for Ada

In GCC we decided to use DW_TAG_module to represent Ada packages, so
make this same decision in gdb.  This also updates tag_matches_domain
to handle this case.

3 months agoUse dwarf2_full_name when computing type names
Tom Tromey [Fri, 6 Sep 2024 18:24:06 +0000 (12:24 -0600)] 
Use dwarf2_full_name when computing type names

This changes a few spots in the DWARF reader to use dwarf2_full_name
when computing the name of a type.  This gives the correct name when a
type is nested in a namespace.  This oddity probably wasn't noticed
before because some of the types in question are either normally
anonymous in C++ (e.g, array type) or do not appear in a namespace
(base type).

3 months agoCompare unqualified names in ada_identical_enum_types_p
Tom Tromey [Mon, 26 Aug 2024 18:54:17 +0000 (12:54 -0600)] 
Compare unqualified names in ada_identical_enum_types_p

With the coming changes to GNAT, gdb must compare the unqualified
names of two enum types.

Currently, GNAT will fully-qualify enumeration constant names, so for
instance one might see "enum_with_gap__lit4" as the name.

GNAT also may emit a copy of an enumeration type when a newtype is
involved.  E.g., in the arr_acc_idx_w_gap.exp test case, this can
occur for the base type of this subtype:

   type Enum_Subrange is new Enum_With_Gaps range Lit1 .. Lit3;

(Note that the base type of this subrange is anonymous.)

With some forthcoming changes to GNAT, these names will no longer be
qualified -- and because the newtype is anonymous, they can't be
identically qualified.  But, in gdb we still want "lit4" to resolve
without ambiguity in this scenario.

The fix is to change ada_identical_enum_types_p to compare unqualified
enum names.  This will work correctly with both variants of the
compiler, and with -fgnat-encodings=all as well.

3 months agoUse ada_identical_enum_types_p in ada_atr_enum_rep
Tom Tromey [Mon, 26 Aug 2024 17:10:54 +0000 (11:10 -0600)] 
Use ada_identical_enum_types_p in ada_atr_enum_rep

With the coming changes to GNAT, we may see two distinct but
equivalent enum types in the DWARF.  In this case, it's better to use
ada_identical_enum_types_p rather than types_equal when comparing
these types... something that matters when using 'Enum_Rep.

3 months agoFixes to gdb.ada/fun_overload_menu.exp
Tom Tromey [Wed, 28 Aug 2024 14:06:58 +0000 (08:06 -0600)] 
Fixes to gdb.ada/fun_overload_menu.exp

This patch applies a few fixes to gdb.ada/fun_overload_menu.exp.

It adds some comments to the source and uses this to extract line
numbers.  This is used to ensure that two otherwise-equivalent results
are in fact different, so that the test really checks that the result
is correct.

It also changes the test_menu proc to accept a list of possible
results.  This lets the test work regardless of the order in which the
menu items are presented by gdb.

Finally, like an earlier patch, it changes the test to optionally
accept unqualified names from gdb.

3 months agoAllow multiple locations in homonym.exp
Tom Tromey [Thu, 5 Sep 2024 17:57:03 +0000 (11:57 -0600)] 
Allow multiple locations in homonym.exp

With some forthcoming changes to GNAT, the two Get_Value functions in
this test case will end up with the same name (with the current GNAT,
one ends up with a "__2" suffix).  This change will cause one test to
set multiple breakpoints; this patch changes the test to work with
either version of the compiler.

3 months agoFix type name in ptype-o.exp
Tom Tromey [Thu, 12 Sep 2024 14:18:10 +0000 (08:18 -0600)] 
Fix type name in ptype-o.exp

The "Rec" type in ptype-o.exp is currently named "prog__rec" by the
compiler.  However, with my changes to GNAT, the type will no longer
have a prefix, as it is local to a procedure.

Changing this to just use "rec" works fine with the new compiler, but
then fails with older compilers.  To allow correct operation with both
compilers, this patch simply moves the type into a new package.  This
doesn't affect the meaning of the test, which is just ensuring that
ptype/o works in a certain case.

Note that the more obvious fix of just using "ptype/o rec" does not
work with the current GNAT.  I haven't investigated this but I did
file a bug to track it:

    https://sourceware.org/bugzilla/show_bug.cgi?id=32169

3 months agoAllow unqualified names in Ada tests
Tom Tromey [Fri, 23 Aug 2024 19:08:42 +0000 (13:08 -0600)] 
Allow unqualified names in Ada tests

Currently, when a type is declared in a subprogram that isn't part of
a package, gdb will give this type a qualified name.  E.g., in the
program for gdb.ada/arr_arr.exp:

    procedure Foo is
       type Array2_First is array (24 .. 26) of Integer;

gdb will name this type 'foo.array2_first'.

However, with some coming changes to GNAT (and with the remainder of
this series applied as well), this will no longer happen.  Instead,
such types will be given their local name.  IMO this makes more sense
anyway.

This patch updates most of the Ada tests to allow either form in the
spots where it matters.  Both are accepted so that the tests continue
to work with older versions of GNAT.  (A few tests are handled in
separate patches; this patch only contains the straightforward
changes.)

3 months agoFix latent crash in ada_variant_discrim_name
Tom Tromey [Mon, 9 Sep 2024 17:29:12 +0000 (11:29 -0600)] 
Fix latent crash in ada_variant_discrim_name

ada_variant_discrim_name does this:

  for (discrim_end = name + strlen (name) - 6; discrim_end != name;

If NAME is too short, this will construct an invalid pointer, perhaps
causing a crash.

This patch arranges to check the length first.

3 months agoAllow for anonymous Ada enumeration types
Tom Tromey [Mon, 9 Sep 2024 16:57:56 +0000 (10:57 -0600)] 
Allow for anonymous Ada enumeration types

With some forthcoming changes to GNAT, gdb might see a nameless enum
in ada_resolve_enum, causing a crash.  This patch allows an anonymous
enum type to be considered identical to a named type when the contents
are identical.

3 months agoAdd a quit to maint_print_all_sections
Tom Tromey [Tue, 4 Mar 2025 13:48:47 +0000 (06:48 -0700)] 
Add a quit to maint_print_all_sections

If you have many sections, "maint print sections" can take a very long
time (due to a bug).  If you happen to "c" at the pagination prompt,
this can't be interrupted.  This patch adds a QUIT to the loop to at
least allow interruption.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32758
Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
3 months ago[gdbserver] Drop abbreviations in gdbserver/xtensa-xtregs.cc
Tom de Vries [Thu, 6 Mar 2025 20:08:57 +0000 (21:08 +0100)] 
[gdbserver] Drop abbreviations in gdbserver/xtensa-xtregs.cc

In gdbserver/xtensa-xtregs.cc, there's a table:
...
const xtensa_regtable_t  xtensa_regmap_table[] = {
  /* gnum,gofs,cpofs,ofs,siz,cp, dbnum,  name */
  {   44, 176,   0,   0,  4, -1, 0x020c, "scompare1" },
  { 0 }
};
...
on which codespell triggers:
...
$ codespell --config ./gdbserver/setup.cfg gdbserver
gdbserver/xtensa-xtregs.cc:34: siz ==> size, six
...

Fix this by laying out the table in vertical fashion, and using the full field
names instead of the abbreviations ("size" instead of "siz", "offset" instead
of "ofs", etc).

Approved-By: Simon Marchi <simon.marchi@efficios.com>
3 months agoUse 'const' in some gdbarch methods
Tom Tromey [Thu, 6 Mar 2025 17:09:38 +0000 (10:09 -0700)] 
Use 'const' in some gdbarch methods

This changes a couple of gdbarch methods to use 'const' for an
"asymbol *" parameter.  These methods shouldn't be modifying the
underlying symbol in the BFD.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
3 months ago[gdbserver] Add codespell section in setup.cfg
Tom de Vries [Thu, 6 Mar 2025 16:57:28 +0000 (17:57 +0100)] 
[gdbserver] Add codespell section in setup.cfg

Add a codespell section in new config file gdbserver/setup.cfg, similar to the
one in gdbsupport/setup.cfg.

There's just one item left:
...
$ codespell --config ./gdbserver/setup.cfg gdbserver
gdbserver/xtensa-xtregs.cc:34: siz ==> size, six
...

3 months agogdb/dwarf: remove unnecessary `this->` in read.c
Simon Marchi [Wed, 5 Mar 2025 21:10:10 +0000 (16:10 -0500)] 
gdb/dwarf: remove unnecessary `this->` in read.c

I like using `this->` when it's unclear that the method or field
accessed is within the current class, but when accessing a private
member prefixed with `m_`, it's unnecessary, as the prefix makes it
clear.  Remove some instances of it (some coming from the previous
patch, other pre-existing) to de-clutter the code a bit.

Change-Id: Ia83d0bce51d222fa3ac3d756d50170ec6ed12b94
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: make all fields of cutu_reader private
Simon Marchi [Wed, 5 Mar 2025 21:10:09 +0000 (16:10 -0500)] 
gdb/dwarf: make all fields of cutu_reader private

Make all fields of cutu_reader private, then add getters for whatever
needs to be accessed outside of cutu_reader.  This should help spot
what's used by cutu_reader itself, and what is used by others.

Change-Id: I71cb73fffa5d70cc9c7fc68bf74db937e84c2db1
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: pass dwarf2_cu instead of cutu_reader to two functions
Simon Marchi [Wed, 5 Mar 2025 21:10:08 +0000 (16:10 -0500)] 
gdb/dwarf: pass dwarf2_cu instead of cutu_reader to two functions

These functions don't need to receive a cutu_reader, they only use it to
obtain the contained dwarf2_cu, so change them to accept a dwarf2_cu.
This helps reduce the creep of cutu_reader a little bit.

Change-Id: Iebb3c4697a4aec638b47423b3ac59077d4fa5090
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: move a bunch of DIE-reading functions to cutu_reader
Simon Marchi [Wed, 5 Mar 2025 21:10:07 +0000 (16:10 -0500)] 
gdb/dwarf: move a bunch of DIE-reading functions to cutu_reader

With the hope of organizing things better and spotting patterns that
could lead to simplification, move all these functions to be methods of
cutu_reader.  At least, this gives a good picture of what the entry
points for DIE and attribute reading are, by looking at what methods are
public.

Right now, my vague understanding of cutu_reader is that it does 3
things:

 - it provides means to navigate and read the DIE tree, abstracting
   things like whether the real content is in a DWO file or not
 - it builds a dwarf2_cu object, for its own use but also for the use of
   the caller
 - it fills in missing details in the passed in dwarf2_per_cu

In the future, I'd like to separate those concerns.  I think that
cutu_reader could retain the first one of those concerns, while the
other two could be done by other classes or functions, perhaps using
cutu_reader under the hood.

Change-Id: I04e0d6c864bbc09c7071ac8e9493e1e54c093d68
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: add empty lines in cutu_reader::read_cutu_die_from_dwo comment
Simon Marchi [Wed, 5 Mar 2025 21:10:06 +0000 (16:10 -0500)] 
gdb/dwarf: add empty lines in cutu_reader::read_cutu_die_from_dwo comment

I find it much more readable this way, with one idea per paragraph.

Change-Id: Ib31b410867c8444e0f3200681881f54f1b8ebea8
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: make init_cu_die_reader a method of cutu_reader
Simon Marchi [Wed, 5 Mar 2025 21:10:05 +0000 (16:10 -0500)] 
gdb/dwarf: make init_cu_die_reader a method of cutu_reader

init_cu_die_reader is only used inside cutu_reader, to initialize fields
of cutu_reader, so make it a private method.

Change-Id: Iaa80d4dbb8d0fa35bcac18ee70e147276874cc1b
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: make read_cutu_die_from_dwo a method of cutu_reader
Simon Marchi [Wed, 5 Mar 2025 21:10:04 +0000 (16:10 -0500)] 
gdb/dwarf: make read_cutu_die_from_dwo a method of cutu_reader

read_cutu_die_from_dwo is only used as a helper to cutu_reader, so make
it a private method of cutu_reader.

Remove the "result_reader" parameter, because it's always "this".

Change-Id: I7df6162137451c160f0e6bf3539569fcb2421eff
Approved-By: Tom Tromey <tom@tromey.com>
3 months ago[gdbsupport] Add codespell section in setup.cfg
Tom de Vries [Thu, 6 Mar 2025 16:38:32 +0000 (17:38 +0100)] 
[gdbsupport] Add codespell section in setup.cfg

When running codespell on gdbsupport, we get:
...
$ codespell gdbsupport
gdbsupport/common-debug.h:218: invokable ==> invocable
gdbsupport/osabi.h:51: configury ==> configurable
gdbsupport/ChangeLog-2020-2021:344: ro ==> to, row, rob, rod, roe, rot
gdbsupport/ChangeLog-2020-2021:356: contaning ==> containing
gdbsupport/common.m4:19: configury ==> configurable
gdbsupport/Makefile.am:97: configury ==> configurable
gdbsupport/Makefile.in:811: configury ==> configurable
gdbsupport/event-loop.cc:84: useable ==> usable
gdbsupport/configure:15904: assigment ==> assignment
...

Some of these files we want to skip in a spell check, because they're
generated.  We also want to skip ChangeLogs, we don't actively maintain those.

Add a file gdbsupport/setup.cfg with a codespell section, that skips those
files.  The choice for setup.cfg (rather than say .codespellrc) comes from the
presence of gdb/setup.cfg.

That leaves invokable, configury and useable.  I think configury is a common
expression in our context, and for invokable and useable I don't manage to
find out whether they really need rewriting, so I'd rather leave them alone
for now.

Add these to a file gdb/contrib/codespell-ignore-words.txt, and use the file in
gdbsupport/setup.cfg.

This makes the directory codespell clean:
...
$ codespell --config gdbsupport/setup.cfg gdbsupport
$
...

Because codespell seems to interpret filenames relative to the working
directory rather than relative to the config file, and the filename used in
gdbsupport/setup.cfg is gdb/contrib/codespell-ignore-words.txt, this simple
invocation doesn't work:
...
$ cd gdbsupport
$ codespell
...
because codespell can't find gdbsupport/gdb/contrib/codespell-ignore-words.txt.

We could fix this by using ../gdb/contrib/codespell-ignore-words.txt instead, but
likewise that breaks this invocation:
...
$ codespell --config gdbsupport/setup.cfg gdbsupport
...

I can't decide which one is worse, so I'm sticking with
gdb/contrib/codespell-ignore-words.txt for now.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
3 months agogdb: remove unnecessary local variable in pager_file::puts
Simon Marchi [Wed, 5 Mar 2025 19:13:40 +0000 (14:13 -0500)] 
gdb: remove unnecessary local variable in pager_file::puts

The lineptr variable isn't really necessary, we can just keep using
linebuffer, since the original value is linebuffer isn't needed.  Remove
lineptr, and fix some comparisons to be explicit.

Change-Id: If2f7df43bf79efd40149e46d5c77f9bc0439f879
Approved-By: Tom Tromey <tom@tromey.com>
3 months ago[gdbserver] Fix some typos
Tom de Vries [Thu, 6 Mar 2025 14:34:43 +0000 (15:34 +0100)] 
[gdbserver] Fix some typos

Fix typos in gdbserver:
...
gdbreplay.cc:444: substract ==> subtract
notif.cc:35: Enque ==> Enqueue
notif.cc:42: enque ==> enqueue
i387-fp.cc:233: simplifed ==> simplified
i387-fp.cc:508: simplifed ==> simplified
linux-arc-low.cc:221: shoudn't ==> shouldn't
linux-sparc-low.cc:112: ans ==> and
linux-ppc-low.cc:1134: Followings ==> Following
linux-ppc-low.cc:1160: Followings ==> Following
linux-ppc-low.cc:1193: Followings ==> Following
linux-ppc-low.cc:1226: Followings ==> Following
configure.ac:141: defintions ==> definitions
...

Regenerate configure from configure.ac using autoconf.

3 months agoUse "::" as separator for Fortran in cooked index
Tom Tromey [Mon, 27 Jan 2025 23:58:12 +0000 (16:58 -0700)] 
Use "::" as separator for Fortran in cooked index

This teaches cooked_index_entry::full_name that "::" is the separator
for Fortran.  I don't know enough Fortran to write a test case for
this.  However, a different series I am working on has a regression if
this patch is not applied.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
3 months agoAvoid double-decoding in ada_add_global_exceptions
Tom Tromey [Mon, 24 Feb 2025 20:18:27 +0000 (13:18 -0700)] 
Avoid double-decoding in ada_add_global_exceptions

I noticed that ada_add_global_exceptions calls ada_decode on
'search_name' -- and then passes this to name_matches_regex, which
also calls ada_decode.

name_matches_regex is also used later, where the result of
'natural_name ()' is passed to it -- but natural_name also calls
ada_decode.

So, I think the call to ada_decode in name_matches_regex is redundant.
This patch removes it, and turns name_matches_regex into an inner
function to avoid propagating its use.

Note that, right now, the DWARF implementation of
expand_symtabs_matching does not in fact pass an encoded name to this
callback.  So, this code remains slightly (but currently harmlessly)
wrong.  expand_symtabs_matching is fixed by another pending series of
mine.

3 months ago[gdbsupport] Fix some typos
Tom de Vries [Thu, 6 Mar 2025 11:58:25 +0000 (12:58 +0100)] 
[gdbsupport] Fix some typos

Fix typos:
...
mentionning -> mentioning
suppported -> supported
aligment -> alignment
...

3 months ago[gdb] Fix typos in some selftests
Tom de Vries [Thu, 6 Mar 2025 10:34:41 +0000 (11:34 +0100)] 
[gdb] Fix typos in some selftests

Fix typos:
...
figured on out -> figured one out
fpr -> for
hopefuly -> hopefully
...

3 months agoRevert "gprof: only process line numbers for intersection of vmas and histograms"
H.J. Lu [Thu, 6 Mar 2025 07:30:54 +0000 (15:30 +0800)] 
Revert "gprof: only process line numbers for intersection of vmas and histograms"

This reverts commit b8189cf9e40bd90502c9a2ce0df39dd54419bea4 to fix
PR gprof/32764:

https://sourceware.org/bugzilla/show_bug.cgi?id=32764

3 months agoAutomatic date update in version.in
GDB Administrator [Thu, 6 Mar 2025 00:00:12 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 months agold: Update PR ld/25237 test
H.J. Lu [Wed, 5 Mar 2025 11:08:49 +0000 (19:08 +0800)] 
ld: Update PR ld/25237 test

1. Skip targets which don't support the .bss section alignment, 1 << 16.
2. Replace .bss with ".section .bss".
3. Use ".zero 0xb60000" for targets which pad the section to its alignment.

PR ld/25237
* testsuite/ld-elf/pr25237.d: Skip avr-*-* and h8300-*-*.
Update expected segment size to 0xb60000.
* testsuite/ld-elf/pr25237.s: Use ".section .bss" and
".zero 0xb60000".

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 months agogdb/testsuite: add test for memory requirements of gcore
Guinevere Larsen [Fri, 21 Feb 2025 13:06:03 +0000 (10:06 -0300)] 
gdb/testsuite: add test for memory requirements of gcore

For a long time, Fedora has been carrying an out-of-tree patch with a
similar test to the one proposed in this patch, that ensures that the
memory requirements don't grow with the inferior's memory. It's been
so long that the context for why this test exists has been lost, but
it looked like it could be interesting for upstream.

The test runs twice, once with the inferior allocating 4Mb of memory,
and the other allocating 64Mb. My plan was to find the rate at which
things increase based on inferior size, and have that tested to ensure
we're not growing that requirement accidentally, but my testing
actually showed memory requirements going down as the inferior increases,
so instead I just hardcoded that we need less than 2Mb for the command,
and it can be tweaked later if necessary.

Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb: do not handle a NULL linebuffer in pager_file::puts
Simon Marchi [Wed, 5 Mar 2025 16:28:15 +0000 (11:28 -0500)] 
gdb: do not handle a NULL linebuffer in pager_file::puts

This patch [1] has shown that different implementations of ui_file::puts
handle a NULL line differently.  pager_file::puts handles a NULL
argument gracefully, as a no-op, while other implementations don't and
likely crash.  This causes subtle bugs: things will be working until the
current ui_file is suddenly not a pager_file anymore.  I think it would
be better to be consistent here, so change pager_file::puts to not
accept a NULL line.

A regular test run on Linux shows no regression.

[1] https://inbox.sourceware.org/gdb-patches/edfe6e17-1c20-4a4c-944f-247ff71b6c10@simark.ca/T/#m864aea10de8ca6fa84757971fcbaf3180e2eaefa

Change-Id: Ieb465c86cd2c42a248cf481cd174c8622ef6724b
Approved-By: Tom Tromey <tom@tromey.com>
3 months agoInconsistent treatment of template parameters in DWARF reader
Tom Tromey [Wed, 1 Jan 2025 21:34:10 +0000 (14:34 -0700)] 
Inconsistent treatment of template parameters in DWARF reader

I noticed that if you hack some clean_restart calls into
paramless.exp, the test will fail.  That is, the test currently relies
on the desired CUs already being expanded when trying to set a
breakpoint -- which is clearly a bug, the CU expansion state should
not affect "break".

I tracked this down to incorrect construction of a lookup_name_info in
cooked_index_functions::expand_symtabs_matching.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32510
Approved-By: Simon Marchi <simon.marchi@efficios.com>
3 months agogdb/dwarf: store dwo_file_up in dwo_file_set
Simon Marchi [Wed, 5 Mar 2025 05:06:43 +0000 (00:06 -0500)] 
gdb/dwarf: store dwo_file_up in dwo_file_set

Heap-allocated dwo_file objects, stored in dwarf2_per_bfd::dwo_files,
are never freed.  They are created in one of the
create_dwo_unit_in_dwp_* or lookup_dwo_cutu functions.  I confirmed this
by running:

  $ make check TESTS="gdb.cp/anon-ns.exp" RUNTESTFLAGS="--target_board=fission-dwp"
  $ ./gdb -q -nx --data-directory=data-directory testsuite/outputs/gdb.cp/anon-ns/anon-ns -ex "p main" -ex "file" -batch

... and checking the ASan leak report.  I also debugged this invocation
of GDB, placed a breakpoint on ~dwo_file, and didn't see any hit.

Change the dwo_file set to hold dwo_file_up objects.  When the
dwarf2_per_bfd object gets destroyed, dwo_file objects will
automatically get destroyed.  With this change, I see the related leaks
disappear in the ASan leak report, and my ~dwo_file breakpoint gets hit
when debugging GDB.

Change-Id: Icb38539c3f9e553f3625c625a00fc63dd6e9f3c5
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: make dwarf2_per_bfd::dwo_files a gdb::unordered_set
Simon Marchi [Wed, 5 Mar 2025 05:06:42 +0000 (00:06 -0500)] 
gdb/dwarf: make dwarf2_per_bfd::dwo_files a gdb::unordered_set

Change the dwarf2_per_bfd::dwo_files htab to a gdb::unordered_set.

No behavior change expected, except maybe the failure case in
lookup_dwo_cutu.  If open_and_init_dwo_file returns nullptr, the
previous code would leave the slot value empty (nullptr).  Is this
legit?  With the new hash table, the only thing we can do really is not
attempt to insert the nullptr value.

Change-Id: I63992f388b1197e696ded4ea483634e8ae67fce4
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: change htabs holding dwo_unit objects to gdb::unordered_set
Simon Marchi [Wed, 5 Mar 2025 05:06:41 +0000 (00:06 -0500)] 
gdb/dwarf: change htabs holding dwo_unit objects to gdb::unordered_set

Change a few occurences of htabs holding `dwo_unit *` values, using
their signature as identity, to gdb::unordered_set.
allocate_dwo_unit_table and allocate_dwp_loaded_cutus_table appeared to
create hash tables with identical behavior, so they both use the same
set type now.

The only expected change in behavior is that when there are multiple
units with the same signature, we will now keep the unit previously in
the set, rather than overwriting it.  But this seems ok, as it's a case
of bad DWARF.

Also, in the complaint in create_debug_type_hash_table, I think we
previously erroneously printed the same sect_off twice.

Change-Id: I57739977735ee1fd5c7b754107f5624f0621baa5
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: remove unused local variable in create_debug_type_hash_table
Simon Marchi [Wed, 5 Mar 2025 05:06:40 +0000 (00:06 -0500)] 
gdb/dwarf: remove unused local variable in create_debug_type_hash_table

Change-Id: I40679fbe32a8a1a9cced085532c83f06affc294c
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: remove unnecessary parameters to create_{cus,debug_type}_hash_table
Simon Marchi [Wed, 5 Mar 2025 05:06:39 +0000 (00:06 -0500)] 
gdb/dwarf: remove unnecessary parameters to create_{cus,debug_type}_hash_table

In create_cus_hash_table, we can get the section and hash table from the
dwo_file directly.

In create_debug_type_hash_table, we can get the hash table from the
dwo_file directly - the section varies.

Change-Id: I1d5ef49df98fe2620e12b83484b28cd7398f24ae
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: remove die_reader_specs
Simon Marchi [Wed, 5 Mar 2025 05:06:38 +0000 (00:06 -0500)] 
gdb/dwarf: remove die_reader_specs

die_reader_specs is a relic of some past design, today it only serves as
(useless) a base class for cutu_reader.  Remove it and move all its
fields to cutu_reader.

Change-Id: I5d55018eb8c6e0b828ef5d2f6d09b2047d1a5912
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: remove unnecessary parameter of create_cus_hash_table
Simon Marchi [Wed, 5 Mar 2025 05:06:37 +0000 (00:06 -0500)] 
gdb/dwarf: remove unnecessary parameter of create_cus_hash_table

We can use `cu->per_objfile` instead of passing down a
dwarf2_per_objfile explicitly.

Change-Id: Ie1fd93d9e7a74d09b857f1f0909d7441b79ed893
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: remove unnecessary local variable in dw2_get_file_names_reader
Simon Marchi [Wed, 5 Mar 2025 05:06:36 +0000 (00:06 -0500)] 
gdb/dwarf: remove unnecessary local variable in dw2_get_file_names_reader

It seems like the lh_cu variable is not necessary, we can just use
this_cu.

Change-Id: Ic2ed6ee82faf1fb5d340cd92dc8ef15434b20cb8
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb: fix null pointer dereference on missing PATH variable
Daniel Starke [Tue, 4 Mar 2025 21:50:11 +0000 (22:50 +0100)] 
gdb: fix null pointer dereference on missing PATH variable

When running "show" with missing PATH variable a null pointer is being
dereferenced in path_info().

path_command() correctly checks whether PATH has been set before using it.
It then calls path_info() which retrieves the variable again but fails to
perform the null pointer test on it. As a result, the application crashes with
SIGSEGV on Windows for example.

Fix this by handling the null pointer case in path_info() accordingly.

Signed-off-by: Daniel Starke <daniel-email@gmx.net>
Co-Authored-By: Simon Marchi <simon.marchi@efficios.com>
Approved-By: Tom Tromey <tom@tromey.com>
Change-Id: I41ef10f00802d3163793491454190008e78f5dc1

3 months agoCreate dwarf2/parent-map.c
Tom Tromey [Wed, 26 Feb 2025 02:27:52 +0000 (19:27 -0700)] 
Create dwarf2/parent-map.c

This creates a new file, dwarf2/parent-map.c, to hold some code
related to parent maps.  This helps shrink read.c a bit.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
3 months agoDump debug names index
Tom Tromey [Fri, 28 Feb 2025 03:26:13 +0000 (20:26 -0700)] 
Dump debug names index

This changes the .debug_names reader to dump the contents of the
index.  This follows what the cooked index does, and also fixes a
couple of test failures when run with the debug-names board:
forward-spec-inter-cu.exp and backward-spec-inter-cu.exp.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
3 months agoelfxx-aarch64.c: Replace nested function with a static inline version instead.
Nick Clifton [Wed, 5 Mar 2025 10:45:35 +0000 (10:45 +0000)] 
elfxx-aarch64.c: Replace nested function with a static inline version instead.

3 months agold: Add a test for PR ld/25237
H.J. Lu [Wed, 5 Mar 2025 03:58:57 +0000 (11:58 +0800)] 
ld: Add a test for PR ld/25237

PR ld/25237
* testsuite/ld-elf/pr25237.d: New file.
* testsuite/ld-elf/pr25237.s: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 months agold: Pass -Wl,-z,lazy to compiler for i386 lazy binding tests
H.J. Lu [Wed, 5 Mar 2025 04:44:11 +0000 (12:44 +0800)] 
ld: Pass -Wl,-z,lazy to compiler for i386 lazy binding tests

Pass -Wl,-z,lazy to compiler for i386 tests which require lazy binding
to support compilers which default to non-lazy binding.

PR ld/32762
* testsuite/ld-i386/i386.exp: Pass -Wl,-z,lazy for
"Build ifunc-1a with PIE -z ibtplt" test.
* testsuite/ld-i386/no-plt.exp: Pass -Wl,-z,lazy for
"Build libno-plt-1b.so", "No PLT (dynamic 1a)",
"No PLT (dynamic 1b)", "No PLT (dynamic 1c)",
"No PLT (PIE 1e)", "No PLT (PIE 1f)", "No PLT (PIE 1g)" tests.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 months agoAutomatic date update in version.in
GDB Administrator [Wed, 5 Mar 2025 00:00:24 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 months agogdb/dwarf: pass is_dwz to dwarf2_per_cu constructor
Simon Marchi [Mon, 3 Mar 2025 21:35:37 +0000 (16:35 -0500)] 
gdb/dwarf: pass is_dwz to dwarf2_per_cu constructor

It is always known at construction time whether a dwarf2_per_cu is
built to represent a unit from a dwz file or not, so pass that
information through the constructor.

Change-Id: I278c1894ed606451aad02e830085190bb724c473
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: make dwarf2_get_dwz_file a method of dwarf2_per_bfd
Simon Marchi [Mon, 3 Mar 2025 21:35:36 +0000 (16:35 -0500)] 
gdb/dwarf: make dwarf2_get_dwz_file a method of dwarf2_per_bfd

dwarf2_get_dwz_file looks more or less like a simple getter of
dwarf2_per_bfd::dwz_file, so make it into a method.

I typically avoid the `get_` prefix for getters, but that would conflict
with the field name here.

Change-Id: Idd0d5b1bd3813babf438b20aac514b19c77cfc18
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: remove create_cu_from_index_list
Simon Marchi [Mon, 3 Mar 2025 21:35:35 +0000 (16:35 -0500)] 
gdb/dwarf: remove create_cu_from_index_list

I noticed that create_cu_from_index_list is only used in
read-gdb-index.c, so I started by moving it there.  But given that this
function is use at only one spot and doesn't do much, I opted to inline
its code in the caller instead.

Change-Id: Iebe0dc20d345fa70a2f11aa9ff1a04fe26a31407
Approved-By: Tom Tromey <tom@tromey.com>
3 months agoCheck whether gnatmake can link with -shared
Tom Tromey [Wed, 12 Feb 2025 17:57:13 +0000 (10:57 -0700)] 
Check whether gnatmake can link with -shared

Currently, gnat-llvm does not ship a shared libgnat.  This patch
changes the relevant test to check whether linking with -shared
actually works.

3 months agoCheck whether gnatmake supports -Og
Tom Tromey [Wed, 12 Feb 2025 17:59:22 +0000 (10:59 -0700)] 
Check whether gnatmake supports -Og

gnat-llvm does not support the -Og flag.  This arranges to check for
this flag before using it.

3 months agoLook for -fgnat-encodings option
Tom Tromey [Wed, 12 Feb 2025 17:56:43 +0000 (10:56 -0700)] 
Look for -fgnat-encodings option

gnat-llvm does not support the -fgnat-encodings option, and does not
emit GNAT encodings at all -- it only supports the equivalent of GCC's
"minimal" encodings; which is to say, ordinary DWARF.

This patch changes gdb to test whether gnatmake supports this flag and
adapt accordingly.  foreach_gnat_encoding is changed to pretend that
the "minimal" mode is in effect, as some test examine the mode.

3 months agoCheck -fvar-tracking via ada_simple_compile
Tom Tromey [Wed, 12 Feb 2025 17:51:33 +0000 (10:51 -0700)] 
Check -fvar-tracking via ada_simple_compile

A couple of Ada tests check whether the C compiler supports
-fvar-tracking.  However, this doesn't really work when using
gnat-llvm, because that will invoke clang under the hood.  This patch
arranges to check gnatmake instead, which is more robust even when
toolchains are mix-and-matched.

3 months agoIntroduce ada_simple_compile
Tom Tromey [Wed, 12 Feb 2025 17:28:14 +0000 (10:28 -0700)] 
Introduce ada_simple_compile

This introduces ada_simple_compile, an Ada-specific analog of
gdb_simple_compile.  gdb_compile_test is split into two procs to make
this possible.  ada_simple_compile isn't used in this patch but will
be by later patches in this series.

3 months agoCheck for compiler support in scalar_storage.exp
Tom Tromey [Wed, 12 Feb 2025 16:35:26 +0000 (09:35 -0700)] 
Check for compiler support in scalar_storage.exp

gnat-llvm does not currently handle Scalar_Storage_Order.  This patch
changes the scalar_storage.exp test to check the compiler error
messages and report "unsupported" in this case.  This way, the test
ought to start working automatically if this feature is added to
gnat-llvm.