diff --git a/Source/NSGraphicsContext.m b/Source/NSGraphicsContext.m
index d593565..c624091 100644
--- a/Source/NSGraphicsContext.m
+++ b/Source/NSGraphicsContext.m
@@ -55,6 +55,56 @@
 #import "GNUstepGUI/GSVersion.h"
 #import "GNUstepGUI/GSDisplayServer.h"
 
+#import <objc/runtime.h>
+#import "../../libobjc2/ivar.h"
+static void printNSThreadOffsets_GUI(void)
+{
+    static BOOL printed = NO;
+    struct objc_ivar_list *ivarList;
+    int ivarIndex;
+    NSThread *thread = GSCurrentThread();
+
+    if (printed)
+        return;
+
+    printed = YES;
+
+    ivarList = (struct objc_ivar_list *) class_getIvarLayout([NSThread class]);
+
+    if (!ivarList)
+        return;
+
+    printf("\nGUI:\n");
+    printf(" class_getIvarLayout([NSThread class])\n");
+
+    for (ivarIndex=0; ivarIndex<ivarList->count; ivarIndex++)
+    {
+        printf("   %s : %d\n", ivarList->ivar_list[ivarIndex].name, 
+                ivarList->ivar_list[ivarIndex].offset);
+    }
+
+    printf("\n");
+
+    if (!thread)
+        return;
+
+    printf(" Current thread from GSCurrentThread(): %p\n", thread);
+    printf("   thread->_target: %p (%ld)\n", &thread->_target, (long) &thread->_target - (long) thread); 
+    printf("   thread->_arg: %p (%ld)\n", &thread->_arg, (long) &thread->_arg - (long) thread); 
+    printf("   thread->_selector: %p (%ld)\n", &thread->_selector, (long) &thread->_selector - (long) thread); 
+    printf("   thread->_name: %p (%ld)\n", &thread->_name, (long) &thread->_name - (long) thread); 
+    printf("   thread->_stackSize: %p (%ld)\n", &thread->_stackSize, (long) &thread->_stackSize - (long) thread); 
+    printf("   thread->_cancelled: %p (%ld)\n", &thread->_cancelled, (long) &thread->_cancelled - (long) thread); 
+    printf("   thread->_active: %p (%ld)\n", &thread->_active, (long) &thread->_active - (long) thread); 
+    printf("   thread->_finished: %p (%ld)\n", &thread->_finished, (long) &thread->_finished - (long) thread); 
+    printf("   thread->_exception_handler: %p (%ld)\n", &thread->_exception_handler, (long) &thread->_exception_handler - (long) thread); 
+    printf("   thread->_thread_dictionary: %p (%ld)\n", &thread->_thread_dictionary, (long) &thread->_thread_dictionary - (long) thread); 
+    printf("   thread->_autorelease_vars: %p (%ld)\n", &thread->_autorelease_vars, (long) &thread->_autorelease_vars - (long) thread); 
+    printf("   thread->_gcontext: %p (%ld)\n", &thread->_gcontext, (long) &thread->_gcontext - (long) thread); 
+    printf("   thread->_runLoopInfo: %p (%ld)\n", &thread->_runLoopInfo, (long) &thread->_runLoopInfo - (long) thread); 
+    printf("\n");
+}
+
 /* The memory zone where all global objects are allocated from (Contexts
    are also allocated from this zone) */
 static NSZone *_globalGSZone = NULL;
@@ -166,6 +216,8 @@ NSGraphicsContext	*GSCurrentContext(void)
  */
   NSThread *th = GSCurrentThread();
 
+printNSThreadOffsets_GUI();
+
   ASSIGN(th->_gcontext, context);
 #else
   NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
