Commit 4a44d85e authored by Seiji Aguchi's avatar Seiji Aguchi Committed by Luiz Capitulino

Convert stderr message calling error_get_pretty() to error_report()

Convert stderr messages calling error_get_pretty()
to error_report().

Timestamp is prepended by -msg timstamp option with it.

Per Markus's comment below, A conversion from fprintf() to
error_report() is always an improvement, regardless of
error_get_pretty().

http://marc.info/?l=qemu-devel&m=137513283408601&w=2

But, it is not reasonable to convert them at one time
because fprintf() is used everwhere in qemu.

So, it should be done step by step with avoiding regression.
Signed-off-by: default avatarSeiji Aguchi <seiji.aguchi@hds.com>
Reviewed-by: default avatarLaszlo Ersek <lersek@redhat.com>
Signed-off-by: default avatarLuiz Capitulino <lcapitulino@redhat.com>
parent 9176e8fb
...@@ -1125,8 +1125,8 @@ void do_acpitable_option(const QemuOpts *opts) ...@@ -1125,8 +1125,8 @@ void do_acpitable_option(const QemuOpts *opts)
acpi_table_add(opts, &err); acpi_table_add(opts, &err);
if (err) { if (err) {
fprintf(stderr, "Wrong acpi table provided: %s\n", error_report("Wrong acpi table provided: %s",
error_get_pretty(err)); error_get_pretty(err));
error_free(err); error_free(err);
exit(1); exit(1);
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "sysemu/char.h" #include "sysemu/char.h"
#include "qemu/timer.h" #include "qemu/timer.h"
#include "exec/address-spaces.h" #include "exec/address-spaces.h"
#include "qemu/error-report.h"
//#define DEBUG_SERIAL //#define DEBUG_SERIAL
...@@ -696,7 +697,7 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase, ...@@ -696,7 +697,7 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase,
s->chr = chr; s->chr = chr;
serial_realize_core(s, &err); serial_realize_core(s, &err);
if (err != NULL) { if (err != NULL) {
fprintf(stderr, "%s\n", error_get_pretty(err)); error_report("%s", error_get_pretty(err));
error_free(err); error_free(err);
exit(1); exit(1);
} }
...@@ -760,7 +761,7 @@ SerialState *serial_mm_init(MemoryRegion *address_space, ...@@ -760,7 +761,7 @@ SerialState *serial_mm_init(MemoryRegion *address_space,
serial_realize_core(s, &err); serial_realize_core(s, &err);
if (err != NULL) { if (err != NULL) {
fprintf(stderr, "%s\n", error_get_pretty(err)); error_report("%s", error_get_pretty(err));
error_free(err); error_free(err);
exit(1); exit(1);
} }
......
...@@ -978,7 +978,7 @@ void pc_cpus_init(const char *cpu_model, DeviceState *icc_bridge) ...@@ -978,7 +978,7 @@ void pc_cpus_init(const char *cpu_model, DeviceState *icc_bridge)
cpu = pc_new_cpu(cpu_model, x86_cpu_apic_id_from_index(i), cpu = pc_new_cpu(cpu_model, x86_cpu_apic_id_from_index(i),
icc_bridge, &error); icc_bridge, &error);
if (error) { if (error) {
fprintf(stderr, "%s\n", error_get_pretty(error)); error_report("%s", error_get_pretty(error));
error_free(error); error_free(error);
exit(1); exit(1);
} }
...@@ -1096,8 +1096,8 @@ void pc_acpi_init(const char *default_dsdt) ...@@ -1096,8 +1096,8 @@ void pc_acpi_init(const char *default_dsdt)
acpi_table_add(opts, &err); acpi_table_add(opts, &err);
if (err) { if (err) {
fprintf(stderr, "WARNING: failed to load %s: %s\n", filename, error_report("WARNING: failed to load %s: %s", filename,
error_get_pretty(err)); error_get_pretty(err));
error_free(err); error_free(err);
} }
g_free(arg); g_free(arg);
......
...@@ -3344,7 +3344,7 @@ CharDriverState *qemu_chr_new(const char *label, const char *filename, void (*in ...@@ -3344,7 +3344,7 @@ CharDriverState *qemu_chr_new(const char *label, const char *filename, void (*in
chr = qemu_chr_new_from_opts(opts, init, &err); chr = qemu_chr_new_from_opts(opts, init, &err);
if (error_is_set(&err)) { if (error_is_set(&err)) {
fprintf(stderr, "%s\n", error_get_pretty(err)); error_report("%s", error_get_pretty(err));
error_free(err); error_free(err);
} }
if (chr && qemu_opt_get_bool(opts, "mux", 0)) { if (chr && qemu_opt_get_bool(opts, "mux", 0)) {
......
...@@ -1852,7 +1852,7 @@ X86CPU *cpu_x86_init(const char *cpu_model) ...@@ -1852,7 +1852,7 @@ X86CPU *cpu_x86_init(const char *cpu_model)
out: out:
if (error) { if (error) {
fprintf(stderr, "%s\n", error_get_pretty(error)); error_report("%s", error_get_pretty(error));
error_free(error); error_free(error);
if (cpu != NULL) { if (cpu != NULL) {
object_unref(OBJECT(cpu)); object_unref(OBJECT(cpu));
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "cpu-models.h" #include "cpu-models.h"
#include "mmu-hash32.h" #include "mmu-hash32.h"
#include "mmu-hash64.h" #include "mmu-hash64.h"
#include "qemu/error-report.h"
//#define PPC_DUMP_CPU //#define PPC_DUMP_CPU
//#define PPC_DEBUG_SPR //#define PPC_DEBUG_SPR
...@@ -8281,7 +8282,7 @@ PowerPCCPU *cpu_ppc_init(const char *cpu_model) ...@@ -8281,7 +8282,7 @@ PowerPCCPU *cpu_ppc_init(const char *cpu_model)
object_property_set_bool(OBJECT(cpu), true, "realized", &err); object_property_set_bool(OBJECT(cpu), true, "realized", &err);
if (err != NULL) { if (err != NULL) {
fprintf(stderr, "%s\n", error_get_pretty(err)); error_report("%s", error_get_pretty(err));
error_free(err); error_free(err);
object_unref(OBJECT(cpu)); object_unref(OBJECT(cpu));
return NULL; return NULL;
......
...@@ -2393,7 +2393,7 @@ static int chardev_init_func(QemuOpts *opts, void *opaque) ...@@ -2393,7 +2393,7 @@ static int chardev_init_func(QemuOpts *opts, void *opaque)
qemu_chr_new_from_opts(opts, NULL, &local_err); qemu_chr_new_from_opts(opts, NULL, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
fprintf(stderr, "%s\n", error_get_pretty(local_err)); error_report("%s", error_get_pretty(local_err));
error_free(local_err); error_free(local_err);
return -1; return -1;
} }
...@@ -4375,8 +4375,8 @@ int main(int argc, char **argv, char **envp) ...@@ -4375,8 +4375,8 @@ int main(int argc, char **argv, char **envp)
vnc_display_init(ds); vnc_display_init(ds);
vnc_display_open(ds, vnc_display, &local_err); vnc_display_open(ds, vnc_display, &local_err);
if (local_err != NULL) { if (local_err != NULL) {
fprintf(stderr, "Failed to start VNC server on `%s': %s\n", error_report("Failed to start VNC server on `%s': %s",
vnc_display, error_get_pretty(local_err)); vnc_display, error_get_pretty(local_err));
error_free(local_err); error_free(local_err);
exit(1); exit(1);
} }
...@@ -4419,7 +4419,8 @@ int main(int argc, char **argv, char **envp) ...@@ -4419,7 +4419,8 @@ int main(int argc, char **argv, char **envp)
Error *local_err = NULL; Error *local_err = NULL;
qemu_start_incoming_migration(incoming, &local_err); qemu_start_incoming_migration(incoming, &local_err);
if (local_err) { if (local_err) {
fprintf(stderr, "-incoming %s: %s\n", incoming, error_get_pretty(local_err)); error_report("-incoming %s: %s", incoming,
error_get_pretty(local_err));
error_free(local_err); error_free(local_err);
exit(1); exit(1);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment