From patchwork Wed Jun 30 15:41:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prerna Saxena X-Patchwork-Id: 57425 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 468B1B6F07 for ; Thu, 1 Jul 2010 01:42:50 +1000 (EST) Received: from localhost ([127.0.0.1]:39719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OTzR1-000546-3b for incoming@patchwork.ozlabs.org; Wed, 30 Jun 2010 11:42:47 -0400 Received: from [140.186.70.92] (port=60111 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OTzQM-00053z-Mg for qemu-devel@nongnu.org; Wed, 30 Jun 2010 11:42:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OTzQH-00008h-DV for qemu-devel@nongnu.org; Wed, 30 Jun 2010 11:42:06 -0400 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:56916) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OTzQG-00008H-Oy for qemu-devel@nongnu.org; Wed, 30 Jun 2010 11:42:01 -0400 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by e28smtp03.in.ibm.com (8.14.4/8.13.1) with ESMTP id o5UFfoW8030395 for ; Wed, 30 Jun 2010 21:11:50 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o5UFfn7x4423730 for ; Wed, 30 Jun 2010 21:11:50 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o5UFfnIY011200 for ; Thu, 1 Jul 2010 01:41:49 +1000 Received: from zephyr ([9.77.126.213]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o5UFfmvj011196; Thu, 1 Jul 2010 01:41:49 +1000 Date: Wed, 30 Jun 2010 21:11:45 +0530 From: Prerna Saxena To: qemu-devel Message-ID: <20100630211145.41631855@zephyr> Organization: IBM X-Mailer: Claws Mail 3.7.5 (GTK+ 2.16.6; i586-redhat-linux-gnu) Mime-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Maneesh Soni , Ananth Narayan , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH][Tracing] Fix build errors for target i386-linux-user X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org [PATCH 1/1] Move definitions of monitor command handlers (do_info_trace, do_info_all_trace_events) to monitor.c. This removes build errors for user targets such as i386-linux-user, which are not linked with monitor. The export of trace_buf and trace_idx is an unfortunate side effect, since these are needed by do_info_trace which dumps buffer contents. Signed-off-by: Prerna Saxena --- monitor.c | 21 +++++++++++++++++++++ simpletrace.c | 39 ++------------------------------------- tracetool | 16 ++++++++++++++++ 3 files changed, 39 insertions(+), 37 deletions(-) diff --git a/monitor.c b/monitor.c index 433a3ec..9b5d65a 100644 --- a/monitor.c +++ b/monitor.c @@ -540,6 +540,27 @@ static void do_change_trace_event_state(Monitor *mon, const QDict *qdict) bool new_state = qdict_get_bool(qdict, "option"); change_trace_event_state(tp_name, new_state); } + +void do_info_trace(Monitor *mon) +{ + unsigned int i; + + for (i = 0; i < trace_idx ; i++) { + monitor_printf(mon, "Event %lu : %lx %lx %lx %lx %lx\n", + trace_buf[i].event, trace_buf[i].x1, trace_buf[i].x2, + trace_buf[i].x3, trace_buf[i].x4, trace_buf[i].x5); + } +} + +void do_info_all_trace_events(Monitor *mon) +{ + unsigned int i; + + for (i = 0; i < NR_TRACE_EVENTS; i++) { + monitor_printf(mon, "%s [Event ID %u] : state %u\n", + trace_list[i].tp_name, i, trace_list[i].state); + } +} #endif static void user_monitor_complete(void *opaque, QObject *ret_data) diff --git a/simpletrace.c b/simpletrace.c index 57c41fc..834b4c1 100644 --- a/simpletrace.c +++ b/simpletrace.c @@ -1,23 +1,9 @@ #include #include -#include "monitor.h" #include "trace.h" -typedef struct { - unsigned long event; - unsigned long x1; - unsigned long x2; - unsigned long x3; - unsigned long x4; - unsigned long x5; -} TraceRecord; - -enum { - TRACE_BUF_LEN = 64 * 1024 / sizeof(TraceRecord), -}; - -static TraceRecord trace_buf[TRACE_BUF_LEN]; -static unsigned int trace_idx; +TraceRecord trace_buf[TRACE_BUF_LEN]; +unsigned int trace_idx; static FILE *trace_fp; static void trace(TraceEventID event, unsigned long x1, @@ -69,27 +55,6 @@ void trace5(TraceEventID event, unsigned long x1, unsigned long x2, unsigned lon trace(event, x1, x2, x3, x4, x5); } -void do_info_trace(Monitor *mon) -{ - unsigned int i; - - for (i = 0; i < trace_idx ; i++) { - monitor_printf(mon, "Event %lu : %lx %lx %lx %lx %lx\n", - trace_buf[i].event, trace_buf[i].x1, trace_buf[i].x2, - trace_buf[i].x3, trace_buf[i].x4, trace_buf[i].x5); - } -} - -void do_info_all_trace_events(Monitor *mon) -{ - unsigned int i; - - for (i = 0; i < NR_TRACE_EVENTS; i++) { - monitor_printf(mon, "%s [Event ID %u] : state %u\n", - trace_list[i].tp_name, i, trace_list[i].state); - } -} - static TraceEvent* find_trace_event_by_name(const char *tname) { unsigned int i; diff --git a/tracetool b/tracetool index c77280d..c7a690d 100755 --- a/tracetool +++ b/tracetool @@ -125,6 +125,22 @@ typedef struct { bool state; } TraceEvent; +typedef struct { + unsigned long event; + unsigned long x1; + unsigned long x2; + unsigned long x3; + unsigned long x4; + unsigned long x5; +} TraceRecord; + +enum { + TRACE_BUF_LEN = 64 * 1024 / sizeof(TraceRecord), +}; + +extern TraceRecord trace_buf[TRACE_BUF_LEN]; +extern unsigned int trace_idx; + void trace1(TraceEventID event, unsigned long x1); void trace2(TraceEventID event, unsigned long x1, unsigned long x2); void trace3(TraceEventID event, unsigned long x1, unsigned long x2, unsigned long x3);