Example adb program: adbsamp2
The following sample program is used in this example:
/*program listing for adbsamp2.c*/
int fcnt,loop_count;
f(a,b)
int a,b;
{
a = a+b;
fcnt++;
return(a);
}
main()
{
loop_count = 0;
while(loop_count <= 100)
{
loop_count = f(loop_count,1);
printf("%s%d\n","Loop count is: ", loop_count);
printf("%s%d\n","fcnt count is: ",fcnt);
}
}
Compile the program using the cc command to the adbsamp2 file with the following command:
cc -g adbsamp2.c -o adbsamp2
To start the debug session, enter:
adb adbsamp2