Re: GDB: How to access arguments
Re: GDB: How to access arguments
- Subject: Re: GDB: How to access arguments
- From: daniel <email@hidden>
- Date: Sat, 9 Apr 2005 22:43:45 -0700
You're trying to use two commands in one line. Good memory! But you
need to pick one.
"p" - short for print. use this to display the value of a variable (or
any expression).
"x" - examine memory. use this to display the contents of memory.
and one you didn't remember but you'll want:
"po" - short for print-object. use this to print an objective-C object.
So, if you want to display the integer first parameter to an
objective-C method call, you could do a "p $r5". If it's a C-string,
you could do "x/s $r5", etc. Remember that for Objective-C method
calls, $r3 is self and $r4 is the selector, so it's often handy to know
both. I defined this macro in my ~/.gdbinit file so I could easily
obtain this information whenever I'm sitting on a message send
subroutine:
define omv
po $r3
x/s $r4
end
Another handy one in case you do any CoreFoundation debugging is the
CFShow function. You can call it from gdb, so if you know that $r4
contains a CF type, just do this:
call (void)CFShow($r4)
Hope this helps,
Daniel
On Apr 9, 2005, at 3:45 AM, Philip Mötteli wrote:
Hello
How can I access the first argument ('self'), the second and the few
next ones, if there are no debugging symbols?
I remember something like
p x /s $r3
used to work. But not any more.
Can somebody tell me how?
Thanks
Phil
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
sweater.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden