qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christophe LYON <christophe.lyon@st.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] make qemu.log name unique
Date: Thu, 1 Jul 2010 13:53:49 +0200	[thread overview]
Message-ID: <4C2C81CD.3010504@st.com> (raw)
In-Reply-To: <4C29B5FE.3030700@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 313 bytes --]


> Maybe adding a -logfile option would allow what you're trying to achieve
> without affecting other use cases? I've always thought that it's strange
> that you can only change the logfile location in the monitor and not on
> the command line.
>
> Kevin
>

Here is patch that does what you suggest.

Christophe.

[-- Attachment #2: qemu.logfile.patch --]
[-- Type: text/x-patch, Size: 2807 bytes --]

 linux-user/main.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/linux-user/main.c b/linux-user/main.c
index a6af2a5..8d1db46 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,7 +2455,8 @@ static void usage(void)
 #endif
            "\n"
            "Debug options:\n"
-           "-d options   activate log (logfile=%s)\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"
@@ -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));
 

  reply	other threads:[~2010-07-01 11:54 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 [this message]
2010-07-01 13:18     ` Stefan Weil
2010-07-05 15:41       ` Christophe LYON

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=4C2C81CD.3010504@st.com \
    --to=christophe.lyon@st.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).