Commit Graph

123785 Commits

Author SHA1 Message Date
Simon Marchi
e92df1d0eb gdb: make lwp_info_iterator yield references
Same rational as the previous patches.

Change-Id: I36852ec0c94dc3a87e3af033ca5e55c6b0f708b1
Approved-By: Tom Tromey <tom@tromey.com>
2025-10-07 16:22:15 -04:00
Simon Marchi
f25e28c3fe gdb: change thread_step_over_list_iterator to yield references
Same rationale as the previous patches.

Change-Id: Ic46e2e6b81b17173f4137ff4a0970c84aab4de61
Approved-By: Tom Tromey <tom@tromey.com>
2025-10-07 16:22:15 -04:00
Simon Marchi
675a17a8a5 gdb: change all_threads_safe to yield references
To be consistent with all_threads and the others, following the previous
patch.

Change-Id: I4ee4ff32b005fc5554a9d637725f10fca70cee14
Approved-By: Tom Tromey <tom@tromey.com>
2025-10-07 16:22:15 -04:00
Simon Marchi
1ad8737b3c gdb: change inf_threads_iterator to yield references
When adding reference_to_pointer_iterator, I saw it as a temporary
thing, to not have to do a codebase-wide change right away.  Remove it
from inf_threads_iterator and adjust all the users.

It's very possible that I forgot to update some spots in the files I
can't compile, but it will be very easy to fix if that happens.

Change-Id: Iddc462fecfaafb6a9861d185b217bc714e7dc651
Approved-By: Tom Tromey <tom@tromey.com>
2025-10-07 16:22:15 -04:00
Tom Tromey
7f1cdb3e37 Remove 'sys' import from frame_filters.py
pre-commit (really flake8) points out that a recent change to
frame_filters.py left an unused import.  This patch fixes the problem.
2025-10-07 13:08:19 -06:00
Andrew Burgess
01040a24d9 gdb/python: make use of gdb.Style for shipped Python commands
With the recent addition of the gdb.Style Python API, this commit goes
through the gdb.Command sub-classes which we ship with GDB and adds
some styling support.

This adds 'title' style in a couple of places where we layout tables.
And uses 'filename' style where we are printing filenames.

While I was making these changes I've made a couple of related fixes.

In 'info frame-filter', 'info missing-objfile-handlers', 'info
pretty-printer', and 'info xmethod', we would sometimes print the
gdb.Progspace.filename unconditionally, even though this field can
sometimes be None.  To better handle this case, I now check for None,
and print '<no-file>' instead.  We already printed that same string
for the program space name in at least one other case, so this change
makes things a little more consistent.

I don't format the '<no-file>' string with the filename style, only if
we have an actual filename does the string get formatted.

The other fix I made was in 'maint info python-disassemblers'.  Here
I've added an extra space between the two columns in the output
table.  The two columns are 'Architecture' and 'Disassembler Name'.
Given that one column contains a white space, it was rather confusing
having a single space between columns.  Luckily the tests don't depend
on a single space, so nothing needs updating for this change.

Additionally, in 'info frame-filter' I've updated the exception
handling to use the gdb.warning function, rather than just printing a
line of output.  This means that should this case occur we get the
neat little emoji.  We have no tests that trigger this warning, and I
couldn't figure out how to write one.  In this end, I just hacked the
Python code to raise an exception and checked the output looked
reasonable.  I suspect this warning might be a hard one to trigger!

Approved-By: Tom Tromey <tom@tromey.com>
2025-10-07 16:35:44 +01:00
Tom Tromey
48b5669c2e Ignore artificial fields in Ada
A user found an unusual Ada situation that DWARF does not readily
support.  Consider this type:

   type Discrete_Typ is tagged null record;
   type Int_Typ (Is_Static : Boolean) is new Discrete_Typ with null record;

   type Signed_Int_Typ (Is_Static : Boolean) is
      new Int_Typ (Is_Static => Is_Static)
                    with record
      case Is_Static is
         when True =>
            Field : Integer;
         when others =>
            null;
      end case;
   end record;

