Minor ficup for nodebug build

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25610 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2007-11-25 16:45:03 +00:00
parent 635c255ed2
commit 92e3e46e54
2 changed files with 43 additions and 36 deletions

View file

@ -6,6 +6,7 @@
* Source/NSThread.m: Implement some new MacOS-5 stuff and add stubs
for stack size and thread cancellation.
* Source/NSException.m Implement ([NSThread+callStackReturnAddresses])
Restructure a little to avoid problems when building without debug.
2007-11-09 Adam Fedor <fedor@gnu.org>

View file

@ -41,41 +41,6 @@
typedef struct { @defs(NSThread) } *TInfo;
#if defined(__MINGW32__)
static NSString *
GSPrivateBaseAddress(void *addr, void **base)
{
return nil;
}
#else /* __MINGW32__ */
#ifndef GNU_SOURCE
#define GNU_SOURCE
#endif
#ifndef __USE_GNU
#define __USE_GNU
#endif
#include <dlfcn.h>
static NSString *
GSPrivateBaseAddress(void *addr, void **base)
{
#ifdef HAVE_DLADDR
Dl_info info;
if (!dladdr(addr, &info))
return nil;
*base = info.dli_fbase;
return [NSString stringWithUTF8String: info.dli_fname];
#else
return nil;
#endif
}
#endif /* __MINGW32__ */
/* This is the GNU name for the CTOR list */
@interface GSStackTrace : NSObject
@ -114,6 +79,45 @@ GSPrivateBaseAddress(void *addr, void **base)
#endif
#endif
#if defined(__MINGW32__)
#if defined(STACKSYMBOLS)
static NSString *
GSPrivateBaseAddress(void *addr, void **base)
{
return nil;
}
#endif /* STACKSYMBOLS */
#else /* __MINGW32__ */
#ifndef GNU_SOURCE
#define GNU_SOURCE
#endif
#ifndef __USE_GNU
#define __USE_GNU
#endif
#include <dlfcn.h>
#if defined(STACKSYMBOLS)
static NSString *
GSPrivateBaseAddress(void *addr, void **base)
{
#ifdef HAVE_DLADDR
Dl_info info;
if (!dladdr(addr, &info))
return nil;
*base = info.dli_fbase;
return [NSString stringWithUTF8String: info.dli_fname];
#else
return nil;
#endif
}
#endif /* STACKSYMBOLS */
#endif /* __MINGW32__ */
#if defined(STACKSYMBOLS)
// GSStackTrace inspired by FYStackTrace.m
@ -637,7 +641,7 @@ GSListModules()
{
void *address = NSReturnAddress(i);
[frames addObject: [NSString stringWithFormat: @"%p", address]];
[frames addObject: [NSValue valueWithPointer: address]];
}
#endif
@ -661,6 +665,7 @@ GSListModules()
+ (NSArray*) callStackReturnAddresses
{
NSMutableArray *frames = [[GSStackTrace currentStack] frames];
#if defined(STACKSYMBOLS)
unsigned count = [frames count];
while (count-- > 0)
@ -672,6 +677,7 @@ GSListModules()
[frames replaceObjectAtIndex: count
withObject: address];
}
#endif
return frames;
}
@end