Hello,
My problem is about debugging within "C::B", "watches" and viewing the contents of fixed size arrays passed to functions.
Below is a simplified example code.
#define N_ARRAY_S_LENGTH 100
int main()
{
fun_1();
return 0;
}
void fun_1()
{
unsigned char array[N_ARRAY_S_LENGTH];
[...]
fun_2(array);
[...]
}
void fun_2(unsigned char array[N_ARRAY_S_LENGTH])
{
[...]
fun_3(array);
[...]
}
void fun_3(unsigned char array[N_ARRAY_S_LENGTH])
{
array[0] = 'a';
array[1] = 0x0;
array[2] = 'b';
}
If I watch "array" in the "Watches" view when the debugging cursor points:
- inside "fun_3()" - I get: a
- inside "fun_2()" - I get: a
- inside "fun_1()" - I get: a\000b (this is what I would expect in the two previous cases).
The problem is that I can't check the contents of "array" when I'm inside "fun_3()" or "fun_2()", I have to wait till I'm back into "fun_1()".
So I am wondering why is it behaving that way.
Can you help?
Thank you.
--
OS: Debian GNU/Linux 6.0.3 (squeeze)
C::B SVN 7790
Compiler: GNU GCC Compiler
Debugger: GNU GDB
void bar(int a[N]) is equivalent to void bar(int a[])
What you may want is
void bar(int (&a)[N])
Quote from: Léa Massiot on October 28, 2012, 01:49:42 PM
The problem is that I can't check the contents of "array" when I'm inside "fun_3()" or "fun_2()", I have to wait till I'm back into "fun_1()".
In watches windows do the following:
1. right click on a
2. select properties
3. the check watch as array
4. set the size
5. press ok
Hello jarod42 and oBFusCATed,
Both your solutions work for me.
So, thank you very much for your help :).
Best regards.