Debugging 逐行跟踪模块?

Debugging 逐行跟踪模块?,debugging,windbg,Debugging,Windbg,我正在尝试使用WinDbg跟踪我的程序(其中只有一个模块),并记录执行的行号。稍后我将自动执行该过程,但现在我只希望逐行浏览代码 我试图看看是否可以使用我的自动调试器来计算自动化的代码覆盖率 我有正确的符号。我该怎么做?调试器显然具有逐行执行代码的能力 我试过使用l+t,l+o,l+s,p和pr。我启用了源代码模式(l+t),但在命令窗口中看不到源代码,也看不到任何源代码窗口。cdb-lines-c“l+t;l+o;l+s;g main;p 12;q”printhello.exe 0:000&g

我正在尝试使用WinDbg跟踪我的程序(其中只有一个模块),并记录执行的行号。稍后我将自动执行该过程,但现在我只希望逐行浏览代码

我试图看看是否可以使用我的自动调试器来计算自动化的代码覆盖率

我有正确的符号。我该怎么做?调试器显然具有逐行执行代码的能力

我试过使用
l+t
l+o
l+s
p
pr
。我启用了源代码模式(
l+t
),但在命令窗口中看不到源代码,也看不到任何源代码窗口。

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:

您需要将符号和src路径添加到windbg,它将无法正常解决此问题

您可以使用Gui添加路径:

'文件>符号文件路径…' 及 “文件>源文件路径…”使用gui 或分别按ctrl+S和ctrl+P

或者,您可以使用命令执行此操作

您需要在windbg中添加pdb位置和源文件位置,这可以使用gui中的“文件>符号文件路径…”和“文件>源文件路径…”来完成,或者分别使用ctrl+S和ctrl+p。或者,您可以使用命令
.srcpath
.sympath
@EdChum执行此操作,是的,我现在可以执行。现在觉得自己很愚蠢:|。我的源路径未设置,符号已设置。