diff --git a/headers/private/kernel/tracing_config.h b/headers/private/kernel/tracing_config.h index c54df839a8..eab4a86c18 100644 --- a/headers/private/kernel/tracing_config.h +++ b/headers/private/kernel/tracing_config.h @@ -10,7 +10,7 @@ // tracing buffer size (in bytes) #ifndef MAX_TRACE_SIZE -# define MAX_TRACE_SIZE 1024 * 1024 +# define MAX_TRACE_SIZE (1024 * 1024) #endif @@ -20,5 +20,6 @@ //#define SIGNAL_TRACING //#define SYSCALL_TRACING //#define TEAM_TRACING +//#define BMESSAGE_TRACING #endif // KERNEL_TRACING_CONFIG_H diff --git a/src/kits/app/Message.cpp b/src/kits/app/Message.cpp index 137aa69f14..8f04394afa 100644 --- a/src/kits/app/Message.cpp +++ b/src/kits/app/Message.cpp @@ -32,11 +32,20 @@ #include #include +#include + // kernel tracing configuration #define DEBUG_FUNCTION_ENTER //debug_printf("thread: 0x%x; this: 0x%08x; header: 0x%08x; fields: 0x%08x; data: 0x%08x; line: %04ld; func: %s\n", find_thread(NULL), this, fHeader, fFields, fData, __LINE__, __PRETTY_FUNCTION__); #define DEBUG_FUNCTION_ENTER2 //debug_printf("thread: 0x%x; line: %04ld: func: %s\n", find_thread(NULL), __LINE__, __PRETTY_FUNCTION__); +#ifdef BMESSAGE_TRACING +# define KTRACE(format...) ktrace_printf(format) +#else +# define KTRACE(format...) +#endif + + const char *B_SPECIFIER_ENTRY = "specifiers"; const char *B_PROPERTY_ENTRY = "property"; const char *B_PROPERTY_NAME_ENTRY = "name"; @@ -1911,6 +1920,10 @@ BMessage::_SendMessage(port_id port, team_id portOwner, int32 token, header->flags |= MESSAGE_FLAG_WAS_DELIVERED; if (direct != NULL) { + KTRACE("BMessage send direct: port: %ld, token: %ld, " + "message: '%c%c%c%c'", port, token, + char(what >> 24), char(what >> 16), char(what >> 8), (char)what); + // this is a local message transmission direct->AddMessage(copy); @@ -1921,6 +1934,10 @@ BMessage::_SendMessage(port_id port, team_id portOwner, int32 token, direct->Release(); } else { + KTRACE("BMessage send remote: team: %ld, port: %ld, token: %ld, " + "message: '%c%c%c%c'", portOwner, port, token, + char(what >> 24), char(what >> 16), char(what >> 8), (char)what); + do { result = write_port_etc(port, kPortMessageCode, (void *)buffer, size, B_RELATIVE_TIMEOUT, timeout);