title: How do I get user-mode breakpoints to hit in windbg while kernel debugging?
body: <p>I'm having trouble getting user mode breakpoints to hit in windbg when I am kernel debugging.  I know that I have to be in the target process's context to set a user mode breakpoint, but that still doesn't seem to work reliably.  Sometimes it works, but I can't wrap my head around what the variable is that is making it work sometimes but not others.  Here is what I am doing.</p>
  
  <pre><code>1) !process &lt;process&gt; 0x17, then find a thread that I am curious 
     about.  See that the thread is in mixed user/kernel callstack, 
     identify return address I want to break on.
  
  2) .process /r /p &lt;process&gt;, to change to the target process context
  
  3) .thread &lt;thread&gt;, to change to the thread identified in step (1)
  
  4) bp &lt;addr&gt;, to break on that particular address I care about
  
  5) g
  </code></pre>
  
  <p>Sometimes the breakpoint hits.  Sometimes it doesn't (except I have evidence that the thread has returned).  This makes debugging really frustrating since I never know if things will work.  Thanks for your help.</p>
  
  <p>EDIT: this is not about thread-specific breakpoints, in my example I only change thread to take a callstack, because the callstack shows me the address I need to break on.  In reality I want to break whenever that address is hit.</p>