GDB调试(设置断点循环次数)
时间:2006-09-22 来源:hoog
................
48 while(i < TIME)
49 {
50 bzero(path, sizeof(char)*SIZE);
(gdb)
51 bzero(array, sizeof(char)*SIZE);
52
53 path = strcat(path,RDPATH);
54
55 itoc(i , array);
56 fprintf(stderr,"%s \n", array);
57
58 path = strcat(path,array);
59
60 fd = fopen(path , "w");
......................
针对这段程序,希望在循环条件i执行到999的时候,在断点处(第54行)停止。
下面代码可达此目的:
(gdb) set $counter = 0
(gdb) break 54 if ++$counter == 999
48 while(i < TIME)
49 {
50 bzero(path, sizeof(char)*SIZE);
(gdb)
51 bzero(array, sizeof(char)*SIZE);
52
53 path = strcat(path,RDPATH);
54
55 itoc(i , array);
56 fprintf(stderr,"%s \n", array);
57
58 path = strcat(path,array);
59
60 fd = fopen(path , "w");
......................
针对这段程序,希望在循环条件i执行到999的时候,在断点处(第54行)停止。
下面代码可达此目的:
(gdb) set $counter = 0
(gdb) break 54 if ++$counter == 999
相关阅读 更多 +