From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
Prerna Saxena <prerna@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH] trace: Support trace events with no arguments
Date: Tue, 29 Jun 2010 14:08:24 +0100 [thread overview]
Message-ID: <1277816904-32614-1-git-send-email-stefanha@linux.vnet.ibm.com> (raw)
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
reply other threads:[~2010-06-29 13:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1277816904-32614-1-git-send-email-stefanha@linux.vnet.ibm.com \
--to=stefanha@linux.vnet.ibm.com \
--cc=prerna@linux.vnet.ibm.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).