aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-12-12Replace uses of "title" style with "command"Tom Tromey4-16/+17
Currently the "title" style is only used when printing command names. The "title" name itself is probably a misnomer, but meanwhile this patch changes the existing uses to instead use the new "command" style for consistency. The "title" style is not removed; see the next patch. Reviewed-By: Keith Seitz <keiths@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-12-12Introduce "command" stylingTom Tromey22-65/+143
This adds a new "command" style that is used when styling the name of a gdb command. Note that not every instance of a command name that is output by gdb is changed here. There is currently no way to style error() strings, and there is no way to mark up command help strings. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31747 Reviewed-By: Eli Zaretskii <eliz@gnu.org> Reviewed-By: Keith Seitz <keiths@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-12-13Automatic date update in version.inGDB Administrator1-1/+1
2024-12-12Lock bfd_stat and bfd_get_mtimeTom Tromey7-9/+47
PR gdb/31713 points out some races when using the background DWARF reader. This particular patch fixes some of these, namely the ones when using the sim. In this case, the 'load' command calls reopen_exec_file, which calls bfd_stat, which introduces a race. BFD only locks globals -- concurrent use of a single BFD must be handled by the application. To this end, this patch adds locked wrappers for bfd_stat and bfd_get_mtime. I couldn't reproduce these data races but the original reporter tested the patch and confirms that it helps. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31713 Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-12-12Fix races involving _bfd_section_idTom Tromey5-2/+43
BFD's threading approach is that global variables are guarded by a lock. However, while implementing this, I missed _bfd_section_id. A user pointed out, via Thread Sanitizier, that this causes a data race when gdb's background DWARF reader is enabled. This patch fixes the problem by using the BFD lock in most of the appropriate spots. However, in ppc64_elf_setup_section_lists I chose to simply assert that multiple threads are not in use instead. (Not totally sure if this is good, but I don't think this can be called by gdb.) I chose locking in bfd_check_format_matches, even though it is a relatively big hammer, because it seemed like the most principled approach, and anyway if this causes severe contention we can always revisit the decision. Also this approach means we don't need to add configury to check for _Atomic, or figure out whether bfd_section_init can be reworded to make "rollback" unnecessary. I couldn't reproduce these data races but the original reporter tested the patch and confirms that it helps. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31713
2024-12-12Fix formatting in gdb.ada/lazy-string.expTom Tromey1-3/+3
This fixes a formatting issue and corrects a comment in the new gdb.ada/lazy-string.exp. I meant to do this in an earlier patch but forgot to save.
2024-12-12Use generic_printstr from ada_language::printstrTom Tromey3-2/+77
Currently, if you create a lazy string while in Ada language mode, the string will be rendered strangely, like: "["d0"]["9f"]["d1"]["80"]["d0"]["b8"]... This happens because ada_printstr does not really handle UTF-8 decoding. This patch changes ada_language::printstr to use generic_printstr when UTF-8 is used. Note that this code could probably be improved some more -- the current patch only addresses the narrow case of the Python API. I've filed a follow-up bug (PR ada/32413) for the remaining changes. Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-12-12Add text to gdbreplay --help outputTom Tromey1-3/+29
I noticed that gdbreplay --help is rather sparse -- it doesn't even mention the names of the options it accepts. This patch updates the help output to be more complete. Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-12-12Fix GNAT version check in gdb.adaTom Tromey4-5/+5
Commit 1411185a ("Introduce and use gnat_version_compare") changed the Ada tests to use a new proc for version checking. Unfortunately this patch inadvertently reversed the sense of the test in packed_array_assign.exp. After fixing this, I went through that patch again and looked for other problems. I found one spot where the wrong syntax was used, and some others where I believe the sense of the test was inverted. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32444 Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-12-12Make rs6000-tdep.c:variants 'const'Tom Tromey1-1/+1
I noticed that rs6000-tdep.c has a global "variants" array that can be marked "const", moving it into rodata. Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-12-12mangle_style: Add new DWARF5 constantsAlexandra Hájková1-0/+10
Update bfd/dwarf2.c with the post DWARF5 language codes which were added after DWARF5 was finalized. Adding them makes it possible to return the mangling style for the new language codes for Ada 2005 Fortran, C++, C and Assembly. Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Jan Beulich <jbeulich@suse.com>
2024-12-12Revert bfd_use_reserved_id patchAlan Modra3-21/+2
Commit fc1cfaa5f1 and bc110b6e40 were made to avoid testsuite regressions on a number of targets that used bfd id in symbol hashing. Since it no longer seems necessary to start plugin bfd id's from -1 and count down, revert the functional changes in those patches.
2024-12-12Use bfd id to validate dwarf2 cacheAlan Modra1-8/+5
Using a bfd pointer to validate the cache isn't very robust. If a bfd is closed somehow without clearing the cache, then it's possible that another bfd is opened using the same memory and thus orig_bfd compares equal to the new bfd. * dwarf2.c (struct dwarf2_debug): Add orig_bfd_id. Delete orig_bfd. (_bfd_dwarf2_slurp_debug_info): Validate stash with orig_bfd_id.
2024-12-12close last arfile before processing current arfileAlan Modra4-66/+38
This also reduces peak memory a little. * dlltool.c (identify_search_archive): Close last_arfile earlier. Report an error if bfd_openr_next_archived_file returns the same bfd. Localise variables. * nm.c (display_archive): Likewise. * objdump.c (display_any_bfd): Likewise. * size.c (display_archive): Likewise.
2024-12-12nm.c free_lineno_cacheAlan Modra1-8/+3
free_lineno_cache frees symbol and relocation data used when displaying line number info for symbols (nm -l). Currently that is done when closing the bfd, but that's not ideal for archives since that results in two bfds worth of memory in use. * nm.c (display_rel_file): Call free_lineno_cache here.. (display_archive, display_file): ..not here.
2024-12-12tdata related object_p tidy for various formatsAlan Modra14-145/+92
The aout object_p function copies any existing tdata. Apparently this was done for hp300, an old target that is no longer supported. See commit ebd241352942. This isn't useful for current sources, nor is it necessary or useful any more to preserve tdata in object_p functions when a target doesn't match. When I was fixing this, I noticed some object_p functions rudely didn't release memory on failures, and others had nits in the bfd_error returns. * aoutx.h (some_aout_object_p): Don't restore previous tdata on failure. Don't copy any existing tdata. * archive.c (bfd_generic_archive_p): Don't restore previous tdata on failure. * pdp11.c (some_aout_object_p): Likewise. * coff-rs6000.c (_bfd_xcoff_archive_p): Allocate both artdata and extension in one call. Don't restore previous tdata on failure. * coff64-rs6000.c (xcoff64_archive_p): Likewise. * coffgen.c (coff_real_object_p): Don't restore previous tdata on failure. * ihex.c (ihex_object_p): Likewise. Simplify release of tdata on scan failure. * mach-o.c (bfd_mach_o_scan): Don't set tdata here. Do set error on read_command failure. (bfd_mach_o_header_p): Set tdata here, release on failure. Tidy bfd_error return values. (bfd_mach_o_fat_archive_p): Tidy error return values. * mmo.c (mmo_mkobject): Do not test current tdata. * pef.c (bfd_pef_scan_start_address): Set bfd_error on failure. (bfd_pef_scan): Don't set tdata here. (bfd_pef_object_p): Set tdata here, release on failure. Tidy bfd_error return values. (bfd_pef_xlib_object_p): Tidy bfd_error return values. * srec.c (srec_object_p): Don't restore previous tdata on failure. Do release tdata on failure. (symbolsrec_object_p): Likewise. * tekhex.c (tekhex_object_p): Don't ignore tekhex_mkobject failure. Release tdata on failure. * vms-alpha.c (alpha_vms_object_p): Don't restore previous tdata on failure. Simplify release of tdata. * xsym.c (bfd_sym_scan): Don't set tdata here. (bfd_sym_object_p): Set tdata here. Release on failure.
2024-12-12Automatic date update in version.inGDB Administrator1-1/+1
2024-12-11Fix gdbreplay checksum calculationTom Tromey1-20/+11
I needed to use gdbreplay today. It didn't work quite right, and using "set debug remote 1" showed that gdb was rejecting some responses like: [remote] Sending packet: $vCont?#49 [remote] Junk: #vCont? [remote] Junk: 8vCont? [remote] Junk: 3vCont? [remote] Received Ack The checksum recalculation seems to have gone wrong. Looking at the code, it seems like 'where_csum' is calculated inconsistently: in the main loop it is after the '#' but in the "== 0" case it is before the '#'. This patch fixes the problem and also avoids a string copy. CC: Alexandra Hájková <ahajkova@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-12-11dwarf_lang_to_enum_language: Map new DWARF5 constantsAlexandra Hájková1-0/+10
Add new DWARF5 language codes to gdb/dwarf2/read.c where they are converted to GDB language names. The codes were added to include/dwarf.h by syncing with gcc, Ada language codes were added to dwarf.h earlier. Approved-By: Tom Tromey <tom@tromey.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-12-11gdb: s390: Correct record/replay of may/mayr insnJens Remus1-0/+14
The IBM z/Architecture Principles of Operation [1] specifies that the R1 operand of the may and mayr instructions designates may designate either the lower- or higher-numbered register of a floating-point- register (FPR) pair. [1]: IBM z/Architecture Principles of Operation, SA22-7832-13, IBM z16, https://publibfp.dhe.ibm.com/epubs/pdf/a227832d.pdf gdb/ * s390-tdep.c (s390_process_record): may/mayr operand R1 may designate lower- or higher numbered register of FPR pair. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-12-11Automatic date update in version.inGDB Administrator1-1/+1
2024-12-10gprofng: fix sorting in Hist_data::sortVladimir Mezentsev1-2/+1
If the '-name soname' option is used, the fake '<Total>' function is expanded with the name loadobject. gprofng/ChangeLog 2024-12-09 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> * src/Hist_data.cc (Hist_data::sort): Fix sorting.
2024-12-10[gdb/testsuite] Use setVariable in gdb.dap/scopes.expTom de Vries1-18/+9
The test-case gdb.dap/scopes.exp contains the following outdated comment: ... # setVariable isn't implemented yet, so use the register name. ... Now that setVariable is implemented, use it to set variable scalar, and remove the bit that sets the first register. That part is known to fail on s390x, because the first register isn't writeable [1]. Tested on x86_64-linux. Suggested-By: Tom Tromey <tom@tromey.com> Approved-By: Tom Tromey <tom@tromey.com> [1] https://sourceware.org/pipermail/gdb-patches/2024-December/213823.html
2024-12-10[gdb/testsuite] Fix gdb.dap/step-out.exp on s390xTom de Vries1-23/+29
With test-case gdb.dap/step-out.exp on s390x-linux, I get: ... >>> {"seq": 7, "type": "request", "command": "scopes", "arguments": {"frameId": 0}} Content-Length: 569^M ^M {"request_seq": 7, "type": "response", "command": "scopes", "body": {"scopes": [{"variablesReference": 1, "name": "Locals", "presentationHint": "locals", "expensive": false, "namedVariables": 1, "line": 35, "source": {"name": "step-out.c", "path": "/home/vries/gdb/src/gdb/testsuite/gdb.dap/step-out.c"}}, {"variablesReference": 2, "name": "Registers", "presentationHint": "registers", "expensive": false, "namedVariables": 114, "line": 35, "source": {"name": "step-out.c", "path": "/home/vries/gdb/src/gdb/testsuite/gdb.dap/step-out.c"}}]}, "success": true, "seq": 21}PASS: gdb.dap/step-out.exp: get scopes success FAIL: gdb.dap/step-out.exp: three scopes ... The problem is that the test-case expects three scopes: ... lassign $scopes scope reg_scope return_scope ... but the return_scope is missing because this doesn't work: ... $ gdb -q -batch outputs/gdb.dap/step-out/step-out \ -ex "b function_breakpoint_here" \ -ex run \ -ex finish ... Value returned has type: struct result. Cannot determine contents ... This is likely caused by a problem in gdb, but there's nothing wrong the DAP support. Fix this by: - allowing two scopes, and - declaring the tests of return_scope unsupported. Tested on s390x-linux. Approved-By: Tom Tromey <tom@tromey.com>
2024-12-10[gdb/testsuite] Fix fails in gdb.python/py-arch-reg-groups.expTom de Vries1-0/+3
Since commit e69d35f45e0 ("Use ui-out table in "maint print reggroups""), test-case gdb.python/py-arch-reg-groups.exp fails with check-read1: ... FAIL: $exp: Same number of registers groups found FAIL: $exp: all register groups match ... Fix this by adding a gdb_test_multiple clause that matches the command. Tested on x86_64-linux.
2024-12-10LoongArch: Default to a maximum page size of 64KiBWANG Xuerui9-15/+34
As per the spec (Section 7.5.10, LoongArch Reference Manual Vol. 1), LoongArch machines are not limited in page size choices, and currently page sizes of 4KiB, 16KiB and 64KiB are supported by mainline Linux. While 16KiB is the most common, the current BFD code says it is the maximum; this is not correct, and as an effect, almost all existing binaries are incompatible with a 64KiB kernel because the sections are not sufficiently aligned, while being totally fine otherwise. This is needlessly complicating integration testing [1]. This patch fixes the inconsistency, and also brings BFD behavior in line with that of LLD [2]. [1] https://github.com/loongson-community/discussions/issues/47 [2] https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/lld/ELF/Arch/LoongArch.cpp#L174-L183 bfd/ * elfnn-loongarch.c (ELF_MAXPAGESIZE): Bump to 64KiB. (ELF_MINPAGESIZE): Define as 4KiB. (ELF_COMMONPAGESIZE): Define as 16KiB. ld/ * testsuite/ld-loongarch-elf/64_pcrel.d: Update assertions after changing the target max page size to 64KiB. * testsuite/ld-loongarch-elf/data-got.d: Likewise. * testsuite/ld-loongarch-elf/desc-relex.d: Likewise. * testsuite/ld-loongarch-elf/relax-align-ignore-start.d: Likewise. * testsuite/ld-loongarch-elf/tlsdesc_abs.d: Make the fuzzy match work as intended by not checking exact instruction words. * testsuite/ld-loongarch-elf/tlsdesc_extreme.d: Likewise. Signed-off-by: WANG Xuerui <git@xen0n.name>
2024-12-10Automatic date update in version.inGDB Administrator1-1/+1
2024-12-10Re: gprofng: use gprofng- prefix for gprofng binariesAlan Modra2-2/+2
Commit d25ba4596e85 mangled ZLIBINC to ZLIgp-C. Fix that.
2024-12-09PowerPC: Disallow r0 as a base register for the hashst and hashchk insnsPeter Bergner1-7/+7
Using r0 as a base address register in the ROP hashst and hashchk instructions is invalid. Modify the assembler to catch that illegal use and emit an error. opcodes/ * ppc-opc.c (insert_ras): Update error message and function comment. (powerpc_opcodes) <hashst, hashstp, hashchk, hashchkp>: Use RAS.
2024-12-09Introduce NoOpStringPrinterTom Tromey3-1/+147
We discovered that attempting to print a very large string-like array would succeed on the CLI, but in DAP would cause the "variables" request to fail with: value requires 67038491 bytes, which is more than max-value-size This turns out to be a limitation in Value.format_string, which de-lazy-ifies the value. This patch fixes this problem by introducing a new NoOpStringPrinter class, and then using it for string-like values. This printer returns a lazy string, which solves the problem. Note there are some special cases where we do not want to return a lazy string. I've documented these in the code. I considered making gdb.Value.lazy_string handle these cases -- for example it could return 'self' rather than a lazy string in some situations -- but this approach was simpler.
2024-12-09Clean up 0-length handling in gdbpy_create_lazy_string_objectTom Tromey2-8/+19
gdbpy_create_lazy_string_object will throw an exception if you pass it a NULL pointer without also setting length=0 -- the default, length==-1, will fail. This seems bizarre. Furthermore, it doesn't make sense to do this check for array types, as an array can have a zero length. This patch cleans up the check and makes it specific to TYPE_CODE_PTR.
2024-12-09Reject non-string types in gdb.Value.lazy_stringTom Tromey4-14/+9
Currently, gdb.Value.lazy_string will allow the conversion of any object to a "lazy string". However, this was never the intent and is weird besides. This patch changes this code to correctly throw an exception in the non-matching cases. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20769
2024-12-09Fix error check in gdb_py_test_silent_cmdTom Tromey1-0/+1
I added a new test using gdb_py_test_silent_cmd, and then was surprised to find out that the new test passed -- it caused a Python exception and I had expected it to fail. This patch fixes this proc to detect this situation and fail.
2024-12-09Omit artificial symbols from DAP variables responseTom Tromey6-1/+89
While testing DAP, we found a situation where a compiler-generated variable caused the "variables" request to fail -- the variable in question being an apparent 67-megabyte string. It seems to me that artificial variables like this aren't interesting to DAP users, and the gdb CLI omits these as well. This patch changes DAP to omit these variables, adding a new gdb.Symbol.is_artificial attribute to make this possible.
2024-12-09Defer DAP launch command until after configurationDoneTom Tromey36-164/+341
PR dap/32090 points out that gdb's DAP "launch" sequencing is incorrect. The current approach (which is itself a 2nd implementation...) was based on a misreading of the spec. The spec has since been clarified here: https://github.com/microsoft/debug-adapter-protocol/issues/497 The clarification here is that a client is free to send the "launch" (or "attach") request at any point after the "initialized" event has been sent by gdb. However, the "launch" does not cause any action to be taken -- and does not send a response -- until after "configurationDone" has been seen. This patch implements this by arranging for the launch and attach commands to return a DeferredRequest object. All the tests needed updates. I've also added a new test that checks that the deferred "launch" request can be cancelled. (Note that the cancellation is lazy -- it also waits until configurationDone is seen. This could be fixed, but I was not sure whether it is important to do so.) Finally, the "launch" command has a somewhat funny sequencing now. Simply sending the command and waiting for a response yielded strange results if the inferior did not stop -- in this case, the repsonse was never sent. So now, the command is split into two parts, with some setup being done synchronously (for better error propagation) and the actual "run" being done async. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32090 Reviewed-by: Kévin Le Gouguec <legouguec@adacore.com>
2024-12-09Add DAP deferred requestsTom Tromey1-24/+136
This adds a new "deferred request" capability to DAP. The idea here is that if a request returns a DeferredRequest object, then no response is sent immediately to the client. Instead, the request is pending until the deferred request is rescheduled. Some minor refactorings, particularly in cancellation, were needed to make this work. There's no use of this in the tree yet -- that is the next patch. Reviewed-by: Kévin Le Gouguec <legouguec@adacore.com>
2024-12-09Allow cancellation of DAP-thread requestsTom Tromey1-6/+18
This patch started as an attempt to fix the comment in CancellationHandler.cancel, but while working on it I found that the code could be improved as well. The current DAP cancellation code only handles the case where work is done on the gdb thread -- by checking for cancellation in interruptable_region. This means that if a request is handled completely in tthe DAP thread, then cancellation will never work. Now, this isn't a bug per se. DAP doesn't actually require that cancellation succeed. In fact, I think it can't, because cancellation is inherently racy. However, a coming patch will add a sort of "pending" request, and it would be nice if that were cancellable before any commands are sent to the gdb thread. No test in this patch, but one will arrive at the end of the series. Reviewed-by: Kévin Le Gouguec <legouguec@adacore.com>
2024-12-09Refactor CancellationHandler in DAPTom Tromey1-18/+15
This refactors the DAP CancellationHandler to be a context manager, and reorganizes the caller to use this. This is a bit more robust and also simplifies a subsequent patch in this series. Reviewed-by: Kévin Le Gouguec <legouguec@adacore.com>
2024-12-09Add call_function_later to DAPTom Tromey1-0/+12
This adds a new call_function_later API to DAP. This arranges to run a function after the current request has completed. This isn't used yet, but will be at the end of this series. Reviewed-by: Kévin Le Gouguec <legouguec@adacore.com>
2024-12-09Reimplement DAP delayed eventsTom Tromey1-12/+12
This patch changes how delayed events are implemented in DAP. The new implementation makes it simpler to add a delayed function call, which will be needed by the final patch in this series. Reviewed-by: Kévin Le Gouguec <legouguec@adacore.com>
2024-12-09Reimplement DAP's stopAtBeginningOfMainSubprogramTom Tromey1-5/+7
Right now, stopAtBeginningOfMainSubprogram is implemented "by hand", but then later the launch function uses "starti" to implement stopOnEntry. This patch unifies this code and rewrites it to use "start" when appropriate. Reviewed-by: Kévin Le Gouguec <legouguec@adacore.com>
2024-12-09[gdb/symtab] Apply workaround for PR gas/31115 a bit moreTom de Vries1-10/+31
In commit 8a61ee551ce ("[gdb/symtab] Workaround PR gas/31115"), I applied a workaround for PR gas/31115 in read_func_scope, fixing test-case gdb.arch/pr25124.exp. Recently I noticed that the test-case is failing again. Fix this by factoring out the workaround into a new function fixup_low_high_pc and applying it in dwarf2_die_base_address. While we're at it, do the same in dwarf2_record_block_ranges. Tested on arm-linux with target boards unix/-marm and unix/-mthumb. Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
2024-12-09[gdb/syscalls] Generate aarch64-linux.xml.in in update-linux-from-src.shTom de Vries2-2/+50
Currently aarch64-linux.xml.in is skipped by update-linux-from-src.sh: ... $ ./update-linux-from-src.sh ~/upstream/linux-stable.git/ Skipping aarch64-linux.xml.in, no syscall.tbl ... $ ... and instead we use update-linux.sh. This works fine, but requires an aarch64 system with recent system headers, which makes it harder to pick up the latest changes in the linux kernel. Fix this by updating ./update-linux-from-src.sh to: - build the linux kernel headers for aarch64 - use update-linux.sh with those headers to generate aarch64-linux.xml.in. Regenerating aarch64-linux.xml.in using current trunk of linux-stable gives me these changes: ... + <syscall name="setxattrat" number="463"/> + <syscall name="getxattrat" number="464"/> + <syscall name="listxattrat" number="465"/> + <syscall name="removexattrat" number="466"/> ... which are the same changes I see for the other architectures. Note that the first step, building the linux kernel headers is a cross build and should work on any architecture. But the second step, update-linux.sh uses plain gcc rather than a cross-gcc, so there is scope for problems, but we seem to get away with this on x86_64-linux. So, while we could constrain this to only generate aarch64-linux.xml.in on aarch64-linux, I'm leaving this unconstrained. For aarch64-linux.xml.in, this doesn't matter much to me because I got an aarch64-linux system. But I don't have a longaarch system, and the same approach seems to work there. I'm leaving this for follow-up patch though. Tested on aarch64-linux and x86_64-linux. Verified with shellcheck.
2024-12-09Include gdbsupport/gdb_vecs.h in gdb/s390-linux-nat.cMark Wielaard1-0/+1
Commit c8889b913175 ("gdb, gdbserver, gdbsupport: remove some unused gdb_vecs.h includes") removed gdbsupport/gdb_vecs.h from various header files. This caused an compile issue for gdb/s390-linux-nat.c ../../binutils-gdb/gdb/s390-linux-nat.c: In member function ‘virtual int s390_linux_nat_target::remove_watchpoint(CORE_ADDR, int, target_hw_bp_type, expression*)’: ../../binutils-gdb/gdb/s390-linux-nat.c:875:11: error: ‘unordered_remove’ was not declared in this scope 875 | unordered_remove (state->watch_areas, ix); | ^~~~~~~~~~~~~~~~ ../../binutils-gdb/gdb/s390-linux-nat.c: In member function ‘virtual int s390_linux_nat_target::remove_hw_breakpoint(gdbarch*, bp_target_info*)’: ../../binutils-gdb/gdb/s390-linux-nat.c:928:11: error: ‘unordered_remove’ was not declared in this scope 928 | unordered_remove (state->break_areas, ix); | ^~~~~~~~~~~~~~~~ Fix this by including gdbsupport/gdb_vecs.h in gdb/s390-linux-nat.c.
2024-12-09gdbserver: remove 'struct' in 'struct thread_info' declarationsTankut Baris Aktemur16-78/+78
Remove the 'struct' keyword in occurrences of 'struct thread_info'. This is a code clean-up. Tested by rebuilding. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2024-12-09Add linker diagnostic message about missing static librariesNick Clifton1-0/+6
2024-12-09gdb: allow core file containing special characters on the command lineAndrew Burgess4-71/+88
After the commit: commit 03ad29c86c232484f9090582bbe6f221bc87c323 Date: Wed Jun 19 11:14:08 2024 +0100 gdb: 'target ...' commands now expect quoted/escaped filenames it was no longer possible to pass GDB the name of a core file containing any special characters (white space or quote characters) on the command line. For example: $ gdb -c /tmp/core\ file.core Junk after filename "/tmp/core": file.core (gdb) The problem is that the above commit changed the 'target core' command to expect quoted filenames, so before the above commit a user could write: (gdb) target core /tmp/core file.core [New LWP 2345783] Core was generated by `./mkcore'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000000000401111 in ?? () (gdb) But after the above commit the user must write: (gdb) target core /tmp/core\ file.core or (gdb) target core "/tmp/core file.core" This is part of a move to make GDB's filename argument handling consistent. Anyway, the problem with the '-c' command line flag is that it forwards the filename unmodified through to the 'core-file' command, which in turn forwards to the 'target core' command. So when the user, at a shell writes: $ gdb -c "core file.core" this arrives in GDB as the unquoted string 'core file.core' (without the single quotes). GDB then forwards this to the 'core-file' command as if the user had written this at a GDB prompt: (gdb) core-file core file.core Which then fails to parse due to the unquoted white space between 'core' and 'file.core'. The solution I propose is to escape any special characters in the core file name passed from the command line before calling 'core-file' command from main.c. I've updated the corefile.exp test to include a test for passing a core file containing a white space character. While I was at it I've modernised the part of corefile.exp that I was touching.
2024-12-09gdb: make core_target_open staticAndrew Burgess2-6/+6
The core_target_open function is only used in corelow.c, so lets make it static. There should be no user visible changes after this commit.
2024-12-09gdb: use 'const' more in a couple of small breakpoint functionsAndrew Burgess2-6/+6
Make the 'struct breakpoint *' argument 'const' in user_breakpoint_p and pending_breakpoint_p. And make the 'struct bp_location *' argument 'const' in bl_address_is_meaningful. There should be no user visible changes after this commit.
2024-12-09LoongArch: Assign DWARF register numbers to register aliasesLulu Cai7-17/+845
.cfi directives only support the use of register numbers and not register names or aliases. This commit adds support for 4 formats, for example: .cfi_offset r1, 8 .cfi_offset ra, 8 .cfi_offset $r1,8 .cfi_offset $ra,8 The above .cfi directives are equivalent and all represent dwarf register number 1. Display register aliases as specified in the psABI during disassembly.