cuda-gdb prints wrong?


I’m writing my first CUDA application so I apologize if this is an obvious question. :)

Basically I allocate memory for a structure in global memory and I copy it in there. I then pass a pointer to this structure to my kernel. I used cuda-debug with a breakpoint in my kernel to try and print a member from my structure, but the value that’s printed differs from what it should be. However, when I print the dereferenced pointer it shows all the fields of the struct and they are correct. Also, when I copy my structure back from global memory to host memory I get the correct structure again in host memory.

To make it concrete, I have a struct ownClassifier

struct ownClassifier{
int count;
size_t datasize;
ownStage* stages;

I pass a pointer to such a struct named classifier to my kernel. When I ‘print classifier->count’ it gives an incorrect number. When I do ‘print *classifier’ it shows the three fields with their correct values…
Could someone please clarify what the problem is here? Thank you! :)