aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-06-13dlltool: respect use-nul-prefixed-import-tables option for delaylibJeremy Drake1-8/+13
Noticed the extra zeros while inspecting the output. Signed-off-by: Jeremy Drake <sourceware-bugzilla@jdrake.com>
2025-06-13ld,dlltool: move read-only delayimp data into .rdataJeremy Drake3-8/+12
This allows the delay IAT to be in its own section with nothing else, as required by IMAGE_GUARD_DELAYLOAD_IAT_IN_ITS_OWN_SECTION, documented at https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#load-configuration-layout Signed-off-by: Jeremy Drake <sourceware-bugzilla@jdrake.com>
2025-06-13bfd,ld,dlltool: Emit delay-load import data into its own sectionLIU Hao16-8/+158
A delay-import symbol (of a function) is resolved when a call to it is made. The delay loader may overwrite the `__imp_` pointer to the actual function after it has been resolved, which requires the pointer itself be in a writeable section. Previously it was placed in the ordinary Import Address Table (IAT), which is emitted into the `.idata` section, which had been changed to read-only in db00f6c3aceabbf03acdb69e74b59b2d2b043cd7, which caused segmentation faults when functions from delay-import library were called. This is PR 32675. This commit makes DLLTOOL emit delay-import IAT into `.didat`, as specified by Microsoft. Most of the code is copied from `.idata`, except that this section is writeable. As a side-effect of this, PR 14339 is also fixed. Using this DEF: ``` ; ws2_32.def LIBRARY "WS2_32.DLL" EXPORTS WSAGetLastError ``` and this C program: ``` // delay.c #define WIN32_LEAN_AND_MEAN 1 #include <windows.h> #include <stdio.h> ///////////////////////////////////////////////////////// // User code ///////////////////////////////////////////////////////// DWORD WINAPI WSAGetLastError(void); extern PVOID __imp_WSAGetLastError; int main(void) { fprintf(stderr, "before delay load, __imp_WSAGetLastError = %p\n", __imp_WSAGetLastError); SetLastError(123); fprintf(stderr, "WSAGetLastError() = %d\n", WSAGetLastError()); fprintf(stderr, "after delay load, __imp_WSAGetLastError = %p\n", __imp_WSAGetLastError); __imp_WSAGetLastError = (PVOID) 1234567; fprintf(stderr, "after plain write, __imp_WSAGetLastError = %p\n", __imp_WSAGetLastError); } ///////////////////////////////////////////////////////// // Overridden `__delayLoadHelper2` facility ///////////////////////////////////////////////////////// extern char __ImageBase[]; PVOID WINAPI ResolveDelayLoadedAPI(PVOID ParentModuleBase, LPCVOID DelayloadDescriptor, PVOID FailureDllHook, PVOID FailureSystemHook, FARPROC* ThunkAddress, ULONG Flags); FARPROC WINAPI DelayLoadFailureHook(LPCSTR name, LPCSTR function); FARPROC WINAPI __delayLoadHelper2(LPCVOID pidd, FARPROC* ppfnIATEntry) { return ResolveDelayLoadedAPI(&__ImageBase, pidd, NULL, (PVOID) DelayLoadFailureHook, ppfnIATEntry, 0); } ``` This program used to crash: ``` $ dlltool -nn -d ws2_32.def -y delay_ws2_32.a $ gcc -g delay.c delay_ws2_32.a -o delay.exe $ ./delay.exe before delay load, __imp_WSAGetLastError = 00007FF6937215C6 Segmentation fault ``` After this commit, it loads and calls `WSAGetLastError()` properly, and `__imp_WSAGetLastError` is writeable: ``` $ dlltool -nn -d ws2_32.def -y delay_ws2_32.a $ gcc -g delay.c delay_ws2_32.a -o delay.exe $ ./delay.exe before delay load, __imp_WSAGetLastError = 00007FF76E2215C6 WSAGetLastError() = 123 after delay load, __imp_WSAGetLastError = 00007FFF191FA720 after plain write, __imp_WSAGetLastError = 000000000012D687 ``` Reference: https://learn.microsoft.com/en-us/windows/win32/secbp/pe-metadata#import-handling Co-authored-by: Jeremy Drake <sourceware-bugzilla@jdrake.com> Signed-off-by: LIU Hao <lh_mouse@126.com> Signed-off-by: Jeremy Drake <sourceware-bugzilla@jdrake.com>
2025-06-13Automatic date update in version.inGDB Administrator1-1/+1
2025-06-12Minor grammar fix in DAP commentTom Tromey1-1/+1
I noticed a minor grammer issue in a comment in DAP.
2025-06-12gdb, linespec: avoid multiple locations with same PCKlaus Gerlicher3-0/+14
Setting a BP on a line like this would incorrectly yield two BP locations: 01 void two () { {int var = 0;} } (gdb) break 1 Breakpoint 1 at 0x1164: main.cpp:1. (2 locations) (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y <MULTIPLE> 1.1 y 0x0000000000001164 in two() at main.cpp:1 1.2 y 0x0000000000001164 in two() at main.cpp:1 In this case decode_digits_ordinary () returns two SALs, exactly matching the requested line. One for the entry PC and one for the prologue end PC. This was tested with GCC, CLANG and ICPX. Subsequent code tries to skip the prologue on these PCs, which in turn makes them the same. To fix this, ignore SALs with the same PC and program space when adding to the list of SALs. This will then properly set only one location: (gdb) break 1 Breakpoint 1 at 0x1164: file main.cpp, line 1 (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y 0x0000000000001164 in two() at main.cpp:1 Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-06-12gdb: convert linux-namespaces debug to the new(er) debug schemeAndrew Burgess2-39/+41
Convert 'set debug linux-namespaces' to the new(er) debug scheme. As part of this change I converted the mnsh_debug_print_message function, which previously printed its output, to instead return a std::string, this string is then printed using linux_namespaces_debug_printf. The mnsh_debug_print_message function is only used as part of the debug output. I also updated one place in the code where debug_linux_namespaces, the debug control variable, which is a boolean, was assigned an integer. When debug is turned on then clearly the output is now different, but in all other cases, there should be no user visible change in GDB after this commit. Approved-By: Tom Tromey <tom@tromey.com>
2025-06-12aarch64: Add support for FEAT_FPRCVTRichard Ball12-3412/+3941
FEAT_FPRCVT introduces new versions of previous instructions. The instructions are used to convert between floating points and Integers. These new versions take as operands SIMD&FP registers for both the source and destination register. FEAT_FPRCVT also enables the use of some existing AdvSIMD instructions in streaming mode. However, no changes are needed in gas to support this.
2025-06-12Automatic date update in version.inGDB Administrator1-1/+1
2025-06-11gdb: fix size of z80 "add ii,rr" and "ld (ii+d),n" instructionsAaron Griffith1-3/+3
The tables in z80-tdep.c previously either gave these instructions the wrong size, or failed to recognize them by using the wrong masks, or both. The fixed instructions alongside their representation in octal are: * add ii,rr: [0335] 00r1 (where r & 1 == 1) [0375] 00r1 * ld (ii+d,n): [0335] 0066 <d> <n> [0375] 0066 <d> <n> Prefix bytes inside [] do not count towards instruction length in these tables. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33066 Approved-By: Tom Tromey <tom@tromey.com>
2025-06-11GDB: doc: Improve AArch64 subsubsection titles and index entries in gdb.texinfoThiago Jung Bauermann1-14/+15
Remove period from subsubsection titles in the AArch64 configuration-specific subsection, and expand acronyms. Regarding @cindex entries, remove periods and standardise their order and the position of "AArch64" to make it easier to find them by using the index-searching commands of Info readers that offer TAB completion. Approved-By: Eli Zaretskii <eliz@gnu.org>
2025-06-11Arm tests: reduce objdump's output and improve some matching patternsMatthieu Longo4-29/+14
Linker scripts can change the sections order in the output. Some matching patterns in tests try to detect the end of a section by detecting the beginning of the next one. However, they mistakenly enforce the name of the next section without any need. This caused the tests to break due to minor changes to the linker scripts. This patch adds '-j <interesting-section>' to the arguments of objdump to dump only relevant information for the tests. This removed the issue related to the ordering of the sections. The matching patterns were also made stricter to match better the expected output.
2025-06-11gdb testsuite: Introduce allow_multi_inferior_tests and use it throughoutPedro Alves25-45/+116
The Windows port does not support multi-process debugging. Testcases that want to exercise multi-process currently FAIL and some hit cascading timeouts. Add a new allow_multi_inferior_tests procedure, meant to be used with require, and sprinkle it throughout testcases as needed. Approved-by: Kevin Buettner <kevinb@redhat.com> Change-Id: I4a10d8f04f9fa10f4b751f140ad0a6d31fbd9dfb
2025-06-11gdb testsuite: Introduce allow_fork_tests and use it throughoutPedro Alves37-29/+78
Cygwin debugging does not support follow fork. There is currently no interface between the debugger and the Cygwin runtime to be able to intercept forks and execs. Consequently, testcases that try to exercise fork/exec all FAIL, and several hit long cascading timeouts. Add a new allow_fork_tests procedure, meant to be used with require, and sprinkle it throughout testcases that exercise fork. Note that some tests currently are skipped on targets other than Linux, with something like: # Until "set follow-fork-mode" and "catch vfork" are implemented on # other targets... # if {![istarget "*-linux*"]} { continue } However, some BSD ports also support fork debugging nowadays, and the testcases were never adjusted... That is why the new allow_fork_tests procedure doesn't look for linux. With this patch, on Cygwin, I get this: $ make check TESTS="*/*fork*.exp" ... === gdb Summary === # of expected passes 6 # of untested testcases 1 # of unsupported tests 31 Reviewed-By: Keith Seitz <keiths@redhat.com> Change-Id: I0c5e8c574d1f61b28d370c22a0b0b6bc3efaf978
2025-06-11gdb.multi/attach-no-multi-process.exp: Detect no remote non-stopPedro Alves2-2/+5
Running gdb.multi/attach-no-multi-process.exp on Cygwin, where GDBserver does not support non-stop mode, I see: FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=off: info threads FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=on: attach to the program via remote (timeout) FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=on: info threads (timeout) Let's ignore the first "info threads" fail. The timeouts look like this: builtin_spawn /home/alves/gdb-cache-cygwin/gdb/../gdbserver/gdbserver --once --multi localhost:2346 Listening on port 2346 target extended-remote localhost:2346 Remote debugging using localhost:2346 Non-stop mode requested, but remote does not support non-stop (gdb) gdb_do_cache: can_spawn_for_attach ( ) builtin_spawn /home/alves/gdb/build-cygwin-testsuite/outputs/gdb.multi/attach-no-multi-process/attach-no-multi-process attach 14540 FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=on: attach to the program via remote (timeout) info threads FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=on: info threads (timeout) Note the "Non-stop mode requested, but remote does not support non-stop" line. The intro to gdb_target_cmd_ext says: # gdb_target_cmd_ext # Send gdb the "target" command. Returns 0 on success, 1 on failure, 2 on # unsupported. That's perfect here, we can just use gdb_target_cmd_ext instead of gdb_target_cmd, and check for 2 (unsupported). That's what this patch does. However gdb_target_cmd_ext incorrectly returns 1 instead of 2 for the case where the remote target says it does not support non-stop. That is also fixed by this patch. With this, we no longer get those timeout fails. We get instead: target extended-remote localhost:2346 Remote debugging using localhost:2346 Non-stop mode requested, but remote does not support non-stop (gdb) UNSUPPORTED: gdb.multi/attach-no-multi-process.exp: target_non_stop=on: non-stop RSP Approved-by: Kevin Buettner <kevinb@redhat.com> Change-Id: I1ab3162f74200c6c02a17a0600b102d2d12db236
2025-06-11Convert gdb.base/watchpoint-hw-attach.exp to spawn_wait_for_attachPedro Alves1-15/+6
On Cygwin, starting an inferior under GDB, and detaching it, quitting GDB, and then closing the shell, like so: (gdb) start (gdb) detach (gdb) quit # close shell ... hangs the parent shell of GDB (not GDB!) until the inferior process that was detached (as it is still using the same terminal GDB was using) exits too. This leads to odd failures in gdb.base/watchpoint-hw-attach.exp like so: detach Detaching from program: .../outputs/gdb.base/watchpoint-hw-attach/watchpoint-hw-attach, process 16580 [Inferior 1 (process 16580) detached] (gdb) FAIL: gdb.base/watchpoint-hw-attach.exp: detach Fix this by converting the testcase to spawn the inferior outside GDB, with spawn_wait_for_attach. With this patch, the testcase passes cleanly on Cygwin, for me. Approved-By: Tom Tromey <tom@tromey.com> Change-Id: I8e3884073a510d6fd2fff611e1d26fc808adc4fa
2025-06-11ld: arm32: fix segfault when linking foreign BFDs [PR32870]dongjianqiang (A)1-0/+3
PR ld/32870 The linker may occasionally need to process a BFD that is from a non-Arm architecture. There will not be any Arm-specific tdata in that case, so skip such BFDs when looking for iplt information as the necessary tdata will not be present.
2025-06-11Fix Solaris buildTom Tromey2-15/+13
Commit 58984e4a ("Use gdb::function_view in iterate_over_threads") broke the Solaris build. This patch attempts to fix it, changing find_signalled_thread to have the correct signature, and correcting a couple of problems in sol_thread_target::get_ada_task_ptid. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33073
2025-06-11ld/PE: special-case relocation types only for COFF inputsJan Beulich1-4/+5
In 72cd2c709779 ("ld/PE: no base relocs for section (relative) ones") I made a pre-existing problem quite a bit worse: When looking at a relocation's (numerical) howto->type, that value is meaningful only if the object was of corresponding COFF type. ELF objects in particular have their own enumeration. As it stands, specifically the not entirely unusual R_X86_64_32 and R_X86_64_32S did no longer have relocations emitted for them, due to matching R_AMD64_SECTION and R_AMD64_SECREL in value respectively.
2025-06-11arm: ignore inapplicable .arch=no...Jan Beulich1-2/+6
Unlike for command line options, where a base architecture needs to be provided explicitly, the .arch directive doesn't have such a requirement. Therefore it is odd that disabling of an inapplicable extension isn't silently ignored; claiming "not allowed for the current base architecture" is at best misleading. Alter the error path to emit a more "soft" diagnostic in that case instead.
2025-06-11AArch64 variant PCS tests: remove RWX permissions on segmentsMatthieu Longo4-114/+124
The symbols of variant PCS functions require special handling. The variant PCS tests check both the relocation information and the markings in the symbol table. Those tests dump a lot of addresses, so a custom linker script, variant_pcs.ld was used to control reliably the addresses of the sections. However, the linker script does not provide information enough to the linker to assess the right set of permisssions on segments (i.e. Read/Write/Execute). This insufficiency caused the linker to bundle all the sections in a same segment with the union of all the required permissions, i.e. RWX. A segment with such lax permissions constitutes a security hole, so the linker emits the following warning message: <ELF file> has a LOAD segment with RWX permissions. This warning message is noisy in the tests, and has no reason to exist. This issue can be addressed in two ways: - either by providing the right set of permissions on a section so that the linker assigns them to a segment with compatible permissions. - or by providing alignment constraints so that the linker can move the sections automatically to a new segment and set the right permission for non-executable data. The second option seems to be the preferred approach, even if not explicitly recommended. Examples of linker scripts for AArch64 are available at [1]. This patch reorganizes the linker script to eliminate RWX segments by changing the order of the sections and their offset. The tests needed to be amended to match the new addresses. [1]: https://developer.arm.com/documentation/dui0474/m/gnu-ld-script-support-in -armlink/default-gnu-ld-scripts-used-by-armlink/default-ld-script-when -building-an-executable?lang=en
2025-06-11AArch64 BTI/PAC PLT tests: remove RWX permissions on segmentsMatthieu Longo18-59/+86
The bti-far.ld and bti-plt.ld scripts don't provide information enough to the linker to assess the right set of permisssions on segments (i.e. Read/Write/Execute). This insufficiency caused the linker to bundle all the sections in a same segment with the union of all the required permissions, i.e. RWX. A segment with such lax permissions constitutes a security hole, so the linker emits the following warning message: <ELF file> has a LOAD segment with RWX permissions. This warning message is noisy in the tests, and has no reason to exist. This issue can be addressed in two ways: - either by providing the right set of permissions on a section so that the linker assigns them to a segment with compatible permissions. - or by providing alignment constraints so that the linker can move the sections automatically to a new segment and set the right permission for non-executable data. The second option seems to be the preferred approach, even if not explicitly recommended. Examples of linker scripts for AArch64 are available at [1]. The fixes in bti-far.ld and bti-plt.ld are the same, except that bti-far.ld also contains a ".far" section, to make sure that it generates the trampolines correctly. [1]: https://developer.arm.com/documentation/dui0474/m/gnu-ld-script-support-in -armlink/default-gnu-ld-scripts-used-by-armlink/default-ld-script-when -building-an-executable?lang=en
2025-06-11AArch64 tests: remove RWX permissions on segmentsMatthieu Longo6-56/+61
aarch64.ld is the linker script used by most of the relocation tests in AArch64 testsuite. The script does not provide information enough to the linker to assess the right set of permisssions on segments (i.e. Read/Write/Execute). This insufficiency caused the linker to bundle all the sections in a same segment with the union of all the required permissions, i.e. RWX. A segment with such lax permissions constitutes a security hole, so the linker emits the following warning message: <ELF file> has a LOAD segment with RWX permissions. This warning message is noisy in the tests, and has no reason to exist. This issue can be addressed in two ways: - either by providing the right set of permissions on a section so that the linker assigns them to a segment with compatible permissions. - or by providing alignment constraints so that the linker can move the sections automatically to a new segment and set the right permission for non-executable data. The second option seems to be the preferred approach, even if not explicitly recommended. Examples of linker scripts for AArch64 are available at [1]. [1]: https://developer.arm.com/documentation/dui0474/m/gnu-ld-script-support-in -armlink/default-gnu-ld-scripts-used-by-armlink/default-ld-script-when -building-an-executable?lang=en
2025-06-11aarch64: Add system registers for 2024 MPAM extensionYury Khrustalev8-0/+67
This patch adds support for new system registers introduced in the 2024 MPAM extension (Memory Partitioning and Monitoring): Available in Armv9.3-A: MPAMBW0_EL1, MPAMBW1_EL1, MPAMBW1_EL12, MPAMBW2_EL2, MPAMBW3_EL3, MPAMBWCAP_EL2, MPAMBWIDR_EL1 Available in Armv9.3-A with SME: MPAMBWSM_EL1 The details can be found in [1]. [1]: https://developer.arm.com/documentation/ddi0601/latest
2025-06-11aarch64: Add definitions for missing architecture bitsYury Khrustalev1-4/+16
Complete macros for feature bits for v9.1-A, v9.2-A, v9.3-A, and v9.4-A.
2025-06-11Automatic date update in version.inGDB Administrator1-1/+1
2025-06-11gas md_apply_fix value castsAlan Modra11-22/+20
These are all innocuous but unneeded. pdp11 and ppc are only formatting.
2025-06-11gas md_apply_fix bad castsAlan Modra3-3/+3
ns32k and z8k cast a valueT pointer to a long pointer when loading md_apply_fix's value. That's quite wrong if the types have different sizes, as they may eg. on a 32-bit host with 64-bit bfd support. sparc also loads the value via a cast pointer, but at least in that case the cast is to the same size pointer. None of these casts are needed. Get rid of them.
2025-06-11loongarch gcc-4.5 build fixesAlan Modra3-18/+33
Yet another case of missing fields in struct initialisation, which I've replaced with a memset, and some complaints about identifiers shadowing global declarations. Fixing the shadowing in loongarch-parse.y is easy. This one isn't so easy: gas/expr.c: In function 'expr': gas/expr.c:1891:12: error: declaration of 'is_unsigned' shadows a global declaration include/opcode/loongarch.h:224:14: error: shadowed declaration is here opcode/loongarch.h declares lots of stuff that shouldn't be made available to generic gas code, so I've removed that header from tc-loongarch.h and moved the parts of TC_FORCE_RELOCATION_SUB_LOCAL and TC_FORCE_RELOCATION_SUB_LOCAL that need LARCH_opts to functions in tc-loongarch.c * config/loongarch-parse.y (loongarch_parse_expr): Rename param to avoid shadowing. * config/tc-loongarch.c (loongarch_assemble_INSNs): Use memset rather than struct initialisation. (loongarch_force_relocation_sub_local): New function. (loongarch_force_relocation_sub_same): Likewise. * config/tc-loongarch.h: Don't include opcode/loongarch.h. (loongarch_force_relocation_sub_local): Declare, and.. (TC_FORCE_RELOCATION_SUB_LOCAL): ..use here. (loongarch_force_relocation_sub_same): Declare, and.. (TC_FORCE_RELOCATION_SUB_SAME): ..use here.
2025-06-11kvx gcc-4.5 build fixesAlan Modra3-5/+5
More missing struct initialisers, for expressionS vars that in this case don't need to be initialised. Also an error: redefinition of typedef 'symbolS'. OK, so don't use a typedef.
2025-06-11csky gcc-4.5 build fixAlan Modra1-26/+50
gcc-4.5 warns about missing csky_cpus struct initialisers. Fix that by providing everything in the init macros and the zero sentinel, rather than just a single {0} as allowed by C99.
2025-06-11gas m68hc11 use standard qsort predicate signatureAlan Modra1-4/+4
Avoid a function cast when using cmp_opcode with qsort.
2025-06-11Re: Further rs_code_align support refinementAlan Modra1-9/+9
Don't write the repeating nop pattern if it won't be used for alpha handle_align too.
2025-06-11gas: xtensa build failure with --enable-64-bit-bfdAlan Modra1-7/+13
A 32-bit host with --enable-64-bit-bfd --target=xtensa-lx106-elf give: gas/config/tc-xtensa.c: In function ‘xg_get_best_chain_entry’: gas/config/tc-xtensa.c:7689:11: error: absolute value function ‘labs’ given an argument of type ‘offsetT’ {aka ‘long long int’} but has parameter of type ‘long int’ which may cause truncation of value [-Werror=absolute-value] 7689 | if (labs (off) >= J_RANGE - J_MARGIN) | ^~~~ Let's not use labs. Unlike labs vma_abs deliberately returns an unsigned value, and does the negation in an unsigned type so that signed overflow can't happen. * config/tc-xtensa.c (vma_abs): New function. (xg_get_best_chain_entry, xg_get_fulcrum, xg_find_best_trampoline), (xg_is_relaxable_fixup): Use in place of labs.
2025-06-11dlltool invalid freeAlan Modra1-1/+1
This is a followup to commt 619f863c55ca "dlltool memory leaks". The name passed to def_name is freed, so if missing we can't just use "". strdup it. * defparse.y (opt_name): xstrdup empty string.
2025-06-10AArch64, Arm and TIC6x tests: fix typo in linker scriptsMatthieu Longo11-12/+12
The linker scripts for AArch64 and TIC6x were probably originally copied from Arm testsuite, and contain the same typo in the name of the attributes section. This patch fixes the typo across all the testsuites.
2025-06-10gdb/dwarf2: remove erroneous comment in open_and_init_dwo_fileSimon Marchi1-5/+0
When writing commit 28f15782adab ("gdb/dwarf: read multiple .debug_info.dwo sections"), I initially thought that the gcc behavior of producing multiple .debug_info.dwo sections was a bug (it is not). I updated the commit message, but it looks like this comment stayed. Remove it, since it can be misleading. Change-Id: I027712d44b778e836f41afbfafab993da02726ef Approved-By: Tom Tromey <tom@tromey.com>
2025-06-10RISC-V: Add Smrnmi extension imply relation.Jiawei3-0/+3
This patch adds the dependency of Smrnmi extension on Zicsr extension. bfd/ChangeLog: * elfxx-riscv.c: New imply. gas/ChangeLog: * testsuite/gas/riscv/imply.d: New test check. * testsuite/gas/riscv/imply.s: New imply test. Signed-off-by: Jiawei <jiawei@iscas.ac.cn>
2025-06-10RISC-V: Add support for svvptc extension.Dongyan Chen3-1/+3
This implements the svvptc extensons, version 1.0[1]. [1] https://github.com/riscv/riscv-svvptc bfd/ChangeLog: * elfxx-riscv.c: New extension. gas/ChangeLog: * NEWS: Updated. * testsuite/gas/riscv/march-help.l: Ditto.
2025-06-10Automatic date update in version.inGDB Administrator1-1/+1
2025-06-09gdb/solib-svr4: remove svr4_have_link_map_offsetsSimon Marchi1-18/+0
While C++ifying the solib code, I concluded that all arches that use SVR4 libraries do provide link map offsets, so I think this function is unnecessary now. Change-Id: Ifaae2560d92f658df3724def6219e2f89054e4b7 Approved-By: Tom Tromey <tom@tromey.com>
2025-06-09Adjust gdb.cp/cpexprs.exp for CygwinPedro Alves1-10/+26
Running gdb.cp/cpexprs.exp on x86-64 GNU/Linux, I see: break base::~base Breakpoint 117 at 0x555555555d90: file .../src/gdb/testsuite/gdb.cp/cpexprs.cc, line 135. (gdb) continue Continuing. Breakpoint 117, base::~base (this=0x7fffffffd0f8, __in_chrg=<optimized out>) at .../src/gdb/testsuite/gdb.cp/cpexprs.cc:135 135 ~base (void) { } // base::~base (gdb) PASS: gdb.cp/cpexprs.exp: continue to base::~base Here, the breakpoint only got one location because both the in-charge and the not-in-charge dtors are identical and got the same address: $ nm -A ./testsuite/outputs/gdb.cp/cpexprs/cpexprs| c++filt |grep "~base" ./testsuite/outputs/gdb.cp/cpexprs/cpexprs:0000000000001d84 W base::~base() ./testsuite/outputs/gdb.cp/cpexprs/cpexprs:0000000000001d84 W base::~base() While on Cygwin, we get two locations for the same breakpoint, which the testcase isn't expecting: break base::~base Breakpoint 117 at 0x100402678: base::~base. (2 locations) (gdb) continue Continuing. Thread 1 "cpexprs" hit Breakpoint 117.1, base::~base (this=0x7ffffcaf8, __in_chrg=<optimized out>) at .../src/gdb/testsuite/gdb.cp/cpexprs.cc:135 135 ~base (void) { } // base::~base (gdb) FAIL: gdb.cp/cpexprs.exp: continue to base::~base We got two locations because the in-charge and the not-in-charge dtors have different addresses: $ nm -A outputs/gdb.cp/cpexprs/cpexprs.exe | c++filt | grep "~base" outputs/gdb.cp/cpexprs/cpexprs.exe:0000000100402680 T base::~base() outputs/gdb.cp/cpexprs/cpexprs.exe:0000000100402690 T base::~base() On Cygwin, we also see the typical failure due to not expecting the inferior to be multi-threaded: (gdb) continue Continuing. [New Thread 628.0xe08] Thread 1 "cpexprs" hit Breakpoint 200, test_function (argc=1, argv=0x7ffffcc20) at .../src/gdb/testsuite/gdb.cp/cpexprs.cc:336 336 derived d; (gdb) FAIL: gdb.cp/cpexprs.exp: continue to test_function for policyd3::~policyd Both issues are fixed by this patch, and now the testcase passes cleanly on Cygwin, for me. Reviewed-By: Keith Seitz <keiths@redhat.com> Change-Id: If7eb95d595f083f36dfebf9045c0fc40ef5c5df1
2025-06-09gdb.threads/thread-execl, don't re-exec foreverPedro Alves1-2/+8
I noticed on Cygwin, gdb.thread/thread-execl.exp would hang, (not that surprising since we can't follow-exec on Cygwin). Looking at the process list running on the machine, we end up with a thread-execl.exe process constantly respawning another process [1]. We see the same constant-reexec if we launch gdb.thread/thread-execl manually on the shell: $ ./testsuite/outputs/gdb.threads/thread-execl/thread-execl # * doesn't exit, constantly re-execing * ^C Prevent this leftover constantly-re-execing scenario by making the testcase program only exec once. We now get: $ ./testsuite/outputs/gdb.threads/thread-execl/thread-execl $ # exits immediately after one exec. On Cygwin, the testcase now fails reasonably quickly, and doesn't leave stale processes behind. Still passes cleanly on x86-64 GNU/Linux. [1] Cygwin's exec emulation spawns a new Windows process for the new image. Approved-By: Andrew Burgess <aburgess@redhat.com> Change-Id: I0de1136cf2ef7e89465189bc43489a2139a80efb
2025-06-09Support core dumping testcases with Cygwin's dumperPedro Alves1-1/+6
Cygwin supports dumping ELF cores via a dumper.exe utility, see https://www.cygwin.com/cygwin-ug-net/dumper.html. When I run a testcase that has the "kernel" generate a corefile, like gdb.base/corefile.exp, Cygwin invokes dumper.exe correctly and generates an ELF core file, however, the testsuite doesn't find the generated core: Running /home/alves/gdb/src/gdb/testsuite/gdb.base/corefile.exp ... WARNING: can't generate a core file - core tests suppressed - check ulimit -c The file is correctly put under $coredir, e.g., like so: outputs/gdb.base/corefile/coredir.8926/corefile.exe.core The problem is in this line in core_find: foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" { Note that that isn't looking for "${binfile}.core" inside ${coredir}... That is fixed in this patch. However, that still isn't sufficient for Cygwin + dumper, as in that case the core is going to be called foo.exe.core, not foo.core. Fix that by looking for foo.exe.core in the core dir as well. With this, gdb.base/corefile.exp and other tests that use core_find now run. They don't pass cleanly, but at least now they're exercised. Approved-By: Tom Tromey <tom@tromey.com> Change-Id: Ic807dd2d7f22c5df291360a18c1d4fbbbb9b993e
2025-06-09Adjust gdb.base/sigall.exp for CygwinPedro Alves1-4/+5
The gdb.base/sigall.exp testcase has many FAILs on Cygwin currently. From: Thread 1 "sigall" received signal SIGPWR, Power fail/restart. 0x00007ffeac9ed134 in ntdll!ZwWaitForSingleObject () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll (gdb) FAIL: gdb.base/sigall.exp: get signal LOST we see two issues. The test is expecting "Program received ..." which only appears if the inferior is single-threaded. All Cygwin inferiors are multi-threaded, because both Windows and the Cygwin runtime spawn a few helper threads. And then, SIGLOST is the same as SIGPWR on Cygwin. The testcase already knows to treat them the same on SPARC64 GNU/Linux. We just need to extend the relevant code to treat Cygwin the same. With this, the test passes cleanly on Cygwin. Approved-By: Tom Tromey <tom@tromey.com> Change-Id: Ie3553d043f4aeafafc011347b6cb61ed58501667
2025-06-09Adjust gdb.arch/amd64-watchpoint-downgrade.exp for CygwinPedro Alves1-1/+1
The gdb.arch/amd64-watchpoint-downgrade.exp testcase is assuming the output of debugging a single-thread program, like so, on e.g., GNU/Linux: starti Starting program: .../gdb.arch/amd64-watchpoint-downgrade/amd64-watchpoint-downgrade warning: watchpoint 1 downgraded to software watchpoint Program stopped. 0x00007ffff7fe32b0 in _start () from /lib64/ld-linux-x86-64.so.2 However, on Cygwin, where all inferiors are multi-threaded (because both Windows and the Cygwin runtime spawn a few helper threads), we get: starti Starting program: .../gdb.arch/amd64-watchpoint-downgrade/amd64-watchpoint-downgrade [New Thread 4652.0x17e4] warning: watchpoint 1 downgraded to software watchpoint Thread 1 stopped. 0x00007ffbfc1c0911 in ntdll!LdrInitShimEngineDynamic () from C:/Windows/SYSTEM32/ntdll.dll This commit adjusts the testcase to work with either output. (Note GDB may print a thread name after the thread number.) Approved-by: Kevin Buettner <kevinb@redhat.com> Change-Id: I3aedfec04924ea3fb3bb87ba3251e2b720f8d59c
2025-06-09Adjust gdb.base/bp-permanent.exp for CygwinPedro Alves1-2/+2
On Cygwin, all inferiors are multi-threaded, because both Windows and the Cygwin runtime spawn a few helper threads. Adjust the gdb.base/bp-permanent.exp testcase to work with either single- or multi-threaded inferiors. Approved-by: Kevin Buettner <kevinb@redhat.com> Change-Id: I28935b34fc9f739c2a5490e83aa4995d29927be2
2025-06-09Adjust gdb.base/bp-cond-failure.exp for CygwinPedro Alves1-2/+2
Currently on Cygwin, I get: Running /home/alves/gdb/src/gdb/testsuite/gdb.base/bp-cond-failure.exp ... FAIL: gdb.base/bp-cond-failure.exp: access_type=char: cond_eval=auto: multi-loc: continue FAIL: gdb.base/bp-cond-failure.exp: access_type=char: cond_eval=auto: single-loc: continue FAIL: gdb.base/bp-cond-failure.exp: access_type=short: cond_eval=auto: multi-loc: continue FAIL: gdb.base/bp-cond-failure.exp: access_type=short: cond_eval=auto: single-loc: continue FAIL: gdb.base/bp-cond-failure.exp: access_type=int: cond_eval=auto: multi-loc: continue FAIL: gdb.base/bp-cond-failure.exp: access_type=int: cond_eval=auto: single-loc: continue FAIL: gdb.base/bp-cond-failure.exp: access_type=long long: cond_eval=auto: multi-loc: continue FAIL: gdb.base/bp-cond-failure.exp: access_type=long long: cond_eval=auto: single-loc: continue On GNU/Linux, we see: Breakpoint 2.1, foo () at .../src/gdb/testsuite/gdb.base/bp-cond-failure.c:21 21 return 0; /* Multi-location breakpoint here. */ (gdb) PASS: gdb.base/bp-cond-failure.exp: access_type=char: cond_eval=auto: multi-loc: continue While on Cygwin, we see: Thread 1 "bp-cond-failure" hit Breakpoint 2.1, foo () at .../src/gdb/testsuite/gdb.base/bp-cond-failure.c:21 21 return 0; /* Multi-location breakpoint here. */ (gdb) FAIL: gdb.base/bp-cond-failure.exp: access_type=char: cond_eval=auto: multi-loc: continue The difference is the "Thread 1" part in the beginning of the quoted output. It appears on Cygwin, but not on Linux. That's because on Cygwin, all inferiors are multi-threaded, because both Windows and the Cygwin runtime spawn a few helper threads. Fix this by adjusting the gdb.base/bp-cond-failure.exp testcase to work with either single- or multi-threaded inferiors. The testcase passes cleanly for me after this. Approved-by: Kevin Buettner <kevinb@redhat.com> Change-Id: I5ff11d06ac1748d044cef025f1e78b8f84ad3349
2025-06-09MAINTAINERS: Add myself as an AArch64 maintainerAlice Carlotti1-0/+1
2025-06-09aarch64: Increase the number of feature words to 3Richard Earnshaw1-1/+2
Now that most of the effort of updating the number of feature words is handled by macros, add an additional one, taking the number of supported features to 192.