General

Macros

CUDBG_APICLIENT_PID

Name of the global variable containing the API client PID.

CUDBG_APICLIENT_REVISION

Name of the global variable containing the API client revision.

CUDBG_API_VERSION_MAJOR

Major release version number.

CUDBG_API_VERSION_MINOR

Minor release version number.

CUDBG_API_VERSION_REVISION

API revision number.

CUDBG_ATTACH_HANDLER_AVAILABLE

Name of the global variable containing the attach handler available flag.

CUDBG_DEBUGGER_CAPABILITIES

Name of the global variable containing the debug engine capabilities bitmask.

CUDBG_DEBUGGER_INITIALIZED

Name of the global variable containing the debug engine initialized flag.

CUDBG_ENABLE_LAUNCH_BLOCKING

Name of the global variable containing the enable launch blocking flag.

CUDBG_INITIATE_DEBUGGER_ATTACH_PROCEDURE_FD

Name of the global variable containing the debug engine attach procedure initiation FD.

CUDBG_IPC_FLAG_NAME

Name of the global variable containing the IPC flag.

CUDBG_MAX_DEVICES

Maximum number of supported devices.

CUDBG_MAX_LANES

Maximum number of lanes per warp.

CUDBG_MAX_LOG_LEN

Maximum length of a single CUDA log message.

CUDBG_MAX_SMS

Maximum number of SMs per device.

CUDBG_MAX_WARPS

Maximum number of warps per SM.

CUDBG_MAX_WARP_BARRIERS

Maximum number of convergence barriers per warp.

CUDBG_PRE_INIT

Name of the pre-init global function.

CUDBG_REPORTED_DRIVER_API_ERROR_CODE

Name of the global variable containing the code of the driver API error being reported.

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.

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.

CUDBG_REPORTED_DRIVER_API_ERROR_NAME_ADDR

Name of the global variable containing the address where the driver API error name is stored.

CUDBG_REPORTED_DRIVER_API_ERROR_NAME_SIZE

Name of the global variable containing the size of the driver API error name being reported.

CUDBG_REPORTED_DRIVER_API_ERROR_SOURCE

Name of the global variable containing the driver API error source.

CUDBG_REPORTED_DRIVER_API_ERROR_STRING_ADDR

Name of the global variable containing the address where the driver API error string is stored.

CUDBG_REPORTED_DRIVER_API_ERROR_STRING_SIZE

Name of the global variable containing the size of the driver API error string being reported.

CUDBG_REPORTED_DRIVER_INTERNAL_ERROR_CODE

Name of the global variable containing the driver internal error code.

CUDBG_REPORT_ATTACH_PROCEDURE_FINISHED

Name of the global function that's called to report the completion of the attach procedure.

CUDBG_REPORT_DRIVER_API_ERROR

Name of the global function that's called to report a driver API error.

CUDBG_REPORT_DRIVER_API_ERROR_FLAGS

Name of the global variable containing the driver API error flag.

CUDBG_REPORT_DRIVER_INTERNAL_ERROR

Name of the global function that's called to report an internal driver error.

CUDBG_RESUME_FOR_ATTACH_DETACH

Name of the global variable containing the resume for attach detach flag.

CUDBG_RPC_ENABLED

Name of the global variable containing the RPC enabled flag.

CUDBG_SESSION_ID

Name of the global variable containing the session ID.

CUDBG_USE_EXTERNAL_DEBUGGER

Name of the global variable containing the external debug engine in use flag.

Enumerations

CUDBGCapabilityFlags

Debug engine capability flags.

CUDBGReportDriverApiErrorFlags

API error reporting flags.

CUDBGReportedDriverApiErrorSource

Driver API error source.

CUDBGResult

Result values of all the API routines.

Functions

void cudbgApiAttach(void)

Attach to a CUDA application.

void cudbgApiDetach(void)

Detach from a CUDA application.

void cudbgApiInit(uint32_t arg)

Initialize the CUDA Debugger API.

CUDBGResult cudbgGetAPI(uint32_t major, uint32_t minor, uint32_t rev, CUDBGAPI *api)

Get the API associated with the major/minor/revision version numbers.

CUDBGResult cudbgGetAPIVersion(uint32_t *major, uint32_t *minor, uint32_t *rev)

