| 877 | } |
| 878 | |
| 879 | void installDebugAgent ( DebugAgentPtr newAgent, const char * category, LineInfoArg * at, Context * context ) { |
| 880 | if ( !category ) context->throw_error_at(at, "need to specify category"); |
| 881 | std::lock_guard<std::recursive_mutex> guard(g_DebugAgentMutex); |
| 882 | auto it = g_DebugAgents.find(category); |
| 883 | if ( it != g_DebugAgents.end() ) { |
| 884 | DebugAgent * oldAgentPtr = it->second.debugAgent.get(); |
| 885 | for_each_debug_agent([&](const DebugAgentPtr & pAgent){ |
| 886 | pAgent->onUninstall(oldAgentPtr); |
| 887 | }); |
| 888 | } |
| 889 | g_DebugAgents[category] = { |
| 890 | debugAgentContextOrNull(context), |
| 891 | newAgent |
| 892 | }; |
| 893 | DebugAgent * newAgentPtr = newAgent.get(); |
| 894 | for_each_debug_agent([&](const DebugAgentPtr & pAgent){ |
| 895 | pAgent->onInstall(newAgentPtr); |
| 896 | }); |
| 897 | } |
| 898 | |
| 899 | Context & getDebugAgentContext ( const char * category, LineInfoArg * at, Context * context ) { |
| 900 | if ( !category ) context->throw_error_at(at, "need to specify category"); |
nothing calls this directly
no test coverage detected