bug-gnustep
[Top][All Lists]
Advanced

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

Re: tweak for gnustep-make to make which_lib work on Darwin


From: Lars Sonchocky-Helldorf
Subject: Re: tweak for gnustep-make to make which_lib work on Darwin
Date: Tue, 2 Jul 2002 01:26:02 +0200

Am Samstag den, 29. Juni 2002, um 13:23, schrieb Nicola Pero:


Since a debug version of libobj is not standard,

Yes - libobjc_d is normally only used when debugging the runtime itself
... it's recommended *not* to use it to debug user-level libraries and
applications (not even gnustep-base normally) ... because you want to do
without all the low-level details of the runtime internals when debuggin
your stuff.

But maybe Lars is precisely debugging the runtime (btw which one, Apple or
GNU ?) ?

We probably need more detailed explanations on what he's trying to do to
help him properly.

I am trying to debug gnustep-base on Darwin using the Apple/NeXT runtime.

For that purpose I have build a debug version of objc4 (this is the objc runtime), which is installed in /usr/lib/ (standard location) as libobjc_debug.A.dylib. Then I have symlinked it as libobjc_d.dylib in the same directory especially for GNUstep (the Apple convention would be libobjc_debug.dylib). I also have symlinked it as libobjc_d.dylib into /opt/GNUstep/System/Libraries/powerpc/darwin5 and /opt/GNUstep/System/Libraries/powerpc/darwin5/nx-gnu-gnu, but there the library is also not found during the build process of gnustep-base.

Why do I need to link gnustep-base against libobjc_d.dylib?
- I try to debug gnustep-base itself.
- When I do a backtrace it is more informative if I have gnustep-base linked against libobjc_d.dylib. - I have tweaked some methods in libobjc_d.dylib to get some information while runing programs (I tweaked _class_lookupMethodAndLoadCache() to show me which method got called and class_initialize() to show which class should get initialized). This comes in VERY handy.

My previous way to reach that goal (linking against libobjc_d.dylib) was just to brute force search and replace all occurrences of -lobjc with -lobjc_d in GNUstep. This is of course NOT the way to go.

This is how I build GNUstep:

tar -xf core.YYYYMMMDD.tar
cd core/make/
./configure --with-library-combo=nx-gnu-gnu --prefix=/opt/GNUstep
make debug=yes
sudo make install debug=yes
make distclean debug=yes
source /opt/GNUstep/System/Makefiles/GNUstep.csh
cd ../base
./configure
make library-combo=nx-gnu-gnu debug=yes
sudo make install debug=yes

This is the typical output of a debugging session (with gnustep-base linked against my libobjc_d):

(gdb) break [NSObject forward::]
Breakpoint 1 at 0x5feb64: file NSObject.m, line 939.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /Volumes/Data/Projekte/GNUstep-
Darwin/core/base/Examples/shared_debug_obj/powerpc/darwin5/nx-gnu-
gnu/dictionary
[Switching to process 700 thread 0x1907]
Temporarily disabling shared library breakpoints: 1
Re-enabling shared library breakpoints: 1
_class_lookupMethodAndLoadCache() Class: Protocol Method: _fixup:numElements:
class_initialize(): Protocol
class_initialize(): Object
_class_lookupMethodAndLoadCache() Class: Object Method: initialize
class_initialize(): Object
_class_lookupMethodAndLoadCache() Class: Protocol Method: initialize
class_initialize(): Protocol
_class_lookupMethodAndLoadCache() Class: NSAutoreleasePool Method: new
class_initialize(): NSAutoreleasePool
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSObject Method: initialize
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSObject Method: class
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSRecursiveLock Method: alloc
class_initialize(): NSRecursiveLock
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSRecursiveLock Method: initialize
class_initialize(): NSRecursiveLock
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSObject Method: class
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSRecursiveLock Method: allocWithZone:
_class_lookupMethodAndLoadCache() Class: NSRecursiveLock Method: init
_class_lookupMethodAndLoadCache() Class: NSObject Method: init
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSZombie Method: class
class_initialize(): NSZombie
_class_lookupMethodAndLoadCache() Class: NSZombie Method: initialize
class_initialize(): NSZombie
_class_lookupMethodAndLoadCache() Class: NSZombie Method: forward::
class_initialize(): NSZombie
[NSZombie forward::] aSel: initialize
_class_lookupMethodAndLoadCache() Class: NSString Method: stringWithCString:
class_initialize(): NSString
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSString Method: initialize
class_initialize(): NSString
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSString Method: class
class_initialize(): NSString
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSString Method: allocWithZone:
_class_lookupMethodAndLoadCache() Class: NSString Method: initWithCString:length: _class_lookupMethodAndLoadCache() Class: NSString Method: initWithCStringNoCopy:length:freeWhenDone:
_class_lookupMethodAndLoadCache() Class: NSString Method: zone
_class_lookupMethodAndLoadCache() Class: NSString Method: release
_class_lookupMethodAndLoadCache() Class: NSString Method: dealloc
_class_lookupMethodAndLoadCache() Class: NSString Method: zone
_class_lookupMethodAndLoadCache() Class: NSAutoreleasePool Method: new
class_initialize(): NSAutoreleasePool
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSAutoreleasePool Method: initialize
class_initialize(): NSAutoreleasePool
class_initialize(): NSObject
(((struct objc_class*)(self))->name): NSAutoreleasePool
((((struct objc_class*)(self))->isa)->name): NSAutoreleasePool
_class_lookupMethodAndLoadCache() Class: NSAutoreleasePool Method: methodForSelector:
class_initialize(): NSAutoreleasePool
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSAutoreleasePool Method: instanceMethodForSelector:
class_initialize(): NSAutoreleasePool
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSAutoreleasePool Method: forward::
class_initialize(): NSAutoreleasePool
class_initialize(): NSObject

