It's been while in touch with C program debugging. I wrote sample program and trying to debug with gdb. I am having problem to go step by step. The program works fine. when i say step, it is executing whole function. Also when i say print specific parameter value, it say's "No symbol "i" in current context". Here is the complile option that i have used to compile it and debug it. But 'i' is declared and assigned
Here are the complie options that i have tried.
gcc -g test.c -o test
gcc -g -Wall -o test test.c
gcc -Wall -O -g -o test test.c
gcc -Wall -O -g test.c
here is the code.
#include <stdio.h>
int bazz(int anint);
int f;
int main() {
int i;
i=5;
f=5;
printf("This is my program\n");
bazz(i);
return 0;
}
int bazz(int anint) {
printf("You gave me %d\n", anint);
return anint;
}
Am i doing any thing wrong?
Thanks in advance,
Srini.
Here are the complie options that i have tried.
gcc -g test.c -o test
gcc -g -Wall -o test test.c
gcc -Wall -O -g -o test test.c
gcc -Wall -O -g test.c
here is the code.
#include <stdio.h>
int bazz(int anint);
int f;
int main() {
int i;
i=5;
f=5;
printf("This is my program\n");
bazz(i);
return 0;
}
int bazz(int anint) {
printf("You gave me %d\n", anint);
return anint;
}
Am i doing any thing wrong?
Thanks in advance,
Srini.