From patchwork Thu Oct 29 20:44:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 538037 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D4B65141345 for ; Fri, 30 Oct 2015 07:50:44 +1100 (AEDT) Received: from localhost ([::1]:46641 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zru9j-0007EH-1I for incoming@patchwork.ozlabs.org; Thu, 29 Oct 2015 16:50:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zru3m-0005YF-5M for qemu-devel@nongnu.org; Thu, 29 Oct 2015 16:44:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zru3l-0001Jg-97 for qemu-devel@nongnu.org; Thu, 29 Oct 2015 16:44:34 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:10737 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zru3k-0001JV-Mn for qemu-devel@nongnu.org; Thu, 29 Oct 2015 16:44:33 -0400 Received: from hades.sw.ru ([10.30.8.132]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id t9TKiIBB018999; Thu, 29 Oct 2015 23:44:31 +0300 (MSK) From: "Denis V. Lunev" To: Date: Thu, 29 Oct 2015 23:44:17 +0300 Message-Id: <1446151457-21157-12-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1446151457-21157-1-git-send-email-den@openvz.org> References: <1446151457-21157-1-git-send-email-den@openvz.org> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x X-Received-From: 195.214.232.25 Cc: Paolo Bonzini , qemu-devel@nongnu.org, "Denis V. Lunev" Subject: [Qemu-devel] [PATCH 11/11] log: add "-d trace:PATTERN" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Paolo Bonzini This is a bit easier to use than "-trace" if you are also enabling other kinds of logging. It is also more discoverable for experienced QEMU users, and accessible from user-mode emulators. Signed-off-by: Paolo Bonzini Signed-off-by: Denis V. Lunev Acked-by: Christian Borntraeger --- util/log.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/util/log.c b/util/log.c index 5c641a0..2bcef95 100644 --- a/util/log.c +++ b/util/log.c @@ -19,6 +19,7 @@ #include "qemu-common.h" #include "qemu/log.h" +#include "trace/control.h" static char *logfilename; FILE *qemu_logfile; @@ -154,6 +155,11 @@ int qemu_str_to_log_mask(const char *str) for (item = qemu_log_items; item->mask != 0; item++) { mask |= item->mask; } +#ifdef CONFIG_TRACE_LOG + } else if (strncmp(p, "trace:", 6) == 0 && p + 6 != p1) { + trace_enable_events(p + 6); + mask |= LOG_TRACE; +#endif } else { for (item = qemu_log_items; item->mask != 0; item++) { if (cmp1(p, p1 - p, item->name)) { @@ -161,9 +167,9 @@ int qemu_str_to_log_mask(const char *str) } } return 0; + found: + mask |= item->mask; } - found: - mask |= item->mask; if (*p1 != ',') { break; } @@ -177,6 +183,10 @@ void qemu_print_log_usage(FILE *f) const QEMULogItem *item; fprintf(f, "Log items (comma separated):\n"); for (item = qemu_log_items; item->mask != 0; item++) { - fprintf(f, "%-10s %s\n", item->name, item->help); + fprintf(f, "%-15s %s\n", item->name, item->help); } +#ifdef CONFIG_TRACE_LOG + fprintf(f, "trace:PATTERN enable trace events\n"); + fprintf(f, "\nUse \"-d trace:help\" to get a list of trace events.\n\n"); +#endif }