Breakpoints in *.cpp files are not hit, while breakpoints in *.cu files are working

Hi,

I am trying to debug a proof-of-concept small C++ app. The app consists from one cpp file (main.cpp) which calls a wrapper function defined in a *.cu file. This wrapper function then calls another function defined in this *.cu file, which is decorated with _host_ _device_ attributes.

The *.cpp file is compiled with gcc, the *.cu file is compiled with nvcc. Linking and building is done with nvcc. Compiling and linking is using flags g and G also.

When I debug the app with cuda-gdb, I can hit breakpoints in the functions from *.cu file, but the breakpoints in the main.cpp are skipped.

In the debug console is a message: No source file named /.. full path…/main.cpp

After that it outputs the breakpoint in the wrapper function from the *.cu file, in which the debugger hits the breakpoint as expected.

If I debug using gcc, there is no message “No source file named / full path…/main.cpp” in the debug console, and all breakpoints are listed with lines numbers, but no breakpoint from *.cpp file will be hit. The breakpoints in *.cu files are working as expected.

When looking for answers I came across cases when the g, G flags helped. However, I am using these flags, so this is not a problem.

Am I missing some different flags?

I am using Cuda Toolkit 13, Ubuntu 24, std:C++20, VS Code.

Thanks for help.