My code with sanitizerGetFunctionPcAndSize:
void SANITIZERAPI
my_callback(void *userdata,
Sanitizer_CallbackDomain domain,
Sanitizer_CallbackId cbid,
const void *cbdata)
{
if (domain == SANITIZER_CB_DOMAIN_LAUNCH) {
Sanitizer_LaunchData *ld = (Sanitizer_LaunchData *)cbdata;
if (cbid == SANITIZER_CBID_LAUNCH_BEGIN) {
std::cout << "launch begin" << std::endl;
std::cout << "mod: " << ld->module << ", name: " << ld->functionName << std::endl;
uint64_t function_pc = 0, function_size = 0;
auto ret = sanitizerGetFunctionPcAndSize(ld->module, ld->functionName, &function_pc,
&function_size);
std::cout << "ret: " << ret << ", function pc: " << function_pc << ", function size: " << function_size << std::endl;
} else if (cbid == SANITIZER_CBID_LAUNCH_AFTER_SYSCALL_SETUP) {
std::cout << "launch after syscall setup" << std::endl;
} else if (cbid == SANITIZER_CBID_LAUNCH_END) {
std::cout << "launch end" << std::endl;
}
}
}
the callback is successfully called, but the get pc call returns error. The output:
launch begin
mod: 0x56276de445e0, name: _Z9vectorAddPKfS0_Pfi
ret: 1, function pc: 0, function size: 0
launch after syscall setup
launch end
My CUDA version:
nvidia-smi
Thu Jul 3 15:30:00 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 560.28.03 Driver Version: 560.28.03 CUDA Version: 12.6 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 4090 D Off | 00000000:B1:00.0 Off | Off |
| 32% 40C P8 19W / 425W | 15MiB / 24564MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Fri_Jun_14_16:34:21_PDT_2024
Cuda compilation tools, release 12.6, V12.6.20
Build cuda_12.6.r12.6/compiler.34431801_0