Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What you need is in the Tools menu: Attach to Process. This gives you a list of running processes and allows you to attach your debugger to those processes.</p> <p>For local debugging, Transport and Qualifier should keep their default values. The Attach To value just above the list determines which type of debugging you'll be doing (native or managed are the most common types), and normally the debugger can figure out a good default here as well.</p> <p>The main interesting part is the list of processes - look in this list for the sub-processes you want to debug. Once you've found and selected the process, click Attach in the lower right corner (or just double-click the process), and the debugger will attach to that process and start debugging it.</p> <p>You'll probably also want to enable the Debug Location toolbar, which provides a way to change the focus of the debugger to the various processes and threads you're attached to. Multi-process debugging within one Visual Studio instance can be tricky, so you can always consider starting separate instances to debug each different process.</p> <p>Another tricky aspect of this can be debugging the initial startup of the sub-processes. Often the thing you want to debug happens before you can get the debugger attached, so you need some way to cause the process to wait for you to be ready. An easy way to do this in C++ is to use the IsDebuggerPresent function. Try adding this code to the very beginning of your main() function (or equivalent):</p> <pre><code>while( !IsDebuggerPresent() ) Sleep( 500 ); </code></pre> <p>Or try this code for C#:</p> <pre><code>while( !System.Diagnostics.Debugger.IsAttached ) System.Threading.Thread.Sleep( 500 ); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload