summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2010-02-26 09:32:15 +0000
committerSimon Marlow <marlowsd@gmail.com>2010-02-26 09:32:15 +0000
commit91bfa780ddd229cff6c3d86a8f05e3898ef65e53 (patch)
tree97d9e42d73089f9b7a8aadfc3435a45b97d61227 /rts
parentb1b95df69d97f279018b08d9e7c672318055bac4 (diff)
downloadhaskell-91bfa780ddd229cff6c3d86a8f05e3898ef65e53.tar.gz
Fix crash when using printf format specifiers in traceEvent (#3874)
Diffstat (limited to 'rts')
-rw-r--r--rts/Trace.c14
-rw-r--r--rts/eventlog/EventLog.c4
-rw-r--r--rts/eventlog/EventLog.h2
3 files changed, 14 insertions, 6 deletions
diff --git a/rts/Trace.c b/rts/Trace.c
index a1da9911a7..c8a0285837 100644
--- a/rts/Trace.c
+++ b/rts/Trace.c
@@ -299,21 +299,29 @@ void trace_(char *msg, ...)
va_end(ap);
}
-void traceUserMsg(Capability *cap, char *msg)
+static void traceFormatUserMsg(Capability *cap, char *msg, ...)
{
+ va_list ap;
+ va_start(ap,msg);
+
#ifdef DEBUG
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
- traceCap_stderr(cap, msg, NULL);
+ traceCap_stderr(cap, msg, ap);
} else
#endif
{
if (eventlog_enabled) {
- postUserMsg(cap, msg);
+ postUserMsg(cap, msg, ap);
}
}
dtraceUserMsg(cap->no, msg);
}
+void traceUserMsg(Capability *cap, char *msg)
+{
+ traceFormatUserMsg(cap, "%s", msg);
+}
+
void traceThreadStatus_ (StgTSO *tso USED_IF_DEBUG)
{
#ifdef DEBUG
diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c
index ede1615139..7026a2abaf 100644
--- a/rts/eventlog/EventLog.c
+++ b/rts/eventlog/EventLog.c
@@ -448,9 +448,9 @@ void postCapMsg(Capability *cap, char *msg, va_list ap)
postLogMsg(&capEventBuf[cap->no], EVENT_LOG_MSG, msg, ap);
}
-void postUserMsg(Capability *cap, char *msg)
+void postUserMsg(Capability *cap, char *msg, va_list ap)
{
- postLogMsg(&capEventBuf[cap->no], EVENT_USER_MSG, msg, NULL);
+ postLogMsg(&capEventBuf[cap->no], EVENT_USER_MSG, msg, ap);
}
void closeBlockMarker (EventsBuf *ebuf)
diff --git a/rts/eventlog/EventLog.h b/rts/eventlog/EventLog.h
index e2b8043f7e..fd87820e08 100644
--- a/rts/eventlog/EventLog.h
+++ b/rts/eventlog/EventLog.h
@@ -39,7 +39,7 @@ void postEvent(Capability *cap, EventTypeNum tag);
void postMsg(char *msg, va_list ap);
-void postUserMsg(Capability *cap, char *msg);
+void postUserMsg(Capability *cap, char *msg, va_list ap);
void postCapMsg(Capability *cap, char *msg, va_list ap);