| 366 | } |
| 367 | |
| 368 | void DebuggerPlugin::load( PluginManager* pluginManager ) { |
| 369 | Clock clock; |
| 370 | AtomicBoolScopedOp loading( mLoading, true ); |
| 371 | pluginManager->subscribeMessages( this, |
| 372 | [this]( const auto& notification ) -> PluginRequestHandle { |
| 373 | return processMessage( notification ); |
| 374 | } ); |
| 375 | std::vector<std::string> paths; |
| 376 | std::string path( pluginManager->getResourcesPath() + "plugins/debugger.json" ); |
| 377 | if ( FileSystem::fileExists( path ) ) |
| 378 | paths.emplace_back( path ); |
| 379 | path = pluginManager->getPluginsPath() + "debugger.json"; |
| 380 | if ( FileSystem::fileExists( path ) || |
| 381 | FileSystem::fileWrite( |
| 382 | path, "{\n \"config\":{},\n \"keybindings\":{},\n \"dap\":[]\n}\n" ) ) { |
| 383 | mConfigPath = path; |
| 384 | paths.emplace_back( path ); |
| 385 | } |
| 386 | if ( paths.empty() ) |
| 387 | return; |
| 388 | |
| 389 | for ( const auto& ipath : paths ) { |
| 390 | try { |
| 391 | loadDAPConfig( ipath, mConfigPath == ipath ); |
| 392 | } catch ( const json::exception& e ) { |
| 393 | Log::error( "Parsing Debugger \"%s\" failed:\n%s", ipath.c_str(), e.what() ); |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | if ( getUISceneNode() ) |
| 398 | updateUI(); |
| 399 | |
| 400 | subscribeFileSystemListener(); |
| 401 | mReady = true; |
| 402 | fireReadyCbs(); |
| 403 | setReady( clock.getElapsedTime() ); |
| 404 | } |
| 405 | |
| 406 | static std::initializer_list<std::string> DebuggerCommandList = { |
| 407 | "debugger-continue-interrupt", |
no test coverage detected