How could I debug the code in cuda files in a Optix project?

For example, in the optixSphere project, I set a breakpoint at some code line in the inner of function inhole_camera(). But when I start “Nsight”->“Start CUDA Debuging”->“connect unsecurely”, the program is executed without interrupt.

How could I watch the value of the variable in the function inhole_camera()?
Any suggestion will be appreciated.

Unfortunately source code level debugging of the CUDA sources in OptiX is not supported.
First, OptiX doesn’t handle PTX code generated with debug info (nvcc -g or -G options).
Then it translates and rewrites the input PTX code to a mega-kernel which doesn’t retain any possible debug information.
There is no connection to the original CUDA sources left to work with in Nsight after that.

Debugging OptiX programs can be done by using the rtPrintf and rtThrow plus exception program mechanisms described in these earlier forum posts:

Note that the kernel compilation time and runtime performance with all exceptions enabled can be drastically lower in OptiX 4.1.1.

Thanks Detlef.
I will follow the two topics.