How can I tell which process I am debugging (attached to multiple processes)?

大兔子大兔子 提交于 2019-12-04 07:49:52

You could add a watch to the following statement:

System.Diagnostics.Process.GetCurrentProcess().Id

This gives you the PID (process id) you are attached to. You can look for pids in windows task manager (Menu View->Select Columns and tick PID).

Hope this helps

You can try the "When Hit..." option available on a breakpoint (right click on the breakpoint, it's in the context menu that pops up). You can then print a message with the value of a variable along with lots of other information, such as:

$ADDRESS - Current Instruction

$CALLER - Previous Function Name

$CALLSTACK - Call Stack

$FUNCTION - Current Function Name

$PID - Process ID

$PNAME - Process Name

$TID - Thread ID

$TNAME - Thread Name

http://msdn.microsoft.com/en-us/library/232dxah7(v=vs.110).aspx

That's what the Processes window is for (Debug->Windows->Processes, or Ctrl+Alt+Z).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!