3b6c27d8 | 05-Jul-2024 |
Gustavo Romero <gustavo.romero@linaro.org> |
gdbstub: Use true to set cmd_startswith
cmd_startswith is a boolean so use 'true' to set it instead of 1.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org> Message-Id: <20240628050850.53644
gdbstub: Use true to set cmd_startswith
cmd_startswith is a boolean so use 'true' to set it instead of 1.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org> Message-Id: <20240628050850.536447-10-gustavo.romero@linaro.org> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240705084047.857176-39-alex.bennee@linaro.org>
show more ...
|
2be4d5db | 05-Jul-2024 |
Gustavo Romero <gustavo.romero@linaro.org> |
gdbstub: Pass CPU context to command handler
Allow passing the current CPU context to command handlers via user_ctx when the handler requires it.
Signed-off-by: Gustavo Romero <gustavo.romero@linar
gdbstub: Pass CPU context to command handler
Allow passing the current CPU context to command handlers via user_ctx when the handler requires it.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org> Message-Id: <20240628050850.536447-9-gustavo.romero@linaro.org> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240705084047.857176-38-alex.bennee@linaro.org>
show more ...
|
60f4ce8e | 05-Jul-2024 |
Gustavo Romero <gustavo.romero@linaro.org> |
gdbstub: Add support for target-specific stubs
Currently, it's not possible to have stubs specific to a given target, even though there are GDB features which are target-specific, like, for instance
gdbstub: Add support for target-specific stubs
Currently, it's not possible to have stubs specific to a given target, even though there are GDB features which are target-specific, like, for instance, memory tagging.
This commit introduces gdb_extend_qsupported_features, gdb_extend_query_table, and gdb_extend_set_table functions as interfaces to extend the qSupported string, the query handler table, and the set handler table, allowing target-specific stub implementations.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240628050850.536447-4-gustavo.romero@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240705084047.857176-33-alex.bennee@linaro.org>
show more ...
|
133f202b | 05-Jul-2024 |
Gustavo Romero <gustavo.romero@linaro.org> |
gdbstub: Move GdbCmdParseEntry into a new header file
Move GdbCmdParseEntry and its associated types into a separate header file to allow the use of GdbCmdParseEntry and other gdbstub command functi
gdbstub: Move GdbCmdParseEntry into a new header file
Move GdbCmdParseEntry and its associated types into a separate header file to allow the use of GdbCmdParseEntry and other gdbstub command functions outside of gdbstub.c.
Since GdbCmdParseEntry and get_param are now public, kdoc GdbCmdParseEntry and rename get_param to gdb_get_cmd_param.
This commit also makes gdb_put_packet public since is used in gdbstub command handling.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240628050850.536447-3-gustavo.romero@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240705084047.857176-32-alex.bennee@linaro.org>
show more ...
|
4408155a | 24-May-2024 |
Paolo Bonzini <pbonzini@redhat.com> |
meson: Drop the .fa library suffix
The non-standard .fa library suffix breaks the link source de-duplication done by Meson so drop it.
The lack of link source de-duplication causes AddressSanitizer
meson: Drop the .fa library suffix
The non-standard .fa library suffix breaks the link source de-duplication done by Meson so drop it.
The lack of link source de-duplication causes AddressSanitizer to complain ODR violations, and makes GNU ld abort when combined with clang's LTO.
Fortunately, the non-standard suffix is not necessary anymore for two reasons.
First, the non-standard suffix was necessary for fork-fuzzing. Meson wraps all standard-suffixed libraries with --start-group and --end-group. This made a fork-fuzz.ld linker script wrapped as well and broke builds. Commit d2e6f9272d33 ("fuzz: remove fork-fuzzing scaffolding") dropped fork-fuzzing so we can now restore the standard suffix.
Second, the libraries are not even built anymore, because it is possible to just use the object files directly via extract_all_objects().
The occurences of the suffix were detected and removed by performing a tree-wide search with 'fa' and .fa (note the quotes and dot).
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-ID: <20240524-xkb-v4-4-2de564e5c859@daynix.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
0eaf7fb9 | 13-Mar-2024 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
gdbstub/system: Rename 'user_ctx' argument as 'ctx'
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <2024031321333
gdbstub/system: Rename 'user_ctx' argument as 'ctx'
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20240313213339.82071-4-philmd@linaro.org>
show more ...
|
6971998e | 11-Mar-2024 |
Ilya Leoshkevich <iii@linux.ibm.com> |
gdbstub: Fix double close() of the follow-fork-mode socket
When the terminal GDB_FORK_ENABLED state is reached, the coordination socket is not needed anymore and is therefore closed. However, if the
gdbstub: Fix double close() of the follow-fork-mode socket
When the terminal GDB_FORK_ENABLED state is reached, the coordination socket is not needed anymore and is therefore closed. However, if there is a communication error between QEMU gdbstub and GDB, the generic error handling code attempts to close it again.
Fix by closing it later - before returning - instead.
Fixes: Coverity CID 1539966 Fixes: d547e711a8a5 ("gdbstub: Implement follow-fork-mode child") Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240312001813.13720-1-iii@linux.ibm.com>
show more ...
|
9ae5801d | 08-Mar-2024 |
Gustavo Romero <gustavo.romero@linaro.org> |
gdbstub: Add Xfer:siginfo:read stub
Add stub to handle Xfer:siginfo:read packet query that requests the machine's siginfo data.
This is used when GDB user executes 'print $_siginfo' and when the ma
gdbstub: Add Xfer:siginfo:read stub
Add stub to handle Xfer:siginfo:read packet query that requests the machine's siginfo data.
This is used when GDB user executes 'print $_siginfo' and when the machine stops due to a signal, for instance, on SIGSEGV. The information in siginfo allows GDB to determiner further details on the signal, like the fault address/insn when the SIGSEGV is caught.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org> Message-Id: <20240309030901.1726211-5-gustavo.romero@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
d547e711 | 05-Mar-2024 |
Ilya Leoshkevich <iii@linux.ibm.com> |
gdbstub: Implement follow-fork-mode child
Currently it's not possible to use gdbstub for debugging linux-user code that runs in a forked child, which is normally done using the `set follow-fork-mode
gdbstub: Implement follow-fork-mode child
Currently it's not possible to use gdbstub for debugging linux-user code that runs in a forked child, which is normally done using the `set follow-fork-mode child` GDB command. Purely on the protocol level, the missing piece is the fork-events feature.
However, a deeper problem is supporting $Hg switching between different processes - right now it can do only threads. Implementing this for the general case would be quite complicated, but, fortunately, for the follow-fork-mode case there are a few factors that greatly simplify things: fork() happens in the exclusive section, there are only two processes involved, and before one of them is resumed, the second one is detached.
This makes it possible to implement a simplified scheme: the parent and the child share the gdbserver socket, it's used only by one of them at any given time, which is coordinated through a separate socketpair. The processes can read from the gdbserver socket only one byte at a time, which is not great for performance, but, fortunately, the follow-fork-mode handling involves only a few messages.
Advertise the fork-events support, and remember whether GDB has it as well. Implement the state machine that is initialized on fork(), decides the current owner of the gdbserver socket, and is terminated when one of the two processes is detached. The logic for the parent and the child is the same, only the initial state is different.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20240219141628.246823-12-iii@linux.ibm.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240305121005.3528075-13-alex.bennee@linaro.org>
show more ...
|
539cb4ec | 05-Mar-2024 |
Ilya Leoshkevich <iii@linux.ibm.com> |
gdbstub: Introduce gdb_handle_detach_user()
The upcoming follow-fork-mode child support needs to perform certain actions when GDB detaches from the stopped parent or the stopped child. Introduce a u
gdbstub: Introduce gdb_handle_detach_user()
The upcoming follow-fork-mode child support needs to perform certain actions when GDB detaches from the stopped parent or the stopped child. Introduce a user-specific hook for this.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20240219141628.246823-11-iii@linux.ibm.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240305121005.3528075-12-alex.bennee@linaro.org>
show more ...
|
e454f2fe | 05-Mar-2024 |
Ilya Leoshkevich <iii@linux.ibm.com> |
gdbstub: Introduce gdb_handle_set_thread_user()
The upcoming follow-fork-mode child support needs to perform certain actions when GDB switches between the stopped parent and the stopped child. Intro
gdbstub: Introduce gdb_handle_set_thread_user()
The upcoming follow-fork-mode child support needs to perform certain actions when GDB switches between the stopped parent and the stopped child. Introduce a user-specific hook for this.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20240219141628.246823-10-iii@linux.ibm.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240305121005.3528075-11-alex.bennee@linaro.org>
show more ...
|
6d923112 | 05-Mar-2024 |
Ilya Leoshkevich <iii@linux.ibm.com> |
gdbstub: Introduce gdb_handle_query_supported_user()
The upcoming follow-fork-mode child support requires advertising the fork-events feature, which is user-specific. Introduce a user-specific hook
gdbstub: Introduce gdb_handle_query_supported_user()
The upcoming follow-fork-mode child support requires advertising the fork-events feature, which is user-specific. Introduce a user-specific hook for this.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20240219141628.246823-9-iii@linux.ibm.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240305121005.3528075-10-alex.bennee@linaro.org>
show more ...
|
6604b057 | 05-Mar-2024 |
Ilya Leoshkevich <iii@linux.ibm.com> |
gdbstub: Call gdbserver_fork() both in parent and in child
The upcoming follow-fork-mode child support requires post-fork message exchange between the parent and the child. Prepare gdbserver_fork()
gdbstub: Call gdbserver_fork() both in parent and in child
The upcoming follow-fork-mode child support requires post-fork message exchange between the parent and the child. Prepare gdbserver_fork() for this purpose. Rename it to gdbserver_fork_end() to better reflect its purpose.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20240219141628.246823-8-iii@linux.ibm.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240305121005.3528075-9-alex.bennee@linaro.org>
show more ...
|
9d456e09 | 05-Mar-2024 |
Ilya Leoshkevich <iii@linux.ibm.com> |
{linux,bsd}-user: Pass pid to gdbserver_fork()
The upcoming follow-fork-mode child support requires knowing the child pid. Pass it down.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org
{linux,bsd}-user: Pass pid to gdbserver_fork()
The upcoming follow-fork-mode child support requires knowing the child pid. Pass it down.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20240219141628.246823-7-iii@linux.ibm.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240305121005.3528075-8-alex.bennee@linaro.org>
show more ...
|