From: Richard Henderson <richard.henderson@linaro.org>
To: "Alex Bennée" <alex.bennee@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH v4 25/26] gdbstub: split out softmmu/user specifics for syscall handling
Date: Thu, 2 Mar 2023 14:21:31 -0800 [thread overview]
Message-ID: <c3c114ce-a70d-ab39-a8f9-41378b4a6ee0@linaro.org> (raw)
In-Reply-To: <20230302190846.2593720-26-alex.bennee@linaro.org>
On 3/2/23 09:08, Alex Bennée wrote:
> @@ -104,9 +104,10 @@ void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list va)
> }
>
> gdbserver_syscall_state.current_syscall_cb = cb;
> -#ifndef CONFIG_USER_ONLY
> - vm_stop(RUN_STATE_DEBUG);
> -#endif
> +
> + /* user/softmmu specific handling */
> + gdb_pre_syscall_handling();
I think this placement of vm_stop is inconvenient, and that we don't need to continue. If
we move it down below the construction of gdbserver_syscall_state.syscall_buf...
> p = &gdbserver_syscall_state.syscall_buf[0];
> p_end = &gdbserver_syscall_state.syscall_buf[sizeof(gdbserver_syscall_state.syscall_buf)];
> *(p++) = 'F';
> @@ -141,27 +142,13 @@ void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list va)
> }
> }
> *p = 0;
> -#ifdef CONFIG_USER_ONLY
> - gdb_put_packet(gdbserver_syscall_state.syscall_buf);
> - /*
> - * Return control to gdb for it to process the syscall request.
> - * Since the protocol requires that gdb hands control back to us
> - * using a "here are the results" F packet, we don't need to check
> - * gdb_handlesig's return value (which is the signal to deliver if
> - * execution was resumed via a continue packet).
> - */
> - gdb_handlesig(gdbserver_state.c_cpu, 0);
> -#else
> - /*
> - * In this case wait to send the syscall packet until notification that
> - * the CPU has stopped. This must be done because if the packet is sent
> - * now the reply from the syscall request could be received while the CPU
> - * is still in the running state, which can cause packets to be dropped
> - * and state transition 'T' packets to be sent while the syscall is still
> - * being processed.
> - */
> - qemu_cpu_kick(gdbserver_state.c_cpu);
> -#endif
> +
> + if (gdb_send_syscall_now()) { /* true only for *-user */
> + gdb_put_packet(gdbserver_syscall_state.syscall_buf);
> + }
> +
> + /* user/softmmu specific handling */
> + gdb_post_syscall_handling();
... then we don't need 3 separate hooks for user/softmmu.
softmmu:
void gdb_syscall_handling(const char *syscall_buf)
{
vm_stop(RUN_STATE_DEBUG);
qemu_cpu_kick(gdbserver_state.c_cpu);
}
user:
void gdb_syscall_handling(const char *syscall_buf)
{
gdb_put_packet(syscall_buf);
gdb_handlesig(gdbserver_state.c_cpu, 0);
}
r~
next prev parent reply other threads:[~2023-03-02 22:21 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 19:08 [PATCH v4 00/26] gdbstub/next: re-organise and split build Alex Bennée
2023-03-02 19:08 ` [PATCH v4 01/26] gdbstub/internals.h: clean up include guard Alex Bennée
2023-03-02 19:08 ` [PATCH v4 02/26] gdbstub: fix-up copyright and license files Alex Bennée
2023-03-02 19:08 ` [PATCH v4 03/26] gdbstub: Make syscall_complete/[gs]et_reg target-agnostic typedefs Alex Bennée
2023-03-02 19:08 ` [PATCH v4 04/26] gdbstub: clean-up indent on gdb_exit Alex Bennée
2023-03-02 20:29 ` Richard Henderson
2023-03-03 8:33 ` Daniel Henrique Barboza
2023-03-02 19:08 ` [PATCH v4 05/26] gdbstub: define separate user/system structures Alex Bennée
2023-03-02 19:08 ` [PATCH v4 06/26] gdbstub: move GDBState to shared internals header Alex Bennée
2023-03-02 19:08 ` [PATCH v4 07/26] includes: move tb_flush into its own header Alex Bennée
2023-03-02 19:08 ` [PATCH v4 08/26] gdbstub: move fromhex/tohex routines to internals Alex Bennée
2023-03-02 19:08 ` [PATCH v4 09/26] gdbstub: make various helpers visible to the rest of the module Alex Bennée
2023-03-02 19:08 ` [PATCH v4 10/26] gdbstub: move chunk of softmmu functionality to own file Alex Bennée
2023-03-02 19:08 ` [PATCH v4 11/26] gdbstub: move chunks of user code into own files Alex Bennée
2023-03-02 19:08 ` [PATCH v4 12/26] gdbstub: rationalise signal mapping in softmmu Alex Bennée
2023-03-02 19:08 ` [PATCH v4 13/26] gdbstub: abstract target specific details from gdb_put_packet_binary Alex Bennée
2023-03-02 19:08 ` [PATCH v4 14/26] gdbstub: specialise handle_query_attached Alex Bennée
2023-03-02 19:08 ` [PATCH v4 15/26] gdbstub: specialise target_memory_rw_debug Alex Bennée
2023-03-02 19:08 ` [PATCH v4 16/26] gdbstub: introduce gdb_get_max_cpus Alex Bennée
2023-03-02 19:08 ` [PATCH v4 17/26] gdbstub: specialise stub_can_reverse Alex Bennée
2023-03-02 19:08 ` [PATCH v4 18/26] gdbstub: fix address type of gdb_set_cpu_pc Alex Bennée
2023-03-02 19:08 ` [PATCH v4 19/26] gdbstub: don't use target_ulong while handling registers Alex Bennée
2023-03-02 19:08 ` [PATCH v4 20/26] gdbstub: move register helpers into standalone include Alex Bennée
2023-03-02 19:08 ` [PATCH v4 21/26] gdbstub: move syscall handling to new file Alex Bennée
2023-03-02 19:08 ` [PATCH v4 22/26] gdbstub: only compile gdbstub twice for whole build Alex Bennée
2023-03-02 22:00 ` Richard Henderson
2023-03-02 19:08 ` [PATCH v4 23/26] testing: probe gdb for supported architectures ahead of time Alex Bennée
2023-03-02 20:47 ` Richard Henderson
2023-03-02 21:52 ` Richard Henderson
2023-03-02 19:08 ` [PATCH v4 24/26] include: split target_long definition from cpu-defs Alex Bennée
2023-03-02 19:08 ` [PATCH v4 25/26] gdbstub: split out softmmu/user specifics for syscall handling Alex Bennée
2023-03-02 22:21 ` Richard Henderson [this message]
2023-03-02 19:08 ` [PATCH v4 26/26] gdbstub: move update guest debug to accel ops Alex Bennée
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c3c114ce-a70d-ab39-a8f9-41378b4a6ee0@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).