[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 07/43] windbg: added chardev
From: |
Ladi Prosek |
Subject: |
Re: [Qemu-devel] [PATCH 07/43] windbg: added chardev |
Date: |
Tue, 3 Oct 2017 13:49:24 +0200 |
On Tue, Sep 26, 2017 at 1:04 PM, Mihail Abakumov
<address@hidden> wrote:
> Added chardev for listening to windbg. Target device is a parameter in the
> '-windbg' option.
>
> Signed-off-by: Mihail Abakumov <address@hidden>
> Signed-off-by: Pavel Dovgalyuk <address@hidden>
> Signed-off-by: Dmitriy Koltunov <address@hidden>
> ---
> windbgstub.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/windbgstub.c b/windbgstub.c
> index 60a380c213..378d1b911f 100755
> --- a/windbgstub.c
> +++ b/windbgstub.c
> @@ -10,6 +10,7 @@
> */
>
> #include "qemu/osdep.h"
> +#include "qapi/error.h"
> #include "chardev/char.h"
> #include "chardev/char-fe.h"
> #include "exec/windbgstub.h"
> @@ -18,12 +19,26 @@
> typedef struct WindbgState {
> bool is_loaded;
>
> + CharBackend chr;
> +
> uint32_t ctrl_packet_id;
> uint32_t data_packet_id;
> } WindbgState;
>
> static WindbgState *windbg_state;
>
> +static int windbg_chr_can_receive(void *opaque)
> +{
> + return PACKET_MAX_SIZE;
> +}
> +
> +static void windbg_chr_receive(void *opaque, const uint8_t *buf, int size)
> +{
> + if (windbg_state->is_loaded) {
> + /* T0D0: parse data */
> + }
> +}
> +
> static void windbg_exit(void)
> {
> g_free(windbg_state);
> @@ -31,6 +46,8 @@ static void windbg_exit(void)
>
> int windbg_server_start(const char *device)
> {
> + Chardev *chr = NULL;
> +
> if (windbg_state) {
> WINDBG_ERROR("Multiple instances are not supported");
> exit(1);
> @@ -40,6 +57,15 @@ int windbg_server_start(const char *device)
> windbg_state->ctrl_packet_id = RESET_PACKET_ID;
> windbg_state->data_packet_id = INITIAL_PACKET_ID;
>
> + chr = qemu_chr_new_noreplay(WINDBG, device);
> + if (!chr) {
This should generate error output. Passing "-windbg bogus" makes QEMU
exit silently.
-gdb seems to have the same problem.
> + return -1;
> + }
> +
> + qemu_chr_fe_init(&windbg_state->chr, chr, &error_abort);
> + qemu_chr_fe_set_handlers(&windbg_state->chr, windbg_chr_can_receive,
> + windbg_chr_receive, NULL, NULL, NULL, NULL,
> true);
> +
> atexit(windbg_exit);
> return 0;
> }
>
- Re: [Qemu-devel] [PATCH 07/43] windbg: added chardev,
Ladi Prosek <=