Breakpoint 1, -[NSObject forward::] (self=0x6a5938, _cmd=0x117a98, aSel=0x13a248, argFrame=0xbfffe990) at NSObject.m:939
939             printf("[NSObject forward::] aSel: %s\n", aSel);
(gdb) cont
Continuing.
Current language:  auto; currently objective-c
[NSObject forward::] aSel: instanceMethodForSelector:
_class_lookupMethodAndLoadCache() Class: NSInvocation Method: alloc
class_initialize(): NSInvocation
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSInvocation Method: initialize
class_initialize(): NSInvocation
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSInvocation Method: class
class_initialize(): NSInvocation
class_initialize(): NSObject
_class_lookupMethodAndLoadCache() Class: NSInvocation Method: forward::

Breakpoint 1, -[NSObject forward::] (self=0x6a6178, _cmd=0x117a98, aSel=0x1179e8, argFrame=0xbfffe880) at NSObject.m:939
939             printf("[NSObject forward::] aSel: %s\n", aSel);
(gdb) step
[NSObject forward::] aSel: alloc
940 inv = AUTORELEASE([[NSInvocation alloc] initWithArgframe: argFrame
(gdb) step
Unable to determine target of Objective-C method call (ignoring):
Error accessing memory address 0x3: Invalid argument.

Breakpoint 1, -[NSObject forward::] (self=0x6a6178, _cmd=0x117a98, aSel=0x1179e8, argFrame=0xbfffe770) at NSObject.m:939
939             printf("[NSObject forward::] aSel: %s\n", aSel);
(gdb) bt
#0 -[NSObject forward::] (self=0x6a6178, _cmd=0x117a98, aSel=0x1179e8, argFrame=0xbfffe770) at NSObject.m:939
#1  0x001171c4 in _objc_msgForward ()
#2 0x005feb90 in -[NSObject forward::] (self=0x6a6178, _cmd=0x117a98, aSel=0x1179e8, argFrame=0xbfffe880) at NSObject.m:940
#3  0x001171c4 in _objc_msgForward ()
#4 0x005feb90 in -[NSObject forward::] (self=0x6a5938, _cmd=0x117a98, aSel=0x13a248, argFrame=0xbfffe990) at NSObject.m:940
#5  0x001171c4 in _objc_msgForward ()
#6 0x0058d530 in +[NSAutoreleasePool initialize] (self=0x6a5938, _cmd=0x1179fc) at NSAutoreleasePool.m:134
#7  0x0010ed88 in class_initialize (cls=0x6a5938) at runtime/objc-
class.m:2071
#8 0x0010efc0 in _class_lookupMethodAndLoadCache (cls=0x6a7e28, sel=0x1179f0) at runtime/objc-class.m:2144
#9  0x00116bbc in objc_msgSend ()
#10 0x005ea208 in NSLogv (format=0x6a1a94, args=0xbfffecdc "\000"...) at NSLog.m:124 #11 0x005ea208 in NSLogv (format=Cannot access memory at address 0xc24bc23d
) at NSLog.m:124
#12 0x005ea1b4 in NSLog (format=0x6a1a94) at NSLog.m:116
#13 0x005fd8c0 in GSLogZombie (o=0x6a63b8, sel=0x1179fc) at NSObject.m:120 #14 0x00600f6c in -[NSZombie forward::] (self=0x6a63b8, _cmd=0x117a98, aSel=0x1179fc, argFrame=0xbfffed98) at NSObject.m:1655
#15 0x001171c4 in _objc_msgForward ()
#16 0x0010ed88 in class_initialize (cls=0x6a63b8) at runtime/objc-
class.m:2071
#17 0x0010efc0 in _class_lookupMethodAndLoadCache (cls=0x6a88a8, sel=0x1179c8) at runtime/objc-class.m:2144
#18 0x00116bbc in objc_msgSend ()
#19 0x005fdfd4 in +[NSObject initialize] (self=0x6a6418, _cmd=0x1179fc) at NSObject.m:724 #20 0x005fdfd4 in +[NSObject initialize] (self=Cannot access memory at address 0xc24bc21d
) at NSObject.m:724
#21 0x0010ed88 in class_initialize (cls=0x6a6418) at runtime/objc-
class.m:2071
#22 0x0010ecac in class_initialize (cls=0x6a5938) at runtime/objc-
class.m:2045
#23 0x0010efc0 in _class_lookupMethodAndLoadCache (cls=0x6a7e28, sel=0x1179f0) at runtime/objc-class.m:2144
#24 0x00116bbc in objc_msgSend ()
#25 0x00613c40 in _gnu_process_args (argc=1, argv=0xbffff3bc, env=0xbffff3c4) at NSProcessInfo.m:171 #26 0x00613c40 in _gnu_process_args (argc=Cannot access memory at address 0xc24bc26d
) at NSProcessInfo.m:171
#27 0x00614200 in main (argc=1, argv=0xbffff3bc, env=0xbffff3c4) at NSProcessInfo.m:536
#28 0x000028f0 in _start ()
#29 0x00002720 in start ()
(gdb)

greetings and thanks for your help, Lars




reply via email to

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