How to use cuda-gdb debugging .c and .cu file?


I have a project composed by .cpp file calling .cu file. For example

.cpp file
int main(){


.cu file

-g -G option has been added in Makefile for .cu file. .cpp file is built with regular gcc.

The resulting .o files are : main.o, kernel.cu_o

I want to use cuda-gdb to check data on device side. However, when I used cuda-gdb main, it can not enter kernel(); if I used cuda-gdb kernel, there is segment error and core is dumped.

Anyone knows how to debug this structure?

Try to do linking stage with nvcc -g -G -O0