@@ -477,21 +477,21 @@ lldb::SBFrame DAP::GetLLDBFrame(const llvm::json::Object &arguments) {
477477
478478llvm::json::Value DAP::CreateTopLevelScopes () {
479479 llvm::json::Array scopes;
480- scopes.emplace_back (CreateScope ( " Locals " , VARREF_LOCALS,
481- g_dap. variables .locals .GetSize (), false ));
480+ scopes.emplace_back (
481+ CreateScope ( " Locals " , VARREF_LOCALS, variables.locals .GetSize (), false ));
482482 scopes.emplace_back (CreateScope (" Globals" , VARREF_GLOBALS,
483- g_dap. variables .globals .GetSize (), false ));
483+ variables.globals .GetSize (), false ));
484484 scopes.emplace_back (CreateScope (" Registers" , VARREF_REGS,
485- g_dap. variables .registers .GetSize (), false ));
485+ variables.registers .GetSize (), false ));
486486 return llvm::json::Value (std::move (scopes));
487487}
488488
489489ReplMode DAP::DetectReplMode (lldb::SBFrame frame, std::string &expression,
490490 bool partial_expression) {
491491 // Check for the escape hatch prefix.
492492 if (!expression.empty () &&
493- llvm::StringRef (expression).starts_with (g_dap. command_escape_prefix )) {
494- expression = expression.substr (g_dap. command_escape_prefix .size ());
493+ llvm::StringRef (expression).starts_with (command_escape_prefix)) {
494+ expression = expression.substr (command_escape_prefix.size ());
495495 return ReplMode::Command;
496496 }
497497
@@ -531,7 +531,7 @@ ReplMode DAP::DetectReplMode(lldb::SBFrame frame, std::string &expression,
531531 << " Warning: Expression '" << term
532532 << " ' is both an LLDB command and variable. It will be evaluated as "
533533 " a variable. To evaluate the expression as an LLDB command, use '"
534- << g_dap. command_escape_prefix << " ' as a prefix.\n " ;
534+ << command_escape_prefix << " ' as a prefix.\n " ;
535535 }
536536
537537 // Variables take preference to commands in auto, since commands can always
@@ -901,7 +901,7 @@ bool StartDebuggingRequestHandler::DoExecute(
901901 return false ;
902902 }
903903
904- g_dap .SendReverseRequest (
904+ dap .SendReverseRequest (
905905 " startDebugging" ,
906906 llvm::json::Object{{" request" , request},
907907 {" configuration" , std::move (*configuration)}},
@@ -925,7 +925,7 @@ bool ReplModeRequestHandler::DoExecute(lldb::SBDebugger debugger,
925925 // If a new mode is not specified report the current mode.
926926 if (!command || llvm::StringRef (command[0 ]).empty ()) {
927927 std::string mode;
928- switch (g_dap .repl_mode ) {
928+ switch (dap .repl_mode ) {
929929 case ReplMode::Variable:
930930 mode = " variable" ;
931931 break ;
@@ -946,11 +946,11 @@ bool ReplModeRequestHandler::DoExecute(lldb::SBDebugger debugger,
946946 llvm::StringRef new_mode{command[0 ]};
947947
948948 if (new_mode == " variable" ) {
949- g_dap .repl_mode = ReplMode::Variable;
949+ dap .repl_mode = ReplMode::Variable;
950950 } else if (new_mode == " command" ) {
951- g_dap .repl_mode = ReplMode::Command;
951+ dap .repl_mode = ReplMode::Command;
952952 } else if (new_mode == " auto" ) {
953- g_dap .repl_mode = ReplMode::Auto;
953+ dap .repl_mode = ReplMode::Auto;
954954 } else {
955955 lldb::SBStream error_message;
956956 error_message.Printf (" Invalid repl-mode '%s'. Expected one of 'variable', "
@@ -1022,7 +1022,7 @@ bool SendEventRequestHandler::DoExecute(lldb::SBDebugger debugger,
10221022 event.try_emplace (" body" , std::move (*body));
10231023 }
10241024
1025- g_dap .SendJSON (llvm::json::Value (std::move (event)));
1025+ dap .SendJSON (llvm::json::Value (std::move (event)));
10261026 result.SetStatus (lldb::eReturnStatusSuccessFinishNoResult);
10271027 return true ;
10281028}
@@ -1031,29 +1031,27 @@ void DAP::SetFrameFormat(llvm::StringRef format) {
10311031 if (format.empty ())
10321032 return ;
10331033 lldb::SBError error;
1034- g_dap. frame_format = lldb::SBFormat (format.str ().c_str (), error);
1034+ frame_format = lldb::SBFormat (format.str ().c_str (), error);
10351035 if (error.Fail ()) {
1036- g_dap.SendOutput (
1037- OutputType::Console,
1038- llvm::formatv (
1039- " The provided frame format '{0}' couldn't be parsed: {1}\n " , format,
1040- error.GetCString ())
1041- .str ());
1036+ SendOutput (OutputType::Console,
1037+ llvm::formatv (
1038+ " The provided frame format '{0}' couldn't be parsed: {1}\n " ,
1039+ format, error.GetCString ())
1040+ .str ());
10421041 }
10431042}
10441043
10451044void DAP::SetThreadFormat (llvm::StringRef format) {
10461045 if (format.empty ())
10471046 return ;
10481047 lldb::SBError error;
1049- g_dap. thread_format = lldb::SBFormat (format.str ().c_str (), error);
1048+ thread_format = lldb::SBFormat (format.str ().c_str (), error);
10501049 if (error.Fail ()) {
1051- g_dap.SendOutput (
1052- OutputType::Console,
1053- llvm::formatv (
1054- " The provided thread format '{0}' couldn't be parsed: {1}\n " ,
1055- format, error.GetCString ())
1056- .str ());
1050+ SendOutput (OutputType::Console,
1051+ llvm::formatv (
1052+ " The provided thread format '{0}' couldn't be parsed: {1}\n " ,
1053+ format, error.GetCString ())
1054+ .str ());
10571055 }
10581056}
10591057
0 commit comments