[rocprofiler-sdk] ROCpd GOTCHA Fix (#720)

* Update GOTCHA submodule

- public API for gotcha_init
- switch repo to ROCm/gotcha

* rocpd interop GOTCHA updates

- fix issues wrapping dlopen/dlsym
This commit is contained in:
Jonathan R. Madsen
2025-09-23 10:45:56 -05:00
committad av GitHub
förälder 68cd123b0f
incheckning 9278770b89
4 ändrade filer med 25 tillägg och 2 borttagningar
+1 -1
Visa fil
@@ -49,7 +49,7 @@
url = https://github.com/pybind/pybind11.git
[submodule "projects/rocprofiler-sdk/external/gotcha"]
path = projects/rocprofiler-sdk/external/gotcha
url = https://jrmadsen@github.com/jrmadsen/GOTCHA
url = https://github.com/ROCm/GOTCHA
[submodule "projects/rocprofiler-systems/external/timemory"]
path = projects/rocprofiler-systems/external/timemory
url = https://github.com/ROCm/timemory.git
@@ -32,6 +32,13 @@ try:
except Exception:
pass
try:
import sqlite3
sqlite3.connect(":memory:") # Test if sqlite3 is available
except Exception:
pass
from . import libpyrocpd
from .importer import RocpdImportData
@@ -161,6 +161,22 @@ auto bindings = std::array<gotcha_binding_t, 4>{
void
activate_gotcha_bindings()
{
#if defined(GOTCHA_INIT) && GOTCHA_INIT > 0
// initialize gotcha
gotcha_init_config_t gotcha_cfg = {
.size = sizeof(gotcha_init_config_t), .dl_open_bind = 0, .dl_sym_bind = 0};
gotcha_init(&gotcha_cfg);
#endif
// this ensures that the sqlite3 module is imported and the sqlite3_open_v2 and sqlite3_close_v2
// in lib-dynload/_sqlite3.cpython-*.so are remapped to the gotcha bindings.
// this is needed to ensure that the sqlite3 connections are captured by gotcha
{
auto sqlite3_mod = py::module_::import("sqlite3");
auto ret = sqlite3_mod.attr("connect")(":memory:");
ret.attr("close")();
}
// activate the gotcha wrappers
auto _err = gotcha_wrap(bindings.data(), bindings.size(), "rocpd.sqlite3");
ROCP_WARNING_IF(_err != GOTCHA_SUCCESS) << "gotcha error for rocpd.sqlite3";