summaryrefslogtreecommitdiffstats
path: root/qemu-error.c
blob: 63bcdcfa1a85826bb1982516b18f45549de752af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include "monitor.h"
#include "sysemu.h"

void qemu_error(const char *fmt, ...)
{
    va_list args;

    va_start(args, fmt);
    if (cur_mon) {
        monitor_vprintf(cur_mon, fmt, args);
    } else {
        vfprintf(stderr, fmt, args);
    }
    va_end(args);
}

void qemu_error_internal(const char *file, int linenr, const char *func,
                         const char *fmt, ...)
{
    va_list va;
    QError *qerror;

    va_start(va, fmt);
    qerror = qerror_from_info(file, linenr, func, fmt, &va);
    va_end(va);

    if (cur_mon) {
        monitor_set_error(cur_mon, qerror);
    } else {
        qerror_print(qerror);
        QDECREF(qerror);
    }
}
OpenPOWER on IntegriCloud