3.1. General

Classes

struct 
2-dimensional coordinates for threads, blocks, etc.
struct 
3-dimensional coordinates for threads, blocks, etc.

Defines

#define CUDBG_APICLIENT_PID cudbgApiClientPid
Name of the global variable containing the API client PID. This variable is set by the API client to identify itself.
#define CUDBG_APICLIENT_REVISION cudbgApiClientRevision
Name of the global variable containing the API client revision. This variable is set by the API client to identify the API revision it wants to use.
#define CUDBG_API_VERSION_MAJOR 13
Major release version number. This matches the major version of the CUDA driver exposing this API.
#define CUDBG_API_VERSION_MINOR 2
Minor release version number. This matches the minor version of the CUDA driver exposing this API.
#define CUDBG_API_VERSION_REVISION 172
API revision number. This number is incremented every time changes are made to the API.
#define CUDBG_ATTACH_HANDLER_AVAILABLE
Name of the global variable containing the attach handler available flag. This variable is set by the debug engine to indicate that the attach handler is available.
#define CUDBG_DEBUGGER_CAPABILITIES
Name of the global variable containing the debug engine capabilities bitmask. This variable is set by the API client to indicate the requested capabilities. See the CUDBGCapabilityFlags enum for the list of available capabilities.
#define CUDBG_DEBUGGER_INITIALIZED cudbgDebuggerInitialized
Name of the global variable containing the debug engine initialized flag. This variable is set by the debug engine to indicate that it has been initialized.
#define CUDBG_ENABLE_LAUNCH_BLOCKING
Name of the global variable containing the enable launch blocking flag. This variable is set by the API client to enable blocking launches of CUDA kernels.
#define CUDBG_INITIATE_DEBUGGER_ATTACH_PROCEDURE_FD
Name of the global variable containing the debug engine attach procedure initiation FD. If this FD is not -1, write a single byte (any value) to it to initiate the CUDA debug engine attach procedure. After the request was received and the attach procedure has finished, the CUDBG_REPORT_ATTACH_PROCEDURE_FINISHED function is called.
#define CUDBG_IPC_FLAG_NAME cudbgIpcFlag
Name of the global variable containing the IPC flag. This variable is set by the API client to indicate that it is ready to attach to a running CUDA application.
#define CUDBG_MAX_DEVICES 64
Maximum number of supported devices.
#define CUDBG_MAX_LANES 32
Maximum number of lanes per warp.
#define CUDBG_MAX_LOG_LEN 256
Maximum length of a single CUDA log message.
#define CUDBG_MAX_SMS 256
Maximum number of SMs per device.
#define CUDBG_MAX_WARPS 64
Maximum number of warps per SM.
#define CUDBG_MAX_WARP_BARRIERS 16
Maximum number of convergence barriers per warp.
#define CUDBG_PRE_INIT cudbgPreInit
Name of the pre-init global function. The API client can set a breakpoint on this function to be notified before the CUDA driver starts its initialization.
#define CUDBG_REPORTED_DRIVER_API_ERROR_CODE
Name of the global variable containing the code of the driver API error being reported. This variable is set by the debug engine when a driver API error is reported.
#define CUDBG_REPORTED_DRIVER_API_ERROR_FUNC_NAME_ADDR
Name of the global variable containing the address of the name of the function in which the driver API error occurred. This variable is set by the debug engine when a driver API error is reported.
#define CUDBG_REPORTED_DRIVER_API_ERROR_FUNC_NAME_SIZE
Name of the global variable containing the size of the name of the function in which the driver API error occurred. This variable is set by the debug engine when a driver API error is reported.
#define CUDBG_REPORTED_DRIVER_API_ERROR_NAME_ADDR
Name of the global variable containing the address where the driver API error name is stored. This variable is set by the debug engine when a driver API error is reported.
#define CUDBG_REPORTED_DRIVER_API_ERROR_NAME_SIZE
Name of the global variable containing the size of the driver API error name being reported. This variable is set by the debug engine when a driver API error is reported.
#define CUDBG_REPORTED_DRIVER_API_ERROR_SOURCE
Name of the global variable containing the driver API error source. This variable is set by the debug engine when a driver API error is reported. See the CUDBGReportedDriverApiErrorSource enum for the list of available sources.
#define CUDBG_REPORTED_DRIVER_API_ERROR_STRING_ADDR
Name of the global variable containing the address where the driver API error string is stored. This variable is set by the debug engine when a driver API error is reported.
#define CUDBG_REPORTED_DRIVER_API_ERROR_STRING_SIZE
Name of the global variable containing the size of the driver API error string being reported. This variable is set by the debug engine when a driver API error is reported.
#define CUDBG_REPORTED_DRIVER_INTERNAL_ERROR_CODE
Name of the global variable containing the driver internal error code. This variable is set by the debug engine when an internal driver error is reported.
#define CUDBG_REPORT_ATTACH_PROCEDURE_FINISHED
Name of the global function that's called to report the completion of the attach procedure. The API client can set a breakpoint on this function to be notified about the completion of the attach procedure. This function is called after the attach is done after signalling CUDBG_INITIATE_DEBUGGER_ATTACH_PROCEDURE_FD.
#define CUDBG_REPORT_DRIVER_API_ERROR
Name of the global function that's called to report a driver API error. The API client can set a breakpoint on this function to be notified about driver API errors.
#define CUDBG_REPORT_DRIVER_API_ERROR_FLAGS
Name of the global variable containing the driver API error flag. This variable is set by the API client to indicate which driver API errors should be reported. See the CUDBGReportDriverApiErrorFlags enum for the list of available flags.
#define CUDBG_REPORT_DRIVER_INTERNAL_ERROR
Name of the global function that's called to report an internal driver error. The API client can set a breakpoint on this function to be notified about internal driver errors.
#define CUDBG_RESUME_FOR_ATTACH_DETACH
Name of the global variable containing the resume for attach detach flag. This variable is set by the debug engine to indicate that the API client should resume the CUDA application (including the CPU) to complete the attach or detach procedure.
#define CUDBG_RPC_ENABLED cudbgRpcEnabled
Name of the global variable containing the RPC enabled flag. This variable is only used by debuggers that use the RPCD interface (e.g. CUDA-GDB).
#define CUDBG_SESSION_ID cudbgSessionId
Name of the global variable containing the session ID. This variable is set by the API client to identify the session.
#define CUDBG_USE_EXTERNAL_DEBUGGER cudbgUseExternalDebugger
Name of the global variable containing the external debug engine in use flag. Can be read to detect whether the external debug engine implementation (libcudadebugger.so) is used or not.

