Tx2 SPI with debug

Hi

I want debug the code included SPI function.

/***************************************
nvcc -g -G -o

-> cuda-gdb ./ (debug mode start but not works)

-> cuda-gdb ./ -D/dev/spidev3.0 (Not works)
***************************************/

It only works sudo ./ -D/dev/spidev3.0

Is there have any way to use spi function with debug mode ?

/**************************

The message is “can’t open device: permission denied”

**************************/
thanks.

How about sudo cuda-gdb xxxxx

Hi ShaneCCC

of course I tried append sudo but it not works

nvidia@tegra-ubuntu:~/BY/SPI_Ex$ cuda-gdb sudo ./test 
NVIDIA (R) CUDA Debugger
9.0 release
Portions Copyright (C) 2007-2017 NVIDIA Corporation
GNU gdb (GDB) 7.12
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "aarch64-elf-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from sudo...(no debugging symbols found)...done.
"/home/nvidia/BY/SPI_Ex/./test" is not a core dump: File format not recognized
(cuda-gdb) run
Starting program: /usr/bin/sudo 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
[Inferior 1 (process 17135) exited with code 01]

My code need to printf '1 ’ 4096 times but it not works at all.

And want to know about to using nvprof with using SPI function

If I tired to use nvprof then

nvidia@tegra-ubuntu:~/BY/SPI_Ex$ nvprof sudo ./test -D/dev/spidev3.0
spi mode: 0
bits per word: 8
max speed: 20000000 Hz (20000 KHz)

4096
======== Warning: No CUDA application was profiled, exiting

There’s no kernel elapsed time and also elapsed time in CPU.