aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorzheng siyao <[email protected]>2012-05-09 19:55:56 +0800
committerHenrik Nord <[email protected]>2012-05-11 11:19:56 +0200
commitd032e097cac47bc0f6e6cf0df86b778e0ae16f94 (patch)
tree08ed7f93ecef135b329345eb85f070da74598431 /erts/emulator/beam
parent04745e3fbb5fe194bc7561f96300d821e7f9e2aa (diff)
downloadotp-d032e097cac47bc0f6e6cf0df86b778e0ae16f94.tar.gz
otp-d032e097cac47bc0f6e6cf0df86b778e0ae16f94.tar.bz2
otp-d032e097cac47bc0f6e6cf0df86b778e0ae16f94.zip
DTrace bug in message-send
dtrace doesn't print sender pid and receiver pid in message related probe correctly, it truncates pid string to 7 characters on 64bit platform(or 3 characters on 32bit platform). The dtrace related code did not set the string length correctly, it sets the string length to the length of a pointer rather than the buffer length.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/dtrace-wrapper.h2
-rw-r--r--erts/emulator/beam/erl_message.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/erts/emulator/beam/dtrace-wrapper.h b/erts/emulator/beam/dtrace-wrapper.h
index 1aeb7f9221..6ec0c91e21 100644
--- a/erts/emulator/beam/dtrace-wrapper.h
+++ b/erts/emulator/beam/dtrace-wrapper.h
@@ -42,6 +42,8 @@
#define DTRACE_CHARBUF(name, size) \
char name##_BUFFER[size], *name = name##_BUFFER
+#define DTRACE_CHARBUF_NAME(name) name##_BUFFER
+
#if defined(USE_DYNAMIC_TRACE) && defined(USE_VM_PROBES)
#include "erlang_dtrace.h"
diff --git a/erts/emulator/beam/erl_message.c b/erts/emulator/beam/erl_message.c
index bd86e3ea9e..cb3db6a564 100644
--- a/erts/emulator/beam/erl_message.c
+++ b/erts/emulator/beam/erl_message.c
@@ -905,8 +905,8 @@ erts_send_message(Process* sender,
#ifdef USE_VM_PROBES
*sender_name = *receiver_name = '\0';
if (DTRACE_ENABLED(message_send)) {
- erts_snprintf(sender_name, sizeof(sender_name), "%T", sender->id);
- erts_snprintf(receiver_name, sizeof(receiver_name), "%T", receiver->id);
+ erts_snprintf(sender_name, sizeof(DTRACE_CHARBUF_NAME(sender_name)), "%T", sender->id);
+ erts_snprintf(receiver_name, sizeof(DTRACE_CHARBUF_NAME(receiver_name)), "%T", receiver->id);
}
#endif
if (SEQ_TRACE_TOKEN(sender) != NIL && !(flags & ERTS_SND_FLG_NO_SEQ_TRACE)) {