* [Qemu-devel] [PATCH] trace: Support trace events with no arguments
@ 2010-06-29 13:08 Stefan Hajnoczi
0 siblings, 0 replies; only message in thread
From: Stefan Hajnoczi @ 2010-06-29 13:08 UTC (permalink / raw)
To: qemu-devel; +Cc: Stefan Hajnoczi, Prerna Saxena
Trace events with no arguments are not parsed correctly. For example:
foo(void) ""
This patch fixes the trace-events parsing code and simple trace backend.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
This patch applies against the tracing branch:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/tracing
simpletrace.c | 4 ++++
tracetool | 24 +++++++++++++++++++-----
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/simpletrace.c b/simpletrace.c
index 2d65114..5c327af 100644
--- a/simpletrace.c
+++ b/simpletrace.c
@@ -55,6 +55,10 @@ static void trace(TraceEventID event, unsigned long x1,
}
}
+void trace0(TraceEventID event) {
+ trace(event, 0, 0, 0, 0, 0);
+}
+
void trace1(TraceEventID event, unsigned long x1) {
trace(event, x1, 0, 0, 0, 0);
}
diff --git a/tracetool b/tracetool
index c77280d..9ce8e74 100755
--- a/tracetool
+++ b/tracetool
@@ -39,8 +39,11 @@ get_args()
# Get the argument name list of a trace event
get_argnames()
{
- local first field name
+ local nfields field name
+ nfields=0
for field in $(get_args "$1"); do
+ nfields=$((nfields + 1))
+
# Drop pointer star
field=${field#\*}
@@ -50,7 +53,12 @@ get_argnames()
echo -n "$name, "
done
- echo -n "$name"
+
+ # Last argument name
+ if [ "$nfields" -gt 1 ]
+ then
+ echo -n "$name"
+ fi
}
# Get the number of arguments to a trace event
@@ -125,6 +133,7 @@ typedef struct {
bool state;
} TraceEvent;
+void trace0(TraceEventID event);
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);
@@ -148,15 +157,20 @@ cast_args_to_ulong()
linetoh_simple()
{
- local name args argc ulong_args
+ local name args argc trace_args
name=$(get_name "$1")
args=$(get_args "$1")
argc=$(get_argc "$1")
- ulong_args=$(cast_args_to_ulong "$1")
+
+ trace_args="$simple_event_num"
+ if [ "$argc" -gt 0 ]
+ then
+ trace_args="$trace_args, $(cast_args_to_ulong "$1")"
+ fi
cat <<EOF
static inline void trace_$name($args) {
- trace$argc($simple_event_num, $ulong_args);
+ trace$argc($trace_args);
}
EOF
--
1.7.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-06-29 13:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-29 13:08 [Qemu-devel] [PATCH] trace: Support trace events with no arguments Stefan Hajnoczi
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).