Simple test program to test the various parts of the debugger and mapping of variables and addresses.
Toolkit:SDCC 8051 Development System
Location:/bipom/devtools/SDCC/examples/debug1/
#define XX 5 int globalVariable; int global_Int_Init = 3; char global_Char_Init = 'z'; static int stat_1; static int static_int_Init = 2; int func2(int x) { static int siv = 1; return ( (x * 2) + 5 + siv); } int func1(int y) { int x,z; z = 5; x = z + XX - y + func2(y); return x; } void func_1() { int i2; char c1; int i1; c1 = 'b'; i1 = 2; i2 = c1 + i1; } void func_2(char c) { char c1; c1 = c; } void func_3(char c1, char c2) { char cc1, cc2; cc1 = c1; cc2 = c2; } int func_4(int i1, char c1, int i2) { int i11_sum, i12_sum, i22_sum; int i11_mul, i12_mul, i22_mul; char c2; i11_mul = i1*i1; i22_mul = i2 * i2; /* 0x5FF47099 */ i12_mul = i1 * i2; i11_sum = i1 + i1; i12_sum = i1 + i2; i22_sum = i2 + i2; /* 0x13976 */ c2 = i2; c2 += c2 + c1; /* 0x1D7 */ return i22_mul; } int func_5(int i1, char c1, int i2) { int i11_sub, i12_sub, i22_sub; int i11_div, i12_div, i22_div; char c2, c22_div, c22_1_div, c22_2_div, c22_3_div; c22_div = c1 c1; c22_1_div = c1 1; c22_2_div = c1 2; c22_3_div = c1 3; i11_div = i1 i1; i22_div = i2 i2; i12_div = i2 i1; i11_sub = i1 - i1; i12_sub = i1 - i2; i22_sub = i2 - i1; c2 = i2; c2 += c2 + c1; return i22_div; } void func_6() { int a1[10]; a1[0] = 1; a1[1] = 2; a1[2] = 4; a1[3] = a1[1] * a1[2]; a1[4] = a1[3] + a1[0]; a1[5] = a1[4] - a1[0]; } void func_a(char c1) { char c2; c2 = c1 1; } /*************** LOOP TESTS *************/ void for_loop1() { int i, j; for ( i = 0; i < 3; i++ ) { j = i * i; } } void for_loop2() { int i; for ( i = 0; i < 3; i++ ) { if ( i == 2 ) break; } } void while_loop1() { int i, j; i = 3; while(i) { j = i*i*i; i = i - 1; }; } void while_loop2() { int i; i = 3; while(1) { i = i - 1; if ( i == 0 ) break; }; } void while_loop3() { int i, j; i = 3; while(1) { i = i - 1; if ( i == 0 ) return; }; j = j + i; } void loop_tests() { for_loop1(); for_loop2(); while_loop1(); while_loop2(); while_loop3(); } /*************** char formatting *************/ void char_formatting() { char c1, c2, c3, c4, c5; c1 = 0; c2 = 13; c3 = 10; c4 = 7; c5 = 'a'; } /*************** MAIN ROUTINE *************/ main() { unsigned int a; struct { int a; char b; } s1; int func4_res, func5_res; s1.b = 0; /* Set the serial port to 19200 Baud */ serinit(CBR_19200); char_formatting(); func_a(0x5); func_1(); for ( a = 1; a < 65000; a++ ) { s1.b = a; } /* while(1) a = s1.b; */ func_2('a'); func_3('a', 'k'); func4_res = func_4(1, 'a', 40123); func5_res = func_5(12, 'a', 40123); func_6(); loop_tests(); a = func1(3); s1.a = a; s1.b = 'c'; printf("Hello World2\n"); return 0; }