Author: mlytwyn
Date: Fri Feb 5 23:56:51 2016
New Revision: 39341
URL: http://svn.gna.org/viewcvs/gnustep?rev=39341&view=rev
Log:
More GPBS debugging code
Modified:
libs/base/branches/gnustep_testplant_branch/Source/NSMessagePort.m
libs/base/branches/gnustep_testplant_branch/Source/win32/NSMessagePort.m
Modified: libs/base/branches/gnustep_testplant_branch/Source/NSMessagePort.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSMessagePort.m?rev=39341&r1=39340&r2=39341&view=diff
==============================================================================
--- libs/base/branches/gnustep_testplant_branch/Source/NSMessagePort.m
(original)
+++ libs/base/branches/gnustep_testplant_branch/Source/NSMessagePort.m Fri Feb
5 23:56:51 2016
@@ -334,6 +334,11 @@
return AUTORELEASE(handle);
}
+#if defined(__MINGW__)
+typedef void (*PrintStackTracePtr)();
+static HANDLE BTHandle = NULL;
+#endif
+
+ (void) initialize
{
if (self == [GSMessageHandle class])
@@ -342,8 +347,34 @@
mutableDataClass = [NSMutableData class];
portMessageClass = [NSPortMessage class];
runLoopClass = [NSRunLoop class];
- }
-}
+
+#if defined(__MINGW__)
+ // Load backtrace library for mingw...
+ BTHandle = LoadLibraryA("Resources/backtrace.dll");
+ if (BTHandle == 0)
+ {
+ NSLog(@"%s:error loading mingw backtrace library - status: %d",
__PRETTY_FUNCTION__, GetLastError());
+ }
+ else
+ {
+ NSLog(@"%s:Windows/mingw backtrace library loaded successfully",
__PRETTY_FUNCTION__);
+ }
+#endif
+ }
+}
+
+
+#if defined(__MINGW__)
++ (void) printStackTrace
+{
+ if (BTHandle != NULL)
+ {
+ PrintStackTracePtr printStackTrace = GetProcAddress(BTHandle,
"backtracePrintStackTrace");
+ if (printStackTrace != NULL)
+ (*printStackTrace)();
+ }
+}
+#endif
- (BOOL) connectToPort: (NSMessagePort*)aPort beforeDate: (NSDate*)when
{
@@ -814,6 +845,9 @@
NSLog(@"%@ - unable to decode remote port", self);
M_UNLOCK(myLock);
[self invalidate];
+#if defined(__MINGW__)
+ [[self class] printStackTrace];
+#endif
return;
}
/*
Modified:
libs/base/branches/gnustep_testplant_branch/Source/win32/NSMessagePort.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/win32/NSMessagePort.m?rev=39341&r1=39340&r2=39341&view=diff
==============================================================================
--- libs/base/branches/gnustep_testplant_branch/Source/win32/NSMessagePort.m
(original)
+++ libs/base/branches/gnustep_testplant_branch/Source/win32/NSMessagePort.m
Fri Feb 5 23:56:51 2016
@@ -178,6 +178,12 @@
return result;
}
+
+#if defined(__MINGW__)
+typedef void (*PrintStackTracePtr)();
+static HANDLE BTHandle = NULL;
+#endif
+
+ (void) initialize
{
if (self == [NSMessagePort class])
@@ -191,8 +197,33 @@
security.nLength = sizeof(SECURITY_ATTRIBUTES);
security.lpSecurityDescriptor = 0; // Default
security.bInheritHandle = FALSE;
- }
-}
+
+#if defined(__MINGW__)
+ // Load backtrace library for mingw...
+ BTHandle = LoadLibraryA("Resources/backtrace.dll");
+ if (BTHandle == 0)
+ {
+ NSLog(@"%s:error loading mingw backtrace library - status: %d",
__PRETTY_FUNCTION__, GetLastError());
+ }
+ else
+ {
+ NSLog(@"%s:Windows/mingw backtrace library loaded successfully",
__PRETTY_FUNCTION__);
+ }
+#endif
+ }
+}
+
+#if defined(__MINGW__)
++ (void) printStackTrace
+{
+ if (BTHandle != NULL)
+ {
+ PrintStackTracePtr printStackTrace = GetProcAddress(BTHandle,
"backtracePrintStackTrace");
+ if (printStackTrace != NULL)
+ (*printStackTrace)();
+ }
+}
+#endif
+ (id) newWithName: (NSString*)name
{
@@ -644,6 +675,9 @@
if (rPort == nil)
{
NSLog(@"%@ - unable to decode remote port", self);
+#if defined(__MINGW__)
+ [[self class] printStackTrace];
+#endif
break;
}
rItems = [NSMutableArray alloc];
@@ -681,6 +715,9 @@
if (p == nil)
{
NSLog(@"%@ - unable to decode remote port", self);
+#if defined(__MINGW__)
+ [[self class] printStackTrace];
+#endif
break;
}
[rItems addObject: p];
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs