From ee79d65b5b4256d539b0f7e2eb35e2ccb45d317e Mon Sep 17 00:00:00 2001 From: rfm Date: Thu, 27 Nov 2008 15:01:19 +0000 Subject: [PATCH] Add some debug git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27152 72102866-910b-0410-8b05-ffd578937521 --- Tools/gdnc.m | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Tools/gdnc.m b/Tools/gdnc.m index b01c310f6..8c9c5ec90 100644 --- a/Tools/gdnc.m +++ b/Tools/gdnc.m @@ -39,6 +39,7 @@ #define NSIG 32 #endif +static BOOL debugging = NO; static BOOL is_daemon = NO; /* Currently running as daemon. */ static BOOL auto_stop = NO; /* Should we shut down when unused? */ static char ebuf[2048]; @@ -197,6 +198,11 @@ ihandler(int sig) RELEASE(info); [super dealloc]; } +- (NSString*) description +{ + return [NSString stringWithFormat: @"%@ Name:'%@' Object:'%@' Info:'%@'", + [super description], name, object, info]; +} + (GDNCNotification*) notificationWithName: (NSString*)notificationName object: (NSString*)notificationObject data: (NSData*)notificationData @@ -524,6 +530,10 @@ ihandler(int sig) GDNCObserver *obs; NSConnection *connection; + if (debugging) + NSLog(@"Adding observer %lu for %@ %@", + anObserver, notificationName, anObject); + connection = [(NSDistantObject*)client connectionForProxy]; clients = (NSMapTable*)NSMapGet(connections, connection); if (clients == 0) @@ -803,6 +813,8 @@ ihandler(int sig) NS_DURING { [obs->queue removeObjectAtIndex: 0]; + if (debugging) + NSLog(@"Posting to observer %lu with %@", obs->observer, n); [obs->client->client postNotificationName: n->name object: n->object userInfo: n->info @@ -822,6 +834,11 @@ ihandler(int sig) - (void) removeObserver: (GDNCObserver*)observer { + if (debugging) + NSLog(@"Removing observer %lu for %@ %@", + observer->observer, observer->notificationName, + observer->notificationObject); + if (observer->notificationObject) { NSMutableArray *objList; @@ -1048,7 +1065,6 @@ main(int argc, char** argv, char** env) { GDNCServer *server; BOOL subtask = YES; - BOOL debugging = NO; NSProcessInfo *pInfo; NSMutableArray *args; CREATE_AUTORELEASE_POOL(pool);