Enumerations

enum CUDBGCapabilityFlags
Debug engine capability flags. Clients should request the capabilities they want by setting the CUDBG_DEBUGGER_CAPABILITIES global variable and then checking the supported capabilities by calling the getSupportedDebuggerCapabilities() API method and adjusting their behavior accordingly. Capabilities requested but not supported by the debug engine will be ignored and should not be relied upon.
enum CUDBGReportDriverApiErrorFlags
API error reporting flags.
enum CUDBGReportedDriverApiErrorSource
Driver API error source.
enum CUDBGResult
Result values of all the API routines.

Functions

void CUDBG_PRE_INIT ( )
Empty global function that gets called before CUDA driver initialization. The API client can set a breakpoint on this function to be notified before the CUDA driver starts its initialization.
void CUDBG_REPORT_ATTACH_PROCEDURE_FINISHED ( void )
Report that the attach procedure has finished. The API client can set a breakpoint on this function to be notified that the attach procedure has finished.
void CUDBG_REPORT_DRIVER_API_ERROR ( void )
Report a driver API error. The API client can set a breakpoint on this function to be notified about driver API errors.
void CUDBG_REPORT_DRIVER_INTERNAL_ERROR ( void )
Report a driver internal error. The API client can set a breakpoint on this function to be notified about driver internal errors.
void cudbgApiAttach ( void )
Attach to a CUDA application. Remotely called by the API client during the attach procedure to attach to the CUDA application.
void cudbgApiDetach ( void )
Detach from a CUDA application. Remotely called by the API client during the detach procedure to detach from the CUDA application.
void cudbgApiInit ( uint32_t arg )
Initialize the CUDA Debugger API. Remotely called by the API client during the attach procedure to initialize the debugger API.
CUDBGResult cudbgGetAPIVersion ( uint32_t* major, uint32_t* minor, uint32_t* rev )
Get the API version supported by the CUDA driver.
const _CUDBG_INLINE char* cudbgGetErrorString ( CUDBGResult error )
Returns the string representation of a result value. It is preferred to use this function instead of indexing CUDBGResultNames directly as future versions of the old API methods might start returning new result values.

