MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / debugAgentContextOrNull

Function debugAgentContextOrNull

src/runtime/context.cpp:859–862  ·  view source on GitHub ↗

Standalone-AOT contexts are constructed as member objects (see daslib/aot_standalone.das::writeStandaloneCtor), not via make_shared, so their weak_from_this() is empty and shared_from_this() throws bad_weak_ptr. The agent adapter only needs the context's raw pointer for dispatch (passed at make_debug_agent time); debugAgentContext is only consulted by getDebugAgentContext, which already returns an

Source from the content-addressed store, hash-verified

857 // error for null. So fall back to a null shared_ptr in that case
858 // instead of aborting the process.
859 static inline shared_ptr<Context> debugAgentContextOrNull ( Context * context ) {
860 auto wp = context->weak_from_this();
861 return wp.expired() ? nullptr : wp.lock();
862 }
863
864 void installThreadLocalDebugAgent ( DebugAgentPtr newAgent, LineInfoArg * at, Context * context ) {
865 if ( *daScriptEnvironment::g_threadLocalDebugAgent && (*daScriptEnvironment::g_threadLocalDebugAgent)->debugAgent ) {

Callers 2

installDebugAgentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected