GDBus: Add `return' debug option

This prints all GDBusMethodInvocation API usage and is normally used
with the `incoming' option. Example:

 # G_DBUS_DEBUG=incoming,return ./polkitd --replace
 Entering main event loop
 Connected to the system bus
 Registering null backend at priority -10
 [...]
 Acquired the name org.freedesktop.PolicyKit1
 [...]

 ========================================================================
 GDBus-debug:Incoming:
  <<<< METHOD INVOCATION org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       invoked by name :1.26
       serial 299
 ========================================================================
 GDBus-debug:Return:
  >>>> METHOD ERROR org.freedesktop.PolicyKit1.Error.Failed
       message `Cannot determine session the caller is in'
       in response to org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       to name :1.26
       reply-serial 299

 [...]

 ========================================================================
 GDBus-debug:Incoming:
  <<<< METHOD INVOCATION org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       invoked by name :1.2402
       serial 25
 ========================================================================
 GDBus-debug:Return:
  >>>> METHOD RETURN
       in response to org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       to name :1.2402
       reply-serial 25

Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
David Zeuthen
2010-08-04 16:59:26 -04:00
parent 89a1b571ad
commit d52e1c33f7
5 changed files with 61 additions and 6 deletions

View File

@@ -1178,8 +1178,9 @@ _g_dbus_worker_flush_sync (GDBusWorker *worker,
#define G_DBUS_DEBUG_CALL (1<<3)
#define G_DBUS_DEBUG_SIGNAL (1<<4)
#define G_DBUS_DEBUG_INCOMING (1<<5)
#define G_DBUS_DEBUG_EMISSION (1<<6)
#define G_DBUS_DEBUG_ADDRESS (1<<7)
#define G_DBUS_DEBUG_RETURN (1<<6)
#define G_DBUS_DEBUG_EMISSION (1<<7)
#define G_DBUS_DEBUG_ADDRESS (1<<8)
static gint _gdbus_debug_flags = 0;
@@ -1225,6 +1226,13 @@ _g_dbus_debug_incoming (void)
return (_gdbus_debug_flags & G_DBUS_DEBUG_INCOMING) != 0;
}
gboolean
_g_dbus_debug_return (void)
{
_g_dbus_initialize ();
return (_gdbus_debug_flags & G_DBUS_DEBUG_RETURN) != 0;
}
gboolean
_g_dbus_debug_emission (void)
{
@@ -1283,6 +1291,7 @@ _g_dbus_initialize (void)
{ "call", G_DBUS_DEBUG_CALL },
{ "signal", G_DBUS_DEBUG_SIGNAL },
{ "incoming", G_DBUS_DEBUG_INCOMING },
{ "return", G_DBUS_DEBUG_RETURN },
{ "emission", G_DBUS_DEBUG_EMISSION },
{ "address", G_DBUS_DEBUG_ADDRESS }
};