Commit Graph

120450 Commits

Author SHA1 Message Date
GDB Administrator
4c35cbf9e1 Automatic date update in version.in 2024-12-02 00:00:07 +00:00
Alan Modra
1959d2a1ba Correct hpux-core.c thread_section_p signature
Fix fallout from commit 0a1b45a20e.
2024-12-01 20:15:16 +10:30
Alan Modra
8ab91a0335 Re: PR32399, buffer overflow printing core_file_failing_command
Fix more potential buffer overflows, and correct trad-code.c and
cisco-core.c where they should be using bfd_{z}alloc rather than
bfd_{z}malloc.  To stop buffer overflows with fuzzed objects that
don't have a terminator on the core_file_failing_command string, this
patch allocates an extra byte at the end of the entire header buffer
rather than poking a NUL at the end of the name array (u_comm[] or
similar) because (a) it's better to not overwrite the file data, and
(b) it is possible that some core files make use of fields in struct
user beyond the end of u_comm to extend the command name.  The patch
also changes some unnecessary uses of bfd_zalloc to bfd_alloc.
There's not much point in clearing memeory that will shortly be
completely overwritten.

	PR 32399
	* aix5ppc-core.c (xcoff64_core_p): Allocate an extra byte to
	ensure the core_file_failing_command string is terminated.
	* netbsd-core.c (netbsd_core_file_p): Likewise.
	* ptrace-core.c (ptrace_unix_core_file_p): Likewise.
	* rs6000-core.c (rs6000coff_core_p): Likewise.
	* trad-core.c (trad_unix_core_file_p): Likewise, and bfd_alloc
	tdata rather than bfd_zmalloc.
	* cisco-core.c (cisco_core_file_validate): bfd_zalloc tdata.
2024-12-01 16:43:15 +10:30
oltolm
227146c286 Remove more remnants of old Mach-O workaround
Remove another adjustment for section address, this time for the
offset into .debug_str{,.dwo} read from .debug_str_offsets{,.dwo} by
fetch_indexed_string.

