我正在尝试使用WinDbg来跟踪我的程序(其中只有一个模块),并记录执行的行号。我稍后会自动完成这个过程,但是现在我只想逐行完成代码。
我正在尝试查看是否可以使用自动调试程序来计算自动化的代码覆盖率。
我有正确的符号。我该怎么做呢?调试器显然有能力逐行执行代码。
我尝试过使用l+t
,l+o
,l+s
,p
和pr
。我已启用源模式(l+t
),但我没有在命令窗口中看到源代码,也没有看到任何源窗口。
答案 0 :(得分:0)
cdb -lines -c“l + t; l + o; l + s; g main; p 12; q”printhello.exe
0:000> cdb: Reading initial command 'l+t;l+o;l+s;g main;p 12;q'
Source options are d:
1/t - Step/trace by source line
4/s - List source code at prompt
8/o - Only show source code at prompt
> 5: printf("lets say hello to the world for %8s time\n", count[0]);
lets say hello to the world for first time
> 6: printf("lets say hello to the world for %8s time\n", count[1]);
lets say hello to the world for second time
> 7: printf("lets say hello to the world for %8s time\n", count[2]);
lets say hello to the world for third time
> 8: printf("lets say hello to the world for %8s time\n", count[3]);
lets say hello to the world for fourth time
> 9: printf("lets say hello to the world for %8s time\n", count[4]);
lets say hello to the world for fifth time
> 10: printf("lets say hello to the world for %8s time\n", count[5]);
lets say hello to the world for sixth time
> 11: printf("lets say hello to the world for %8s time\n", count[6]);
lets say hello to the world for seventh time
> 12: printf("lets say hello to the world for %8s time\n", count[7]);
lets say hello to the world for eighth time
> 13: printf("lets say hello to the world for %8s time\n", count[8]);
lets say hello to the world for ninth time
> 14: printf("lets say hello to the world for %8s time\n", count[9]);
lets say hello to the world for tenth time
> 15: }½½½½½½½½■?¶
printhello!__tmainCRTStartup+0x10b:
004013a8 83c40c add esp,0Ch
printhello!__tmainCRTStartup+0x111:
004013ae 3975e4 cmp dword ptr [ebp-1Ch],esi ss:0023:0013ffa4=000000
00
printhello!__tmainCRTStartup+0x116:
004013b3 50 push eax
quit:
答案 1 :(得分:0)