qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Konstantin Kostiuk <kkostiuk@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"Yan Vugenfirer" <yvugenfi@redhat.com>
Subject: Re: [PATCH 1/4] QGA VSS: Add wrapper to send log to debugger and stderr
Date: Thu, 6 Jul 2023 10:54:47 +0300	[thread overview]
Message-ID: <CAPMcbCp2Rx4jz3S9R8VbaeRZrkakn4HE7e-GZtubv5b29Km1OA@mail.gmail.com> (raw)
In-Reply-To: <413a30a2-c050-7587-8c0e-a6d89c8b7ab3@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 1522 bytes --]

Hi Philippe,

On Wed, Jul 5, 2023 at 11:35 PM Philippe Mathieu-Daudé <philmd@linaro.org>
wrote:

> Hi Konstantin,
>
> On 5/7/23 16:12, Konstantin Kostiuk wrote:
> > Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
> > ---
> >   qga/vss-win32/vss-debug.h | 31 +++++++++++++++++++++++++++++++
> >   1 file changed, 31 insertions(+)
> >   create mode 100644 qga/vss-win32/vss-debug.h
>
>
> > +#define PRINT_DEBUG(fmt, ...) {
>        \
> > +    char user_sting[512] = { 0 };
>        \
> > +    char full_string[640] = { 0 };
>       \
> > +    snprintf(user_sting, 512, fmt, ## __VA_ARGS__);
>        \
> > +    snprintf(full_string, 640, QGA_PROVIDER_NAME"[%lu]: %s %s\n",
>        \
> > +        GetCurrentThreadId(), __func__, user_sting);
>       \
> > +    OutputDebugString(full_string);
>        \
> > +    fprintf(stderr, "%s", full_string);
>        \
> > +}
>
> Why not simply use a plain function?
>

I am not sure what you mean.

If you mean to call OutputDebugString directly, then we need to concatenate
the proper string
for each call.
If you mean convert PRINT_DEBUG to function, then we can't use the __func__
macro in
PRINT_DEBUG to get the real function name. We can convert PRINT_DEBUG to
function
and a new macro that will call PRINT_DEBUG and pass a proper value of
__fucn__.

What solution is better there?


>
> > +#define PRINT_DEBUG_BEGIN PRINT_DEBUG("begin")
> > +#define PRINT_DEBUG_END PRINT_DEBUG("end")
> > +
> > +#endif
>
>

[-- Attachment #2: Type: text/html, Size: 2604 bytes --]

  reply	other threads:[~2023-07-06  7:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05 14:12 [PATCH 0/4] QGA VSS Logging Konstantin Kostiuk
2023-07-05 14:12 ` [PATCH 1/4] QGA VSS: Add wrapper to send log to debugger and stderr Konstantin Kostiuk
2023-07-05 20:35   ` Philippe Mathieu-Daudé
2023-07-06  7:54     ` Konstantin Kostiuk [this message]
2023-07-06 10:01       ` Philippe Mathieu-Daudé
2023-07-06 10:58         ` Konstantin Kostiuk
2023-07-06 16:48           ` Philippe Mathieu-Daudé
2023-07-05 14:12 ` [PATCH 2/4] QGA VSS: Replace 'fprintf(stderr' with PRINT_DEBUG Konstantin Kostiuk
2023-07-05 20:36   ` Philippe Mathieu-Daudé
2023-07-06  8:36     ` Konstantin Kostiuk
2023-07-05 14:12 ` [PATCH 3/4] QGA VSS: Print error in err_set Konstantin Kostiuk
2023-07-05 14:12 ` [PATCH 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=CAPMcbCp2Rx4jz3S9R8VbaeRZrkakn4HE7e-GZtubv5b29Km1OA@mail.gmail.com \
    --to=kkostiuk@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=yvugenfi@redhat.com \
    /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).