- Timestamp:
- Aug 14, 2020 12:27:41 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139917
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv-dtrace.cpp
r85172 r85766 256 256 #define dtrace_unregister g_pfnDTraceProviderUnregister 257 257 258 /** For dynamical resolving and releasing. */ 259 static const struct 260 { 261 const char *pszName; 262 uintptr_t *ppfn; /**< @note Clang 11 nothrow weirdness forced this from PFNRT * to uintptr_t *. */ 263 } g_aDTraceFunctions[] = 264 { 265 { "dtrace_probe", (uintptr_t *)&dtrace_probe }, 266 { "dtrace_probe_create", (uintptr_t *)&dtrace_probe_create }, 267 { "dtrace_probe_lookup", (uintptr_t *)&dtrace_probe_lookup }, 268 { "dtrace_register", (uintptr_t *)&dtrace_register }, 269 { "dtrace_invalidate", (uintptr_t *)&dtrace_invalidate }, 270 { "dtrace_unregister", (uintptr_t *)&dtrace_unregister }, 271 }; 272 258 273 /** @} */ 259 274 #endif … … 1112 1127 # endif 1113 1128 1114 static const struct1115 {1116 const char *pszName;1117 uintptr_t *ppfn; /**< @note Clang 11 nothrow weirdness forced this from PFNRT * to uintptr_t *. */1118 } s_aDTraceFunctions[] =1119 {1120 { "dtrace_probe", (uintptr_t *)&dtrace_probe },1121 { "dtrace_probe_create", (uintptr_t *)&dtrace_probe_create },1122 { "dtrace_probe_lookup", (uintptr_t *)&dtrace_probe_lookup },1123 { "dtrace_register", (uintptr_t *)&dtrace_register },1124 { "dtrace_invalidate", (uintptr_t *)&dtrace_invalidate },1125 { "dtrace_unregister", (uintptr_t *)&dtrace_unregister },1126 };1127 1129 unsigned i; 1128 for (i = 0; i < RT_ELEMENTS( s_aDTraceFunctions); i++)1130 for (i = 0; i < RT_ELEMENTS(g_aDTraceFunctions); i++) 1129 1131 { 1130 1132 # ifndef RT_OS_LINUX 1131 rc = RTR0DbgKrnlInfoQuerySymbol(hKrnlInfo, NULL, s_aDTraceFunctions[i].pszName,1132 (void **) s_aDTraceFunctions[i].ppfn);1133 rc = RTR0DbgKrnlInfoQuerySymbol(hKrnlInfo, NULL, g_aDTraceFunctions[i].pszName, 1134 (void **)g_aDTraceFunctions[i].ppfn); 1133 1135 if (RT_FAILURE(rc)) 1134 1136 { 1135 SUPR0Printf("supdrvDTraceInit: Failed to resolved '%s' (rc=%Rrc, i=%u).\n", s_aDTraceFunctions[i].pszName, rc, i);1137 SUPR0Printf("supdrvDTraceInit: Failed to resolved '%s' (rc=%Rrc, i=%u).\n", g_aDTraceFunctions[i].pszName, rc, i); 1136 1138 break; 1137 1139 } 1138 # else 1139 u nsigned long ulAddr = kallsyms_lookup_name(s_aDTraceFunctions[i].pszName);1140 # else /* RT_OS_LINUX */ 1141 uintptr_t ulAddr = (uintptr_t)__symbol_get(g_aDTraceFunctions[i].pszName); 1140 1142 if (!ulAddr) 1141 1143 { 1142 SUPR0Printf("supdrvDTraceInit: Failed to resolved '%s' (i=%u).\n", s_aDTraceFunctions[i].pszName, i); 1144 SUPR0Printf("supdrvDTraceInit: Failed to resolved '%s' (i=%u).\n", g_aDTraceFunctions[i].pszName, i); 1145 while (i-- > 0) 1146 { 1147 __symbol_put(g_aDTraceFunctions[i].pszName); 1148 *g_aDTraceFunctions[i].ppfn = NULL; 1149 } 1143 1150 return NULL; 1144 1151 } 1145 * s_aDTraceFunctions[i].ppfn = (PFNRT)ulAddr;1146 # endif 1152 *g_aDTraceFunctions[i].ppfn = (PFNRT)ulAddr; 1153 # endif /* RT_OS_LINUX */ 1147 1154 } 1148 1155 … … 1151 1158 if (RT_FAILURE(rc)) 1152 1159 return NULL; 1153 # else1154 /** @todo grab a reference to the dtrace module... */1155 1160 # endif 1156 1161 #endif 1157 1162 1158 1163 return &g_VBoxDTraceReg; 1164 } 1165 1166 /** 1167 * Module teardown code. 1168 */ 1169 void VBOXCALL supdrvDTraceFini(void) 1170 { 1171 #ifdef RT_OS_LINUX 1172 /* Release the references. */ 1173 unsigned i; 1174 for (i = 0; i < RT_ELEMENTS(g_aDTraceFunctions); i++) 1175 if (*g_aDTraceFunctions[i].ppfn) 1176 { 1177 __symbol_put(g_aDTraceFunctions[i].pszName); 1178 *g_aDTraceFunctions[i].ppfn = NULL; 1179 } 1180 #endif 1159 1181 } 1160 1182 -
trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h
r85698 r85766 1108 1108 #ifdef VBOX_WITH_NATIVE_DTRACE 1109 1109 const SUPDRVTRACERREG * VBOXCALL supdrvDTraceInit(void); 1110 void VBOXCALL supdrvDTraceFini(void); 1110 1111 #endif 1111 1112 -
trunk/src/VBox/HostDrivers/Support/SUPDrvTracer.cpp
r85606 r85766 2469 2469 2470 2470 supdrvTracerRemoveAllProviders(pDevExt); 2471 2471 #ifdef VBOX_WITH_NATIVE_DTRACE 2472 supdrvDTraceFini(); 2473 #endif 2472 2474 RTSemFastMutexDestroy(pDevExt->mtxTracer); 2473 2475 pDevExt->mtxTracer = NIL_RTSEMFASTMUTEX;
Note:
See TracChangeset
for help on using the changeset viewer.