Defines

#define CUDBG_APICLIENT_PID cudbgApiClientPid

#define CUDBG_APICLIENT_REVISION cudbgApiClientRevision

#define CUDBG_API_VERSION_MAJOR 13

#define CUDBG_API_VERSION_MINOR 2

#define CUDBG_API_VERSION_REVISION 172

#define CUDBG_ATTACH_HANDLER_AVAILABLE

Value

cudbgAttachHandlerAvailable

#define CUDBG_DEBUGGER_CAPABILITIES

Value

cudbgDebuggerCapabilities

#define CUDBG_DEBUGGER_INITIALIZED cudbgDebuggerInitialized

#define CUDBG_ENABLE_LAUNCH_BLOCKING

Value

cudbgEnableLaunchBlocking

#define CUDBG_INITIATE_DEBUGGER_ATTACH_PROCEDURE_FD

Value

cudbgInitiateDebuggerAttachProcedureFd

#define CUDBG_IPC_FLAG_NAME cudbgIpcFlag

#define CUDBG_MAX_DEVICES 64

#define CUDBG_MAX_LANES 32

#define CUDBG_MAX_LOG_LEN 256

#define CUDBG_MAX_SMS 256

#define CUDBG_MAX_WARPS 64

#define CUDBG_MAX_WARP_BARRIERS 16

#define CUDBG_PRE_INIT cudbgPreInit

#define CUDBG_REPORTED_DRIVER_API_ERROR_CODE

Value

cudbgReportedDriverApiErrorCode

#define CUDBG_REPORTED_DRIVER_API_ERROR_FUNC_NAME_ADDR

Value

cudbgReportedDriverApiErrorFuncNameAddr

#define CUDBG_REPORTED_DRIVER_API_ERROR_FUNC_NAME_SIZE

Value

cudbgReportedDriverApiErrorFuncNameSize

#define CUDBG_REPORTED_DRIVER_API_ERROR_NAME_ADDR

Value

cudbgReportedDriverApiErrorNameAddr

#define CUDBG_REPORTED_DRIVER_API_ERROR_NAME_SIZE

Value

cudbgReportedDriverApiErrorNameSize

#define CUDBG_REPORTED_DRIVER_API_ERROR_SOURCE

Value

cudbgReportedDriverApiErrorSource

#define CUDBG_REPORTED_DRIVER_API_ERROR_STRING_ADDR

Value

cudbgReportedDriverApiErrorStringAddr

#define CUDBG_REPORTED_DRIVER_API_ERROR_STRING_SIZE

Value

cudbgReportedDriverApiErrorStringSize

#define CUDBG_REPORTED_DRIVER_INTERNAL_ERROR_CODE

Value

cudbgReportedDriverInternalErrorCode

#define CUDBG_REPORT_ATTACH_PROCEDURE_FINISHED

Value

cudbgReportAttachProcedureFinished

#define CUDBG_REPORT_DRIVER_API_ERROR

Value

cudbgReportDriverApiError

#define CUDBG_REPORT_DRIVER_API_ERROR_FLAGS

Value

cudbgReportDriverApiErrorFlags

#define CUDBG_REPORT_DRIVER_INTERNAL_ERROR

Value

