I confused myself.
There was a bug.
Here is the corrected version which read both current process and gnustep-base.dll symbols.
And display your stack trace.


Problem is I would like to replace 'gnustep-base.dll' by a more multiplatform constant / invocation. One that could read 'gnustep-base.dll' on windows and 'gnustep-base.dylib' on MacOSX for example...

Any tips?

Attachment: stack.tgz
Description: Binary data

#import <Foundation/Foundation.h>
#include <bfd.h>

@interface GSFunctionInfo : NSObject
{
        void*    _address;
        NSString *_fileName;
        NSString *_functionName;
        int       _lineNo;
}
- initWithAddress:(void*)address file:(NSString*)file function:(NSString*)function line:(int)lineNo;

- (void*) address;
- (int) lineNumber;
- (NSString *) fileName;
- (NSString *) function;

@end


@interface GSBinaryFileInfo : NSObject
{
        NSString * _filename;
        bfd     *_abfd;
        asymbol **_symbols;
        long    _symbolCount;
}
// return info for an executable (.EXE or .DLL) // but not for any of its dependency (i.e. required DLL)
- initWithBinaryFile: (NSString *)filename;
- init; // return info for the current executing process

- (NSString *) filename;

- (GSFunctionInfo *) functionForAddress: (void*) address;

@end


@interface GSStackTrace : NSObject
{
        NSMutableArray *frames;
}
// initialize stack trace info
+ (void) loadModule:(NSString *)filename;

// query the stack
+ (GSStackTrace*) currentStack;

- (unsigned) frameCount;
- (GSFunctionInfo*) frameAt:(unsigned) index;

- (NSString*) description;

- (NSEnumerator*) enumerator;
- (NSEnumerator*) reverseEnumerator;

@end

Attachment: StackTrace.m
Description: Binary data

_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to