-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QGA VSS: Add wrapper to send log to debugger and stderr
Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
- Loading branch information
1 parent
fcd1ab3
commit 925d05d
Showing
3 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* 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-debug.h" | ||
#include "vss-common.h" | ||
|
||
void qga_debug_internal(const char *funcname, const char *fmt, ...) | ||
{ | ||
char user_string[512] = {0}; | ||
char full_string[640] = {0}; | ||
|
||
va_list args; | ||
va_start(args, fmt); | ||
if (vsnprintf(user_string, _countof(user_string), fmt, args) <= 0) { | ||
va_end(args); | ||
return; | ||
} | ||
|
||
va_end(args); | ||
|
||
if (snprintf(full_string, _countof(full_string), | ||
QGA_PROVIDER_NAME "[%lu]: %s %s\n", | ||
GetCurrentThreadId(), funcname, user_string) <= 0) { | ||
return; | ||
} | ||
|
||
OutputDebugString(full_string); | ||
fputs(full_string, stderr); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* 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-handles.h> | ||
|
||
#ifndef VSS_DEBUG_H | ||
#define VSS_DEBUG_H | ||
|
||
void qga_debug_internal(const char *funcname, const char *fmt, ...) G_GNUC_PRINTF(2, 3); | ||
|
||
#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 |