3.4. Breakpoints

Defines

#define CUDBG_BREAKPOINT_HANDLE_BREAK_ON_LAUNCH (0xFFFFFFFFFFFFFFFCULL)
Break On Launch breakpoint handle - this breakpoint can be enabled/disabled with enableBreakpoint/disableBreakpoint. It is hit once every time a kernel is launched. It can be hit by one or more warps, but only once. Only supports CUDA Kernel launches (both host-side and device-side launches).
#define CUDBG_BREAKPOINT_HANDLE_INTERNAL (0xFFFFFFFFFFFFFFFDULL)
Special breakpoint handle - internal breakpoint (e.g. used internally for stepping).
#define CUDBG_BREAKPOINT_HANDLE_INVALID (0ULL)
Invalid breakpoint handle.
#define CUDBG_BREAKPOINT_HANDLE_LEGACY (0xFFFFFFFFFFFFFFFEULL)
Special breakpoint handle - breakpoint inserted with setBreakpoint (handle-less).
#define CUDBG_BREAKPOINT_HANDLE_TRAP (0xFFFFFFFFFFFFFFFFULL)
Special breakpoint handle - hard-coded trap.

Typedefs

typedef uint64_t  CUDBGBreakpointHandle
GPU debugger breakpoint handle. Valid breakpoint handles will grow from 1. Handle values of removed breakpoints can be reused in some cases. It is not guaranteed that new (non-reused) breakpoint handles will always be increasing by 1, there can be gaps. A valid handle always corresponds to a single inserted breakpoint, and each breakpoint can only have one handle. Handles with the highest bit set are reserved for special purposes and can correspond to multiple breakpoints.

Enumerations

enum CUDBGAdjAddrAction
Describes which adjusted code address is to be returned.

Variables

CUDBGResult  ( *CUDBGAPI_st::disableBreakpoint )( CUDBGBreakpointHandle handle )
Disable a breakpoint specified by its handle.
CUDBGResult  ( *CUDBGAPI_st::enableBreakpoint )( CUDBGBreakpointHandle handle )
Enable a breakpoint specified by its handle.
CUDBGResult  ( *CUDBGAPI_st::getAdjustedCodeAddress )( uint32_t dev, uint64_t address, uint64_t* adjustedAddress, CUDBGAdjAddrAction adjAction )
Get the adjusted code address for a given code address for a given device.
CUDBGResult  ( *CUDBGAPI_st::getWarpHitBreakpoint )( uint32_t dev, uint32_t sm, uint32_t wp, CUDBGBreakpointHandle* handle )
Get the handle of the breakpoint that the given warp hit.
CUDBGResult  ( *CUDBGAPI_st::insertBreakpoint )( uint32_t dev, uint64_t addr, CUDBGBreakpointHandle* handle )
Set a breakpoint at the given instruction address for the given device.
CUDBGResult  ( *CUDBGAPI_st::isBreakpointEnabled )( CUDBGBreakpointHandle handle, uint32_t* enabled )
Check if a breakpoint specified by its handle is enabled.
CUDBGResult  ( *CUDBGAPI_st::removeBreakpoint )( CUDBGBreakpointHandle handle )
Remove a breakpoint specified by its handle.
CUDBGResult  ( *CUDBGAPI_st::setBreakpoint )( uint32_t dev, uint64_t addr )
Set a breakpoint at the given instruction address for the given device.
CUDBGResult  ( *CUDBGAPI_st::setBreakpoint31 )( uint64_t addr )
Set a breakpoint at the given instruction address.
CUDBGResult  ( *CUDBGAPI_st::unsetBreakpoint )( uint32_t dev, uint64_t addr )
Unset a breakpoint at the given instruction address for the given device.
CUDBGResult  ( *CUDBGAPI_st::unsetBreakpoint31 )( uint64_t addr )
Unset a breakpoint at the given instruction address.

Defines

#define CUDBG_BREAKPOINT_HANDLE_BREAK_ON_LAUNCH (0xFFFFFFFFFFFFFFFCULL)

#define CUDBG_BREAKPOINT_HANDLE_INTERNAL (0xFFFFFFFFFFFFFFFDULL)

#define CUDBG_BREAKPOINT_HANDLE_INVALID (0ULL)

#define CUDBG_BREAKPOINT_HANDLE_LEGACY (0xFFFFFFFFFFFFFFFEULL)

#define CUDBG_BREAKPOINT_HANDLE_TRAP (0xFFFFFFFFFFFFFFFFULL)

