From: Christophe LYON <christophe.lyon@st.com>
To: Stefan Weil <weil@mail.berlios.de>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] make qemu.log name unique
Date: Mon, 5 Jul 2010 17:41:51 +0200 [thread overview]
Message-ID: <4C31FD3F.5040305@st.com> (raw)
In-Reply-To: <4C2C95C1.2040202@mail.berlios.de>
>
> Patches need a "Signed-off-by", and for the code review
> it's better to send them inline.
>
> What about patching the documentation, too?
>
OK Here is an updated version. I have also patched the bsd and darwin
ports, but couldn't actually check it is OK for lack of such platforms.
I hope my mailer won't scramble everything.
Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
bsd-user/main.c | 34 ++++++++++++++++++++--------------
darwin-user/main.c | 32 +++++++++++++++++++-------------
linux-user/main.c | 32 +++++++++++++++++++-------------
qemu-doc.texi | 12 +++++++++---
qemu-options.hx | 11 +++++++++--
5 files changed, 76 insertions(+), 45 deletions(-)
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 9f8683d..8733e82 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -34,7 +34,8 @@
#include "envlist.h"
-#define DEBUG_LOGFILE "/tmp/qemu.log"
+#define DEFAULTDEBUG_LOGFILE "/tmp/qemu.log"
+static const char *debug_logfile = DEFAULTDEBUG_LOGFILE;
int singlestep;
#if defined(CONFIG_USE_GUEST_BASE)
@@ -690,10 +691,11 @@ static void usage(void)
"-bsd type select emulated BSD type
FreeBSD/NetBSD/OpenBSD (default)\n"
"\n"
"Debug options:\n"
- "-d options activate log (logfile=%s)\n"
- "-p pagesize set the host page size to 'pagesize'\n"
- "-singlestep always run in singlestep mode\n"
- "-strace log system calls\n"
+ "-d options activate log\n"
+ "-logfile filename set log file name to 'filename' (default
%s)\n"
+ "-p pagesize set the host page size to 'pagesize'\n"
+ "-singlestep always run in singlestep mode\n"
+ "-strace log system calls\n"
"\n"
"Environment variables:\n"
"QEMU_STRACE Print system calls and arguments similar
to the\n"
@@ -708,7 +710,7 @@ static void usage(void)
TARGET_ARCH,
interp_prefix,
x86_stack_size,
- DEBUG_LOGFILE);
+ debug_logfile);
exit(1);
}
@@ -741,13 +743,11 @@ int main(int argc, char **argv)
char **target_environ, **wrk;
envlist_t *envlist = NULL;
bsd_type = target_openbsd;
+ int log_mask = 0;
if (argc <= 1)
usage();
- /* init debug */
- cpu_set_log_filename(DEBUG_LOGFILE);
-
if ((envlist = envlist_create()) == NULL) {
(void) fprintf(stderr, "Unable to allocate envlist\n");
exit(1);
@@ -770,23 +770,23 @@ int main(int argc, char **argv)
r++;
if (!strcmp(r, "-")) {
break;
+ } else if (!strcmp(r, "logfile")) {
+ debug_logfile = argv[optind++];
} else if (!strcmp(r, "d")) {
- int mask;
const CPULogItem *item;
if (optind >= argc)
break;
- r = argv[optind++];
- mask = cpu_str_to_log_mask(r);
- if (!mask) {
+ r = argv[optind++];
+ log_mask = cpu_str_to_log_mask(r);
+ if (!log_mask) {
printf("Log items (comma separated):\n");
for(item = cpu_log_items; item->mask != 0; item++) {
printf("%-10s %s\n", item->name, item->help);
}
exit(1);
}
- cpu_set_log(mask);
} else if (!strcmp(r, "E")) {
r = argv[optind++];
if (envlist_setenv(envlist, r) != 0)
@@ -857,6 +857,12 @@ int main(int argc, char **argv)
usage();
filename = argv[optind];
+ /* init debug */
+ if (log_mask) {
+ cpu_set_log_filename(debug_logfile);
+ cpu_set_log(log_mask);
+ }
+
/* Zero out regs */
memset(regs, 0, sizeof(struct target_pt_regs));
diff --git a/darwin-user/main.c b/darwin-user/main.c
index 5fd314e..53989c2 100644
--- a/darwin-user/main.c
+++ b/darwin-user/main.c
@@ -29,7 +29,8 @@
#include "qemu.h"
-#define DEBUG_LOGFILE "/tmp/qemu.log"
+#define DEFAULTDEBUG_LOGFILE "/tmp/qemu.log"
+static const char *debug_logfile = DEFAULTDEBUG_LOGFILE;
#ifdef __APPLE__
#include <crt_externs.h>
@@ -715,15 +716,16 @@ void usage(void)
"-s size set the stack size in bytes (default=%ld)\n"
"\n"
"debug options:\n"
- "-d options activate log (logfile='%s')\n"
- "-g wait for gdb on port 1234\n"
- "-p pagesize set the host page size to 'pagesize'\n",
- "-singlestep always run in singlestep mode\n"
+ "-d options activate log\n"
+ "-logfile filename set log file name to 'filename' (default
%s)\n"
+ "-g wait for gdb on port 1234\n"
+ "-p pagesize set the host page size to 'pagesize'\n",
+ "-singlestep always run in singlestep mode\n"
TARGET_ARCH,
TARGET_ARCH,
interp_prefix,
stack_size,
- DEBUG_LOGFILE);
+ debug_logfile);
exit(1);
}
@@ -745,13 +747,11 @@ int main(int argc, char **argv)
short use_gdbstub = 0;
const char *r;
const char *cpu_model;
+ int log_mask = 0;
if (argc <= 1)
usage();
- /* init debug */
- cpu_set_log_filename(DEBUG_LOGFILE);
-
optind = 1;
for(;;) {
if (optind >= argc)
@@ -763,23 +763,23 @@ int main(int argc, char **argv)
r++;
if (!strcmp(r, "-")) {
break;
+ } else if (!strcmp(r, "logfile")) {
+ debug_logfile = argv[optind++];
} else if (!strcmp(r, "d")) {
- int mask;
CPULogItem *item;
if (optind >= argc)
break;
r = argv[optind++];
- mask = cpu_str_to_log_mask(r);
- if (!mask) {
+ log_mask = cpu_str_to_log_mask(r);
+ if (!log_mask) {
printf("Log items (comma separated):\n");
for(item = cpu_log_items; item->mask != 0; item++) {
printf("%-10s %s\n", item->name, item->help);
}
exit(1);
}
- cpu_set_log(mask);
} else if (!strcmp(r, "s")) {
r = argv[optind++];
stack_size = strtol(r, (char **)&r, 0);
@@ -821,6 +821,12 @@ int main(int argc, char **argv)
usage();
filename = argv[optind];
+ /* init debug */
+ if (log_mask) {
+ cpu_set_log_filename(debug_logfile);
+ cpu_set_log(log_mask);
+ }
+
/* Zero out regs */
memset(regs, 0, sizeof(struct target_pt_regs));
diff --git a/linux-user/main.c b/linux-user/main.c
index a6af2a5..56f78db 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -34,7 +34,8 @@
#include "envlist.h"
-#define DEBUG_LOGFILE "/tmp/qemu.log"
+#define DEFAULTDEBUG_LOGFILE "/tmp/qemu.log"
+static const char *debug_logfile = DEFAULTDEBUG_LOGFILE;
char *exec_path;
@@ -2454,10 +2455,11 @@ static void usage(void)
#endif
"\n"
"Debug options:\n"
- "-d options activate log (logfile=%s)\n"
- "-p pagesize set the host page size to 'pagesize'\n"
- "-singlestep always run in singlestep mode\n"
- "-strace log system calls\n"
+ "-d options activate logfile\n"
+ "-logfile filename set log file name to 'filename' (default
%s)\n"
+ "-p pagesize set the host page size to 'pagesize'\n"
+ "-singlestep always run in singlestep mode\n"
+ "-strace log system calls\n"
"\n"
"Environment variables:\n"
"QEMU_STRACE Print system calls and arguments similar
to the\n"
@@ -2472,7 +2474,7 @@ static void usage(void)
TARGET_ARCH,
interp_prefix,
x86_stack_size,
- DEBUG_LOGFILE);
+ debug_logfile);
exit(1);
}
@@ -2531,15 +2533,13 @@ int main(int argc, char **argv, char **envp)
const char *argv0 = NULL;
int i;
int ret;
+ int log_mask = 0;
if (argc <= 1)
usage();
qemu_cache_utils_init(envp);
- /* init debug */
- cpu_set_log_filename(DEBUG_LOGFILE);
-
if ((envlist = envlist_create()) == NULL) {
(void) fprintf(stderr, "Unable to allocate envlist\n");
exit(1);
@@ -2562,23 +2562,23 @@ int main(int argc, char **argv, char **envp)
r++;
if (!strcmp(r, "-")) {
break;
+ } else if (!strcmp(r, "logfile")) {
+ debug_logfile = argv[optind++];
} else if (!strcmp(r, "d")) {
- int mask;
const CPULogItem *item;
if (optind >= argc)
break;
r = argv[optind++];
- mask = cpu_str_to_log_mask(r);
- if (!mask) {
+ log_mask = cpu_str_to_log_mask(r);
+ if (!log_mask) {
printf("Log items (comma separated):\n");
for(item = cpu_log_items; item->mask != 0; item++) {
printf("%-10s %s\n", item->name, item->help);
}
exit(1);
}
- cpu_set_log(mask);
} else if (!strcmp(r, "E")) {
r = argv[optind++];
if (envlist_setenv(envlist, r) != 0)
@@ -2648,6 +2648,12 @@ int main(int argc, char **argv, char **envp)
filename = argv[optind];
exec_path = argv[optind];
+ /* init debug */
+ if (log_mask) {
+ cpu_set_log_filename(debug_logfile);
+ cpu_set_log(log_mask);
+ }
+
/* Zero out regs */
memset(regs, 0, sizeof(struct target_pt_regs));
diff --git a/qemu-doc.texi b/qemu-doc.texi
index 7b8488f..cc7f322 100644
--- a/qemu-doc.texi
+++ b/qemu-doc.texi
@@ -2066,7 +2066,9 @@ Debug options:
@table @option
@item -d
-Activate log (logfile=/tmp/qemu.log)
+Activate log
+@item -logfile filename
+Set log file name to 'filename' (defaut /tmp/qemu.log)
@item -p pagesize
Act as if the host page size was 'pagesize' bytes
@item -g port
@@ -2188,7 +2190,9 @@ Debug options:
@table @option
@item -d
-Activate log (logfile=/tmp/qemu.log)
+Activate log
+@item -logfile filename
+Set log file name to 'filename' (defaut /tmp/qemu.log)
@item -p pagesize
Act as if the host page size was 'pagesize' bytes
@item -singlestep
@@ -2252,7 +2256,9 @@ Debug options:
@table @option
@item -d
-Activate log (logfile=/tmp/qemu.log)
+Activate log
+@item -logfile filename
+Set log file name to 'filename' (defaut /tmp/qemu.log)
@item -p pagesize
Act as if the host page size was 'pagesize' bytes
@item -singlestep
diff --git a/qemu-options.hx b/qemu-options.hx
index 8de71d6..97b21d3 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1648,10 +1648,17 @@ Shorthand for -gdb tcp::1234, i.e. open a
gdbserver on TCP port 1234
ETEXI
DEF("d", HAS_ARG, QEMU_OPTION_d, \
- "-d item1,... output log to %s (use -d ? for a list of log
items)\n")
+ "-d item1,... output log (use -d ? for a list of log items)\n")
STEXI
@item -d
-Output log in /tmp/qemu.log
+Output log
+ETEXI
+
+DEF("logfile", HAS_ARG, QEMU_OPTION_logfile, \
+ "-logfile filename\n Set log file name to 'filename'
(defaut %s)\n")
+STEXI
+@item -logfile
+Set log file name to 'filename' (defaut /tmp/qemu.log)
ETEXI
DEF("hdachs", HAS_ARG, QEMU_OPTION_hdachs, \
prev parent reply other threads:[~2010-07-05 15:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-29 8:46 [Qemu-devel] [PATCH] make qemu.log name unique Christophe LYON
2010-06-29 8:59 ` Kevin Wolf
2010-07-01 11:53 ` Christophe LYON
2010-07-01 13:18 ` Stefan Weil
2010-07-05 15:41 ` Christophe LYON [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C31FD3F.5040305@st.com \
--to=christophe.lyon@st.com \
--cc=qemu-devel@nongnu.org \
--cc=weil@mail.berlios.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.