title: How do I show source code in windbg through ntsd -d?
body: <p>I can't make source code show in windbg when I pipe <code>ntsd -d</code> on the target through <code>windbg -k</code>, but it works when I debug locally.</p>
  
  <p>I want to debug the very first code execution of Winlogon.exe and LSASS.exe. But to make it easy to reproduce the problem, I made up this setup:</p>
  
  <ul>
  <li>I use the <a href="http://windbg.info/apps/46-crashme.html" rel="nofollow noreferrer">CrashMe sample application</a>, with source and symbols pre-built, copied to C:\CrashMe on both the target and host</li>
  <li>I use Windows Debugging tools for Windows (DTW) version 6.12.0002.633 everywhere. </li>
  <li>The target is running Windows XP SP3, the host Windows 7 ultimate.</li>
  <li>Every path and settings is the same on both machine : path to DTW and path to crashme. </li>
  <li>I always use fully qualified path (like c:\dtw\ntsd.exe).</li>
  <li>I run a XP in a VM, booted with <code>/noexecute=optin /fastdetect /debug /debugport=com1 /baudrate=115200</code></li>
  </ul>
  
  <p>I am able to debug locally with this command, launched from C:\CrashMe:</p>
  
  <pre><code>windbg -g -G -srcpath C:\CrashMe -y C:\CrashMe debug\CrashMe.exe
  </code></pre>
  
  <p>I can launch the Windows XP virtual machine and connect to it with this command:</p>
  
  <pre><code>windbg -n -k com:pipe,port=\\.\pipe\com_1,reconnect -srcpath SRV*;C:\CrashMe -y   
  c:\windows\system32;c:\windows\symbols;C:\CrashMe\debug  
  </code></pre>
  
  <p>But I need to debug a remote machine. On the target, I have these choices:</p>
  
  <ol>
  <li>Debug through <code>-server</code> and <code>-remote</code></li>
  <li>Breaking in a running process</li>
  <li>Use Image File Execution Options (IFEO). </li>
  </ol>
  
  <p>In each of these options I can see the symbols (<code>x crashme!*</code> works).</p>
  
  <p>I cannot use #1 (<code>-server</code>) or #2 (<code>breakin.exe &lt;pid&gt;</code>), because I want to debug the startup code of an authentication provider, so I need <code>LSASS.exe</code> start under <code>ntsd -d</code>. I can't let it run and attach later on.</p>
  
  <p>My understanding is that I need to use IFEO. Using gflags.exe instead of modifying the registry manually, I set executable options to </p>
  
  <pre><code>c:\dtw\ntsd -d -G -lines -x -y c:\symcache;c:\windows\system32 -n -srcpath C:\CrashMe\ 
  </code></pre>
  
  <ul>
  <li>I can breakin the application, but breakpoints I set are never hit.</li>
  <li>I can <code>.open</code> any file, but I can't use the file to set breakpoint.</li>
  <li>I can x (examine) any symbol</li>
  <li>I can not see the source code.</li>
  </ul>
  
  <p>How can I see my DLL source code of a process running under <code>ntsd -d</code> through <code>windbg -k</code>?</p>