Get the API version supported by the CUDA driver.

const char * cudbgGetErrorString(CUDBGResult error)

Returns the string representation of a result value.

void cudbgPreInit()

Empty global function that gets called before CUDA driver initialization.

void cudbgReportAttachProcedureFinished(void)

Report that the attach procedure has finished.

void cudbgReportDriverApiError(void)

Report a driver API error.

void cudbgReportDriverInternalError(void)

Report a driver internal error.

Structs

CuDim2

2-dimensional coordinates for threads, blocks, etc.

CuDim3

3-dimensional coordinates for threads, blocks, etc.

Typedefs

CUDBGAPI

CUDA Debugger API methods.

Macros

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.

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.

CUDBG_API_VERSION_MAJOR 13

Major release version number.

This matches the major version of the CUDA driver exposing this API.

CUDBG_API_VERSION_MINOR 4

Minor release version number.

This matches the minor version of the CUDA driver exposing this API.

CUDBG_API_VERSION_REVISION 193

API revision number.

This number is incremented every time changes are made to the API.

CUDBG_ATTACH_HANDLER_AVAILABLE cudbgAttachHandlerAvailable

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.

CUDBG_DEBUGGER_CAPABILITIES cudbgDebuggerCapabilities

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.

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.

CUDBG_ENABLE_LAUNCH_BLOCKING cudbgEnableLaunchBlocking

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.

CUDBG_INITIATE_DEBUGGER_ATTACH_PROCEDURE_FD cudbgInitiateDebuggerAttachProcedureFd

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.

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.

CUDBG_MAX_DEVICES 64

Maximum number of supported devices.

CUDBG_MAX_LANES 32

Maximum number of lanes per warp.

CUDBG_MAX_LOG_LEN 256

Maximum length of a single CUDA log message.

CUDBG_MAX_SMS 256

Maximum number of SMs per device.

CUDBG_MAX_WARPS 64

Maximum number of warps per SM.

CUDBG_MAX_WARP_BARRIERS 16

Maximum number of convergence barriers per warp.

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.

CUDBG_REPORTED_DRIVER_API_ERROR_CODE cudbgReportedDriverApiErrorCode

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.

CUDBG_REPORTED_DRIVER_API_ERROR_FUNC_NAME_ADDR cudbgReportedDriverApiErrorFuncNameAddr

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.

CUDBG_REPORTED_DRIVER_API_ERROR_FUNC_NAME_SIZE cudbgReportedDriverApiErrorFuncNameSize

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.

CUDBG_REPORTED_DRIVER_API_ERROR_NAME_ADDR cudbgReportedDriverApiErrorNameAddr

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.

CUDBG_REPORTED_DRIVER_API_ERROR_NAME_SIZE cudbgReportedDriverApiErrorNameSize

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.

CUDBG_REPORTED_DRIVER_API_ERROR_SOURCE cudbgReportedDriverApiErrorSource

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.

CUDBG_REPORTED_DRIVER_API_ERROR_STRING_ADDR cudbgReportedDriverApiErrorStringAddr

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.

CUDBG_REPORTED_DRIVER_API_ERROR_STRING_SIZE cudbgReportedDriverApiErrorStringSize

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.

CUDBG_REPORTED_DRIVER_INTERNAL_ERROR_CODE cudbgReportedDriverInternalErrorCode

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.

CUDBG_REPORT_ATTACH_PROCEDURE_FINISHED cudbgReportAttachProcedureFinished

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.

CUDBG_REPORT_DRIVER_API_ERROR cudbgReportDriverApiError

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.

CUDBG_REPORT_DRIVER_API_ERROR_FLAGS cudbgReportDriverApiErrorFlags

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.

CUDBG_REPORT_DRIVER_INTERNAL_ERROR cudbgReportDriverInternalError

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.

CUDBG_RESUME_FOR_ATTACH_DETACH cudbgResumeForAttachDetach

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.

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).

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.

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.

Note

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

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.

Values:

enumerator CUDBG_DEBUGGER_CAPABILITY_NONE

No capabilities.

enumerator CUDBG_DEBUGGER_CAPABILITY_LAZY_FUNCTION_LOADING

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.

enumerator CUDBG_DEBUGGER_CAPABILITY_SUSPEND_EVENTS

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.

