exec/cpu-all.h: Get rid of obsolete CPULogItem type and functions.
Upstream has moved the log type definitions to "qemu/log.h" and
the implementation of qemu-log.c, which is now part of our build.
Update the caller to use the new versions which use QEMU/qemu_ as
the prefix, instead of CPU/cpu_.
Change-Id: Iec93d0a9e0b8430706d52cec79103f116f5f88b6
diff --git a/vl-android.c b/vl-android.c
index eebeb28..4077e97 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -41,6 +41,7 @@
#include "ui/console.h"
#include "sysemu/sysemu.h"
#include "exec/gdbstub.h"
+#include "qemu/log.h"
#include "qemu/timer.h"
#include "sysemu/char.h"
#include "sysemu/blockdev.h"
@@ -2556,6 +2557,8 @@
int tb_size;
const char *pid_file = NULL;
const char *incoming = NULL;
+ const char* log_mask = NULL;
+ const char* log_file = NULL;
CPUOldState *env;
int show_vnc_port = 0;
IniFile* hw_ini = NULL;
@@ -2921,20 +2924,7 @@
break;
}
case QEMU_OPTION_d:
- {
- int mask;
- const CPULogItem *item;
-
- mask = cpu_str_to_log_mask(optarg);
- if (!mask) {
- printf("Log items (comma separated):\n");
- for(item = cpu_log_items; item->mask != 0; item++) {
- printf("%-10s %s\n", item->name, item->help);
- }
- PANIC("Invalid parameter -d=%s", optarg);
- }
- cpu_set_log(mask);
- }
+ log_mask = optarg;
break;
case QEMU_OPTION_s:
gdbstub_dev = "tcp::" DEFAULT_GDBSTUB_PORT;
@@ -3944,6 +3934,25 @@
exit(1);
}
+ /* Open the logfile at this point, if necessary. We can't open the logfile
+ * when encountering either of the logging options (-d or -D) because the
+ * other one may be encountered later on the command line, changing the
+ * location or level of logging.
+ */
+ if (log_mask) {
+ int mask;
+ if (log_file) {
+ qemu_set_log_filename(log_file);
+ }
+
+ mask = qemu_str_to_log_mask(log_mask);
+ if (!mask) {
+ qemu_print_log_usage(stdout);
+ exit(1);
+ }
+ qemu_set_log(mask);
+ }
+
#if defined(CONFIG_KVM)
if (kvm_allowed < 0) {
kvm_allowed = kvm_check_allowed();