aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-05-09aarch64: Add new test advsimd-scalar-three-same.dAlice Carlotti2-0/+414
All instructions were previously untested.
2025-05-09aarch64: Add new test advsimd-copy.dAlice Carlotti2-0/+359
Only smov and the second dup variant were previously untested. However, the only test for umov was a disassembly test with -M no-aliases, and the first dup variant was only tested in assembly in diagnostic.d with the non-architectural syntax `dup v0.2d, v1.2d[0]`.
2025-05-09aarch64: Add new test advsimd-permute.dAlice Carlotti2-0/+501
All instructions were previously untested.
2025-05-09aarch64: Add new test advsimd-modified-immediate.dAlice Carlotti2-0/+201
All instructions (7 opcode table entries) were previously untested.
2025-05-09aarch64: Add new test advsimd-two-reg-misc-hilo.dAlice Carlotti4-0/+1454
All instructions were previously untested.
2025-05-09aarch64: Add new test advsimd-two-reg-misc.dAlice Carlotti2-0/+830
sqabs, abs, not, mvn, sqneg and neg were already tested, and cmeq was already assembled in an error test (sve-reg-diagnostic.d), but they are all included here as part of the same encoding group.
2025-05-09aarch64: Add new test advsimd-mul-element.dAlice Carlotti2-0/+750
All instructions were previously untested.
2025-05-09aarch64: Add new test advsimd-widening-narrowing.dAlice Carlotti2-0/+1210
All instructions were previously untested.
2025-05-09aarch64: Add new test advsimd-three-same.dAlice Carlotti2-0/+2453
All instructions except orr/mov were previously untested.
2025-05-09aarch64: Add missing widening fmops testAlice Carlotti3-10/+8
Also remove the valid instructions from the test for invalid instructions - this meant that the instruction was previously being tested for assembly but not disassembly.
2025-05-09aarch64: Add tests for fabd, urecpe and ursqrtAlice Carlotti2-2/+22
Other instructions in the encoding group are tested in advsimd-fp16.d, so add these instructions to the existing test file.
2025-05-09aarch64: Add tests for fcvt, fcvtzs and fcvtzuAlice Carlotti2-2/+52
Other instructions in the encoding group are tested in float-fp16.d, so add these instructions to the existing test file.
2025-05-09aarch64: Add tests for csdb and eret to system.dAlice Carlotti2-0/+4
2025-05-09aarch64: Add test for ands and bicsAlice Carlotti2-0/+107
The other instructions in the encoding group are tested in shifted.d, so add these to the existing test file.
2025-05-09aarch64: Adjust float-fp16.d test patternsAlice Carlotti1-164/+164
Adjust the test to match instruction addresses of any length.
2025-05-09aarch64: Adjust advsimd-fp16.d test patternsAlice Carlotti1-569/+569
Adjust the test to match instruction addresses of any length, and escape literal '.' characters for a stricter match.
2025-05-09aarch64: Adjust shifted.d test patternsAlice Carlotti1-727/+727
Adjust the test to match any instruction addresses, so that the test can be extended more easily.
2025-05-09aarch64: Eliminate AARCH64_OPND_SVE_ADDR_RAlice Carlotti7-2325/+2286
Adjust parsing for AARCH64_OPND_SVE_ADDR_RR{_LSL*} operands to accept implicit XZR offsets. Add new AARCH64_OPND_SVE_ADDR_RM{_LSL*} operands to support instructions where an XZR offset is allowed but must be specified explicitly. This allows the removal of the duplicate opcode table entries using AARCH64_OPND_SVE_ADDR_R.
2025-05-09aarch64: Disallow invalid SVE addressing modesAlice Carlotti6-9/+106
The fix for PR22988 in 2018 added a new operand AARCH64_OPND_SVE_ADDR_R to support implicit XZR offsets, but this fix had several flaws that meant it accepted several invalid addressing modes: 1. The base register type wasn't properly checked when the optional register offset was omitted. This meant that ldff1b {z1.s}, p1/z,[z1.d] was parsed as if it were ldff1b z1.d, p1/z, [x1.d, xzr]. 2. The explicit offset parsing didn't include a shift type, so the new operand would incorrectly parse ldff1h{z0.s}, p0/z, [x0, x0] as if it were ldff1h{z0.s}, p0/z, [x0, x0, lsl #1]. 3. Regardless of the above correctness issues, support for implicit offsets should have been added by amending the operands in the existing opcode table entries, instead of adding new duplicate table entires. Issue 1 can be fixed by using an "if" instead of an "else if" in parse_operands, while issue 2 can be fixed by failing when the first condition is false. This patch applies just these two fixes, leaving issue 3 to be addressed in a subsequent more invasive patch. The instructions removed from the test sme-5.d are architecturally invalid. The new tests cover all of the affected ldff1 variants; the issue also affected SME ZA ld1*/st1* instructions using the same operand type.
2025-05-09RISC-V: Support Zce 1.0Jerry Zhang Jian6-1/+35
Zce is the extension defined in code-size-reduction Ref: https://github.com/riscvarchive/riscv-code-size-reduction Co-authored-by: Kito Cheng <kito.cheng@sifive.com>
2025-05-09RISC-V: Base for complex extension implicationsTsukasa OI1-4/+7
Thanks to the commit 48558a5e5471 ("RISC-V: Allow nested implications for extensions"), we can write complex extension implications in theory. However, to actually do that, we need to pass more information to check_func. For example, we want to imply 'Zcf' from 'F' if and only if the 'Zce' extension is also enabled and XLEN is 32. Passing rps is a way to enable this. This commit prepares for such complex extension implications.
2025-05-09RISC-V: Add augmented hypervisor extension 'sha' support.Jiawei5-1/+9
The augmented hypervisor extension 'sha'[1] is a new profile-defined extension that captures the full set of features that are mandated to be supported along with the H extension. https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc#rva23s64-profile bfd/ChangeLog: * elfxx-riscv.c: New extension and implies. gas/ChangeLog: * NEWS: New extension. * testsuite/gas/riscv/imply.d: New test for sha. * testsuite/gas/riscv/imply.s: Ditto. * testsuite/gas/riscv/march-help.l: New extension.
2025-05-09RISC-V: Add Privileged Architecture 1.13 CSRs.Jiawei19-5/+2525
This patch support RISC-V Privileged Architecture 1.13 CSRs 'medelegh' and 'hedelegh'. More details between 1.12 and 1.13 see [1]. [1] https://github.com/riscv/riscv-isa-manual/blob/main/src/priv-preface.adoc Version log: Remove gas/po changes. bfd/ChangeLog: * cpu-riscv.c: New option. * cpu-riscv.h (enum riscv_spec_class): Ditto. binutils/ChangeLog: * doc/binutils.texi: New option. gas/ChangeLog: * NEWS: Add priv-1.13 support. * config/tc-riscv.c: New option. * configure: Ditto. * configure.ac: Ditto. * testsuite/gas/riscv/csr-version-1p10.d: New CSR. * testsuite/gas/riscv/csr-version-1p10.l: New warning. * testsuite/gas/riscv/csr-version-1p11.d: New CSR. * testsuite/gas/riscv/csr-version-1p11.l: New warning. * testsuite/gas/riscv/csr-version-1p12.d: New CSR. * testsuite/gas/riscv/csr-version-1p12.l: New warning. * testsuite/gas/riscv/csr.s: New CSR. * testsuite/gas/riscv/attribute-15.d: New test. * testsuite/gas/riscv/attribute-16.d: New test. * testsuite/gas/riscv/csr-version-1p13.d: New test. * testsuite/gas/riscv/csr-version-1p13.l: New test. include/ChangeLog: * opcode/riscv-opc.h (CSR_MEDELEGH): New CSR. (CSR_HEDELEGH): Ditto. (DECLARE_CSR): Ditto.
2025-05-09RISC-V: Added vendor extensions, xmipscbop, xmipscmov, xmipsexectl and xmipslspChao-ying Fu11-0/+329
Spec: https://mips.com/wp-content/uploads/2025/03/P8700-F_Programmers_Reference_Manual_Rev1.82_3-19-2025.pdf Added MIPS vendor extensions, xmipscbop, xmipscmov, xmipsexectl and xmipslsp with verison 1.0. Passed binutils testsuites of targets elf32/elf64/linux32/linux64. Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com> Signed-off-by: Chao-ying Fu <cfu@wavecomp.com>
2025-05-09Automatic date update in version.inGDB Administrator1-1/+1
2025-05-08Change substitute_path_component to use std::stringTom Tromey1-43/+24
This changes substitute_path_component to use std::string and std::string_view, simplifying it greatly and removing some manual memory management. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-05-08Move substitute_path_componentTom Tromey5-108/+85
This moves substitute_path_component out of utils.c. I considered making a new file for this (still could if someone wants that), but since the only caller is in auto-load.c, I moved it there instead. I've also moved the tests into auto-load.c as well. This way substitute_path_component can be static. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-05-08Automatic date update in version.inGDB Administrator1-1/+1
2025-05-08windres: buffer overflowAlan Modra1-0/+5
bin_to_res_menuexitems can be called with random data offsets (and thus remaining lengths), confusing code that expects 4-byte aligned data. Prevent an item length adjustment for alignment exceeding the remaining length and then overflowing.
2025-05-08Remove unnecessary use of pragma once in pr25618 testAlan Modra2-2/+0
2025-05-07s390: Fix format specifier for VR in disassemblerJens Remus1-1/+1
Vector register (VR) numbers are unsigned. Use format specifier %u instead of %i. Reported-by: Florian Krohm <flo2030@eich-krohm.de> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-05-07Automatic date update in version.inGDB Administrator1-1/+1
2025-05-06Do not set yydebug in cp-name-parser.yTom Tromey1-3/+5
This reverts the change to cp-name-parser.y, avoiding a TSan report. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-05-06Remove kfail from templates.expTom Tromey1-4/+1
templates.exp has one remaining kfail. However, the output in question has been stabilized ever since the cp-name-parser.y work -- the test just wasn't updated. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=8617 Reviewed-By: Keith Seitz <keiths@redhat.com>
2025-05-06Rewrite bug references in templates.expTom Tromey1-22/+22
templates.exp has many kfails that refer to old GNATS bug numbers. This patch updates them to refer to Bugzilla instead. Reviewed-By: Keith Seitz <keiths@redhat.com>
2025-05-06Revert "gdb: support zero inode in generate-core-file command"Andrew Burgess1-1/+1
This reverts commit 1e21c846c275fc6e387ca903a129096be2a53d0b. This change was causing unexpected mappings to be included in the core files generated by GDB, which was triggering warnings when GDB opened a core file, like this: warning: Can't open file [stack] during file-backed mapping note processing warning: Can't open file [vvar] during file-backed mapping note processing For now I'm reverting the above commit and will come to the list again when I have a solution that addresses the original issue without also including the unexpected mappings.
2025-05-06Handle field with dynamic bit offsetTom Tromey5-22/+161
I discovered that GCC emitted incorrect DWARF for the test case included in this patch. Eric wrote a fix for GCC, but then he found that gdb crashed on the resulting file. This test has a field that is at a non-constant bit offset from the start of the type. DWARF 5 does not allow for this situation (I've sent a report to the DWARF list), but DWARF 3 did allow for this via a combination of an expression for the byte offset and then the use of DW_AT_bit_offset. This looks like: <5><117a>: Abbrev Number: 17 (DW_TAG_member) <117b> DW_AT_name : (indirect string, offset: 0x1959): another_field ... <1188> DW_AT_bit_offset : 6 <1189> DW_AT_data_member_location: 6 byte block: 99 3d 1 0 0 22 (DW_OP_call4: <0x1193>; DW_OP_plus) ... <3><1193>: Abbrev Number: 2 (DW_TAG_dwarf_procedure) <1194> DW_AT_location : 15 byte block: 97 94 1 37 1a 32 1e 23 7 38 1b 31 1c 23 3 (DW_OP_push_object_address; DW_OP_deref_size: 1; DW_OP_lit7; DW_OP_and; DW_OP_lit2; DW_OP_mul; DW_OP_plus_uconst: 7; DW_OP_lit8; DW_OP_div; DW_OP_lit1; DW_OP_minus; DW_OP_plus_uconst: 3) Now, that combination is not fully general, in that the bit offset must be a constant -- only the byte offset may really vary. However, I couldn't come up with a situation where full generality is needed, mainly because GNAT won't seem to pack fields into the padding of a variable-length array. Meanwhile, the reason for the gdb crash is that the code handling DW_AT_bit_offset assumes that the byte offset is a constant. This causes an assertion failure. This patch arranges for DW_AT_bit_offset to be applied during field resolution, when needed.
2025-05-06Introduce apply_bit_offset_to_field helper functionTom Tromey3-40/+72
This patch makes a new function, apply_bit_offset_to_field, that is used to handle the logic of DW_AT_bit_offset. Currently there is just a single caller, but the next patch will change this.
2025-05-06Use OBSTACK_ZALLOC when allocating batonsTom Tromey1-6/+9
I found some places in dwarf2/read.c that allocate a location baton, but fail to initialize one of the fields. It seems safer to me to use OBSTACK_ZALLOC here, so this patch makes this change. This will be useful in a subsequent patch as well, where a new field is added to one of the batons.
2025-05-06Clean up handle_member_locationTom Tromey1-3/+2
This removes a redundant check from handle_member_location, and also changes the complaint -- currently it will issue the "complex location" complaint, but really what is happening here is an unrecognized form.
2025-05-06Handle dynamic field propertiesTom Tromey9-91/+237
I found a situation where gdb could not properly decode an Ada type. In this first scenario, the discriminant of a type is a bit-field. PROP_ADDR_OFFSET does not handle this situation, because it only allows an offset -- not a bit-size. My original approach to this just added a bit size as well, but after some discussion with Eric Botcazou, we found another failing case: a tagged type can have a second discriminant that appears at a variable offset. So, this patch changes this code to accept a general 'struct field' instead of trying to replicate the field-finding machinery by itself. This is handled at property-evaluation time by simply using a 'field' and resolving its dynamic properties. Then the usual field-extraction function is called to get the value. Because the baton now just holds a field, I renamed PROP_ADDR_OFFSET to PROP_FIELD. The DWARF reader now defers filling in the property baton until the fields have been attached to the type. Finally, I noticed that if the discriminant field has a biased representation, then unpack_field_as_long would not handle this either. This bug is also fixed here, and the test case checks this. Regression tested on x86-64 Fedora 41.
2025-05-06Add new unpack_field_as_long overloadTom Tromey2-6/+22
This introduces a new unpack_field_as_long that takes the field object directly, rather than a type and an index. This will be used in the next patch.
2025-05-06Add resolve_dynamic_fieldTom Tromey2-42/+62
The final patch in this series will change one dynamic property approach to use a struct field rather than an offset and a field type. This is convenient because the reference in DWARF is indeed to a field -- and this approach lets us reuse the field-extraction logic that already exists in gdb. However, the field in question may have dynamic properties which must be resolved before it can be used. This patch prepares for this by introducing a separate resolve_dynamic_field function. This patch should cause no visible changes to behavior.
2025-05-06Constify property_addr_infoTom Tromey2-14/+14
This changes most places to use a const property_addr_info. This seems more correct to me because normally the user of a property_addr_info should not modify it. Furthermore, some functions already take a const object, and for a subsequent patch it is convenient if other functions do as well.
2025-05-06gdb/testsuite: Add require allow_hipcc_tests in gdb.rocm/mi-attach.expLancelot SIX1-1/+2
The gdb.rocm/mi-attach.exp test is missing a proper `require` check to ensure that the current configuration can run ROCm tests. This issue has been reported by Baris. This patch adds the missing `allow_hipcc_tests` requirement, and also adds `load_lib rocm.exp` to enable this test. Change-Id: Ie136adfc2d0854268b92af5c4df2dd0334dce259 Reviewed-By: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Approved-By: Tom Tromey <tom@tromey.com>
2025-05-06gdb: support zero inode in generate-core-file commandAndrew Burgess1-1/+1
It is possible, when creating a shared memory segment (i.e. with shmget), that the id of the segment will be zero. When looking at the segment in /proc/PID/smaps, the inode field of the entry holds the shared memory segment id. And so, it can be the case that an entry (in the smaps file) will have an inode of zero. When GDB generates a core file, with the generate-core-file (or its gcore alias) command, the shared memory segment should be written into the core file. Fedora GDB has, since 2008, carried a patch that tests this case. There is no fix for GDB associated with the test, and unfortunately, the motivation for the test has been lost to the mists of time. This likely means that a fix was merged upstream without a suitable test, but I've not been able to find and relevant commit. The test seems to be checking that the shared memory segment with id zero, is being written to the core file. While looking at this test and trying to work out if it should be posted upstream, I saw that GDB does appear to write the shared memory segment into the core file (as expected), which is good. However, GDB still isn't getting this case exactly right. In gcore_memory_sections (gcore.c) we call back into linux-tdep.c (via the gdbarch_find_memory_regions call) to correctly write the shared memory segment into the core file, however, in linux_make_mappings_corefile_notes, when we use linux_find_memory_regions_full to create the NT_FILE note, we call back into linux_make_mappings_callback for each mapping, and in here we reject any mapping with a zero inode. The result of this, is that, for a shared memory segment with a non-zero id, after loading the core file, the shared memory segment will appear in the 'proc info mappings' output. But, for a shared memory segment with a zero id, the segment will not appear in the 'proc info mappings' output. I propose fixing this by not checking the inode in linux_make_mappings_callback. The inode check was in place since the code was originally added in commit 451b7c33cb3c9ec6272c36870 (in 2012). The test for this bug, based on the original Fedora patch, can be found on the mailing list here: https://inbox.sourceware.org/gdb-patches/0d389b435cbb0924335adbc9eba6cf30b4a2c4ee.1741776651.git.aburgess@redhat.com I have not committed this test into the tree though because the test was just too unreliable. User space doesn't have any control over the shared memory id, so all we can do is spam out requests for new shared memory segments and hope that we eventually get the zero id. Obviously, this can fail; the zero id might already be in use by some long running process, or the kernel, for whatever reason, might choose to never allocate the zero id. The test I posted (see above thread) did work more than 50% of the time, but it was far closer to a 50% success rate than 100%, and I really don't like introducing unreliable tests.
2025-05-06gdb/testsuite: add gcore_cmd_available predicate procAndrew Burgess7-4/+25
Add a new gcore_cmd_available predicate proc that can be used in a 'requires' line, and make use of it in a few tests. All of the tests I have modified call gdb_gcore_cmd as one of their first actions and exit if the gcore command is not available, so it makes sense (I think) to move the gcore command check into a requires call. There should be no change in what is actually run after this commit.
2025-05-06gdb/python/guile: check if styling is disabled in Color.escape_sequenceAndrew Burgess6-7/+41
I noticed that the gdb.Color.escape_sequence() method would produce an escape sequence even when styling is disabled. I think this is the wrong choice. Ideally, when styling is disabled (e.g. with 'set style enabled off'), GDB should not be producing styled output. If a GDB extension is using gdb.Color to apply styling to the output, then currently, the extension should be checking 'show style enabled' any time Color.escape_sequence() is used. This means lots of code duplication, and the possibility that some locations will be missed, which means disabling styling no longer does what it says. I propose that Color.escape_sequence() should return the empty string if styling is disabled. A Python extension can then do: python c_none = gdb.Color('none') c_red = gdb.Color('red') print(c_red.escape_sequence(True) + "Text in red." + c_none.escape_sequence(True)) end If styling is enable this will print some red text. And if styling is disabled, then it will print text in the terminal's default color. I have applied the same fix to the guile API. I have extended the tests to cover this case. Approved-By: Tom Tromey <tom@tromey.com>
2025-05-06gas: input_scrub buffersAlan Modra1-8/+19
This tidies freeing of input_scrub buffers on failure paths, making input_scrub_end iterate over any input_scrub_push'd files or string buffers to clean up memory. * input-scrub.c (input_scrub_free): New function. (input_scrub_pop): Call it rather than input_scrub_end. (input_scrub_end): Iterate over next_saved_file freeing buffers. (input_scrub_next_buffer): Move sb_kill to input_scrub_free.
2025-05-06windres_get_* functionsAlan Modra6-252/+254
windres_get_32 and similar have a length parameter that in most cases is just the required length, so it is redundant. The few cases where a variable length is passed are all in resrc.c. So, get rid of the length parameter and introduce wrappers in resrc.c to check the length.