aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-11-23RISC-V: Add floating-point arithmetic instructions for T-Head VECTOR vendor ↵Jin Ma4-0/+480
extension T-Head has a range of vendor-specific instructions. Therefore it makes sense to group them into smaller chunks in form of vendor extensions. This patch adds floating-point arithmetic instructions for the "XTheadVector" extension. The 'th' prefix and the "XTheadVector" extension are documented in a PR for the RISC-V toolchain conventions ([1]). [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19 Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com> Co-developed-by: Christoph Müllner <christoph.muellner@vrull.eu> gas/ChangeLog: * testsuite/gas/riscv/x-thead-vector.d: Add tests for floating-point arithmetic instructions. * testsuite/gas/riscv/x-thead-vector.s: Likewise. include/ChangeLog: * opcode/riscv-opc.h (MATCH_TH_VFSQRTV): New. opcodes/ChangeLog: * riscv-opc.c: Likewise.
2023-11-23RISC-V: Add fixed-point arithmetic instructions for T-Head VECTOR vendor ↵Jin Ma4-0/+226
extension T-Head has a range of vendor-specific instructions. Therefore it makes sense to group them into smaller chunks in form of vendor extensions. This patch adds fixed-point arithmetic instructions for the "XTheadVector" extension. The 'th' prefix and the "XTheadVector" extension are documented in a PR for the RISC-V toolchain conventions ([1]). [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19 Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com> Co-developed-by: Christoph Müllner <christoph.muellner@vrull.eu> gas/ChangeLog: * testsuite/gas/riscv/x-thead-vector.d: Add tests for fixed-point arithmetic instructions. * testsuite/gas/riscv/x-thead-vector.s: Likewise. include/ChangeLog: * opcode/riscv-opc.h (MATCH_TH_VAADDVV): New. opcodes/ChangeLog: * riscv-opc.c: Likewise.
2023-11-23RISC-V: Add integer arithmetic instructions for T-Head VECTOR vendor extensionJin Ma4-0/+812
T-Head has a range of vendor-specific instructions. Therefore it makes sense to group them into smaller chunks in form of vendor extensions. This patch adds integer arithmetic instructions for the "XTheadVector" extension. The 'th' prefix and the "XTheadVector" extension are documented in a PR for the RISC-V toolchain conventions ([1]). [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19 Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com> Co-developed-by: Christoph Müllner <christoph.muellner@vrull.eu> gas/ChangeLog: * testsuite/gas/riscv/x-thead-vector.d: Add tests for integer arithmetic instructions. * testsuite/gas/riscv/x-thead-vector.s: Likewise. include/ChangeLog: * opcode/riscv-opc.h (MATCH_TH_VADCVVM): New. opcodes/ChangeLog: * riscv-opc.c: Likewise.
2023-11-23RISC-V: Add sub-extension XTheadZvamo for T-Head VECTOR vendor extensionJin Ma7-1/+221
T-Head has a range of vendor-specific instructions. Therefore it makes sense to group them into smaller chunks in form of vendor extensions. This patch adds the sub-extension "XTheadZvamo" for the "XTheadVector" extension, and it provides AMO instructions for T-Head VECTOR vendor extension. The 'th' prefix and the "XTheadVector" extension are documented in a PR for the RISC-V toolchain conventions ([1]). [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19 Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com> Co-developed-by: Christoph Müllner <christoph.muellner@vrull.eu> bfd/ChangeLog: * elfxx-riscv.c (riscv_multi_subset_supports): Add support for "XTheadZvamo" extension. (riscv_multi_subset_supports_ext): Likewise. gas/ChangeLog: * doc/c-riscv.texi: * testsuite/gas/riscv/x-thead-vector-zvamo.d: New test. * testsuite/gas/riscv/x-thead-vector-zvamo.s: New test. include/ChangeLog: * opcode/riscv-opc.h (MATCH_TH_VAMOADDWV): New. * opcode/riscv.h (enum riscv_insn_class): Add insn class. opcodes/ChangeLog: * riscv-opc.c: Likewise.
2023-11-23RISC-V: Add load/store segment instructions for T-Head VECTOR vendor extensionJin Ma4-0/+2157
T-Head has a range of vendor-specific instructions. Therefore it makes sense to group them into smaller chunks in form of vendor extensions. This patch adds provides load/store segment instructions for T-Head VECTOR vendor extension, which same as the "Zvlsseg" extension in RVI 0.71 vector extension, but belongs to the "XTheadVector" extension. The 'th' prefix and the "XTheadVector" extension are documented in a PR for the RISC-V toolchain conventions ([1]). [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19 Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com> Co-developed-by: Christoph Müllner <christoph.muellner@vrull.eu> gas/ChangeLog: * testsuite/gas/riscv/x-thead-vector.d: Add test. * testsuite/gas/riscv/x-thead-vector.s: Likewise. include/ChangeLog: * opcode/riscv-opc.h (MATCH_TH_VLSEG2BV): New. opcodes/ChangeLog: * riscv-opc.c: Likewise.
2023-11-23RISC-V: Add load/store instructions for T-Head VECTOR vendor extensionJin Ma4-0/+345
T-Head has a range of vendor-specific instructions. Therefore it makes sense to group them into smaller chunks in form of vendor extensions. This patch adds load/store instructions for the "XTheadVector" extension. The 'th' prefix and the "XTheadVector" extension are documented in a PR for the RISC-V toolchain conventions ([1]). [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19 Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com> Co-developed-by: Christoph Müllner <christoph.muellner@vrull.eu> gas/ChangeLog: * testsuite/gas/riscv/x-thead-vector.d: Add tests for load/store instructions. * testsuite/gas/riscv/x-thead-vector.s: Likewise. include/ChangeLog: * opcode/riscv-opc.h (MATCH_TH_VLBV): New. opcodes/ChangeLog: * riscv-opc.c: Likewise.
2023-11-23RISC-V: Add configuration-setting instructions for T-Head VECTOR vendor ↵Jin Ma3-0/+19
extension T-Head has a range of vendor-specific instructions. Therefore it makes sense to group them into smaller chunks in form of vendor extensions. This patch adds configuration-setting instructions for the "XTheadVector" extension. The 'th' prefix and the "XTheadVector" extension are documented in a PR for the RISC-V toolchain conventions ([1]). [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19 Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com> Co-developed-by: Christoph Müllner <christoph.muellner@vrull.eu> gas/ChangeLog: * testsuite/gas/riscv/x-thead-vector.d: New test. * testsuite/gas/riscv/x-thead-vector.s: New test. opcodes/ChangeLog: * riscv-opc.c: Likewise..
2023-11-23RISC-V: Add CSRs for T-Head VECTOR vendor extensionJin Ma7-2/+76
T-Head has a range of vendor-specific instructions. Therefore it makes sense to group them into smaller chunks in form of vendor extensions. This patch adds the CSRs for XTheadVector. Because of the conflict between encoding and teh 'V' extension, it is implemented by alias. The 'th' prefix and the "XTheadVector" extension are documented in a PR for the RISC-V toolchain conventions ([1]). [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19 Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com> Co-developed-by: Christoph Müllner <christoph.muellner@vrull.eu> gas/ChangeLog: * config/tc-riscv.c (enum riscv_csr_class): Add the class for the CSRs of the "XTheadVector" extension. (riscv_csr_address): Likewise. * testsuite/gas/riscv/x-thead-vector-csr-warn.d: New test. * testsuite/gas/riscv/x-thead-vector-csr-warn.l: New test. * testsuite/gas/riscv/x-thead-vector-csr.d: New test. * testsuite/gas/riscv/x-thead-vector-csr.s: New test. include/ChangeLog: * opcode/riscv-opc.h (DECLARE_CSR_ALIAS): Likewise. opcodes/ChangeLog: * riscv-dis.c (print_insn_args): Prefix the CSRs disassembly with 'th'.
2023-11-23RISC-V: Add T-Head VECTOR vendor extension.Jin Ma7-0/+26
T-Head has a range of vendor-specific instructions ([2]). Therefore it makes sense to group them into smaller chunks in form of vendor extensions. This patch adds the "XTheadVector" extension, a collection of T-Head-specific vector instructions. The 'th' prefix and the "XTheadVector" extension are documented in a PR for the RISC-V toolchain conventions ([1]). Here are some things that need to be explained: The "XTheadVector" extension is not a custom-extension, but a non-standard non-conforming extension. The encoding space of the "TheadVector" instructions overlaps with those of the 'V' extension. This encoding space conflict is not on purpose, but the result of issues in the past that have been resolved since. Therefore, the "XTheadVector" extension and the 'V' extension are in conflict. [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19 [2] https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.3.0/xthead-2023-11-10-2.3.0.pdf Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com> Co-developed-by: Christoph Müllner <christoph.muellner@vrull.eu> bfd/ChangeLog: * elfxx-riscv.c (riscv_parse_check_conflicts): The "XTheadVector" extension and the 'V' extension are in conflict. (riscv_multi_subset_supports): Likewise.. (riscv_multi_subset_supports_ext): Likewise. gas/ChangeLog: * doc/c-riscv.texi: * testsuite/gas/riscv/x-thead-vector-fail.d: New test. * testsuite/gas/riscv/x-thead-vector-fail.l: New test. * testsuite/gas/riscv/x-thead-vector.s: New test. include/ChangeLog: * opcode/riscv.h (enum riscv_insn_class):
2023-11-23Automatic date update in version.inGDB Administrator1-1/+1
2023-11-22Fix AIX thr!= NULL assertion failure during fork.Aditya Vidyadhar Kamath1-8/+20
In AIX, while we followed the child process and detach on fork was on we hit thr!= NULL assertion failure. The reason for the same was GDB core trying to switch to a child thread with tid not set that does not exist, since child's ptid was changed to ptid_t (pid, 0, tid) in sync_threadlists() as it was threaded. The way this happened was when a new child process is born, its object file will be loaded, calling the new_objfile () in aix-thread.c file from clone_program_space, which is called from within follow_fork_inferior. Therefore it end ups syncing threadlists via pd_update (). This patch is a fix for the same where pd_update () is called in the wait () or in update_thread_list() hook only.
2023-11-22[gdb/tui] Fix resizing of terminal to 1 or 2 linesTom de Vries3-3/+34
When starting TUI in a terminal with 3 lines: ... $ echo $LINES 3 $ gdb -q -tui ... and resizing the terminal to 2 lines we run into a segfault. The problem is that for the source window: - the minimum height is 3 (the default), but - the maximum height is only 2 because there are only 2 lines. This discrepancy eventually leads to a call to newwin in make_window with: ... (gdb) p height $1 = 3 (gdb) p width $2 = 56 (gdb) p y $3 = -1 (gdb) p x $4 = 0 ... which results in a nullptr. This violates the assumption here in tui_apply_current_layout: .... /* Get the new list of currently visible windows. */ std::vector<tui_win_info *> new_tui_windows; applied_layout->get_windows (&new_tui_windows); ... that get_windows only returns visible windows, which leads to tui_windows holding a dangling pointer, which results in the segfault. Fix this by: - making sure get_windows only returns visible windows, and - detecting the situation and dropping windows from the layout if there's no room for them. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com> PR tui/31044 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31044
2023-11-22[gdb/tui] Allow command window of 1 or 2 linesTom de Vries2-0/+41
When starting TUI in a terminal with 2 lines (likewise with 1 line): ... $ echo $LINES 2 $ gdb -q -tui ... we run into this assert in tui_apply_current_layout: ... /* This should always be made visible by a layout. */ gdb_assert (TUI_CMD_WIN != nullptr); ... The problem is that for the command window: - the minimum height is 3 (the default), but - the maximum height is only 2 because there are only 2 lines. This discrepancy eventually leads to a call to newwin in make_window with: ... (gdb) p height $1 = 3 (gdb) p width $2 = 66 (gdb) p y $3 = -1 (gdb) p x $4 = 0 (gdb) ... which results in a nullptr, which eventually triggers the assert. The easiest way to fix this is to change the minimum height of the command window to 1. However, that would also change behaviour for the case that the screen size is 3 lines or more. For instance, in gdb.tui/winheight.exp the number of lines in the terminal is 24, and the test-case checks that the user cannot increase the source window height to the point that the command window height would be less than 3. Fix this by calculating the minimum height of the command window as follows: - the default (3) if max_height () allows it, and - max_height () otherwise. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com> PR tui/31044 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31044
2023-11-22[gdb/python] Don't import curses.ascii module unless necessaryTom de Vries1-2/+12
I ran into a failure in test-case gdb.python/py-missing-debug.exp with python 3.6, which was fixed by commit 7db795bc67a ("gdb/python: remove use of str.isascii()"). However, I subsequently ran into a failure with python 3.11: ... (gdb) PASS: $exp: initial checks: debug info no longer found source py-missing-debug.py^M Traceback (most recent call last):^M File "py-missing-debug.py", line 17, in <module>^M from gdb.missing_debug import MissingDebugHandler^M File "missing_debug.py", line 21, in <module>^M from curses.ascii import isascii, isalnum^M File "/usr/lib64/python3.11/_import_failed/curses.py", line 16, in <module>^M raise ImportError(f"""Module '{failed_name}' is not installed.^M ImportError: Module 'curses' is not installed.^M Use:^M sudo zypper install python311-curses^M to install it.^M (gdb) FAIL: $exp: source python script ... Apparently I have the curses module installed for 3.6, but not 3.11. I could just install it, but the test-case worked fine with 3.11 before commit 7db795bc67a. Fix this by only using the curses module when necessary, for python <= 3.7. Tested on x86_64-linux, with both python 3.6 and 3.11.
2023-11-22gdbserver: cleanup monitor_show_helpAndrew Burgess1-3/+1
After this commit: commit 0b04e52316079981b2b77124198a405d826a05cd Date: Sun Jan 19 14:33:37 2014 -0700 link gdbserver against libiberty we can cleanup how the help text is generated in monitor_show_help. This doesn't change the output that the user will see -- it just folds multiple monitor_output calls into one. There should be no user visible change after this commit.
2023-11-22LoongArch: fix internal error when as handling unsupported modifier.Lulu Cai5-4/+13
2023-11-22Automatic date update in version.inGDB Administrator1-1/+1
2023-11-21Simplify C++ type-printingTom Tromey2-112/+30
The C++ type-printing code had its own variant of the accessibility enum. This patch removes this and changes the code to use the new one from gdbtypes.h. This patch also changes the C++ code to recognize the default accessibility of a class. This makes ptype a bit more C++-like, and lets us remove a chunk of questionable code. Acked-By: Simon Marchi <simon.marchi@efficios.com> Reviewed-by: Keith Seitz <keiths@redhat.com>
2023-11-21Use enum accessibility in types and member functionsTom Tromey3-19/+20
This changes nested types and member functions to use the new 'accessibility' enum, rather than separate private/protected flags. This is done for consistency, but it also lets us simplify some other code in the next patch. Acked-By: Simon Marchi <simon.marchi@efficios.com> Reviewed-by: Keith Seitz <keiths@redhat.com>
2023-11-21Remove char-based bitfield macrosTom Tromey1-9/+0
This removes the char-based bitfield macros from gdbtypes.h, as they are no longer used. Acked-By: Simon Marchi <simon.marchi@efficios.com> Reviewed-by: Keith Seitz <keiths@redhat.com>
2023-11-21Remove some type field accessor macrosTom Tromey9-60/+40
This removes TYPE_FIELD_PRIVATE, TYPE_FIELD_PROTECTED, TYPE_FIELD_IGNORE, and TYPE_FIELD_VIRTUAL. In c-varobj.c, match_accessibility can be removed entirely now. Note that the comment before this function was incorrect. Acked-By: Simon Marchi <simon.marchi@efficios.com> Reviewed-by: Keith Seitz <keiths@redhat.com>
2023-11-21Remove some QUIT calls from need_access_label_pTom Tromey1-7/+0
I think these invocations of QUIT in need_access_label_p are overkill. QUIT is already called from its caller. This just removes them. Acked-By: Simon Marchi <simon.marchi@efficios.com> Reviewed-by: Keith Seitz <keiths@redhat.com>
2023-11-21Add field::is_publicTom Tromey1-1/+5
This adds a field::is_public convenience method, and updates one spot to use it. Acked-By: Simon Marchi <simon.marchi@efficios.com> Reviewed-by: Keith Seitz <keiths@redhat.com>
2023-11-21Remove byte vectors from cplus_struct_typeTom Tromey5-275/+122
This removes some byte vectors from cplus_struct_type, moving the information into bitfields in holes in struct field. A new 'enum accessibility' is added to hold some of this information. A similar enum is removed from c-varobj.c. Note that the stabs reader treats "ignored" as an accessibility. However, the stabs texinfo documents this as a public field that is optimized out -- unfortunately nobody has updated the stabs reader to use the better value-based optimized-out machinery. I looked and apparently gcc never emitted this visibility value, so whatever compiler generated this stab is unknown. I left a comment in gdbtypes.h to this effect. Acked-By: Simon Marchi <simon.marchi@efficios.com> Reviewed-by: Keith Seitz <keiths@redhat.com>
2023-11-21Print field accessibility inlineTom Tromey1-1/+12
This changes recursive_dump_type to print field accessibility information "inline". This is clearer and preserves the information when the byte vectors are removed. Acked-By: Simon Marchi <simon.marchi@efficios.com> Reviewed-by: Keith Seitz <keiths@redhat.com>
2023-11-21Use .def file to stringify type codesTom Tromey1-81/+18
This changes recursive_dump_type to reuse the type-codes.def file when stringifying type codes. This version of the patch changes the "unknown" case to an assert. Acked-By: Simon Marchi <simon.marchi@efficios.com> Reviewed-by: Keith Seitz <keiths@redhat.com>
2023-11-21bpf: Fixed register parsing disambiguating with possible symbol.Cupertino Miranda2-0/+7
This changes parse_bpf_register to detect possible symbols that start with valid register name, however due some following characters are not. Also changed the regs-for-symbols-pseudo.s, adding some entries that should not error if parser is properly detecting the symbol.
2023-11-21[opcodes] ARC + PPC: Fix -Walloc-size warningsJan-Benedict Glaw2-2/+2
Recently, -Walloc-size warnings started to kick in. Fix these two calloc() calls to match the intended usage pattern. opcodes/ChangeLog: * arc-dis.c (init_arc_disasm_info): Fix calloc() call. * ppc-dis.c (powerpc_init_dialect): Ditto.
2023-11-21gdb: fix build of darwin-nat.cSimon Marchi1-1/+1
Patch 743877128 ("gdb: remove regcache's address space") changed the signature of darwin_nat_target::cancel_breakpoint, but missing updating the class declaration, resulting in: CXX darwin-nat.o /Users/smarchi/src/binutils-gdb/gdb/darwin-nat.c:1154:20: error: out-of-line definition of 'cancel_breakpoint' does not match any declaration in 'darwin_nat_target' darwin_nat_target::cancel_breakpoint (inferior *inf, ptid_t ptid) ^~~~~~~~~~~~~~~~~ /Users/smarchi/src/binutils-gdb/gdb/darwin-nat.c:1290:9: error: too many arguments to function call, expected single argument 'ptid', have 2 arguments ptid_t (inf->pid, 0, thread->gdb_port))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/smarchi/src/binutils-gdb/gdb/darwin-nat.h:129:7: note: 'cancel_breakpoint' declared here int cancel_breakpoint (ptid_t ptid); ^ Fix that. Change-Id: Iedd58b36777eb77bca9e23f94882b217c9c87059
2023-11-21Refactor DAP queue handlingTom Tromey2-10/+11
A couple of spots in the DAP code use the same workaround for the absence of queue.SimpleQueue before Python 3.6. This patch consolidates these into a single spot.
2023-11-21[gdb/tdep] Handle memory error in s390_linux_get_syscall_numberTom de Vries1-3/+12
In s390_linux_get_syscall_number, we use read_memory_unsigned_integer, which can throw a memory error. According to the function comment though, it should return -1 on error: ... /* Retrieve the syscall number at a ptrace syscall-stop. Return -1 upon error. */ ... Catch the memory error by using safe_read_memory_unsigned_integer instead, similar to how that was fixed for arm in commit eb42bb14895 ("[gdb/tdep] Fix catching syscall execve exit for arm"). Approved-By: Ulrich Weigand <uweigand@de.ibm.com>
2023-11-21[gdb/testsuite] Fix spurious FAILs with examine-backward.exp, againTom de Vries2-20/+33
Commit 59a561480d5 ("Fix spurious FAILs with examine-backward.exp") describes the problem that: ... The test case examine-backward.exp issues the command "x/-s" after the end of the first string in TestStrings, but without making sure that this string is preceded by a string terminator. Thus GDB may spuriously print some random characters from before that string, and then the test fails. ... The commit fixes the problem by adding a Barrier variable before the TestStrings variable: ... +const char Barrier[] = { 0x0 }; const char TestStrings[] = { ... There is however no guarantee that Barrier is placed immediately before TestStrings. Before recent commit 169fe7ab54b ("Change gdb.base/examine-backwards.exp for AIX.") on x86_64-linux, I see: ... 0000000000400660 R Barrier 0000000000400680 R TestStrings ... So while the Barrier variable is the first before the TestStrings variable, it's not immediately preceding TestStrings. After commit 169fe7ab54b: ... 0000000000402259 B Barrier 0000000000402020 D TestStrings ... they're not even in the same section anymore. Fix this reliably by adding the zero in the array itself: ... char TestStringsBase[] = { 0x0, ... }; char *TestStrings = &TestStringsBase[1]; ... and do likewise for TestStringsH and TestStringsW. Tested on x86_64-linux. PR testsuite/31064 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31064
2023-11-21gdb: Use initializers in lambda captures unconditionallyLancelot Six2-13/+2
Initializers in lambda captures were introduced in C++14, and conditionally used in gdb/cp-support.c and gdb/dwarf2/cooked-index.c. Since C++17 is now required by GDB, use this feature unconditionally. Change-Id: I87a3d567941e5c71217538fa75c952e4d421fa1d Approved-By: Tom Tromey <tom@tromey.com> Approved-By: Pedro Alves <pedro@palves.net>
2023-11-21gdb/disasm.h: Mark callbacks noexcept unconditionallyLancelot Six1-21/+6
Given that C++17 is now a requirement for GDB, update gdb/disasm.h to define callback function types noexcept unconditionally. The pre-C++17 configuration is not supported anymore. Change-Id: I0a38e22b7912c70a11425363a991f0b01614343e Approved-By: Tom Tromey <tom@tromey.com> Approved-By: Pedro Alves <pedro@palves.net>
2023-11-21gdbsupport: Replace gdb::invoke_result with std::invoke_resultLancelot Six5-48/+10
Given that GDB now requires C++17, we can replace gdb::invoke_result with std::invoke_result which is provided by <type_traits>. This patch also removes gdbsupport/invoke-result.h as it is not used anymore. Change-Id: I7e567356d38d6b3d85d8797d61cfc83f6f933f22 Approved-By: Tom Tromey <tom@tromey.com> Approved-By: Pedro Alves <pedro@palves.net>
2023-11-21gdbsupport: Remove gdb::string_viewLancelot Six76-6296/+0
Now that all places using gdb::string_view have been updated to use std::string_view, this patch drops the gdb::string_view implementation and the tests which came with it. As this drops the unittests/string_view-selftests.c, this also implicitly solves PR build/23676, as pointed-out by Tom Tromey. Change-Id: Idf5479b09e0ac536917b3f0e13aca48424b90df0 Approved-By: Tom Tromey <tom@tromey.com> Approved-By: Pedro Alves <pedro@palves.net> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23676
2023-11-21gdb: Remove uses of gdb::to_string (const std::string_view &)Lancelot Six6-33/+24
This patch removes all uses of to_string(const std::string_view&) and use the std::string ctor or implicit conversion from std::string_view to std::string instead. A later patch will remove this gdb::to_string while removing gdbsupport/gdb_string_view.h. Change-Id: I877cde557a0727be7b0435107e3c7a2aac165895 Approved-By: Tom Tromey <tom@tromey.com> Approved-By: Pedro Alves <pedro@palves.net>
2023-11-21gdb: Use std::string_view instead of gdb::string_viewLancelot Six31-123/+133
Given that GDB now requires a C++17, replace all uses of gdb::string_view with std::string_view. This change has mostly been done automatically: - gdb::string_view -> std::string_view - #include "gdbsupport/gdb_string_view.h" -> #include <string_view> One things which got brought up during review is that gdb::stging_view does support being built from "nullptr" while std::sting_view does not. Two places are manually adjusted to account for this difference: gdb/tui/tui-io.c:tui_getc_1 and gdbsupport/format.h:format_piece::format_piece. The above automatic change transformed "gdb::to_string (const gdb::string_view &)" into "gdb::to_string (const std::string_view &)". The various direct users of this function are now explicitly including "gdbsupport/gdb_string_view.h". A later patch will remove the users of gdb::to_string. The implementation and tests of gdb::string_view are unchanged, they will be removed in a following patch. Change-Id: Ibb806a7e9c79eb16a55c87c6e41ad396fecf0207 Approved-By: Tom Tromey <tom@tromey.com> Approved-By: Pedro Alves <pedro@palves.net>
2023-11-21gdbsupport: remove gdb::optionalLancelot Six17-1975/+0
The previous patch migrated all the uses of gdb::optional to use std::optional instead, so gdb::optional can be removed entirely as well as the self-tests which came with it. Change-Id: I96ecd67b850b01be10ef00eb85a78ac647d5adc7 Approved-By: Tom Tromey <tom@tromey.com> Approved-By: Pedro Alves <pedro@palves.net>
2023-11-21gdb: Replace gdb::optional with std::optionalLancelot Six147-416/+417
Since GDB now requires C++17, we don't need the internally maintained gdb::optional implementation. This patch does the following replacing: - gdb::optional -> std::optional - gdb::in_place -> std::in_place - #include "gdbsupport/gdb_optional.h" -> #include <optional> This change has mostly been done automatically. One exception is gdbsupport/thread-pool.* which did not use the gdb:: prefix as it already lives in the gdb namespace. Change-Id: I19a92fa03e89637bab136c72e34fd351524f65e9 Approved-By: Tom Tromey <tom@tromey.com> Approved-By: Pedro Alves <pedro@palves.net>
2023-11-21gdb: Use C++17's std::make_unique instead of gdb::make_uniqueLancelot Six26-47/+34
gdb::make_unique is a wrapper around std::make_unique when compiled with C++17. Now that C++17 is required, use std::make_unique directly in the codebase, and remove gdb::make_unique. Change-Id: I80b615e46e4b7c097f09d78e579a9bdce00254ab Approved-By: Tom Tromey <tom@tromey.com> Approved-By: Pedro Alves <pedro@palves.net
2023-11-21Fix: symbols eliminated by --gc-sections still trigger warnings for ↵Nick Clifton1-6/+6
gnu.warning.SYM PR 31067 Fix typo in previous delta: defined -> referenced.
2023-11-21[gdb/tdep] Fix catching syscall execve exit for armTom de Vries1-4/+38
When running test-case gdb.base/catch-syscall.exp on a pinebook (64-bit aarch64 kernel, 32-bit userland) I run into: ... (gdb) PASS: $exp: execve: syscall(s) execve appears in 'info breakpoints' continue^M Continuing.^M ^M Catchpoint 18 (call to syscall execve), 0xf7726318 in execve () from \ /lib/arm-linux-gnueabihf/libc.so.6^M (gdb) PASS: gdb.base/catch-syscall.exp: execve: program has called execve continue^M Continuing.^M process 32392 is executing new program: catch-syscall^M Cannot access memory at address 0xf77c6a7c^M (gdb) FAIL: $exp: execve: syscall execve has returned ... The memory error is thrown by arm_linux_get_syscall_number, when doing: ... /* PC gets incremented before the syscall-stop, so read the previous instruction. */ unsigned long this_instr = read_memory_unsigned_integer (pc - 4, 4, byte_order_for_code); ... The reason for the error is that we're stopped at the syscall exit of syscall execve, and the pc is at the first insn of the new exec, which also happens to be the first insn in the code segment, so consequently we cannot read the previous insn. Fix this by detecting the situation by looking at the register state, similar to what is done in aarch64_linux_get_syscall_number. Furthermore, catch the memory error by using safe_read_memory_unsigned_integer and return -1 instead, matching the documented behaviour of arm_linux_get_syscall_number. Finally, rather than using a hardcoded constant 11, introduce an ad-hoc arm_sys_execve. Tested on pinebook. PR tdep/31071 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31071
2023-11-21Fix: symbols eliminated by --gc-sections still trigger warnings for ↵Nick Clifton4-0/+67
gnu.warning.SYM PR 31067 * linker.c (_bfd_generic_link_add_one_symbol): When issuing a warning message, also display a message about the warning not being affected by garbage colleciton. * ld.texi (Special Sections): New entry in the linker manual. Describes how the .gnu.warning and .gnu.warning.SYM sections behave.
2023-11-21Fix gdb.bas/sigall.exp testcase in AIX.Aditya Vidyadhar Kamath1-5/+2
In AIX, we are not able to see the message of a signal recieved if a debugee recieves a signal. This is a patch to fix the signal handling done incorrectly in AIX. We remove the status that represent program recieving a signal and allow host_status_to_waitstatus to handle it for us.
2023-11-21gdb: Fix segfault with a big .dynamic section sizeFelix Willgerodt1-2/+4
Consider a binary with an erroneous size of the .dynamic section: $ readelf -S a.out ... [24] .dynamic DYNAMIC 0000000000004c20 00003c20 000000fffffffa40 0000000000000010 WA 7 0 8 ... This binary causes a segfault in GDB. GDB is trying to write the .dynamic section into memory allocated on the stack with alloca(). However, the allocation silently fails and the subsequent access to the memory is causing the segfault. (On my node at least.) Stack allocation is a bad idea for something of variable size that GDB has no control over. So I changed the code to heap allocation. In addition, I changed the type of sect_size to the type that bfd actually returns. There should be no user visible change after this. Approved-By: Tom Tromey <tom@tromey.com>
2023-11-21Automatic date update in version.inGDB Administrator1-1/+1
2023-11-20Restore .gdb_index v9 display in readelfTom Tromey1-8/+49
An earlier patch (commit b05efa39 "readelf..debug-dump=loc displays bogus base addresses") inadvertently removed support for displaying .gdb_index v9 sections. This patch corrects the oversight. I tested this by using readelf on an appropriate file. * dwarf.c (display_gdb_index): Restore v9 display code.
2023-11-20PowerPC: Fix test gdb.ada/finish-large.expCarl Love1-1/+7
Function Create_large returns a large data structure. On PowerPC, register r3 contains the address of where the data structure to be returned is to be stored. However, on exit the ABI does not guarantee that r3 has not been changed. The GDB finish command prints the return value of the function at the end of the function. GDB needs to use the DW_TAG_call_site information to determine the value of r3 on entry to the function to correctly print the return value at the end of the function. The test must be compiled with -fvar-tracking for the DW_TAG_call_site information to be included in the executable file. This patch adds the -fvar-tracking option to the compile line if the option is supported. The patch fixes the one regression error for the test on PowerPC. The patch has been tested on Power 10 and X86-64 with no regressions.
2023-11-20libctf: adding CU mappings should be idempotentNick Alcock1-2/+16
When CTF finds conflicting types, it usually shoves each definition into a CTF dictionary named after the compilation unit. The intent of the obscure "cu-mapped link" feature is to allow you to implement custom linkers that shove the definitions into other, more coarse-grained units (say, one per kernel module, even if a module consists of more than one compilation unit): conflicting types within one of these larger components are hidden from name lookup so you can only look up (an arbitrary one of) them by name, but can still be found by chasing type graph links and are still fully deduplicated. You do this by calling ctf_link_add_cu_mapping (fp, "CU name", "bigger lump name"), repeatedly, with different "CU name"s: the ctf_link() following that will put all conflicting types found in "CU name"s sharing a "bigger lump name" into a child dict in an archive member named "bigger lump name". So it's clear enough what happens if you call it repeatedly with the same "bigger lump name" more than once, because that's the whole point of it: but what if you call it with the same "CU name" repeatedly? ctf_link_add_cu_mapping (fp, "CU name", "bigger lump name"); ctf_link_add_cu_mapping (fp, "CU name", "other name"); This is meant to be the same as just doing the second of these, as if the first was never called. Alas, this isn't what happens, and what you get is instead a bit of an inconsistent mess: more or less, the first takes precedence, which is the exact opposite of what we wanted. Fix this to work the right way round. (I plan to add support for CU-mapped links to GNU ld, mainly so that we can properly *test* this machinery.) libctf/ChangeLog: * ctf-link.c (ctf_create_per_cu): Note the behaviour of repeatedly adding FROMs. (ctf_link_add_cu_mapping): Implement that behavour.