3

我正在寻找一种将 C 样式数组索引的内容打印到 XCode 4.5 中的控制台窗口的方法。换句话说,当我的音频缓冲区(一个 C 数组)填充了浮点数据时,我在填充后放置了一个断点,我只想打印我的数组 [] 中的内容值。我尝试了以下方法:

// Just an example of what I'm doing. The following is a buffer that I am declaring:
int total = 235377;
float tmpArr[total];

// gives me the first index [0] contents value only when I type this in the console window in Xcode
p tmpArr

// gives the following error:
// error: subscripted value is not an array, pointer, or vector
// error: 1 errors parsing expression
p tmpArr[3]

// gives me the address as expected
p &tmpArr

// the following seems to access contents but is casting them to ints and therefore truncating anything after the decimal...in audio programming, the float data is between 0 and 1 sooo....
frame variable -ffloat tmpArr
frame variable -ffloat tmpArr[3]

我试图找到为什么我无法访问数组索引的内容的答案。我在这里错过了什么吗?每次我想调试时都必须将 printf() 放在 for 循环中吗?谢谢!

更新

正如@Daniel Fischer 指出的那样,在 XCode 控制台中键入 p *(tmpArr + indexNumber) 可以成功访问 tmpArr[indexNumber] 并将其打印到调试控制台。

4

0 回答 0