Typedefs

typedef uint64_t CUDBGBreakpointHandle

GPU debugger breakpoint handle. Valid breakpoint handles will grow from 1. Handle values of removed breakpoints can be reused in some cases. It is not guaranteed that new (non-reused) breakpoint handles will always be increasing by 1, there can be gaps. A valid handle always corresponds to a single inserted breakpoint, and each breakpoint can only have one handle. Handles with the highest bit set are reserved for special purposes and can correspond to multiple breakpoints.

Enumerations

enum CUDBGAdjAddrAction

Values
CUDBG_ADJ_PREVIOUS_ADDRESS = 0x000
Get the adjusted previous code address.
CUDBG_ADJ_CURRENT_ADDRESS = 0x001
Get the adjusted next code address.
CUDBG_ADJ_NEXT_ADDRESS = 0x002
Get the adjusted current code address.

Variables

CUDBGResult ( *CUDBGAPI_st::disableBreakpoint )( CUDBGBreakpointHandle handle )

Disable a breakpoint specified by its handle. Disabling/enabling a breakpoint might be faster than removing and inserting it again.

Since CUDA 13.2.

See also:

enableBreakpoint

getWarpHitBreakpoint

insertBreakpoint

isBreakpointEnabled

removeBreakpoint

Parameters
handle
- the breakpoint handle
Returns

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UNINITIALIZED, CUDBG_ERROR_INTERNAL, CUDBG_ERROR_INITIALIZATION_FAILURE, CUDBG_ERROR_RECURSIVE_API_CALL, CUDBG_ERROR_BREAKPOINT_STATE_CONFLICT

CUDBGResult ( *CUDBGAPI_st::enableBreakpoint )( CUDBGBreakpointHandle handle )

Enable a breakpoint specified by its handle. Disabling/enabling a breakpoint might be faster than removing and inserting it again.

Since CUDA 13.2.

See also:

disableBreakpoint

getWarpHitBreakpoint

insertBreakpoint

isBreakpointEnabled

removeBreakpoint

Parameters
handle
- the breakpoint handle
Returns

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UNINITIALIZED, CUDBG_ERROR_INTERNAL, CUDBG_ERROR_INITIALIZATION_FAILURE, CUDBG_ERROR_RECURSIVE_API_CALL, CUDBG_ERROR_BREAKPOINT_STATE_CONFLICT

CUDBGResult ( *CUDBGAPI_st::getAdjustedCodeAddress )( uint32_t dev, uint64_t address, uint64_t* adjustedAddress, CUDBGAdjAddrAction adjAction )

Get the adjusted code address for a given code address for a given device. The client must call this function before inserting a breakpoint, or when the previous or next code address is needed for breakpoint inserting purposes.

Since CUDA 5.5.

See also:

setBreakpoint

Parameters
dev
- device index
address
adjustedAddress
- adjusted address
adjAction
- whether the adjusted next, previous or current address is needed
Returns

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UNINITIALIZED, CUDBG_ERROR_INTERNAL, CUDBG_ERROR_INVALID_ADDRESS, CUDBG_ERROR_INITIALIZATION_FAILURE, CUDBG_ERROR_RECURSIVE_API_CALL

CUDBGResult ( *CUDBGAPI_st::getWarpHitBreakpoint )( uint32_t dev, uint32_t sm, uint32_t wp, CUDBGBreakpointHandle* handle )

Get the handle of the breakpoint that the given warp hit. An error is returned if the warp did not hit a breakpoint. Use readBrokenWarps() to check if the warp is broken before calling this method. Some breakpoint handles are special, see the documentation of CUDBGBreakpointHandle for more details.

Since CUDA 13.2.

See also:

disableBreakpoint

enableBreakpoint

insertBreakpoint

isBreakpointEnabled

readBrokenWarps

removeBreakpoint

Parameters
dev
- device index
sm
- SM index
wp
- warp index
handle
- the returned breakpoint handle
Returns

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UNINITIALIZED, CUDBG_ERROR_INTERNAL, CUDBG_ERROR_INVALID_WARP, CUDBG_ERROR_INITIALIZATION_FAILURE, CUDBG_ERROR_INVALID_CONTEXT, CUDBG_ERROR_RECURSIVE_API_CALL

CUDBGResult ( *CUDBGAPI_st::insertBreakpoint )( uint32_t dev, uint64_t addr, CUDBGBreakpointHandle* handle )