cudbgReportDriverInternalError

#define CUDBG_RESUME_FOR_ATTACH_DETACH

Value

cudbgResumeForAttachDetach

#define CUDBG_RPC_ENABLED cudbgRpcEnabled

#define CUDBG_SESSION_ID cudbgSessionId

#define CUDBG_USE_EXTERNAL_DEBUGGER cudbgUseExternalDebugger

Note:

Since CUDA 13.1, the external debug engine implementation is always used.

Enumerations

enum CUDBGCapabilityFlags

Values
CUDBG_DEBUGGER_CAPABILITY_NONE = 0
No capabilities.
CUDBG_DEBUGGER_CAPABILITY_LAZY_FUNCTION_LOADING = (1<<0)
Lazy function loading. Static flag: cannot be changed after initialization. Requesting this capability will enable CUDBG_EVENT_FUNCTIONS_LOADED events to be sent. This capability should not be requested until the API client is prepared to handle these events.
CUDBG_DEBUGGER_CAPABILITY_SUSPEND_EVENTS = (1<<1)
Suspend events. Static flag: cannot be changed after initialization. Requesting this capability will enable CUDBG_EVENT_ALL_DEVICES_SUSPENDED events to be sent. This capability should not be requested until the API client is prepared to handle these events.
CUDBG_DEBUGGER_CAPABILITY_REPORT_EXCEPTIONS_IN_EXITED_WARPS = (1<<2)
Report exceptions in exited warps. Static flag: cannot be changed after initialization. Requesting this capability will enable reporting of exceptions in exited warps. This capability should not be requested until the API client is prepared to handle such situations.
CUDBG_DEBUGGER_CAPABILITY_NO_CONTEXT_PUSH_POP_EVENTS = (1<<3)
No context push/pop events. Static flag: cannot be changed after initialization. Requesting this capability will disable the CUDBG_EVENT_CONTEXT_PUSH and CUDBG_EVENT_CONTEXT_POP events. This capability should be requested if the push/pop events are not used by the API client.
CUDBG_DEBUGGER_CAPABILITY_ENABLE_CUDA_LOGS = (1<<4)
Enable CUDA logs. Dynamic flag: can be changed after initialization. Requesting this capability will enable CUDA log capture by the debug engine and cause CUDBG_EVENT_CUDA_LOGS_AVAILABLE and CUDBG_EVENT_CUDA_LOGS_THRESHOLD_REACHED events to be sent. This capability should not be requested until the API client is prepared to handle these events.
CUDBG_DEBUGGER_CAPABILITY_COLLECT_CPU_CALL_STACK_FOR_KERNEL_LAUNCHES = (1<<5)
Collect CPU call stack for kernel launches. Dynamic flag: can be changed after initialization. Requesting this capability will enable collection of CPU call stack for kernel launches. This capability should not be requested if the API client does not plan on calling the readCPUCallStack() API.
CUDBG_DEBUGGER_CAPABILITY_FLUSH_PRINTF_ON_SUSPEND = (1<<6)
Flush printf on suspend. Static flag: cannot be changed after initialization. Requesting this capability will enable flushing of the CUDA printf output on suspend. This capability should generally be requested.
CUDBG_DEBUGGER_CAPABILITY_BREAK_ON_LAUNCH = (1<<7)
Enable break on launch feature. Static flag: cannot be changed after initialization. Requesting this capability will enable the break on launch feature. It may impact launch performance for light workloads. This capability should be requested if break on launch is used.
enum CUDBGReportDriverApiErrorFlags

Values
CUDBG_REPORT_DRIVER_API_ERROR_FLAGS_NONE = 0x0000
No flags set (default behavior).
CUDBG_REPORT_DRIVER_API_ERROR_FLAGS_SUPPRESS_NOT_READY = (1U<<0)
When set, cudaErrorNotReady/cuErrorNotReady will not be reported.
enum CUDBGReportedDriverApiErrorSource

