Re: debugging
Re: debugging
- Subject: Re: debugging
- From: Shawn Erickson <email@hidden>
- Date: Wed, 18 Oct 2006 08:47:52 -0700
On Oct 18, 2006, at 2:01 AM, Camille GOUREAU-SUIGNARD wrote:
Hi,
I've got a debugging problem
the debugger stop in this configuration:
Thread:
#0 0xfffeff20 in objc_msgSend_rtp
0xfffeff20 <+0032> lwz r11,0(r2)
And I don't know what to do with that.
I'm sure that the error lies in my code, off course ;)
but I can't locate it.
The project was designed under xCode 1.5 for X.3
I juste switched to X.4 and xCode 2
could the problem lie there ?
Could somebody help me ?
What was the code exception that you got in the debugger or any
exception logged in the debug/run log? Hard to know exactly what
failed with out the information. I am guessing a bad access exception.
...not had much coffee so I hope I grok the below correctly... :)
Pulling up the implementation of objc_msgSend:
0x90a3f0e0 <objc_msgSend+0>: cmplwi r3,0
0x90a3f0e4 <objc_msgSend+4>: xoris r11,r4,65534
0x90a3f0e8 <objc_msgSend+8>: cmplwi cr1,r11,61440
0x90a3f0ec <objc_msgSend+12>: beq- 0x90a3f140 <objc_msgSend+96>
0x90a3f0f0 <objc_msgSend+16>: lwz r12,0(r3)
0x90a3f0f4 <objc_msgSend+20>: beqlr cr1
0x90a3f0f8 <objc_msgSend+24>: lwz r2,32(r12)
0x90a3f0fc <objc_msgSend+28>: stw r9,48(r1)
0x90a3f100 <objc_msgSend+32>: lwz r11,0(r2) <<< stops here
0x90a3f104 <objc_msgSend+36>: addi r0,r2,8
0x90a3f108 <objc_msgSend+40>: rlwinm r11,r11,2,0,29
0x90a3f10c <objc_msgSend+44>: and r9,r4,r11
0x90a3f110 <objc_msgSend+48>: lwzx r2,r9,r0
0x90a3f114 <objc_msgSend+52>: addi r9,r9,4
0x90a3f118 <objc_msgSend+56>: cmplwi r2,0
....snip....
Apple's ABI for PPC passes the first parameter in r3, the second
parameter in r4, etc [1]. For objc_msgSend the first parameter is a
pointer to the target object. So r3 in the above is the target of the
message. At offset +16 r3 is dereferenced with no offset and the
result is placed in r12. In effect that is loading the "isa" pointer
from the object into r12 (a pointer to the class the object is a type
of). Then at offset +24 r12 is dereferenced with an offset into the
class structure and that value is loaded into r2. Then at offset +32
it attempts to dereference r2 and fails in some fashion.
So it seems likely the pointer for the object you are messaging is
stale. In other words "foo" in the below is pointing at something
other then what you expect. For example unallocated memory or
allocated memory of some random object or structure.
[foo doBar];
So look back up the call stack to find the code that is calling
object_msgSend and figure out if you are properly doing memory
management of the object instance involved.
-Shawn
[1] <http://developer.apple.com/documentation/DeveloperTools/
Conceptual/LowLevelABI/Articles/32bitPowerPC.html#//apple_ref/doc/uid/
TP40002438-SW20>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >debugging (From: Camille GOUREAU-SUIGNARD <email@hidden>) |