开发者

Visual Studio 2008: how to pause the running program to see a variable value?

I have started a long loop, and i dont want to start it over (been running 3 hours now, i calculated it to run only 1 hour instead), and i am afraid that my program is working incorrectly because its taking so long. I was too stupid to actually output any state values for myself (i didnt think it would take 3 d开发者_如何学Goamn hours).

So, is there some way to spy one specific variable value while the program was launched from visual studio in "Release" mode?


What you want to do is attach to the running process

  • Load the solution which represents the project
  • Tools -> Attach to Process
  • Select the running process and hit attach
  • Hit the Pause Button on the IDE to stop the process or set a break point

At this point you will be broken in the debugger and able to inspect the running program


Attach the debugger to the running program. Set a breakpoint. Bask in the glory.

Of course, this all assumes you built PDBs. If you didn't, you're pretty much out of luck.


If the program was launched from Visual Studio it is possible that it already has a debugger (Visual Studio) attached to the process.

Visual Studio will have VCR/DVD looking buttons on the toolbar for Go, Stop, Pause, etc. Press the Stop button, or go into the Debug menu and choose Break All.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