AnsweredAssumed Answered

debug cpu program in linux using valgrind+gdb

Question asked by scrape on Aug 11, 2012
Latest reply on Aug 30, 2012 by urishomroni

Hello, I am currently attempting to figure out the best way to debug programs on the linux platform.  I do not run windows. 


I have made a simple hello world style program to learn opencl.  The program I wrote works when I do not run it in valgrind.  However when I run it in valgrind using the CPU device I get the following error:


==27365== Thread 3:

==27365== Use of uninitialised value of size 4

==27365==    at 0x42283CB: __OpenCL_square_stub (in /tmp/


When I attach the gdb and run backtrace I get this call stack:


#0  0x04228357 in __OpenCL_square_stub () from /tmp/

#1  0x04a75c89 in ?? () from /opt/AMDAPP/lib/x86/

#2  0x04a66894 in ?? () from /opt/AMDAPP/lib/x86/

Backtrace stopped: previous frame inner to this frame (corrupt stack?)


I am not sure how to debug this or how to remedy the situation, but it seems like the standard tools are unusable for a language that is very close to C using a cpu device. 


I have attached my hello world program and would like to figure out how to remedy this situation so that linux users can reliably create opencl software.


I have also tried gdebugger but it just crashes.  Even on the samples that come from AMD.


any help would be greatly appreciated.