Re: How do I view contents of a simple C buffer in XCode debugger?
Re: How do I view contents of a simple C buffer in XCode debugger?
- Subject: Re: How do I view contents of a simple C buffer in XCode debugger?
- From: Markian Hlynka <email@hidden>
- Date: Sat, 2 Apr 2005 15:07:51 -0700
I'm not sure I understand... maybe this will help:
a) is your variable not available in the debug window?
b) if not, go to Debug -> Tools -> Global Variables... Here you should be able to select which global variables appear in the Debugger
c) If this doesn't work, have you tried entering the Expressions Window (Debug -> Tools -> Expressions...) and just typing in "buf"?
d) if all else fails, you should be able to view things in both the gdb console and the Expressions window as buf[n]. Enter directly into the expression window, or enter "p buf[n]" in the gdb console.
e) you CAN type "p buff" into the gdb console, but if you're using a long to store the size of the array, I suspect this is a bad idea. :-)
You may have trouble with the above in certain cases, like multidimensional global static arrays. I have all too much experience with this. Let me know if you need more detail. (like why I have to look at these using mangled garble like
p ((Killer_T*)(&KillerArray))[n]
Markian
On Apr 2, 2005, at 2:42, Julian Vrieslander wrote:
Let's say that I have an instance variable, or a local variable within a
method, which is a pointer to an allocated buffer:
// create a buffer, whose size is determined at run time
long count = [someObject count];
short *buf;
buf = malloc(count * sizeof(short));
// code that fills buffer with some values
Now I stop at a breakpoint in the debugger, and I want to inspect the data.
Can I get the XCode debugger to display a table showing the indexes and
values for the elements in the buffer?
I can't recall exactly how I used to do this in CodeWarrior, but I think
there was a way to view the buffer as an array. I have been trying to do
this in XCode, using the "View Values As..." and "View Variable as an
Expression" commands. No luck so far. I read the section on Custom Data
Formatters in XCode help, but the explanation of the syntax makes no sense
to me. Google and CocoaBuilder didn't come back with anything either.
Thanks for any tips...
--
Julian Vrieslander <email@hidden>
_______________________________________________
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
_______________________________________________
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