aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-07-30gdb: use std::string vector for macro definitionSimon Marchi4-144/+81
Use std::vector<std::string> when defining macros, to avoid the manual memory management. With the use of std::vector, the separate `int argc` parameter is no longer needed, we can use the size of the vector instead. However, for some functions, this parameter had a dual function. For object-like macros, it was interpreted as a `macro_special_kind` enum. For these functions, remove `argc`, but add a new `special_kind` parameter. Change-Id: Ice76a6863dfe598335e3b8d5d077513e50975cc5 Approved-By: Tom de Vries <tdevries@suse.de>
2024-07-30gdb/doc: move @anchor off @item lineAndrew Burgess1-1/+2
When building the GDB info manual I see this warning: gdb.texinfo:41447: warning: @anchor should not appear on @item line And indeed line 41447 looks like this: @item @anchor{maint info breakpoints}maint info breakpoints I propose moving the @anchor{...} part to the previous line which silences the warning. Approved-By: Eli Zaretskii <eliz@gnu.org>
2024-07-30gas/NEWS, ld/NEWS: Announce LoongArch changes in 2.43Lulu Cai2-0/+7
2024-07-30Automatic date update in version.inGDB Administrator1-1/+1
2024-07-29Add a test for the gcore scriptAlexandra Hájková5-4/+189
It also tests the gcore script being run without its accessible terminal. This test was written by Jan Kratochvil a long time ago. I modernized the test making it use various procs from lib/gdb.exp, reorganizing it and added some comments. Modify the gcore script to make it possible to pass the --data-directory to it. This prevents a lot of these warnings: Python Exception <class 'AttributeError'>: module 'gdb' has no attribute '_handle_missing_debuginfo' Tested by using make check-all-boards. Co-Authored-By: Jan Kratochvil <jan.kratochvil@redhat.com> Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2024-07-29[gdb/testsuite] Fix gdb.gdb/index-file.exp with -g0Tom de Vries1-2/+13
When building gdb with -g0 and running test-case gdb.gdb/index-file.exp, we run into: ... (gdb) save gdb-index index_1^M Error while writing index for `xgdb': No debugging symbols^M (gdb) FAIL: gdb.gdb/index-file.exp: create gdb-index file ... Fix this by instead emitting an unsupported, and bailing out. Tested on aarch64-linux.
2024-07-29[gdb/testsuite] Remove PR31554 kfail in gdb.threads/leader-exit-attach.expTom de Vries1-8/+0
When running test-case gdb.threads/leader-exit-attach.exp with target board native-extended-gdbserver I run into: ... (gdb) KFAIL: $exp: attach (PRMS: gdb/31555) print $_inferior_thread_count^M $1 = 0^M (gdb) KPASS: $exp: get valueof "$_inferior_thread_count" (PRMS server/31554) ... The PR mentioned in the KPASS, PR31554 was fixed by commit f1fc8dc2dcc ("Fix "attach" failure handling with GDBserver"), and consequently the PR is closed. Fix this by removing the corresponding kfail. Tested on x86_64-linux.
2024-07-29[gdb/testsuite] Fix gdb.threads/leader-exit-attach.exp with check-read1Tom de Vries1-3/+3
With test-case gdb.threads/leader-exit-attach.exp and check-read1, I run into: ... (gdb) attach 18591^M Attaching to program: leader-exit-attach, process 18591^M warning: process 18591 is a zombie - the process has already terminatedKFAIL: $exp: attach (PRMS: gdb/31555) ^M ptrace: Operation not permitted.^M (gdb) FAIL: $exp: get valueof "$_inferior_thread_count" ... The problem is that the gdb_test_multiple in the test-case doesn't consume the prompt in all clauses: ... gdb_test_multiple "attach $testpid" "attach" { -re "Attaching to process $testpid failed.*" { # GNU/Linux gdbserver. Linux ptrace does not let you attach # to zombie threads. setup_kfail "gdb/31555" *-*-linux* fail $gdb_test_name } -re "warning: process $testpid is a zombie - the process has already terminated.*" { # Native GNU/Linux. Linux ptrace does not let you attach to # zombie threads. setup_kfail "gdb/31555" *-*-linux* fail $gdb_test_name } -re "Attaching to program: $escapedbinfile, process $testpid.*$gdb_prompt $" { pass $gdb_test_name set attached 1 } } ... Fix this by using -wrap in the first two clauses. While we're at it, also use -wrap in the third clause. Tested on x86_64-linux.
2024-07-29Updated translations for the bfd, binutils, gas, ld and opcodes directoriesNick Clifton16-26194/+28658
2024-07-29Fixes to "PR 31728 testcases"Alan Modra6-23/+55
This brings us down to just these fails for the set of targets I usually test when making testsuite changes. aarch64-pe +FAIL: ld-pe/symbols-ordinals-hints-imports-ld arm-pe +FAIL: ld-pe/symbols-ordinals-hints-exports-dlltool arm-pe +FAIL: ld-pe/symbols-ordinals-hints-imports-dlltool The aarch64 one is likely due to the target missing support somewhere. It is fairly new, I haven't investigated. The arm-pe fails are due to arm-pe being a target that adds underscores to symbol names (see config.bfd) whereas dlltool thinks it does not (see dlltool.c:asm_prefix). arm-wince-pe on the other hand doesn't add underscores. I would guess the right fix for dlltool is to get this symbol info from bfd using bfd_get_target_info. Note I'm not very happy about the creative use of ld_after_inputfile in symbols-ordinals-hints-imports-ld.d, which is likely to break with some future run_dump_test change.
2024-07-29PR 31728 testcasesPali Rohár13-14/+169
2024-07-29PR32032 dwp segfaults on hello world binaryAlan Modra1-5/+5
Fixing the segfault is easy with this bandaid, but further work is needed to teach dwp about DW_AT_dwo_name and dwo id in the cu header. At the moment dwp only handles DW_AT_GNU_dwo_name and DW_AT_GNU_dwo_id. PR 32032 * dwp.cc (Dwp_output_file::finalize): Return immediately on no output file.
2024-07-29Automatic date update in version.inGDB Administrator1-1/+1
2024-07-28gdb/testsuite: track if a caching proc calls gdb_exit or notAndrew Burgess2-74/+135
After a recent patch review I asked myself why can_spawn_for_attach exists. This proc currently does some checks, and then calls can_spawn_for_attach_1 which is an actual caching proc. The answer is that can_spawn_for_attach exists in order to call gdb_exit the first time can_spawn_for_attach is called within any test script. The reason this is useful is that can_spawn_for_attach_1 calls gdb_exit. If the user calls can_spawn_for_attach_1 directly then a problem might exist. Imagine a test written like this: gdb_start if { [can_spawn_for_attach_1] } { ... do stuff that assumes GDB is running ... } If this test is NOT the first test run, and if an earlier test calls can_spawn_for_attach_1, then when the above test is run the can_spawn_for_attach_1 call will return the cached value and gdb_exit will not be called. But, if the above test IS the first test run then can_spawn_for_attach_1 will not return the cached value, but will instead compute the cached value, a process that ends up calling gdb_exit. When can_spawn_for_attach_1 returns GDB will have exited and the test might fail if it is written assuming that GDB is running. So can_spawn_for_attach was added which ensures that we _always_ call gdb_exit the first time can_spawn_for_attach is called within a single test script, this ensures that in the above case, even if the above is not the first test script run, gdb_exit will still be called. This ensures consistent behaviour and avoids some hidden bugs in the testsuite. The split between can_spawn_for_attach and can_spawn_for_attach_1 was introduced in this commit: commit 147fe7f9fb9a89b217d11d73053f53e8edacf90f Date: Mon May 6 14:27:09 2024 +0200 [gdb/testsuite] Handle ptrace operation not permitted in can_spawn_for_attach However, I observe that can_spawn_for_attach is not the only caching proc that calls gdb_exit. Why does can_spawn_for_attach get special treatment when surely the same issue exists for any other caching proc that calls gdb_exit? I think a better solution is to move the logic from can_spawn_for_attach into cache.exp and generalise it so that it applies to all caching procs. This commit does this by: 1. When the underlying caching proc is executed we track calls to gdb_exit. If a caching proc calls gdb_exit then this information is stored in gdb_data_cache (using a ',exit' suffix), and also written to the cache file if appropriate. 2. When a cached value is returned from gdb_do_cache, if the underlying proc would have called gdb_exit, and if this is the first use of the caching proc in this test script, then we call gdb_exit. When storing the ',exit' value into the on-disk cache file, the flag value is stored on a second line. Currently every cached value only occupies a single line, and a check is added to ensure this remains true in the future. To track calls to gdb_exit I eventually settled on using TCL's trace mechanism. We already make use of this in lib/gdb.exp so I figure this is OK to use. This should be fine, so long as non of the caching procs use 'with_override' to replace gdb_exit, or do any other proc replacement to change gdb_exit, however, I think that is pretty unlikely. One issue did come up in testing, a FAIL in gdb.base/break-interp.exp, prior to this commit can_spawn_for_attach would call gdb_exit before calling the underlying caching proc. After this call we call gdb_exit after calling the caching proc. The underlying caching proc relies on gdb_exit having been called. To resolve this issue I just added a call to gdb_exit into can_spawn_for_attach. With this done can_spawn_for_attach_1 can be renamed to can_spawn_for_attach, and the existing can_spawn_for_attach can be deleted.
2024-07-28gdb/testsuite: restructure gdb_data_cache (lib/cache.exp)Andrew Burgess1-9/+9
In the next commit I want to add more information to gdb_data_cache (see lib/cache.exp). Specifically I want to track if the underlying function of a caching proc calls gdb_exit or not. Currently gdb_data_cache is an associative array, the keys of which are the name of the caching proc. In this commit I add a ',value' suffix to the gdb_data_cache keys. In the next commit I'll add additional entries with a different suffix. There should be no noticable changes after this commit, this is just a restructuring.
2024-07-28Automatic date update in version.inGDB Administrator1-1/+1
2024-07-27[gdb/tdep] Fix arm thumb2 hw breakpointTom de Vries3-56/+147
On an aarch64-linux system with 32-bit userland running in a chroot, and using target board unix/mthumb I get: ... (gdb) hbreak hbreak.c:27^M Hardware assisted breakpoint 2 at 0x4004e2: file hbreak.c, line 27.^M (gdb) PASS: gdb.base/hbreak.exp: hbreak continue^M Continuing.^M Unexpected error setting breakpoint: Invalid argument.^M (gdb) XFAIL: gdb.base/hbreak.exp: continue to break-at-exit after hbreak ... due to this call in arm_linux_nat_target::low_prepare_to_resume: ... if (ptrace (PTRACE_SETHBPREGS, pid, (PTRACE_TYPE_ARG3) ((i << 1) + 1), &bpts[i].address) < 0) perror_with_name (_("Unexpected error setting breakpoint")); ... This problem does not happen if instead we use a 4-byte aligned address. This may or may not be a kernel bug. Work around this by first using an inoffensive address bpts[i].address & ~0x7. Likewise in arm_target::low_prepare_to_resume, which fixes the same fail on target board native-gdbserver/mthumb. While we're at it: - use arm_hwbp_control_is_initialized in arm_linux_nat_target::low_prepare_to_resume, - handle the !arm_hwbp_control_is_initialized case explicitly, - add missing '_()' in arm_target::low_prepare_to_resume, - make error messages identical between arm_target::low_prepare_to_resume and arm_linux_nat_target::low_prepare_to_resume, - factor out sethbpregs_hwbp_address and sethbpregs_hwbp_control to make the implementation more readable. Remove the tentative xfail added in d0af16d5a10 ("[gdb/testsuite] Add xfail in gdb.base/hbreak.exp") by simply reverting the commit. Tested on arm-linux. Approved-By: Luis Machado <luis.machado@arm.com> Tested-By: Luis Machado <luis.machado@arm.com>
2024-07-27Automatic date update in version.inGDB Administrator1-1/+1
2024-07-26microMIPS: Add MT ASE instruction set supportYunQiang Su14-25/+2001
Add the MT ASE instruction operand types and encodings to the microMIPS opcode table and enable the assembly of these instructions in GAS from MIPSr2 onwards. Update the binutils and GAS testsuites accordingly. References: "MIPS Architecture for Programmers, Volume IV-f: The MIPS MT Module for the microMIPS32 Architecture", MIPS Technologies, Inc., Document Number: MD00768, Revision 1.12, July 16, 2013 Co-Authored-By: Maciej W. Rozycki <macro@redhat.com>
2024-07-26Fix "Untranslated plural in readelf.c"Nick Clifton1-9/+10
PR 32002
2024-07-26gdb/testsuite: fix build-id compile option when used with clangAndrew Burgess4-5/+6
It was pointed out in this message: https://inbox.sourceware.org/gdb-patches/5d7a514b-5dad-446f-a021-444ea88ecf07@redhat.com That the test gdb.base/build-id-seqno.exp I added recently was FAILing when using Clang as the compiler. The problem was that I had failed to add 'build-id' as a compile option in the call to build_executable within the test script. For GCC this is fine as build-ids are included by default. For Clang though this meant the build-id was not included and the test would fail. So I added build-id to the compiler options.... and the test still didn't pass! Now the test fails to compile and I see this error from the compiler: gdb compile failed, clang-15: warning: -Wl,--build-id: 'linker' \ input unused [-Wunused-command-line-argument] It turns out that the build-id compile option causes our gdb.exp to add the '-Wl,--build-id' option into the compiler flags, which means its used when building the object file AND during the final link. However this option is unnecessary when creating the object file and Clang warns about this, which causes the build to fail. The solution is to change gdb.exp, instead of adding the build-id flags like this: lappend new_options "additional_flags=-Wl,--build-id" we should instead add them like: lappend new_options "ldflags=-Wl,--build-id" Now the flag is only appended during the link phase and Clang is happy. The gdb.base/build-id-seqno.exp test now passes with Clang. The same problem (adding to additional_flags instead of ldflags) exists for the no-build-id compile option, so I've fixed that too. While investigating this I also spotted two test scripts, gdb.base/index-cache.exp and gdb.dwarf2/per-bfd-sharing.exp which were setting ldflag directly rather than using the build-id compile option so I've updated these two tests to use the compile option which I think is neater. I've checked that all these tests still pass with both GCC and Clang. There should be no changes in what is actually tested after this commit. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2024-07-26gas: correct sb_add_char() 2nd parameter typeJan Beulich2-2/+2
It's entirely unclear why size_t was used there; my only guess is copy- and-paste from another of the functions.
2024-07-26gas: drop scrubber state -2Jan Beulich4-48/+50
Instead re-use code handling LEX_IS_TWOCHAR_COMMENT_1ST, thus ensuring that we wouldn't get bogus state transitions: For example, when we're in states 0 or 1, a comment should be no different from whitespace encountered in those states. Plus for e.g. x86 this results in such comments now truly being converted to a blank, as mandated by documentation. Both aspects apparently were a result of blindly (and wrongly) moving to state 3 _before_ consuming the "ungot" blank. Also amend a related comment elsewhere. In the new testcase the .irp is to make visible in the listing all the whitespace that the scrubber inserts / leaves in place.
2024-07-26x86: accept whitespace around prefix separatorJan Beulich4-19/+99
... and prediction suffix comma. Other than documented /**/ comments currently aren't really converted to a single space, at least not for x86 in its most common configurations. That'll be fixed subsequently, at which point blanks may appear where so far none were expected. Furthermore not permitting blanks around these separators wasn't quite logical anyway - such constructs are composite ones, and hence components ought to have been permitted to be separated by whitespace from the very beginning. Furthermore note how, due to the scrubber being overly aggressive in removing whitespace, some similar construct with a prefix were already accepted. Note how certain other checks in parse_insn() can be simplified as a result. While there for the prediction suffix also make checks case-insensitive and check for a proper trailing separator.
2024-07-26x86/APX: optimize certain {nf}-form insns to BMI2 onesJan Beulich10-37/+1530
..., as those leave EFLAGS untouched anyway. That's a shorter encoding, available as long as no eGPR is in use anywhere.
2024-07-26Remove srcdir from x86 testcase "source:" linesAlan Modra3-3/+3
It's wrong to have ${srcdir} in run_dump_test "source:" lines, as run_dump_test adds $srcdir/$subdir/ to the line passed to the shell except when the source path starts with "./". The tests work currently because the shell expands ${srcdir} to an empty string. PR 31728 * testsuite/ld-i386/code16.d: Correct "source:". * testsuite/ld-x86-64/code16.d: Likewise. * testsuite/ld-x86-64/rela.d: Likewise.
2024-07-26ARM print_insn_mve assertionAlan Modra1-17/+2
This corrects objdump -d -m armv8.1-m.main output for a testcase found by oss-fuzz, .inst 0xee2fee79, which hits an assertion. Obviously the switch case constants should be binary, not hex. Correcting that is enough to cure this assertion, but I don't see any point in singling out the invalid case 0b10. In fact, it is just plain wrong to print "undefined instruction: size equals zero undefined instruction: size equals two". I also don't see the need for defensive programming here as is done elsewhere in checking that "value" is in range before indexing mve_vec_sizename. There is exactly one MVE_VSHLL_T2 entry in mve_opcodes. It is easy to verify that "value" is only two bits.
2024-07-26Automatic date update in version.inGDB Administrator1-1/+1
2024-07-25gdb/amdgpu: remove unused includesSimon Marchi1-2/+0
Remove two includes reported as unused by clangd. Change-Id: Idfe27a6c21186de5bd5f8e8f7fdc0fd8ab4d451e
2024-07-25x86: Add missing newlines in TLS transition error messagesH.J. Lu1-6/+6
Change TLS transition error messages from a-argp-help.o(.text+0x12f): relocation R_X86_64_GOTTPOFF against `a' must be used in ADD or MOV onlyld: final link failed: bad value to a-argp-help.o(.text+0x12f): relocation R_X86_64_GOTTPOFF against `a' must be used in ADD or MOV only ld: final link failed: bad value PR ld/32017 * elfxx-x86.c (_bfd_x86_elf_link_report_tls_transition_error): Add missing newlines. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-07-25x86: Improve TLS transition error checkH.J. Lu22-132/+318
Provide detailed TLS transition errors when unsupported instructions are used. Treat R_X86_64_CODE_4_GOTTPOFF and R_X86_64_CODE_6_GOTTPOFF as R_X86_64_GOTTPOFF when performing TLS transition. bfd/ PR ld/32017 * elf32-i386.c (elf_i386_check_tls_transition): Return different enums for different errors. (elf_i386_tls_transition): Change argument from r_symndx to sym. Call _bfd_x86_elf_link_report_tls_transition_error to report TLS transition errors. (elf_i386_scan_relocs): Pass isym instead of r_symndx to elf_i386_tls_transition. (elf_i386_relocate_section): Pass sym instead of r_symndx to elf_i386_tls_transition. * elf64-x86-64.c (elf_x86_64_check_tls_transition): Return different enums for different errors. (elf_x86_64_tls_transition): Change argument from r_symndx to sym. Treat R_X86_64_CODE_4_GOTTPOFF and R_X86_64_CODE_6_GOTTPOFF as R_X86_64_GOTTPOFF. Call _bfd_x86_elf_link_report_tls_transition_error to report TLS transition errors. (elf_x86_64_scan_relocs): Pass isym instead of r_symndx to elf_x86_64_tls_transition. (elf_x86_64_relocate_section): Pass sym instead of r_symndx to elf_x86_64_tls_transition. * elfxx-x86.c (_bfd_x86_elf_link_report_tls_transition_error): New. * elfxx-x86.h (elf_x86_tls_error_type): Likewise. (_bfd_x86_elf_link_report_tls_transition_error): Likewise. ld/ PR ld/32017 * testsuite/ld-i386/i386.exp: Run tlsgdesc1 and tlsgdesc2. * testsuite/ld-i386/tlsie2.d: Updated. * testsuite/ld-i386/tlsie3.d: Likewise. * testsuite/ld-i386/tlsie4.d: Likewise. * testsuite/ld-i386/tlsie5.d: Likewise. * testsuite/ld-x86-64/tlsie2.d: Likewise. * testsuite/ld-x86-64/tlsie3.d: Likewise. * testsuite/ld-i386/tlsgdesc1.d: New file. * testsuite/ld-i386/tlsgdesc1.s: Likewise. * testsuite/ld-i386/tlsgdesc2.d: Likewise. * testsuite/ld-i386/tlsgdesc2.s: Likewise. * testsuite/ld-x86-64/tlsdesc3.d: Likewise. * testsuite/ld-x86-64/tlsdesc3.s: Likewise. * testsuite/ld-x86-64/tlsdesc4.d: Likewise. * testsuite/ld-x86-64/tlsdesc4.s: Likewise. * testsuite/ld-x86-64/tlsie5.d: Likewise. * testsuite/ld-x86-64/tlsie5.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run tlsie5, tlsdesc3 and tlsdesc4. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-07-25Add /usr/lib32 to the native search paths for FreeBSD systems.Nick Clifton1-1/+1
PR 31395
2024-07-25Automatic date update in version.inGDB Administrator1-1/+1
2024-07-24Remove redundant macro definitions from remote.cTom Tromey1-11/+0
I happened to notice that a few macros are defined twice in remote.c. This patch removes one copy. Tested by rebuilding. Reviewed-By: Tom de Vries <tdevries@suse.de>
2024-07-24[gdb/exp] Fix ptype $_creal/$_cimagTom de Vries2-8/+25
Consider test.c, compiled with -g: ... __complex__ float cf = 1 + 2i; int main (void) { return 0; } ... The values of cf and its components are: ... $ gdb -q a.out Reading symbols from a.out... (gdb) p cf $1 = 1 + 2i (gdb) p $_creal(cf) $2 = 1 (gdb) p $_cimag(cf) $3 = 2 ... and their respective types are: ... (gdb) ptype $1 type = complex float (gdb) ptype $2 type = float (gdb) ptype $3 type = float ... Now let's try that again, using ptype directly: ... (gdb) ptype cf type = complex float (gdb) ptype $_creal(cf) type = int (gdb) ptype $_cimag(cf) type = int ... The last two types should have been float, not int. Fix this by extending the internal function handlers creal_internal_fn and cimag_internal_fn with the noside parameter, such that we get instead: ... (gdb) ptype $_creal(cf) type = float (gdb) ptype $_cimag(cf) type = float ... Tested on x86_64-linux. Reviewed-By: Keith Seitz <keiths@redhat.com> PR exp/31816 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31816
2024-07-24[gdb/exp] Allow internal function to indicate return typeTom de Vries5-31/+100
Currently an internal function handler has this prototype: ... struct value *handler (struct gdbarch *gdbarch, const struct language_defn *language, void *cookie, int argc, struct value **argv); ... Also allow an internal function with a handler with an additional "enum noside noside" parameter: ... struct value *handler (struct gdbarch *gdbarch, const struct language_defn *language, void *cookie, int argc, struct value **argv, enum noside noside); ... In case such a handler is called with noside == EVAL_AVOID_SIDE_EFFECTS, it's expected to return some value with the correct return type. At least, provided it can do so without side effects, otherwise it should throw an error. No functional changes. Tested on x86_64-linux and aarch64-linux. Reviewed-By: Keith Seitz <keiths@redhat.com>
2024-07-24BFD: Add .relro_padding to list of special sectionsNick Clifton1-0/+6
2024-07-24gdb/testsuite: ensure gdb_get_worker_threads succeedsAndrew Burgess1-0/+5
Sometimes, if I'm testing on a loaded machine, the gdb.gdb/index-file.exp test will timeout during some early steps, which then cases a TCL error to be thrown later in the test script. Dejagnu then reports this error once the test run has completed, which can be pretty noisy, and isn't really very helpful. The underlying problem is that if GDB takes too long to load the executable (which is GDB itself in this test) then GDB will still be busy loading the executable when dejagnu moves on and call gdb_get_worker_threads. The gdb_get_worker_threads call itself times out as GDB is _still_ busy loading the executable, and so gdb_get_worker_threads returns the string "UNKNOWN". Later we try to perform arithmetic on the worker thread count, which results in errors when we try to do 'UNKNOWN / 2'. I propose that after calling gdb_get_worker_threads, we check if the result was UNKNOWN. If it was then we should report an UNRESOLVED and abandon the test, this avoids the later TCL errors.
2024-07-24opcodes/x86: fix minor missed styling caseAndrew Burgess1-2/+2
I noticed that the x86 instruction: sar $1,%rsi would fail to style the '$0x1' as an immediate. This commit fixes that case.
2024-07-24[gdb/testsuite] Handle address class annotation for s390x in some test-casesTom de Vries3-7/+42
On s390x-linux, I ran into: ... (gdb) ptype crash^M type = class crash {^M ^M public:^M crash(int (class {...}::*)(class {...} * const @mode32));^M }^M (gdb) FAIL: gdb.dwarf2/dw2-anon-mptr.exp: ptype crash ... The problem is that the test-case doesn't expect the address class annotation @mode32. The test-case uses a .S file, with the address size hard-coded to 4 bytes, and that's something that is annotated with @mode32 on s390x (which uses 8 byte addresses). Fix this by allowing the annotation in the regexp. Likewise in two other test-cases. Tested on s390-linux and x86_64-linux.
2024-07-24[gdb/testsuite] Fix gdb.cp/m-static.exp on armTom de Vries2-4/+19
With test-case gdb.cp/m-static.exp on arm-linux, I get: ... (gdb) ptype test5.single_constructor^M type = class single_constructor {^M ^M public:^M single_constructor(void);^M ~single_constructor(void);^M } *(single_constructor * const)^M (gdb) FAIL: gdb.cp/m-static.exp: simple object instance, ptype constructor ... The test-case expects: - no empty line before "public:", and - no "~single_constructor(void)", but "~single_constructor()" The latter is due to commit 137c886e9a6 ("[gdb/c++] Print destructor the same for gcc and clang"). The failing test is in a part only enabled for is_aarch32_target == 1, so it looks like it was left behind. I'm assuming the same happened for the other difference. Fix this by updating the regexps to match the observed output. Tested on arm-linux. Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-07-24RISC-V: PR32001, Untranslated "internal:" prefix for error message.Nelson Chu1-1/+1
bfd/ PR 32001 * elfxx-riscv.c (riscv_update_subset1): Fixed the untranslated "internal:" prefix for error message.
2024-07-24Automatic date update in version.inGDB Administrator1-1/+1
2024-07-23Add returnValue scope to DAPTom Tromey3-16/+25
The DAP spec recently changed to add a new scope for the return value from a "stepOut" request. This new scope uses the "returnValue" presentation hint. See: https://github.com/microsoft/debug-adapter-protocol/issues/458 This patch implements this for gdb. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31945 Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2024-07-23Refine the 'define' documentationTom Tromey1-6/+16
A while ago, an AdaCore user reported some difficulties with the 'define' command. While some of these difficulties are intrinsic, or at least difficult to change, it seemed sensible to document a couple of the typical problems -- and to make the text describing argument substitution a bit more prominent. Approved-By: Eli Zaretskii <eliz@gnu.org>
2024-07-23gdb/solib-frv: move lm_info object to solibSimon Marchi1-0/+2
I noticed that the lm_info_frv objects created in frv_current_sos are never moved to the solib object. This bug was introduced in 8971d2788e ("gdb: link so_list using intrusive_list"), which mistakenly removed the line sop->lm_info = std::move (li); ... probably due so a bad merge conflict resolution. Re-add this line. If merged in master, I would cherry-pick this to gdb-15-branch. Change-Id: I609a1a5ad39e93f70a95ea5ebe3f8ff4ab6a8db2 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32005 Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-07-23[gdb/testsuite] Add xfail in gdb.base/hbreak.expTom de Vries1-6/+34
On an aarch64-linux system with 32-bit userland running in a chroot, and using target board unix/mthumb I get: ... (gdb) hbreak hbreak.c:27^M Hardware assisted breakpoint 2 at 0x4004e2: file hbreak.c, line 27.^M (gdb) PASS: gdb.base/hbreak.exp: hbreak continue^M Continuing.^M Unexpected error setting breakpoint: Invalid argument.^M (gdb) FAIL: gdb.base/hbreak.exp: continue to break-at-exit after hbreak ... due to this call in arm_linux_nat_target::low_prepare_to_resume: ... if (ptrace (PTRACE_SETHBPREGS, pid, (PTRACE_TYPE_ARG3) ((i << 1) + 1), &bpts[i].address) < 0) perror_with_name (_("Unexpected error setting breakpoint")); ... This problem does not happen if instead we use a 4-byte aligned address. I'm not sure if this is simply unsupported or if there's a kernel bug of some sort, but I don't see what gdb can do about this. Tentatively mark this as xfail. Tested on aarch64-linux. Approved-By: Luis Machado <luis.machado@arm.com>
2024-07-23[gdb/testsuite] Fix gdb.ada/mi_task_arg.exp on arm-linuxTom de Vries1-3/+4
On arm-linux, I run into: ... PASS: gdb.ada/mi_task_arg.exp: mi runto task_switch.break_me Expecting: ^(-stack-list-arguments 1[^M ]+)?(\^done,stack-args=\[frame={level="0",args=\[\]},frame={level="1",args=\[{name="<_task>",value="0x[0-9A-Fa-f]+"}(,{name="<_taskL>",value="[0-9]+"})?\]},frame={level="2",args=\[({name="self_id",value="(0x[0-9A-Fa-f]+|<optimized out>)"})?\]},.*[^M ]+[(]gdb[)] ^M [ ]*) -stack-list-arguments 1^M ^done,stack-args=[frame={level="0",args=[]},frame={level="1",args=[{name="<_task>",value="0x40bc48"}]},frame={level="2",args=[]}]^M (gdb) ^M FAIL: gdb.ada/mi_task_arg.exp: -stack-list-arguments 1 (unexpected output) ... The problem is that the test-case expects a level 3 frame, but there is none. This can be reproduced using cli bt: ... $ gdb -q -batch outputs/gdb.ada/mi_task_arg/task_switch \ -ex "b task_switch.break_me" \ -ex run \ -ex bt Breakpoint 1 at 0x34b4: file task_switch.adb, line 57. Thread 3 "my_caller" hit Breakpoint 1, task_switch.break_me () \ at task_switch.adb:57 57 null; #0 task_switch.break_me () at task_switch.adb:57 #1 0x00403424 in task_switch.caller (<_task>=0x40bc48) at task_switch.adb:51 #2 0xf7f95a08 in ?? () from /lib/arm-linux-gnueabihf/libgnarl-12.so Backtrace stopped: previous frame identical to this frame (corrupt stack?) ... The purpose of the test-case is printing the frame at level 1, so I don't think we should bother about the presence of the frame at level 3. Fix this by allowing the backtrace to stop at level 2. Tested on arm-linux. Approved-By: Luis Machado <luis.machado@arm.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-07-23Improve objdump's display of PE header information.Pali Roh?r4-30/+75
PR 31953
2024-07-23Automatic date update in version.inGDB Administrator1-1/+1