老師給予一個測試程式:
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char * arg[]){
int a, b, c, d, e, f, i;
a = 0;
b = 8;
c = 29;
d = 44;
e = 444;
printf("%d %d %d %d %d", a, b, c, d, e);
for (i=0; i<argc; i++) printf("@@ %s \n", arg[i]);
system("pause");
return 0;
}
$ gcc -g -o test1.exe test.c$ gdb or $ gdb test1.exefile test1.exeshow args, set args arg1 arg2 arg3runlistb 8info breakprint a,a 是變數名稱display a,a 是變數名稱undisplay 1,後面第二個參數要接數字,必須是 display list 的數字