Here, Signed_Int_Typ has a variant part where the discriminant is
stored in a superclass.

Anyway, this code caused gnat-llvm to crash.  While fixing the crash,
I decided to fix this by emitting an anonymous field in Signed_Int_Typ
that represents the discriminant.  This would allow member DIEs to
refer to it -- which I suppose is possibly why DWARF specified that
the discriminant should be a member of the variant (though I don't
really know; this decision always seemed very strange to me).

Making the field anonymous lead to the strange error:

    Type ... is not a structure or union type.

... which comes from lookup_struct_elt, which fails when an anonymous
member of a structure has a non-composite type.  This patch includes a
fix for this issue.

After fixing that, though I decided it would be better if the
artificial discriminant were still given a name.  So, this patch
includes a change to ada_is_ignored_field to ignore artificial fields.

Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-10-07 08:25:06 -06:00
Tom Tromey
6d3af8c9f6 Remove some helper functions from DAP breakpoint code
The DAP breakpoint code has some helper functions that don't really
provide much value any more.  This patch removes them.

Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-10-07 08:18:30 -06:00
Tom Tromey
0efa2ec6c8 Fix compile-ops.exp
The recent change to change the parsing of location expressions in the
test suite broke compile-ops.exp.  I neglected to update that patch.
This patch fixes the oversight.
2025-10-07 08:13:44 -06:00
Alan Modra
f376deaf66 tidy coff-alpha.c
Remove K&R required casts.  Formatting fixes.  Localise vars in
alpha_ecoff_get_elt_at_filepos and tidy decompression loop.
2025-10-07 19:14:09 +10:30
Tom de Vries
ae93841151 [gdb/symtab] Improve invalid range check in create_addrmap_from_gdb_index
When running test-case gdb.tui/tui-missing-src.exp with target board
gold-gdb-index (and likewise fission and fission-dwp) on aarch64-linux, I run
into:
...
FAIL: gdb.tui/tui-missing-src.exp: checking if inside f2 ()
...

Looking at the gold-gdb-index case, the problem is caused by the address table
of the .gdb_index section:
...
Address table:
000000000040066c 0000000000400694 0
000000000040053f 0000000000400563 1
...

The address range for f2 is [0x400694, 0x4006b8), but the address table says
it's [0x40053f, 0x400563).

The address 0x40053f is not even in a section:
...
  [Nr] Name    Type            Address          Off    Size   ES Flg Lk Inf Al
  ...
  [12] .plt    PROGBITS        00000000004004b8 0004b8 000050 10  AX  0   0  8
  [13] .text   PROGBITS        0000000000400540 000540 000178 00  AX  0   0 64
...
but part of the hole [0x400508, 0x400540) in between .plt and .text.

Detect this in the invalid range check in create_addrmap_from_gdb_index.

Tested on aarch64-linux.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-10-07 10:25:57 +02:00
GDB Administrator
637f25e886 Automatic date update in version.in 2025-10-07 00:01:12 +00:00
Maciej W. Rozycki
d9b826d8fc MIPS/BFD: Fix rightshift for remaining n32 reloc howtos
Correct the rightshift amount for the R_MIPS_HIGHER, R_MIPS_HIGHEST and
R_MIPS_CALL_HI16 RELA relocation howtos, missed with commit f38e992147
("MIPS HI16 and LO16 reloc howtos").
2025-10-06 21:37:28 +01:00
Maciej W. Rozycki
6571c2a158 MIPS/BFD: Account for VxWorks .got.plt references
On VxWorks calls can refer directly to a .got.plt entry, in which case
they won't have an entry in the regular GOT.  It was missed with commit
6c42ddb92b ("MIPS GOT: Remove TLS GOT info from the symbol table"),
<https://inbox.sourceware.org/binutils/878v6uyaw3.fsf@talisman.default/>,
which revamped GOT entry bookkeeping, and consequently space for regular
GOT entries is needlessly reserved and then not used, with extraneous
null dynamic relocations attached, e.g.:

Relocation section '.rela.dyn' at offset 0x1400 contains 11 entries:
 Offset     Info    Type            Sym.Value  Sym. Name + Addend
