[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs

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

Related Information

adb Debug Program Overview.

adb Debug Program Expressions .

Example adb Program: adbsamp.

Example adb Program: adbsamp3.

The adb command.


[ Previous | Next | Contents | Glossary | Home | Search ]