What | GDB Syntax |
---|---|
return address | *(int*)$esp |
first parameter | *(int*)($esp+4) |
second parameter | *(int*)($esp+8) |
... and so on |
Table 3 : Accessing parameters after the prologue
What | GDB Syntax |
---|---|
previous frame | *(int*)$ebp |
return address | *(int*)($ebp+4) |
first parameter | *(int*)($ebp+8) |
second parameter | *(int*)($ebp+12) |
... and so on |
当在汇编语言下调试Cocoa代码,请记住以下运行时特性:
The Objective-C compiler adds two implicit parameters to each method, the first of which is a pointer to the object being called (self
).
The second implicit parameter is the method selector (_cmd
). In Objective-C this is of type SEL
; in GDB you can print this as a C string.
The Objective-C runtime dispatches methods via a family of C function. The most commonly seen is objc_msgSend
, but some architectures use objc_msgSend_stret
for methods which returns structures, and some architectures useobjc_msgSend_fpret
for methods that return floating point values. There are also equivalent functions for calling super
(objc_msgSendSuper
and so on).
The first word of any Objective-C object (the isa
field) is a pointer to the object's class.
0x04e7aad3: "addSublayer:"
(lldb) po [[`*(int*)($esp+4)` superview] recursiveDescription]
(id) $7 = 0x0719f940 <UIWebSelectionView: 0x107d74e0; frame = (0 0; 0 0); layer = <CALayer: 0x107d7620>>
| <UIView: 0x107d7770; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <CALayer: 0x107d77d0>>
| <UIWebSelectionOutline: 0x759b340; frame = (-2 -2; 4 4); userInteractionEnabled = NO; layer = <CALayer: 0x75963e0>>
| | <UIView: 0x759b3f0; frame = (0 0; 0 0); layer = <CALayer: 0x759d580>>
| | <UIView: 0x759da60; frame = (0 0; 0 0); layer = <CALayer: 0x759bfb0>>
| | <UIView: 0x759be40; frame = (0 0; 0 0); layer = <CALayer: 0x759db30>>
转载请注明出处: http://blog.csdn.net/horkychen