00080c0c  00000405 R_MIPS_HI16       00000000   __GOTT_BASE__ + 0
00080c10  00000406 R_MIPS_LO16       00000000   __GOTT_BASE__ + 0
00080c14  00000601 R_MIPS_16         00000000   __GOTT_INDEX__ + 0
0008141c  00000002 R_MIPS_32                    80c5c
00081800  00000002 R_MIPS_32                    80c5c
00081804  00000002 R_MIPS_32                    81800
00081808  00000502 R_MIPS_32         00081808   dglobal + 0
0008180c  00000202 R_MIPS_32         00000000   dexternal + 0
00081428  00000a02 R_MIPS_32         00081c00   x + 0
00000000  00000000 R_MIPS_NONE                  0
00000000  00000000 R_MIPS_NONE                  0

Adjust regular GOT entry counting then to take .got.plt entries into
account, removing a regression from the commit referred:

mips-vxworks  -FAIL: VxWorks shared library test 1
mipsel-vxworks  -FAIL: VxWorks shared library test 1
2025-10-06 21:37:28 +01:00
Maciej W. Rozycki
c13c7174e1 MIPS/LD/testsuite: Adapt VxWorks segment matching for PR ld/20815 fix
Adjust segment addresses in the program header dump to account for the
inclusion of the program headers in the segment, removing a regression
from commit 1a9ccd70f9 ("Fix the linker so that it will not silently
generate ELF binaries with invalid program headers.  Fix readelf to
report such invalid binaries."):

mips-vxworks  -FAIL: VxWorks executable test 2 (dynamic)
mipsel-vxworks  -FAIL: VxWorks executable test 2 (dynamic)
2025-10-06 21:37:28 +01:00
Maciej W. Rozycki
6d80adb93c TIC6X/GAS: Work around array bounds compilation error
Work around a compilation error:

.../gas/config/tc-tic6x.c: In function 'tic6x_start_unwind_section':
.../gas/config/tc-tic6x.c:4632:17: error: offset '16' outside bounds of constant string [-Werror=array-bounds]
 4632 |       text_name += strlen (".gnu.linkonce.t.");
      |       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

observed with GCC 10.
2025-10-06 21:37:27 +01:00
Maciej W. Rozycki
7495d2d21d IA-64/GAS: Work around format truncation compilation errors
Work around compilation errors:

.../gas/config/tc-ia64.c: In function 'declare_register_set':
.../gas/config/tc-ia64.c:5375:41: error: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 8 [-Werror=format-truncation=]
 5375 |       snprintf (name, sizeof (name), "%s%u", prefix, i);
      |                                         ^~
.../gas/config/tc-ia64.c:5375:38: note: directive argument in the range [0, 4294967294]
 5375 |       snprintf (name, sizeof (name), "%s%u", prefix, i);
      |                                      ^~~~~~
.../gas/config/tc-ia64.c:5375:7: note: 'snprintf' output 2 or more bytes (assuming 11) into a destination of size 8
 5375 |       snprintf (name, sizeof (name), "%s%u", prefix, i);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

observed with GCC 10.  Pick 16 for a round 64-bit stack frame size.
2025-10-06 21:37:27 +01:00
Matthieu Longo
dde707a0c4 aarch64: GICv5 hypervisor control system registers
This patch adds support for hypervisor control registers on AArch64,
available via the Generic Interrupt Controller v5 feature, and enabled
via the +gcie flag.

- ich_apr_el2
- ich_contextr_el2
- ich_hfgitr_el2
- ich_hfgrtr_el2
- ich_hfgwtr_el2
- ich_hppir_el2 (RO)
- ich_ppi_activer[0,1]_el2
- ich_ppi_dvir[0,1]_el2
- ich_ppi_enabler[0,1]_el2
- ich_ppi_pendr[0,1]_el2
- ich_ppi_priorityr[0,15]_el2
- ich_vctlr_el2
- ich_vmcr_el2
2025-10-06 17:56:26 +00:00
Matthieu Longo
84835d6288 aarch64: GICv5 PPI system registers
This patch adds support for PPI registers on AArch64, available via the
Generic Interrupt Controller v5 feature, and enabled via the +gcie flag.

- icc_ppi_cactiver[0,1]_el1
- icc_ppi_cpendr[0,1]_el1
- icc_ppi_enabler[0,1]_el1
- icc_ppi_hmr[0,1]_el1 (RO)
- icc_ppi_priorityr[0,15]_el1
- icc_ppi_sactiver[0,1]_el1
- icc_ppi_spendr[0,1]_el1

Also, the new system register 'icc_ppi_priorityr8_el1' clashed with the
encoding of 's3_0_c12_c15_0' used in a test for the generic syntax of
system registers using mrs and msr.
This patch replaces 's3_0_c12_c15_0' in the test by an unused encoding:
s3_7_c0_c15_0.
2025-10-06 17:56:26 +00:00
Matthieu Longo
e4b118633a aarch64: GICv5 CPU interface system registers
This patch adds support for 13 new AArch64 system registers for the CPU
interface, which are enabled on using Generic Interrupt Controller v5
(+gcie flag) feature:
- 7 R/W registers: ICC_APR_EL1, ICC_APR_EL3, ICC_CR0_EL1, ICC_CR0_EL3
  ICC_ICSR_EL1, ICC_PCR_EL1, ICC_PCR_EL3.
- 6 RO registers: ICC_DOMHPPIR_EL3, ICC_HAPR_EL1, ICC_HPPIR_EL1,
  ICC_HPPIR_EL3, ICC_IAFFIDR_EL1, ICC_IDR0_EL1.

Note: the already-existing ID_AA64PFR2_EL1 register is required by the
GICv5 feature.
2025-10-06 17:56:26 +00:00
Saurabh Jha
a149def232 gas: aarch64: Add instructions for GICv5
Add new instructions from the Generic Interrupt Controller, GICv5,
extension. These instructions are aliases to system instructions and are
the following:

* gic <operation>, <reg>
* gicr <reg>, <operation>
* gsb <operation>
2025-10-06 17:56:26 +00:00
Saurabh Jha
c3954fc3a1 gas: aarch64: Add flag for GICv5
Generic Interrupt Controller v5, GICv5, adds new system registers
and system instructions. These are enabled with the +gcie flag, where
gcie stands for GICv5 (Generic Interrupt Controller) CPU Interrupt
Extension.
2025-10-06 17:56:26 +00:00
Indu Bhagat
70fbed5892 libsframe: testsuite: make test names unique
Previous commit 4dc07bf6 missed making some of the testnames in encode-1
unique.

libsframe/testsuite/
	PR libsframe/33437
	* libsframe.encode/encode-1.c: Update test name to ensure they
	are unique.
2025-10-06 10:39:44 -07:00
Andrew Burgess
f69c1d03c4 gdb/python: add Corefile.mapped_files method
Add a new Corefile.mapped_files method which returns a list of
gdb.CorefileMappedFile objects.

Each gdb.CorefileMappedFile object represents a file that was mapped
into the process when the core file was created.

A gdb.CorefileMappedFile has attributes:

  + filename  -- A string, the name of the mapped file.
  + build_id -- A string or None, the build-id of the mapped file if
                GDB could find it (None if not).
  + is_main_executable -- A boolean, True if this mapping is the main
                          executable.
  + regions -- A list containing the regions of this file that were
               mapped into the process.

The 'regions' list is a list of gdb.CorefileMappedFileRegion objects,
each of these objects has the following attributes:

  + start -- the start address within the inferior.
  + end -- the end address within the inferior.
  + file_offset -- the offset within the mapped file for this mapping.

There are docs and tests.

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

Approved-By: Tom Tromey <tom@tromey.com>
2025-10-06 16:56:56 +01:00
Andrew Burgess
fc8e5a565b gdb: make structured core file mappings processing global
In corelow.c, within core_target::build_file_mappings, we have code
that wraps around a call to gdbarch_read_core_file_mappings and
provides more structure to the results.

Specifically, gdbarch_read_core_file_mappings calls a callback once
for every region of every mapped file.  The wrapper code groups all of
the mappings for one file into an instance of 'struct mapped_file',
this allows all of the mapped regions to be associated with the
build-id and filename of a file.

In the next commit I plan to make this information available via the
Python API, and so I need to allow access to this structured wrapping
outside of corelow.c.

This commit renames 'struct mapped_file' to 'struct core_mapped_file'
and moves the struct into gdbcore.h.  Then a new global function
gdb_read_core_file_mappings is created into which I move the code to
build the structured data.

Then corelow.c is updated to call gdb_read_core_file_mappings.

This commit does not extend the Python API, that is for the next
commit.

There should be no user visible changes after this commit.

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

Approved-By: Tom Tromey <tom@tromey.com>
2025-10-06 16:56:55 +01:00
Andrew Burgess
7862554bcf gdb/python: introduce gdb.Corefile API
This commit starts adding some core file related features to the
Python API.

In this initial commit I've tried to keep the changes as small as
possible for easy review.

There's a new Python class gdb.Corefile, which represents a loaded
core file.  This API doesn't allow the user to create their own
gdb.Corefile objects, a core file must be loaded using the 'core-file'
command, then a gdb.Corefile object can be obtained by querying the
inferior in which the core file was loaded.

There's a new attribute gdb.Inferior.corefile, this is None when no
core file is loaded, or contains a gdb.Corefile object if a core file
has been loaded.

Currently, the gdb.Corefile object has one attribute, and one method,
these are:

  gdb.Corefile.filename -- the file name of the loaded core file.

  gdb.Corefile.is_valid() -- indicates if a gdb.Corefile object is
  valid or not.  See notes below.

A gdb.Corefile object is only valid while the corresponding core file
is loaded into an inferior.  Unloading the core file, or loading a
different one will cause a gdb.Corefile object to become invalid.  For
example:

  (gdb) core-file /tmp/core.54313
  ... snip ...
  (gdb) python core=gdb.selected_inferior().corefile
  (gdb) python print(core)
  <gdb.Corefile inferior=1 filename='/tmp/core.54313'>
  (gdb) python print(core.is_valid())
  True
  (gdb) core-file
  No core file now.
  (gdb) python print(core)
  <gdb.Corefile (invalid)>
  (gdb) python print(core.is_valid())
  False
  (gdb)

In order to track changes to the core file, there is a new observable
'core_file_changed', which accounts for the changes in corelow.c,
observable,c, and observable.h.  Currently, this observable is not
visible as a Python event.

I chose to access the core file via the inferior even though the core
file BFD object is actually stored within the program_space.  As such,
it might seem that the natural choice would be to add the attribute as
gdb.Progspace.corefile.

For background reading on my choice, please see:

  https://inbox.sourceware.org/gdb-patches/577f2c47793acb501c2611c0e6c7ea379f774830.1668789658.git.aburgess@redhat.com

This patch was never merged, it is still on my backlog, but the
observation in that work is that some targets are not really
shareable.  For example, the core_target (corelow.c) stores
information about the loaded core file within the target instance.  As
such, each target instance represents a single loaded core file.

Except that the BFD part of the core file is stored in the
program_space, which is a little weird.

During review, Tom made the observation, that maybe we should
investigate moving the core file BFD into the core_target.  I'm
inclined to agree with this as a direction of travel.

All this leaves us with two observations:

  1. Currently, loading a core file into an inferior, then using
     'add-inferior' will try to share the core_target between
     inferiors.  This is broken, and can trigger GDB crashes.  The
     obvious fix, without reworking core_target, is just to prevent
     this sharing, making core_target per-inferior.

  2. Having the core file information split between the core_target
     instance, and the BFD stored in the program_space is a little
     weird, and is really just historical.  Planning for a future
     where the BFD is also stored in the core_target might be wise.

So, if we imagine that the BFD is (one day) moved into the
core_target, and that the core_target really becomes non-shareable,
then it is, I think, clearer that the corefile attribute should live
on the gdb.Inferior object, not the gdb.Progspace object.

There's testing for all the functionality added in this commit.

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

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
2025-10-06 16:56:55 +01:00
Tom Tromey
c44edec047 Make location expressions be code in DWARF assembler
Currently the DWARF assembler implements manual parsing for location
expressions.  With a recent refactoring, this lead to the use of
[subst] in a number of places.

Following the same logic as the DW_AT_* change, this patch changes
location expressions to simply be nested Tcl code.  This avoids the
need for subst and also allows more complex logic, should that ever be
needed.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33402
2025-10-06 09:30:00 -06:00
Tom Tromey
77ff6e1309 Store the "uplevel" target in DWARF assembler
This changes the DWARF assembler to store the desired "uplevel" frame
in Dwarf::assemble.  This frame is then used in the relevant "uplevel"
invocations in the assembler.

This is primarily useful for the next patch, but it also seems
somewhat cleaner in general to me, as the implementation can now be
refactored without worrying too much about introducing new stack
frames.
2025-10-06 09:12:32 -06:00
Tom Tromey
62df070dd4 More "return" cleanup in gdb.ada
I found some more spots in gdb.ada where a "return" has a value but
does not need one.  This patch cleans these up.

Most of these would be eliminated by the old "critical" idea, if I
ever got around to finishing that...

Approved-by: Kevin Buettner <kevinb@redhat.com>
2025-10-06 07:36:58 -06:00
timurgol007
4cbb6ca055 gdb: tidy RISC-V part in gdb/Makefile.in and gdb/configure.tgt
I noticed that the length of line in gdb/configure.tgt was more than
80 lines, so I straightened it out. Also, in gdb/Makefile.in newly added
file riscv-linux-canonicalize-syscall-gen.c was missed in ALLDEPFILES,
so I added it there. And the last change: one more file
riscv-linux-canonicalize-syscall-gen.o was not in alphabetical order.
2025-10-06 14:35:58 +03:00
Alan Modra
c7b19c4860 alpha-ecoff: check archive element size
If we run out of file before decompression finishes, the archive is
broken.  Don't allow the buffer to be returned with uninitialised data.

	* coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Return an
	error if the full element size can't be decompressed.
2025-10-06 21:52:28 +10:30
Alan Modra
b05d1d8960 vms-alpha: integer overflow
image_offset takes values from section vma then increments when
filling out section data.  Avoid signed integer overflow.

	* vms-alpha.c (struct vms_private_data_struct): Make image_offset
	unsigned.
2025-10-06 13:31:31 +10:30
Alan Modra
049a70652a segv in debug_write_type
In commit 6c3458a8b7 I claimed that u.kenum is always non-NULL,
which is true for debug_make_enum_type, but not for enums made by
debug_make_undefined_tagged_type.  Fix that oversight

	PR 32829
	* debug.c (debug_write_type): Handle NULL u.kenum.
	(debug_type_samep): Likewise.
2025-10-06 13:31:31 +10:30
Alan Modra
236cf2bf60 readelf reloc range check
A fuzzed object file hit this sanitizer error.
readelf.c:16764:9: runtime error: pointer index expression with base
0x6dd4491e1590 overflowed to 0xe7af96d4491e17a1

The same could occur in any of the IN_RANGE reloc checks, where the
reloc address is calculated as "start + r_offset" then compared
against "start" and "end".  So don't do that.  Compare r_offset
against the memory size, first.

	* readelf.c (IN_RANGE): Delete.
	(in_range): New inline funcion.
	(target_specific_reloc_handling): Replace "end" param with
	"size".  Update uses.  Replace IN_RANGE with in_range.
	(apply_relocations): Delete "end" variable.  Update
	target_specific_reloc_handling calls and replace IN_RANGE.
	Avoid pointer overflow.
2025-10-06 13:31:31 +10:30
Alan Modra
f2a3ccf127 msp430: extended_dst disassembly
This avoids a gcc-14.2 bug reporting an "error: null destination
pointer" on an sprintf buffer that is not NULL.  Don't ask me why this
happens to work.

	* msp430-dis.c (msp430_singleoperand): Don't overprint op or
	comm for extended_dst.
2025-10-06 13:31:30 +10:30
GDB Administrator
171eee187f Automatic date update in version.in 2025-10-06 00:01:13 +00:00
Tom Tromey
d8f40958cb Rename "fp" in ctfread.c
Earlier reviews pointed out that "fp" is a poor choice of name in
ctfread.c.  Nick suggested "dict" instead, so this patch makes this
change.
2025-10-05 14:59:01 -06:00
Tom Tromey
fe4b853b93 Rework domain choices in ctfread.c
Another patch I am working on induced some failures in CTF tests.
Looking into this, I found that ctfread.c seems to largely work by
accident.  In particular, it often chooses the wrong domain for a
symbol.

In CTF, I believe there are 4 kinds of symbols: types, variables,
functions, and "data objects" (which IIUC may be either a variable or
a function).

ctfread.c was examining the type-kind of a variable and sometimes
treating one as a type.  add_stt_entries and
ctf_psymtab_add_stt_entries only ever used VAR_DOMAIN (but are called
for functions, which should be in FUNCTION_DOMAIN).  And
ctf_psymtab_type_cb sometimes used VAR_DOMAIN, but is only called for
types, and so should only ever use TYPE_DOMAIN or STRUCT_DOMAIN.

This patch cleans all this up, based on my understanding of the
situation.  This passes the existing tests, and also works with my
aforementioned yet-to-be-submitted patch as well.

Finally, I renamed new_symbol because it is only used for type
symbols.

Acked-By: Simon Marchi <simon.marchi@efficios.com>
2025-10-05 14:59:01 -06:00
Tom Tromey
ba597bdd24 Fix name checks in ctfread.c
I noticed that ctfread.c could create a symbol with the name "".  This
happens because a couple of spots check that a name is not NULL -- but
libctf never returns such names.  Instead check the string contents.

I left the NULL checks in for robustness.

Note that other spots in ctfread.c already do check the contents of
the name.  I changed these to avoid strlen and instead check the first
character.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-10-05 14:59:01 -06:00
Tom Tromey
eb781e047f Remove ctf_tid_key
ctfread.c creates two per-objfile registry keys.  However, one is
sufficient.  This patch combines the two.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-10-05 14:59:01 -06:00
Tom Tromey
f1ca24ee38 Remove unnecessary call to set_tid_type
ctfread.c:read_typedef_type calls set_tid_type twice, but the second
call is unnecessary.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-10-05 14:59:01 -06:00
Tom Tromey
0bfd8b3910 Stack allocate buildsym_compunit in ctfread.c
ctfread.c uses raw "new" and "delete", but for an object that could
just as easily be stack allocated.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-10-05 14:59:01 -06:00
Tom Tromey
c4092c98cd Remove ctf_per_tu_data::pss
The field ctf_per_tu_data::pss is unused and can be removed.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-10-05 14:59:01 -06:00
Tom Tromey
db0a9d95d2 Use gdb::unordered_map in ctfread.c
This changes ctfread.c to use gdb::unordered_map rather than hashtab.
This simplifies the code.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-10-05 14:59:01 -06:00
Tom de Vries
48a5896cd4 [gdb/testsuite, tclint] Fix lib/gdb.exp 2025-10-05 22:50:10 +02:00
Tom de Vries
f06e8324ca [gdb/testsuite, tclint] Fix lib/aarch64-scalable.exp 2025-10-05 22:50:10 +02:00
Tom de Vries
cf08391ee5 [gdb/testsuite, tclint] Fix lib/aarch64.exp 2025-10-05 22:50:10 +02:00
Tom de Vries
8842588bf6 [gdb/testsuite, tclint] Fix lib/mi-support.exp 2025-10-05 22:50:10 +02:00
Tom de Vries
c51f94f2e7 [gdb/testsuite, tclint] Fix lib/dwarf.exp 2025-10-05 22:50:10 +02:00
Tom de Vries
703dffe6c9 [gdb/testsuite, tclint] Fix lib/gen-perf-test.exp 2025-10-05 22:50:10 +02:00