title: CUDA debugging, or how to get source code lines in cuda-gdb without disabling optimization?
body: <p>I have a rather large and complex CUDA code that hangs quite reliably for large numbers of blocks/threads. I am trying to figure out exactly where the code hangs.</p>
  
  <p>When I run the code in <code>cuda-gdb</code>, I can see which threads/blocks are hanging, but I can't see where, beyond the "virtual PC".</p>
  
  <p>If I compile the code with "-G" to get the debug information, it runs a lot slower and refuses to hang, no matter how long I run it for.</p>
  
  <p>Is there any way to map a "virtual PC" to a line of code in the source code, even approximately? Or is there a way to get the debugging information in without turning off all optimization?</p>
  
  <p>I've tried using "-G3", yet to no avail. This just gives me warnings of the type "<code>nvcc warning : Setting optimization level to 0 as optimized debugging is not supported</code>". I am using CUDA compilation tools release 4.1.</p>