discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stack trace information


From: Lloyd Dupont
Subject: Stack trace information
Date: Fri, 5 May 2006 14:05:24 +1000

Here you go, tested in GNUstep for GNUstep (hopefully to become part of GNUstep distribution).

So how it works?
[GSStackTrace currentStack]
will return the current stack trace (as an GSStackTrace instance encapsulating an array of GSFunctionInfo.
All these class implement meaningfull 'description' method for nice output.

GSStackTrace get its user friendly symbol definition from a list of GSBinaryFileInfo. By default it will load symbol for the current process and GNUstep's base & gui
(see private & static function 'GetStackModules()' for detail)
(I'm using the function 'objc_get_symbol_path' by the way)

If you use other bundle / dll / library you should load module symbol explictely with a call to:
[GSStackTrace loadModule:@"full path to the the binary library file"]

I suggest to modify GNUstep with these 2 modifications:

- NSObject.m :~126 (GSLogZombie)
add a stack trace display before / after the zombie output

- NSException: what about add a stack trace property / accessor which is initialize when the exception is created / raised? (as it is the case in Java & C#) (For now, as far as I'm, concern I have hacked [NSException raise] to print the stack, but it would be nicer to add this has a property / accessor of NSException IMHO)

Eventually StackTrace could even becomes a public GNUstep header...


Finally I should aknowledge Win Oudshoorn groundwork and API research which made all of that possible. He also provided me with some nice code to automatically load all dependency / dll but, unfortunately, Windows specific, so I dumped it....

And I should also thanks many of GNUstep people on the mailing list for help, suggestion and bug report!
(I had some problem with my 'dealloc' method).

Attachment: stack.tgz
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]