Signed-off-by: oltolm <oleg.tolmatcev@gmail.com>
2024-12-01 16:41:11 +10:30
GDB Administrator
936f94cf5f Automatic date update in version.in 2024-12-01 00:00:07 +00:00
GDB Administrator
5ca6fa33ef Automatic date update in version.in 2024-11-30 00:00:07 +00:00
Jens Remus
919a671bcc s390: Fix linker test TLS -fpic and -fno-pic exec transitions
Commit 36bbf8646c ("s390: Treat addressing operand sequence as one in
disassembler") changed how plain "nop" gets disassembled and missed to
update any affected linker tests accordingly.

ld/testsuite/
	* ld-s390/tlsbin.dd: "nop" disassembles into "nop".

Fixes: 36bbf8646c ("s390: Treat addressing operand sequence as one in disassembler")
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-11-29 16:57:01 +01:00
Jens Remus
2727c14ec4 s390: Simplify parsing of omitted index register operand
The index register operand X in D(X,B) can optionally be omitted by
coding D(,B) or D(B).  Simplify the parsing logic.

gas/
	* config/tc-s390.c (md_gather_operands): Rename
	omitted_base_or_index to omitted_index and simplify logic.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-11-29 15:37:19 +01:00
Jens Remus
36bbf8646c s390: Treat addressing operand sequence as one in disassembler
Reuse logic introduced with the preceding commit in the assembler to
treat addressing operand sequences D(X,B), D(B), and D(L,B) as one
with regards to optional last operands (i.e. optparm and optparm2).

With this "nop" now disassembles into "nop" instead of "nop 0".

opcodes/
	* s390-dis.c (operand_count): New helper to count the remaining
	operands, treating D(X,B), D(B), and D(L,B) as one.
	(skip_optargs_p): New helper to test whether remaining operands
	 are optional.
	(skip_optargs_zero_p): New helper to test whether remaining
	operands are optional and their values are zero.
	(s390_print_insn_with_opcode): Use skip_optargs_zero_p to skip
	optional last operands with a value of zero.

gas/testsuite/
	* gas/s390/zarch-optargs.d (nop): Adjust test case accordingly.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-11-29 15:37:19 +01:00
Jens Remus
453f481aab s390: Treat addressing operand sequence as one in assembler
The assembler erroneously treated any number of operands as optional,
if the instruction was flagged to have one or two optional operands
(i.e. optparm or optparm2).

Only treat the exact specified number of operands as optional while
treating addressing operand sequences D(X,B), D(B), and D(L,B) as one
operand.

gas/
	* config/tc-s390.c (operand_count): New helper to count the
	remaining operands, treating D(X,B), D(B), and D(L,B) as one.
	(skip_optargs_p): Use new helper operand_count to treat
	D(X,B), D(B), and D(L,B) as one operand.
	(md_gather_operands): Use skip_optargs_p to skip only the
	optional last operands.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-11-29 15:37:19 +01:00
Jens Remus
7507fe3798 s390: Fix disassembly of optional addressing operands
"nop D1(B1)" erroneously disassembled into "nop D1(B1" (missing
closing parenthesis).  "nop D1(X1,0)" and "nop D1(X1,)" erroneously
disassembled into "nop D1(X1)" (missing zero base register) instead
of "nop D1(X1,0)".

Do not skip disassembly of optional operands if they are index (X)
or base (B) registers or length (L) in an addressing operand sequence
"D(X,B)",  "D(B)", or "D(L,B).  Index and base register operand values
of zero are being handled separately, as they may not be omitted
unconditionally.  For instance a base register value of zero must be
printed in above mentioned case, to distinguish the index from the
base register.  This also ensures proper formatting of addressing
operand sequences.

While at it add further test cases for instructions with optional
operands.

opcodes/
	* s390-dis.c (s390_print_insn_with_opcode): Do not
	unconditionally skip disassembly of optional operands with a
	value of zero, if within an addressing operand sequence.

gas/testsuite/
	* gas/s390/zarch-optargs.d: Add further test cases for
	instructions with optional operands.
	* gas/s390/zarch-optargs.s: Likewise.

Reported-by: Florian Krohm <flo2030@eich-krohm.de>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-11-29 15:37:19 +01:00
Jan Beulich
0e6fdecde3 x86: restrict gas'es recognition of -s to Solaris
When there for Solaris compatibility only, also recognize it only there.
This way the option becomes available for other possible uses.

While adjusting md_shortopts[], also re-arrange things such that we have
only a single, uniform definition of it.
2024-11-29 09:37:33 +01:00
Jan Beulich
8a07ebae72 x86/Solaris: support Sun form of CMOVcc
Sun specifies an alternative form for CMOVcc [1], which for some reason
we never cared to support, even if - as per gcc's configure checking for
it - it may have been the only permitted form at some point.

While documentation doesn't indicate FCMOVcc to have similar alternative
forms, gcc assumes so. Hence cover FCMOVcc as well.

[1] https://docs.oracle.com/cd/E37838_01/html/E61064/ennbz.html#XALRMeoizm
2024-11-29 09:37:13 +01:00
Jan Beulich
37fb148efe x86: purge most *avx512*ig*-intel tests
Having just one each (AVX512F) ought to be sufficient to cover Intel
syntax disassembly.

In x86-64.exp also reorder tests some, so that related ones are again
next to each other, rather than being interspersed with APX ones.
2024-11-29 09:35:58 +01:00
Jan Beulich
cebbeb5f9a x86: SETcc doesn't permit W suffix
Accidentally I had removed No_wSuf when cloning the extra template.
2024-11-29 09:35:25 +01:00
Surya Kumari Jangala
6694256221 MAINTAINERS: Update Peter Bergner's e-mail address 2024-11-29 02:38:42 -05:00
Alan Modra
1e3b2da08e PR32399, buffer overflow printing core_file_failing_command
Assorted targets do not check, as the ELF targets do, that the program
name in a core file is NUL terminated.  Fix some of them.  I haven't
attempted to fix all targets because editing host specific code can
easily result in build bugs, which aren't discovered until someone
build binutils for that host.  (Of the files edited here, I can't
easily compile hpux-core.c and osf-core.c on a linux system.)

	PR 32399
	* hppabsd-core.c (hppabsd_core_core_file_p): Ensure core_command
	string is terminated.
	* hpux-core.c (hpux_core_core_file_p): Likewise.
	* irix-core.c (irix_core_core_file_p): Likewise.
	* lynx-core.c (lynx_core_file_p): Likewise.
	* osf-core.c (osf_core_core_file_p): Likewise.
	* mach-o.c (bfd_mach_o_core_file_failing_command): Likewise.
2024-11-29 15:43:44 +10:30
GDB Administrator
b270c84810 Automatic date update in version.in 2024-11-29 00:00:07 +00:00
Alexandra Hájková
dfb65386a5 Sync include/dwarf.h with gcc up to commit c4073a3d154
Approved-by: Kevin Buettner <kevinb@redhat.com>
2024-11-28 17:17:15 +01:00
Tom de Vries
19f3450f74 [gdb/syscalls] Add syscalls {set,get,list,remove}xattrat
In commit 5877690107 ("[gdb/syscalls] Update to linux v6.11") I updated to
linux v6.11, but a recent submission for loongarch [1] used a current trunk
version, so it makes sense to do this as well elsewhere.

Using linux current trunk with update-linux-from-src.sh gets us 4 more
syscalls:
- setxattrat
- getxattrat
- listxattrat
- removexattrat

Tested on x86_64-linux.

[1] https://sourceware.org/pipermail/gdb-patches/2024-November/213613.html
2024-11-28 13:53:04 +01:00
GDB Administrator
cbb4051c33 Automatic date update in version.in 2024-11-28 00:00:42 +00:00
Vladimir Mezentsev
73e931862a Fix 32392 [2.44 Regression] gprofng fails to build on i686-linux-gnu
gprofng/ChangeLog
2024-11-26  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/32392
	* libcollector/libcol_util.c (__collector_util_init): Fix warning.
2024-11-27 13:55:03 -08:00
Vladimir Mezentsev
194a7cc5e4 gprofng: skip unrecognized input command
gprofng crashes when the GUI sends an invalid command.
Skip unrecognized commands and return an error status to the GUI.

gprofng/ChangeLog
2024-11-26  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* src/ipc.cc (ipc_doWork): Skip unrecognized commands.
	* src/ipcio.cc (writeError): New function.
	* src/ipcio.h: Add RESPONSE_STATUS_ERROR.
2024-11-27 13:55:02 -08:00
Guinevere Larsen
d77a5792b3 gdb/testsuite: skip gdb.threads/omp-par-scope.exp with clang
Since 2020 it has been reported to clang[1] that the debug information
around OpenMP is insufficient.  The OpenMP section is not declared
within the correct scope, and instead clang marks as if the section was
a function in the global scope.  This causes several failures in the
test gdb.threads/omp-par-scope.exp when using clang to test GDB.

Since this isn't a true failure of GDB, and there is little expectation
that clang will be able to fix this soon, this commit disables the
aforementioned test when clang is being used.

[1] https://github.com/llvm/llvm-project/issues/44236

Approved-by: Kevin Buettner <kevinb@redhat.com>
2024-11-27 15:49:40 -03:00
Tom de Vries
8b8a557119 [gdb/symtab] Fix parent map dump
Before the fix for PR symtab/32225, the parent map dump showed a mapping from
section offsets to cooked index entries:
...
  0x0000000000000035 0x3ba9560 (0x34: sp1::A)
...
but now that's no longer the case:
...
  0x00000000406f5405 0x410a04d0 (0x34: sp1::A)
...

Fix this by extending the annotation somewhat, such that we get:
...
map start:
  0x0000000012c52405 0x135fd550
	(section: .debug_info, offset: 0x35) -> (0x34: sp1::A)
...

Tested on x86_64-linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32225
2024-11-27 18:48:43 +01:00
Tom de Vries
4c5d88facd [gdb/testsuite] Add gdb.dwarf2/dw2-tu-dwarf-4-5.exp
Add a regression test for PR symtab/32225.

Tested on x86_64-linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32225
2024-11-27 18:48:43 +01:00
Author: Tom Tromey
e33e55b665 [gdb/symtab] Fix parent map when handling .debug_info and .debug_types
Consider test-case:
...
$ cat test.c
namespace sp1 {
  class A {
    int i;
    const int f1 = 1;
    ...
    const int f29 = 1;
  };
}
sp1::A a;
void _start (void) {}
$ cat test2.c
namespace sp2 {
  class B {
    float f;
    const float f1 = 1;
    ...
    const float f29 = 1;
  };
}
sp2::B b;
...
compiled like this:
...
$ g++ test.c -gdwarf-4 -c -g -fdebug-types-section
$ g++ test2.c -gdwarf-5 -c -g -fdebug-types-section
$ g++ -g test.o test2.o -nostdlib
...

Using:
...
$ gdb -q -batch -iex "maint set worker-threads 0" a.out -ex "maint print objfiles"
...
we get a cooked index entry with incorrect parent:
...
    [29] ((cooked_index_entry *) 0x3c57d1a0)
    name:       B
    canonical:  B
    qualified:  sp1::A::B
    DWARF tag:  DW_TAG_class_type
    flags:      0x0 []
    DIE offset: 0x154
    parent:     ((cooked_index_entry *) 0x3c57d110) [A]
...

The problem is that the parent map assumes that all offsets are in the same
section.

Fix this by using dwarf2_section_info::buffer-relative addresses instead,
which get us instead:
...
    [29] ((cooked_index_entry *) 0x3f0962b0)
    name:       B
    canonical:  B
    qualified:  sp2::B
    DWARF tag:  DW_TAG_class_type
    flags:      0x0 []
    DIE offset: 0x154
    parent:     ((cooked_index_entry *) 0x3f096280) [sp2]
...

Tested on x86_64-linux.

PR symtab/32225
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32225
2024-11-27 18:48:43 +01:00
Andreas Arnez
6f385c1ccd [gdb/tdep] s390: Add arch15 record/replay support
Enable recording of the new "arch15" instructions on z/Architecture
targets.
2024-11-27 16:56:00 +01:00
Liu Hao
db00f6c3ac
PE LD: Merge .CRT .ctors and .dtors into .rdata
PR 32264
2024-11-27 14:27:53 +00:00
Nick Clifton
fe217087a4
Tidy up the default ELF linker script 2024-11-27 11:23:38 +00:00
Alan Modra
7a55d8e4df Re: nios2: Remove binutils support for Nios II target
Remove a now unused config file, regenerate POTFILES to remove nios2
refs, and modify config.bfd to report the target is obsolete.
2024-11-27 10:34:08 +10:30
GDB Administrator
d641e2e243 Automatic date update in version.in 2024-11-27 00:00:13 +00:00
Sandra Loosemore
e7a16d9fd6 nios2: Remove binutils support for Nios II target.
The Nios II architecture has been EOL'ed by the vendor.  This patch
removes all binutils, bfd, gas, binutils, and opcodes support for this
target with the exception of the readelf utility.  (The ELF EM_*
number remains valid and the relocation definitions from the Nios II
ABI will never change in future, so retaining the readelf support
seems consistent with its purpose as a utility that tries to parse the
headers in any ELF file provided as an argument regardless of target.)
2024-11-26 19:13:07 +00:00
Sandra Loosemore
7b55df8eff nios2: Remove all GDB support for Nios II targets.
Intel has EOL'ed the Nios II architecture, and it's time to remove support
from all toolchain components before it gets any more bit-rotten from
lack of maintenance or regular testing.
2024-11-26 19:13:07 +00:00
Tom de Vries
dfc65d0579 [gdb/syscalls] Update aarch64-linux.xml to linux v6.11
Use gdb/syscalls/update-linux.sh to update aarch64-linux.xml.in to linux
v6.11, and update aarch64-linux.xml by running make.

Noteworthy changes are removal of entries:
- arch_specific_syscall
- syscalls
which look like they were added accidentally.

I modified update-linux.sh to keep the copyright start date.  Verified with
shellcheck.

Tested-By: Luis Machado <luis.machado@arm.com>
Approved-By: Luis Machado <luis.machado@arm.com>
2024-11-26 13:29:12 +01:00
Alan Modra
1686dc7079 PR32387 ppc64 TLS optimization bug with -fno-plt code
The inline plt code emitted by gcc is incompatible with the
linker/ld.so --tls-get-addr-optimize scheme.  This is the runtime
optimisation where the first call to __tls_get_addr results in
__tls_get_addr updating the tls_index pair, then the special linker
stub using that to short-circuit second and subsequent calls for a
given tls symbol.  Enabled by default when the linker sees
__tls_get_addr_opt is preseent, and enabled in ld.so when DT_PPC64_OPT
has PPC64_OPT_TLS set.  Note that this is distinct from link-time tls
optimisation.

	PR 32387
	* elf64-ppc.c (ppc64_elf_check_relocs): Disable tls_get_addr_opt
	on detecting inline plt calls to __tls_get_addr.
2024-11-26 21:21:25 +10:30
Tom de Vries
ed732554ca [gdb/syscalls] Sync with strace v6.12
I ran gdb/syscalls/update-linux-defaults.sh with strace sources v6.12, and got
one difference in gdb/syscalls/linux-defaults.xml.in:
...
+  <syscall name="mseal" groups="memory"/>
...

Rerun make to propagate this change to the xml files.
2024-11-26 10:02:37 +01:00
Tom de Vries
9d62135dcb [gdb/syscalls] Use update-linux-from-src.sh for arm-linux
I tried to use arm-linux.py to regenerate arm-linux.xml.in, but it didn't work.

Fix this by:
- adding handling of arm-linux.xml.in in update-linux-from-src.sh,
- regenerating arm-linux.xml.in using update-linux-from-src.sh and linux 6.11
  sources,
- regenerating arm-linux.xml using make, and
- removing arm-linux.py.

This changes the name "oldolduname" into "olduname".

Tested on arm-linux.  Verified with shellcheck.
2024-11-26 09:49:29 +01:00
Tom de Vries
59d61f4b7f [gdb/syscalls] Restructure update-linux-from-src.sh
Restructure update-linux-from-src.sh to do the generation of each line
in the script it self rather than in awk.

Tested on aarch64-linux.  Verified with shellcheck.
2024-11-26 09:49:29 +01:00
Tom de Vries
eb522d6d13 [gdb/syscalls] Improve update-linux-from-src.sh
Some improvements in gdb/syscalls/update-linux-from-src.sh:
- use bash instead of sh
- use local to distinguish between local and global vars
  (which brings to light that pre uses the global rather than the local
  start_date)
- factor out main and parse_args
- factor out regen
- iterate over *.xml.in instead of *.in

Tested on aarch64-linux.  Verified with shellcheck.
2024-11-26 09:49:29 +01:00
Tom de Vries
5877690107 [gdb/syscalls] Update to linux v6.11
Regenerate some gdb/syscalls/*.xml.in files using
gdb/syscalls/update-linux-from-src.sh and linux v6.11 sources.

Regenerate the corresponding gdb/syscalls/*.xml using make.

Tested on aarch64-linux.
2024-11-26 09:49:29 +01:00
Simon Marchi
e1bb778eab Convert dwarf2_per_objfile::die_type_hash to new hash table
Convert dwarf2_per_objfile::die_type_hash, which maps debug info
offsets to `type *`, to gdb::unordered_map.

Change-Id: I5c174af64ee46d38a465008090e812acf03704ec
Approved-By: Tom Tromey <tom@tromey.com>
2024-11-25 22:07:04 -05:00
Simon Marchi
de2b4ab50d Convert dwarf2_cu::call_site_htab to new hash table
Convert one use of htab_t, mapping (unrelocated) pc to call_site
objects, to `gdb::unordered_map<unrelocated_addr, call_site *>`.

Change-Id: I40a0903253a8589dbdcb75d52ad4d233931f6641
Approved-By: Tom Tromey <tom@tromey.com>
2024-11-25 22:07:04 -05:00
Simon Marchi
a5a6ba0480 Convert dwarf_cu::die_hash to new hash table
Convert one use of htab_t, mapping offsets to die_info object, to
`gdb::unordered_set`.

Change-Id: Ic80df22bda551e2d4c2511d167e057f4d6cd2b3e
Approved-By: Tom Tromey <tom@tromey.com>
2024-11-25 22:07:04 -05:00
Simon Marchi
9c0818db31 Convert gdb_bfd.c to new hash table
This converts the BFD cache in gdb_bfd.c to use the new hash table.

Change-Id: Ib6257fe9d4f7f8ef793a2c82d53935a8d2c245a3
Co-Authored-By: Tom Tromey <tom@tromey.com>
Approved-By: Tom Tromey <tom@tromey.com>
2024-11-25 22:07:04 -05:00
Simon Marchi
e4ed0965e3 Convert more DWARF code to new hash table
This converts more code in the DWARF reader to use the new hash table.

Change-Id: I86f8c0072f0a09642de3d6f033fefd0c8acbc4a3
Co-Authored-By: Tom Tromey <tom@tromey.com>
Approved-By: Tom Tromey <tom@tromey.com>
2024-11-25 22:07:04 -05:00
Simon Marchi
6a9a1e7fb9 Convert all_bfds to new hash table
This converts gdb_bfd.c to use the new hash table for all_bfds.

This patch slightly changes the htab_t pretty-printer test, which was
relying on all_bfds.  Note that with the new hash table, gdb-specific
printers aren't needed; the libstdc++ printers suffice -- in fact,
they are better, because the true types of the contents are available.

Change-Id: I48b7bd142085287b34bdef8b6db5587581f94280
Co-Authored-By: Tom Tromey <tom@tromey.com>
Approved-By: Tom Tromey <tom@tromey.com>
2024-11-25 22:07:04 -05:00
Simon Marchi
56246f3099 Convert typedef hash to new hash table
This converts the typedef hash to use the new hash table.

This patch found a latent bug in the typedef code.  Previously, the
hash function looked at the type name, but the hash equality function
used types_equal -- but that strips typedefs, meaning that equality of
types did not imply equality of hashes.  This patch fixes the problem
and updates the relevant test.

Change-Id: I0d10236b01e74bac79621244a1c0c56f90d65594
Co-Authored-By: Tom Tromey <tom@tromey.com>
Approved-By: Tom Tromey <tom@tromey.com>
2024-11-25 22:07:04 -05:00
Simon Marchi
cd1a05c76f Convert abbrevs to new hash table
This converts the DWARF abbrevs themselves to use the new hash table.

Change-Id: I0320a733ecefe2cffeb25c068f17322dd3ab23e2
Co-Authored-By: Tom Tromey <tom@tromey.com>
Approved-By: Tom Tromey <tom@tromey.com>
2024-11-25 22:07:04 -05:00
Simon Marchi
345009bbfb Convert abbrev cache to new hash table
This converts the DWARF abbrev cache to use the new hash table.

Change-Id: I5e88cd4030715954db2c43f873b77b6b8e73f5aa
Co-Authored-By: Tom Tromey <tom@tromey.com>
Approved-By: Tom Tromey <tom@tromey.com>
2024-11-25 22:07:04 -05:00