Remote{Message|DrawingEngine}: Add some more debug output.

This commit is contained in:
Michael Lotz 2017-11-21 21:19:49 +01:00
parent 5fb27ee2c4
commit 4d9e21b824
2 changed files with 52 additions and 9 deletions

View File

@ -1011,19 +1011,40 @@ RemoteDrawingEngine::_DrawingEngineResult(void* cookie, RemoteMessage& message)
switch (message.Code()) {
case RP_DRAW_STRING_RESULT:
if (message.Read(engine->fDrawStringResult) != B_OK)
{
status_t result = message.Read(engine->fDrawStringResult);
if (result != B_OK) {
TRACE_ERROR("failed to read draw string result: %s\n",
strerror(result));
return false;
}
break;
}
case RP_STRING_WIDTH_RESULT:
if (message.Read(engine->fStringWidthResult) != B_OK)
{
status_t result = message.Read(engine->fStringWidthResult);
if (result != B_OK) {
TRACE_ERROR("failed to read string width result: %s\n",
strerror(result));
return false;
}
break;
}
case RP_READ_BITMAP_RESULT:
if (message.ReadBitmap(&engine->fReadBitmapResult) != B_OK)
{
status_t result = message.ReadBitmap(&engine->fReadBitmapResult);
if (result != B_OK) {
TRACE_ERROR("failed to read bitmap of read bitmap result: %s\n",
strerror(result));
return false;
}
break;
}
default:
return false;

View File

@ -28,27 +28,49 @@
#include <new>
#ifdef CLIENT_COMPILE
#define TRACE_ALWAYS(x...) printf("RemoteMessage: " x)
#else
#define TRACE_ALWAYS(x...) debug_printf("RemoteMessage: " x)
#endif
#define TRACE(x...) /*TRACE_ALWAYS(x)*/
#define TRACE_ERROR(x...) TRACE_ALWAYS(x)
status_t
RemoteMessage::NextMessage(uint16& code)
{
if (fDataLeft > 0) {
// discard remainder of message
int32 readSize = fSource->Read(NULL, fDataLeft);
if (readSize < 0)
if (readSize < 0) {
TRACE_ERROR("failed to read from source: %s\n", strerror(readSize));
return readSize;
}
}
static const uint32 kHeaderSize = sizeof(uint16) + sizeof(uint32);
fDataLeft = kHeaderSize;
Read(code);
uint32 dataLeft;
status_t result = Read(dataLeft);
if (result != B_OK)
status_t result = Read(code);
if (result != B_OK) {
TRACE_ERROR("failed to read message code: %s\n", strerror(result));
return result;
}
if (dataLeft < kHeaderSize)
uint32 dataLeft;
result = Read(dataLeft);
if (result != B_OK) {
TRACE_ERROR("failed to read message length: %s\n", strerror(result));
return result;
}
if (dataLeft < kHeaderSize) {
TRACE_ERROR("message claims %" B_PRIu32 " bytes, needed at least %"
B_PRIu32 " for the header\n", dataLeft, kHeaderSize);
return B_ERROR;
}
fDataLeft = dataLeft - kHeaderSize;
fCode = code;