Values
CUDBG_REPORTED_DRIVER_API_ERROR_SOURCE_NONE = 0x000
No error/source.
CUDBG_REPORTED_DRIVER_API_ERROR_SOURCE_DRIVER = 0x001
The error originates from the CUDA Driver API.
CUDBG_REPORTED_DRIVER_API_ERROR_SOURCE_RUNTIME = 0x002
The error originates from the CUDA Runtime API.
enum CUDBGResult

Values
CUDBG_SUCCESS = 0x0000
The API call executed successfully.
CUDBG_ERROR_UNKNOWN = 0x0001
Error type not listed below.
CUDBG_ERROR_BUFFER_TOO_SMALL = 0x0002
Cannot copy all the queried data into the buffer argument.
CUDBG_ERROR_UNKNOWN_FUNCTION = 0x0003
Function cannot be found in the CUDA kernel.
CUDBG_ERROR_INVALID_ARGS = 0x0004
Wrong use of arguments (NULL pointer, illegal value,....).
CUDBG_ERROR_UNINITIALIZED = 0x0005
The API has not yet been properly initialized.
CUDBG_ERROR_INVALID_COORDINATES = 0x0006
Invalid block or thread coordinates were provided.
CUDBG_ERROR_INVALID_MEMORY_SEGMENT = 0x0007
Invalid memory segment requested.
CUDBG_ERROR_INVALID_MEMORY_ACCESS = 0x0008
Requested address (+size) is not within proper segment boundaries.
CUDBG_ERROR_MEMORY_MAPPING_FAILED = 0x0009
Memory is not mapped and cannot be mapped.
CUDBG_ERROR_INTERNAL = 0x000a
A debug engine internal error occurred.
CUDBG_ERROR_INVALID_DEVICE = 0x000b
Specified device cannot be found.
CUDBG_ERROR_INVALID_SM = 0x000c
Specified sm cannot be found.
CUDBG_ERROR_INVALID_WARP = 0x000d
Specified warp cannot be found.
CUDBG_ERROR_INVALID_LANE = 0x000e
Specified lane cannot be found.
CUDBG_ERROR_SUSPENDED_DEVICE = 0x000f
The requested operation is not allowed when the device is suspended.
CUDBG_ERROR_RUNNING_DEVICE = 0x0010
Device is running and not suspended.
CUDBG_ERROR_RESERVED_0 = 0x0011
Reserved error code.
CUDBG_ERROR_INVALID_ADDRESS = 0x0012
Address is out-of-range.
CUDBG_ERROR_INCOMPATIBLE_API = 0x0013
The requested API is not available.
CUDBG_ERROR_INITIALIZATION_FAILURE = 0x0014
The API could not be initialized.
CUDBG_ERROR_INVALID_GRID = 0x0015
The specified grid is not valid.
CUDBG_ERROR_NO_EVENT_AVAILABLE = 0x0016
The event queue is empty and there is no event left to be processed.
CUDBG_ERROR_SOME_DEVICES_WATCHDOGGED = 0x0017
Some devices were excluded because they have a watchdog associated with them.
CUDBG_ERROR_ALL_DEVICES_WATCHDOGGED = 0x0018
All devices were exclude because they have a watchdog associated with them.
CUDBG_ERROR_INVALID_ATTRIBUTE = 0x0019
Specified attribute does not exist or is incorrect.
CUDBG_ERROR_ZERO_CALL_DEPTH = 0x001a
No function calls have been made on the device.
CUDBG_ERROR_INVALID_CALL_LEVEL = 0x001b
Specified call level is invalid.
CUDBG_ERROR_COMMUNICATION_FAILURE = 0x001c
Communication error between the debug engine and the application.
CUDBG_ERROR_INVALID_CONTEXT = 0x001d
Specified context cannot be found.
CUDBG_ERROR_ADDRESS_NOT_IN_DEVICE_MEM = 0x001e
Requested address was not originally allocated from device memory (most likely visible in system memory).
CUDBG_ERROR_MEMORY_UNMAPPING_FAILED = 0x001f
Requested address is not mapped and cannot be unmapped.
CUDBG_ERROR_INCOMPATIBLE_DISPLAY_DRIVER = 0x0020
The display driver is incompatible with the API.
CUDBG_ERROR_INVALID_MODULE = 0x0021
The specified module is not valid.
CUDBG_ERROR_LANE_NOT_IN_SYSCALL = 0x0022
The specified lane is not inside a device syscall.
CUDBG_ERROR_RESERVED_1 = 0x0023
Reserved error code.
CUDBG_ERROR_INVALID_ENVVAR_ARGS = 0x0024
Some environment variable's value is invalid.
CUDBG_ERROR_OS_RESOURCES = 0x0025
Error while allocating resources from the OS.
CUDBG_ERROR_FORK_FAILED = 0x0026
Error while forking the debug engine process.
CUDBG_ERROR_NO_DEVICE_AVAILABLE = 0x0027
No CUDA capable device was found.
CUDBG_ERROR_ATTACH_NOT_POSSIBLE = 0x0028
Attaching to the CUDA program is not possible.
CUDBG_ERROR_WARP_RESUME_NOT_POSSIBLE = 0x0029
The resumeWarpsUntilPC() API is not possible, use resumeDevice() or singleStepWarp() instead.
CUDBG_ERROR_INVALID_WARP_MASK = 0x002a
Specified warp mask is zero, or contains invalid warps.
CUDBG_ERROR_AMBIGUOUS_MEMORY_ADDRESS = 0x002b
Specified device pointer cannot be resolved to a GPU unambiguously because it is valid on more than one GPU.
CUDBG_ERROR_RECURSIVE_API_CALL = 0x002c
Debug API entry point called from within a debug API callback.
CUDBG_ERROR_MISSING_DATA = 0x002d
The requested data is missing.
CUDBG_ERROR_NOT_SUPPORTED = 0x002e
Attempted operation is not supported.
CUDBG_ERROR_BREAKPOINT_STATE_CONFLICT = 0x002f
The current breakpoint state conflicts with the requested operation.

