qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Konstantin Kostiuk <kkostiuk@redhat.com>, qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Michael Roth" <michael.roth@amd.com>
Subject: Re: [PATCH v2 1/4] QGA VSS: Add wrapper to send log to debugger and stderr
Date: Fri, 7 Jul 2023 10:33:50 +0200	[thread overview]
Message-ID: <a2f05a31-676a-a1d2-270e-56c525a22291@linaro.org> (raw)
In-Reply-To: <20230707083105.746811-2-kkostiuk@redhat.com>

On 7/7/23 10:31, Konstantin Kostiuk wrote:
> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
> ---
>   qga/vss-win32/meson.build   |  2 +-
>   qga/vss-win32/vss-debug.cpp | 31 +++++++++++++++++++++++++++++++
>   qga/vss-win32/vss-debug.h   | 24 ++++++++++++++++++++++++
>   3 files changed, 56 insertions(+), 1 deletion(-)
>   create mode 100644 qga/vss-win32/vss-debug.cpp
>   create mode 100644 qga/vss-win32/vss-debug.h
> 
> diff --git a/qga/vss-win32/meson.build b/qga/vss-win32/meson.build
> index 9483ccd3b8..0ac918910b 100644
> --- a/qga/vss-win32/meson.build
> +++ b/qga/vss-win32/meson.build
> @@ -7,7 +7,7 @@ link_args = cc.get_supported_link_arguments([
>   
>   qga_vss = shared_module(
>     'qga-vss',
> -  ['requester.cpp', 'provider.cpp', 'install.cpp', genh],
> +  ['requester.cpp', 'provider.cpp', 'install.cpp', 'vss-debug.cpp', genh],
>     name_prefix: '',
>     cpp_args: ['-Wno-unknown-pragmas', '-Wno-delete-non-virtual-dtor', '-Wno-non-virtual-dtor'],
>     link_args: link_args,
> diff --git a/qga/vss-win32/vss-debug.cpp b/qga/vss-win32/vss-debug.cpp
> new file mode 100644
> index 0000000000..de190a53f4
> --- /dev/null
> +++ b/qga/vss-win32/vss-debug.cpp
> @@ -0,0 +1,31 @@
> +/*
> + * QEMU Guest Agent VSS debug declarations
> + *
> + * Copyright (C) 2023 Red Hat Inc
> + *
> + * Authors:
> + *  Konstantin Kostiuk <kkostiuk@redhat.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#include "qemu/osdep.h"
> +#include "vss-common.h"
> +
> +void G_GNUC_PRINTF(2, 3)

"G_GNUC_PRINTF(2, 3)" attribute goes with the declaration,
not the definition ...

> +qga_debug_internal(const char *funcname, const char *fmt, ...)  {
> +    char user_sting[512] = {0};
> +    char full_string[640] = {0};
> +
> +    va_list args;
> +    va_start(args, fmt);
> +    vsnprintf(user_sting, 512, fmt, args);
> +    va_end(args);
> +
> +    snprintf(full_string, 640, QGA_PROVIDER_NAME "[%lu]: %s %s\n",
> +             GetCurrentThreadId(), funcname, user_sting);
> +
> +    OutputDebugString(full_string);
> +    fprintf(stderr, "%s", full_string);
> +}
> diff --git a/qga/vss-win32/vss-debug.h b/qga/vss-win32/vss-debug.h
> new file mode 100644
> index 0000000000..4a15049a62
> --- /dev/null
> +++ b/qga/vss-win32/vss-debug.h
> @@ -0,0 +1,24 @@
> +/*
> + * QEMU Guest Agent VSS debug declarations
> + *
> + * Copyright (C) 2023 Red Hat Inc
> + *
> + * Authors:
> + *  Konstantin Kostiuk <kkostiuk@redhat.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#include <vss-handles.h>
> +
> +#ifndef VSS_DEBUG_H
> +#define VSS_DEBUG_H
> +

... here: "G_GNUC_PRINTF(2, 3)".

> +void qga_debug_internal(const char *funcname, const char *fmt, ...);
> +
> +#define qga_debug(fmt, ...) qga_debug_internal(__func__, fmt, ## __VA_ARGS__)
> +#define qga_debug_begin qga_debug("begin")
> +#define qga_debug_end qga_debug("end")
> +
> +#endif

Otherwise LGTM, thanks for the rework.



  reply	other threads:[~2023-07-07  8:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07  8:31 [PATCH v2 0/4] QGA VSS Logging Konstantin Kostiuk
2023-07-07  8:31 ` [PATCH v2 1/4] QGA VSS: Add wrapper to send log to debugger and stderr Konstantin Kostiuk
2023-07-07  8:33   ` Philippe Mathieu-Daudé [this message]
2023-07-07  8:31 ` [PATCH v2 2/4] QGA VSS: Replace 'fprintf(stderr' with PRINT_DEBUG Konstantin Kostiuk
2023-07-07  8:35   ` Philippe Mathieu-Daudé
2023-07-07  8:31 ` [PATCH v2 3/4] QGA VSS: Print error in err_set Konstantin Kostiuk
2023-07-07  8:36   ` Philippe Mathieu-Daudé
2023-07-07  8:31 ` [PATCH v2 4/4] QGA VSS: Add log in functions begin/end Konstantin Kostiuk

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=a2f05a31-676a-a1d2-270e-56c525a22291@linaro.org \
    --to=philmd@linaro.org \
    --cc=kkostiuk@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=michael.roth@amd.com \
    --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).