qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH][Tracing] Fix build errors for target i386-linux-user
@ 2010-06-30 15:41 Prerna Saxena
  2010-07-01  9:18 ` [Qemu-devel] " Stefan Hajnoczi
  0 siblings, 1 reply; 14+ messages in thread
From: Prerna Saxena @ 2010-06-30 15:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Maneesh Soni, Ananth Narayan, Stefan Hajnoczi

[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 <prerna@linux.vnet.ibm.com>
---
 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 <stdlib.h>
 #include <stdio.h>
-#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);
-- 
1.6.2.5



-- 
Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-07-12  9:39 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-30 15:41 [Qemu-devel] [PATCH][Tracing] Fix build errors for target i386-linux-user Prerna Saxena
2010-07-01  9:18 ` [Qemu-devel] " Stefan Hajnoczi
2010-07-06  8:04   ` [Qemu-devel] [RFC v2][PATCH][Tracing] " Prerna Saxena
2010-07-06 10:10     ` [Qemu-devel] " Stefan Hajnoczi
2010-07-08  5:28       ` [Qemu-devel] [RFC v3][PATCH][Tracing] " Prerna Saxena
2010-07-08  9:20         ` [Qemu-devel] " Stefan Hajnoczi
2010-07-08 11:20           ` Prerna Saxena
2010-07-08 13:34             ` Stefan Hajnoczi
2010-07-09 11:30               ` [Qemu-devel] [RFC v4][PATCH][Tracing] " Prerna Saxena
2010-07-09 11:43                 ` Stefan Hajnoczi
2010-07-12  4:55                   ` [Qemu-devel] [RFC v5[PATCH][Tracing] " Prerna Saxena
2010-07-12  9:16                     ` [Qemu-devel] [PATCH] trace: Remove monitor.h dependency from simpletrace Stefan Hajnoczi
2010-07-12  9:39                       ` Stefan Hajnoczi
2010-07-09 11:35               ` [Qemu-devel] Re: [RFC v3][PATCH][Tracing] Fix build errors for target i386-linux-user Prerna Saxena

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).