Functions

void CUDBG_PRE_INIT ( )
Empty global function that gets called before CUDA driver initialization. The API client can set a breakpoint on this function to be notified before the CUDA driver starts its initialization.
Description

void CUDBG_REPORT_ATTACH_PROCEDURE_FINISHED ( void )
Report that the attach procedure has finished. The API client can set a breakpoint on this function to be notified that the attach procedure has finished.
Description

void CUDBG_REPORT_DRIVER_API_ERROR ( void )
Report a driver API error. The API client can set a breakpoint on this function to be notified about driver API errors.
Description

void CUDBG_REPORT_DRIVER_INTERNAL_ERROR ( void )
Report a driver internal error. The API client can set a breakpoint on this function to be notified about driver internal errors.
Description

void cudbgApiAttach ( void )
Attach to a CUDA application. Remotely called by the API client during the attach procedure to attach to the CUDA application.
Description

void cudbgApiDetach ( void )
Detach from a CUDA application. Remotely called by the API client during the detach procedure to detach from the CUDA application.
Description

void cudbgApiInit ( uint32_t arg )
Initialize the CUDA Debugger API. Remotely called by the API client during the attach procedure to initialize the debugger API.
Description

CUDBGResult cudbgGetAPIVersion ( uint32_t* major, uint32_t* minor, uint32_t* rev )
Get the API version supported by the CUDA driver.
Parameters
major
- the major version number
minor
- the minor version number
rev
- the revision version number
Returns

CUDBG_ERROR_INVALID_ARGS, CUDBG_SUCCESS

Description

See also:

cudbgGetAPI

const _CUDBG_INLINE char* cudbgGetErrorString ( CUDBGResult error )
Returns the string representation of a result value. It is preferred to use this function instead of indexing CUDBGResultNames directly as future versions of the old API methods might start returning new result values.
Parameters
error
The result value to get the string representation of.
Returns

The string representation of the result value or "*UNDEFINED*" if the result value is not recognized.

Description