Set a breakpoint at the given instruction address for the given device. Before setting a breakpoint, getAdjustedCodeAddress() should be called to get the adjusted breakpoint address. The returned handle can be used to enable/disable/remove the breakpoint.

Since CUDA 13.2.

See also:

disableBreakpoint

enableBreakpoint

getWarpHitBreakpoint

isBreakpointEnabled

removeBreakpoint

Parameters
dev
- the device index
addr
- instruction address
handle
- the returned breakpoint handle
Returns

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UNINITIALIZED, CUDBG_ERROR_INTERNAL, CUDBG_ERROR_INVALID_ADDRESS, CUDBG_ERROR_INITIALIZATION_FAILURE, CUDBG_ERROR_RECURSIVE_API_CALL, CUDBG_ERROR_BREAKPOINT_STATE_CONFLICT

CUDBGResult ( *CUDBGAPI_st::isBreakpointEnabled )( CUDBGBreakpointHandle handle, uint32_t* enabled )

Check if a breakpoint specified by its handle is enabled. Since CUDA 13.2.

See also:

disableBreakpoint

enableBreakpoint

getWarpHitBreakpoint

insertBreakpoint

removeBreakpoint

Parameters
handle
- the breakpoint handle
enabled
- whether the breakpoint is enabled
Returns

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UNINITIALIZED, CUDBG_ERROR_INTERNAL, CUDBG_ERROR_INITIALIZATION_FAILURE, CUDBG_ERROR_RECURSIVE_API_CALL

CUDBGResult ( *CUDBGAPI_st::removeBreakpoint )( CUDBGBreakpointHandle handle )

Remove a breakpoint specified by its handle. Since CUDA 13.2.

See also:

disableBreakpoint

enableBreakpoint

getWarpHitBreakpoint

insertBreakpoint

isBreakpointEnabled

Parameters
handle
- the breakpoint handle
Returns

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UNINITIALIZED, CUDBG_ERROR_INTERNAL, CUDBG_ERROR_INITIALIZATION_FAILURE, CUDBG_ERROR_RECURSIVE_API_CALL

CUDBGResult ( *CUDBGAPI_st::setBreakpoint )( uint32_t dev, uint64_t addr )

Set a breakpoint at the given instruction address for the given device. Before setting a breakpoint, getAdjustedCodeAddress() should be called to get the adjusted breakpoint address.

Since CUDA 3.2.

See also:

unsetBreakpoint

Parameters
dev
- device index
addr
- instruction address
Returns

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UNINITIALIZED, CUDBG_ERROR_INTERNAL, CUDBG_ERROR_INVALID_ADDRESS, CUDBG_ERROR_INITIALIZATION_FAILURE, CUDBG_ERROR_RECURSIVE_API_CALL

CUDBGResult ( *CUDBGAPI_st::setBreakpoint31 )( uint64_t addr )

Set a breakpoint at the given instruction address. Behaves like setBreakpoint but tries to automatically find a device for the given address.

Since CUDA 3.0.

Note:

DEPRECATED in CUDA 3.2: Use setBreakpoint instead.

See also:

setBreakpoint

Parameters
addr
- instruction address
Returns

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UNINITIALIZED, CUDBG_ERROR_INTERNAL, CUDBG_ERROR_INVALID_ADDRESS, CUDBG_ERROR_INITIALIZATION_FAILURE, CUDBG_ERROR_RECURSIVE_API_CALL

CUDBGResult ( *CUDBGAPI_st::unsetBreakpoint )( uint32_t dev, uint64_t addr )

Unset a breakpoint at the given instruction address for the given device. Since CUDA 3.2.

See also:

setBreakpoint

Parameters
dev
- device index
addr
- instruction address
Returns

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UNINITIALIZED, CUDBG_ERROR_INTERNAL, CUDBG_ERROR_INITIALIZATION_FAILURE, CUDBG_ERROR_RECURSIVE_API_CALL

CUDBGResult ( *CUDBGAPI_st::unsetBreakpoint31 )( uint64_t addr )

Unset a breakpoint at the given instruction address. Behaves like unsetBreakpoint but tries to automatically find a device for the given address.

Since CUDA 3.0.

Note:

DEPRECATED in CUDA 3.2: Use unsetBreakpoint instead.

See also:

unsetBreakpoint

Parameters
addr
- instruction address
Returns

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UNINITIALIZED, CUDBG_ERROR_INTERNAL, CUDBG_ERROR_INVALID_ADDRESS, CUDBG_ERROR_INITIALIZATION_FAILURE, CUDBG_ERROR_RECURSIVE_API_CALL