enumerator CUDBG_DEBUGGER_CAPABILITY_REPORT_EXCEPTIONS_IN_EXITED_WARPS

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.

enumerator CUDBG_DEBUGGER_CAPABILITY_NO_CONTEXT_PUSH_POP_EVENTS

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.

enumerator CUDBG_DEBUGGER_CAPABILITY_ENABLE_CUDA_LOGS

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.

enumerator CUDBG_DEBUGGER_CAPABILITY_COLLECT_CPU_CALL_STACK_FOR_KERNEL_LAUNCHES

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.

enumerator CUDBG_DEBUGGER_CAPABILITY_FLUSH_PRINTF_ON_SUSPEND

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.

enumerator CUDBG_DEBUGGER_CAPABILITY_BREAK_ON_LAUNCH

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

API error reporting flags.

Values:

enumerator CUDBG_REPORT_DRIVER_API_ERROR_FLAGS_NONE

No flags set (default behavior).

enumerator CUDBG_REPORT_DRIVER_API_ERROR_FLAGS_SUPPRESS_NOT_READY

When set, cudaErrorNotReady/cuErrorNotReady will not be reported.

enum CUDBGReportedDriverApiErrorSource

Driver API error source.

Values:

enumerator CUDBG_REPORTED_DRIVER_API_ERROR_SOURCE_NONE

No error/source.

enumerator CUDBG_REPORTED_DRIVER_API_ERROR_SOURCE_DRIVER

The error originates from the CUDA Driver API.

enumerator CUDBG_REPORTED_DRIVER_API_ERROR_SOURCE_RUNTIME

The error originates from the CUDA Runtime API.

enum CUDBGResult

Result values of all the API routines.

Values:

enumerator CUDBG_SUCCESS

The API call executed successfully.

enumerator CUDBG_ERROR_UNKNOWN

Error type not listed below.

enumerator CUDBG_ERROR_BUFFER_TOO_SMALL

Cannot copy all the queried data into the buffer argument.

enumerator CUDBG_ERROR_UNKNOWN_FUNCTION

Function cannot be found in the CUDA kernel.

enumerator CUDBG_ERROR_INVALID_ARGS

Wrong use of arguments (NULL pointer, illegal value,….).

enumerator CUDBG_ERROR_UNINITIALIZED

The API has not yet been properly initialized.

enumerator CUDBG_ERROR_INVALID_COORDINATES

Invalid block or thread coordinates were provided.

enumerator CUDBG_ERROR_INVALID_MEMORY_SEGMENT

Invalid memory segment requested.

enumerator CUDBG_ERROR_INVALID_MEMORY_ACCESS

Requested address (+size) is not within proper segment boundaries.

enumerator CUDBG_ERROR_MEMORY_MAPPING_FAILED

Memory is not mapped and cannot be mapped.

enumerator CUDBG_ERROR_INTERNAL

A debug engine internal error occurred.

enumerator CUDBG_ERROR_INVALID_DEVICE

Specified device cannot be found.

enumerator CUDBG_ERROR_INVALID_SM

Specified sm cannot be found.

enumerator CUDBG_ERROR_INVALID_WARP

Specified warp cannot be found.

enumerator CUDBG_ERROR_INVALID_LANE

Specified lane cannot be found.

enumerator CUDBG_ERROR_SUSPENDED_DEVICE

The requested operation is not allowed when the device is suspended.

enumerator CUDBG_ERROR_RUNNING_DEVICE

Device is running and not suspended.

enumerator CUDBG_ERROR_RESERVED_0

Reserved error code.

enumerator CUDBG_ERROR_INVALID_ADDRESS

Address is out-of-range.

enumerator CUDBG_ERROR_INCOMPATIBLE_API

The requested API is not available.

enumerator CUDBG_ERROR_INITIALIZATION_FAILURE

The API could not be initialized.

enumerator CUDBG_ERROR_INVALID_GRID

The specified grid is not valid.

enumerator CUDBG_ERROR_NO_EVENT_AVAILABLE

The event queue is empty and there is no event left to be processed.

enumerator CUDBG_ERROR_SOME_DEVICES_WATCHDOGGED

Some devices were excluded because they have a watchdog associated with them.

