| 1 | #include "qemu/osdep.h" |
| 2 | #include "monitor/hmp.h" |
| 3 | |
| 4 | #ifdef CONFIG_HMP |
| 5 | int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) |
| 6 | { |
| 7 | /* |
| 8 | * Pretend 'g_test_message' is our monitor console to |
| 9 | * stop the caller sending messages to stderr |
| 10 | */ |
| 11 | if (g_test_initialized() && !g_test_subprocess() && |
| 12 | getenv("QTEST_SILENT_ERRORS")) { |
| 13 | char *msg = g_strdup_vprintf(fmt, ap); |
| 14 | g_test_message("%s", msg); |
| 15 | size_t ret = strlen(msg); |
| 16 | g_free(msg); |
| 17 | return ret; |
| 18 | } |
| 19 | return -1; |
| 20 | } |
| 21 | #endif |