3.9. DWARF 工具集

变量

CUDBGResult  ( *CUDBGAPI_st::disassemble )( uint32_t dev, uint64_t addr, uint32_t* instSize, char* buf, uint32_t sz )
Disassemble instruction at instruction address.
CUDBGResult  ( *CUDBGAPI_st::getElfImageByHandle )( uint32_t devId, uint64_t handle, CUDBGElfImageType type, void* elfImage, uint64_t size )
Get the relocated or non-relocated ELF image for the given handle on the given device.
CUDBGResult  ( *CUDBGAPI_st::getHostAddrFromDeviceAddr )( uint32_t dev, uint64_t device_addr, uint64_t* host_addr )
given a device virtual address, return a corresponding system memory virtual address.
CUDBGResult  ( *CUDBGAPI_st::getPhysicalRegister30 )( uint64_t pc, char* reg, uint32_t* buf, uint32_t sz, uint32_t* numPhysRegs, CUDBGRegClass* regClass )
Get the physical register number(s) assigned to a virtual register name 'reg' at a given PC, if 'reg' is live at that PC.
CUDBGResult  ( *CUDBGAPI_st::getPhysicalRegister40 )( uint32_t dev, uint32_t sm, uint32_t wp, uint64_t pc, char* reg, uint32_t* buf, uint32_t sz, uint32_t* numPhysRegs, CUDBGRegClass* regClass )
Get the physical register number(s) assigned to a virtual register name 'reg' at a given PC, if 'reg' is live at that PC.
CUDBGResult  ( *CUDBGAPI_st::isDeviceCodeAddress )( uintptr_t addr, bool* isDeviceAddress )
Determines whether a virtual address resides within device code.
CUDBGResult  ( *CUDBGAPI_st::isDeviceCodeAddress55 )( uintptr_t addr, bool* isDeviceAddress )
Determines whether a virtual address resides within device code. This API is strongly deprecated. Use CUDBGAPI_st::isDeviceCodeAddress instead.
CUDBGResult  ( *CUDBGAPI_st::lookupDeviceCodeSymbol )( char* symName, bool* symFound, uintptr_t* symAddr )
Determines whether a symbol represents a function in device code and returns its virtual address.

变量

CUDBGResult ( *CUDBGAPI_st::disassemble )( uint32_t dev, uint64_t addr, uint32_t* instSize, char* buf, uint32_t sz )

反汇编指定指令地址处的指令。自CUDA 3.0起支持。

参数
dev
- device index
addr
- instruction address
instSize
- instruction size (32 or 64 bits)
buf
- disassembled instruction buffer
sz
- disassembled instruction buffer size
返回

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_INVALID_DEVICE, CUDBG_ERROR_UNKNOWN

CUDBGResult ( *CUDBGAPI_st::getElfImageByHandle )( uint32_t devId, uint64_t handle, CUDBGElfImageType type, void* elfImage, uint64_t size )

获取给定设备上指定句柄的重定位或非重定位ELF映像。该句柄由ELF映像加载通知事件提供。

自 CUDA 6.0 起。

参数
devId
- device index
handle
- elf image handle
type
- type of the requested ELF image
elfImage
- pointer to the ELF image
size
返回

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_INVALID_DEVICE, CUDBG_ERROR_UNINITIALIZED

CUDBGResult ( *CUDBGAPI_st::getHostAddrFromDeviceAddr )( uint32_t dev, uint64_t device_addr, uint64_t* host_addr )

给定一个设备虚拟地址,返回对应的系统内存虚拟地址。自CUDA 4.1起。

另请参阅:

readGenericMemory

writeGenericMemory

参数
dev
- device index
device_addr
- device memory address
host_addr
- returned system memory address
返回

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_INVALID_DEVICE, CUDBG_ERROR_INVALID_CONTEXT, CUDBG_ERROR_INVALID_MEMORY_SEGMENT

CUDBGResult ( *CUDBGAPI_st::getPhysicalRegister30 )( uint64_t pc, char* reg, uint32_t* buf, uint32_t sz, uint32_t* numPhysRegs, CUDBGRegClass* regClass )

获取在给定程序计数器(PC)位置分配给虚拟寄存器名称'reg'的物理寄存器编号,前提是该寄存器在该PC位置处于活跃状态。 自CUDA 3.0起支持此功能。

参数
pc
- Program counter
reg
- virtual register index
buf
- physical register name(s)
sz
- the physical register name buffer size
numPhysRegs
- number of physical register names returned
regClass
- the class of the physical registers
返回

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UKNOWN_FUNCTION, CUDBG_ERROR_UNKNOWN

CUDBGResult ( *CUDBGAPI_st::getPhysicalRegister40 )( uint32_t dev, uint32_t sm, uint32_t wp, uint64_t pc, char* reg, uint32_t* buf, uint32_t sz, uint32_t* numPhysRegs, CUDBGRegClass* regClass )

获取在给定PC处分配给虚拟寄存器名称'reg'的物理寄存器编号(如果'reg'在该PC处是活跃的)。 获取在给定PC处分配给虚拟寄存器名称'reg'的物理寄存器编号(如果'reg'在该PC处是活跃的)。 如果一个虚拟寄存器名称映射到多个物理寄存器,则具有最低物理寄存器索引的物理寄存器将包含虚拟寄存器的最高位, 而具有最高物理寄存器索引的物理寄存器将包含虚拟寄存器的最低位。

自 CUDA 3.1 起。

参数
dev
- device index
sm
- SM index
wp
- warp indx
pc
- Program counter
reg
- virtual register index
buf
- physical register name(s)
sz
- the physical register name buffer size
numPhysRegs
- number of physical register names returned
regClass
- the class of the physical registers
返回

CUDBG_SUCCESS, CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UKNOWN_FUNCTION, CUDBG_ERROR_UNKNOWN

CUDBGResult ( *CUDBGAPI_st::isDeviceCodeAddress )( uintptr_t addr, bool* isDeviceAddress )

判断虚拟地址是否位于设备代码内。自CUDA 3.0起。

参数
addr
- virtual address
isDeviceAddress
- true if address resides within device code
返回

CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UNINITIALIZED, CUDBG_SUCCESS

CUDBGResult ( *CUDBGAPI_st::isDeviceCodeAddress55 )( uintptr_t addr, bool* isDeviceAddress )

判断一个虚拟地址是否位于设备代码中。此API已强烈不建议使用。请改用CUDBGAPI_st::isDeviceCodeAddress。自CUDA 3.0起。

参数
addr
- virtual address
isDeviceAddress
- true if address resides within device code
返回

CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UNINITIALIZED, CUDBG_SUCCESS

CUDBGResult ( *CUDBGAPI_st::lookupDeviceCodeSymbol )( char* symName, bool* symFound, uintptr_t* symAddr )

确定一个符号是否表示设备代码中的函数并返回其虚拟地址。自CUDA 3.0起。

参数
symName
- symbol name
symFound
- set to true if the symbol is found
symAddr
- the symbol virtual address if found
返回

CUDBG_ERROR_INVALID_ARGS, CUDBG_ERROR_UNINITIALIZED, CUDBG_SUCCESS