My device code has some bugs and seg faults when I run it in device emulation. When I compile with -g and run it in gdb, I get the following information (see below). Are the numbers before the stack frames memory addresses? Is there any way to find out which line of code caused the problem, as when debugging normal code? I don’t know what to make of 0x00004a34 (which is much larger than the number of lines in my kernel).
If there isn’t any way to find out which line of code cause the problem using the debugger, is there any other clever way to go about doing this? Bracketing the offending line with printf’s seems problematic, given that many threads may be processing concurrently. Or can I assume that each thread will run until it hits a __syncthreads()?
In case it’s relevant, I’m running on Mac OS X version 10.5.4, so I’m running cuda version 1.1. Does the debugger work better under other operating systems, or using more recent incarnations of cuda?
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x7f800000
[Switching to process 17459 thread 0x1603]
0x00004a34 in cuda_calculate_factor_messages ()
#0 0x00004a34 in cuda_calculate_factor_messages ()
#1 0x00004c45 in _device_wrapper__Z30cuda_calculate_factor_messagesPfS_PvS0_PjPiS2_S0 ()
#2 0x001e6482 in cudaGetLastError ()
#3 0x918f36f5 in _pthread_start ()
#4 0x918f35b2 in thread_start ()