CUDA debugging on VS2005 Need help...


I need some help on debugging CUDA codes using my VS2005. I have done all of the following:

  1. Install CUDA build rule made by Jared ( and enable it for my project.
  2. Set the /DEBUG linker option (to generate debug info).
  3. Compile the project in EmuDebug build by enabling Emulation on the CUDA property page.

The project compiles and runs, but when I set a breakpoint inside a .cu file, the breakpoint doesn’t seem to correspond to the line of code specified (e.g. it continues even when it encounters a return statement, it skips codes that are not inside a conditional block, etc.). Further, I also can’t view the variables’ values in the watch window (it says the symbol ‘variableName’ is not found). Could someone help me on this? Thanks!

OK, finally managed to solve the problem:

  • The inaccurate breakpoint was because I split long CUDA_SAFE_CALL() line to several lines. Apparently, multiple line-CUDA_SAFE_CALL()s (and other macros, I suspect) are still counted as one line by nvcc preprocessor…
  • Symbol not found: the debugger couldn’t find variables put inside an anonymous namespace. Declaring these variables as static solves the problem.