enumerator CUDBG_ERROR_ALL_DEVICES_WATCHDOGGED

All devices were exclude because they have a watchdog associated with them.

enumerator CUDBG_ERROR_INVALID_ATTRIBUTE

Specified attribute does not exist or is incorrect.

enumerator CUDBG_ERROR_ZERO_CALL_DEPTH

No function calls have been made on the device.

enumerator CUDBG_ERROR_INVALID_CALL_LEVEL

Specified call level is invalid.

enumerator CUDBG_ERROR_COMMUNICATION_FAILURE

Communication error between the debug engine and the application.

enumerator CUDBG_ERROR_INVALID_CONTEXT

Specified context cannot be found.

enumerator CUDBG_ERROR_ADDRESS_NOT_IN_DEVICE_MEM

Requested address was not originally allocated from device memory (most likely visible in system memory).

enumerator CUDBG_ERROR_MEMORY_UNMAPPING_FAILED

Requested address is not mapped and cannot be unmapped.

enumerator CUDBG_ERROR_INCOMPATIBLE_DISPLAY_DRIVER

The display driver is incompatible with the API.

enumerator CUDBG_ERROR_INVALID_MODULE

The specified module is not valid.

enumerator CUDBG_ERROR_LANE_NOT_IN_SYSCALL

The specified lane is not inside a device syscall.

enumerator CUDBG_ERROR_RESERVED_1

Reserved error code.

enumerator CUDBG_ERROR_INVALID_ENVVAR_ARGS

Some environment variable’s value is invalid.

enumerator CUDBG_ERROR_OS_RESOURCES

Error while allocating resources from the OS.

enumerator CUDBG_ERROR_FORK_FAILED

Error while forking the debug engine process.

enumerator CUDBG_ERROR_NO_DEVICE_AVAILABLE

No CUDA capable device was found.

enumerator CUDBG_ERROR_ATTACH_NOT_POSSIBLE

Attaching to the CUDA program is not possible.

enumerator CUDBG_ERROR_WARP_RESUME_NOT_POSSIBLE

The resumeWarpsUntilPC() API is not possible, use resumeDevice() or singleStepWarp() instead.

enumerator CUDBG_ERROR_INVALID_WARP_MASK

Specified warp mask is zero, or contains invalid warps.

enumerator CUDBG_ERROR_AMBIGUOUS_MEMORY_ADDRESS

Specified device pointer cannot be resolved to a GPU unambiguously because it is valid on more than one GPU.

enumerator CUDBG_ERROR_RECURSIVE_API_CALL

Debug API entry point called from within a debug API callback.

enumerator CUDBG_ERROR_MISSING_DATA

The requested data is missing.

enumerator CUDBG_ERROR_NOT_SUPPORTED

Attempted operation is not supported.

enumerator CUDBG_ERROR_BREAKPOINT_STATE_CONFLICT

The current breakpoint state conflicts with the requested operation.

Functions

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 cudbgGetAPI(uint32_t major, uint32_t minor, uint32_t rev, CUDBGAPI *api)

Get the API associated with the major/minor/revision version numbers.

Parameters
  • major – - the major version number

  • minor – - the minor version number

  • rev – - the revision version number

  • api – - the pointer to the API

Returns

CUDBG_ERROR_INVALID_ARGS,

Returns

CUDBG_SUCCESS,

Returns

CUDBG_ERROR_INCOMPATIBLE_API

CUDBGResult cudbgGetAPIVersion(uint32_t *major, uint32_t *minor, uint32_t *rev)

Get the API version supported by the CUDA driver.

See also

cudbgGetAPI

Parameters
  • major – - the major version number

  • minor – - the minor version number

  • rev – - the revision version number

Returns

CUDBG_ERROR_INVALID_ARGS,

Returns

CUDBG_SUCCESS

static inline const 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.

void cudbgPreInit()

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 cudbgReportAttachProcedureFinished(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 cudbgReportDriverApiError(void)

Report a driver API error.

The API client can set a breakpoint on this function to be notified about driver API errors.

void cudbgReportDriverInternalError(void)

Report a driver internal error.

The API client can set a breakpoint on this function to be notified about driver internal errors.

Typedefs

typedef const struct CUDBGAPI_st *CUDBGAPI

CUDA Debugger API methods.