CUDA Debugging in QtCreator - Linux

Hi,

2 questions:

  1. Is cuda-gdb a direct replacement for gdb. Is it capable of debugging both x64 and CUDA kernel code?

Running cuda-gdb from command line looks suspicious. All commands other than cuda are undefined:

~ $ cuda-gdb
NVIDIA (R) CUDA Debugger
9.2 release
Portions Copyright (C) 2007-2018 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 "x86_64-pc-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".
(cuda-gdb) help
List of classes of commands:

aliases -- Aliases of other commands
breakpoints -- Making program stop at certain points
cuda  -- CUDA commands
data -- Examining data
files -- Specifying and examining files
internals -- Maintenance commands
obscure -- Obscure features
running -- Running the program
stack -- Examining the stack
status -- Status inquiries
support -- Support facilities
tracepoints -- Tracing of program execution without stopping the program
user-defined -- User-defined commands

Type "help" followed by a class name for a list of commands in that class.
Type "help all" for the list of all commands.
Type "help" followed by command name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
(cuda-gdb) aliases
Undefined command: "aliases".  Try "help".
(cuda-gdb) breakpoints
Undefined command: "breakpoints".  Try "help".
(cuda-gdb) cuda
Missing argument(s).
(cuda-gdb) data
Undefined command: "data".  Try "help".
(cuda-gdb) files
Undefined command: "files".  Try "help".
(cuda-gdb) internals
Undefined command: "internals".  Try "help".
(cuda-gdb) obscure
Undefined command: "obscure".  Try "help".
(cuda-gdb) running
Undefined command: "running".  Try "help".
(cuda-gdb) stack
Undefined command: "stack".  Try "help".
(cuda-gdb) status
Undefined command: "status".  Try "help".
(cuda-gdb) support
Undefined command: "support".  Try "help".
(cuda-gdb) tracepoints
Undefined command: "tracepoints".  Try "help".
(cuda-gdb) user-defined
Undefined command: "user-defined".  Try "help".
(cuda-gdb)
  1. How should cuda-gdb be configured in QtCreator?

In options > kits > debuggers I added a manual debugger I call System CUDA - GDB with path /usr/local/cuda-9.2/bin/cuda-gdb

Then in options > kits > kits for Desktop Qt 5.13.0 GCC 64bit I select System CUDA - GDB

My console application returns immediately before even executing main when trying to debug. Simply running the console application works.

Yes, cuda-gdb is a replacement for gdb.

“breakpoints” is not a command in gdb. Just as the help info states, it is a class of commands.

If you want to get help on the breakpoints class of commands, just as the help info states, type help breakpoints

If you actually want to set a breakpoint, the correct command is:

break

https://ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_28.html#SEC29

I don’t have any information on QtCreator.

I managed to setup my project. Failed debugging was due to too old GPU not allowing debugging while having X running.

Here’s my setup https://lfdm.net/2020/02/12/adding-cuda-compiler-to-qtcreator/