From d3fe4f066f70bc8e4aef06b963444ecdbc3dd00f Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Wed, 18 Feb 2015 02:14:39 +0100 Subject: [PATCH] dbus: Print out 'serial' and 'serial reply to' with DBusMessage operator<<. The reply serial is displayed for method call returns and errors, while the serial is displayed for all message types. To see a message serial it is required to dump messages after sending, not before. Task-number: QTBUG-44490 Change-Id: I859f50d739ed059d5b2dfe1a2efdf04b906891a7 Reviewed-by: Thiago Macieira --- src/dbus/qdbusintegrator.cpp | 4 ++-- src/dbus/qdbusmessage.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index f6221d51b6..0c0109b6b6 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1819,8 +1819,8 @@ bool QDBusConnectionPrivate::send(const QDBusMessage& message) } q_dbus_message_set_no_reply(msg, true); // the reply would not be delivered to anything - qDBusDebug() << this << "sending message (no reply):" << message; emit messageNeedsSending(Q_NULLPTR, msg); + qDBusDebug() << this << "sending message (no reply):" << message; return true; } @@ -2019,8 +2019,8 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM lastError = error; processFinishedCall(pcall); } else { - qDBusDebug() << this << "sending message:" << message; emit messageNeedsSending(pcall, msg, timeout); + qDBusDebug() << this << "sending message:" << message; } return pcall; } diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp index e20c851d6c..078442f3f1 100644 --- a/src/dbus/qdbusmessage.cpp +++ b/src/dbus/qdbusmessage.cpp @@ -861,10 +861,16 @@ QDebug operator<<(QDebug dbg, const QDBusMessage &msg) msg.type() == QDBusMessage::SignalMessage) dbg.nospace() << ", path=" << msg.path() << ", interface=" << msg.interface() - << ", member=" << msg.member(); + << ", member=" << msg.member() + << ", serial=" << msg.serial(); if (msg.type() == QDBusMessage::ErrorMessage) dbg.nospace() << ", error name=" << msg.errorName() - << ", error message=" << msg.errorMessage(); + << ", error message=" << msg.errorMessage() + << ", serial=" << msg.serial() + << ", reply serial=" << msg.replySerial(); + else if (msg.type() == QDBusMessage::ReplyMessage) + dbg.nospace() << ", serial=" << msg.serial() + << ", reply serial=" << msg.replySerial(); dbg.nospace() << ", signature=" << msg.signature() << ", contents=("; debugVariantList(dbg, msg.arguments());