@@ -478,21 +478,21 @@ lldb::SBFrame DAP::GetLLDBFrame(const llvm::json::Object &arguments) {
478
478
479
479
llvm::json::Value DAP::CreateTopLevelScopes () {
480
480
llvm::json::Array scopes;
481
- scopes.emplace_back (CreateScope ( " Locals " , VARREF_LOCALS,
482
- g_dap. variables .locals .GetSize (), false ));
481
+ scopes.emplace_back (
482
+ CreateScope ( " Locals " , VARREF_LOCALS, variables.locals .GetSize (), false ));
483
483
scopes.emplace_back (CreateScope (" Globals" , VARREF_GLOBALS,
484
- g_dap. variables .globals .GetSize (), false ));
484
+ variables.globals .GetSize (), false ));
485
485
scopes.emplace_back (CreateScope (" Registers" , VARREF_REGS,
486
- g_dap. variables .registers .GetSize (), false ));
486
+ variables.registers .GetSize (), false ));
487
487
return llvm::json::Value (std::move (scopes));
488
488
}
489
489
490
490
ReplMode DAP::DetectReplMode (lldb::SBFrame frame, std::string &expression,
491
491
bool partial_expression) {
492
492
// Check for the escape hatch prefix.
493
493
if (!expression.empty () &&
494
- llvm::StringRef (expression).starts_with (g_dap. command_escape_prefix )) {
495
- expression = expression.substr (g_dap. command_escape_prefix .size ());
494
+ llvm::StringRef (expression).starts_with (command_escape_prefix)) {
495
+ expression = expression.substr (command_escape_prefix.size ());
496
496
return ReplMode::Command;
497
497
}
498
498
@@ -532,7 +532,7 @@ ReplMode DAP::DetectReplMode(lldb::SBFrame frame, std::string &expression,
532
532
<< " Warning: Expression '" << term
533
533
<< " ' is both an LLDB command and variable. It will be evaluated as "
534
534
" a variable. To evaluate the expression as an LLDB command, use '"
535
- << g_dap. command_escape_prefix << " ' as a prefix.\n " ;
535
+ << command_escape_prefix << " ' as a prefix.\n " ;
536
536
}
537
537
538
538
// Variables take preference to commands in auto, since commands can always
@@ -903,7 +903,7 @@ bool StartDebuggingRequestHandler::DoExecute(
903
903
return false ;
904
904
}
905
905
906
- g_dap .SendReverseRequest (
906
+ dap .SendReverseRequest (
907
907
" startDebugging" ,
908
908
llvm::json::Object{{" request" , request},
909
909
{" configuration" , std::move (*configuration)}},
@@ -927,7 +927,7 @@ bool ReplModeRequestHandler::DoExecute(lldb::SBDebugger debugger,
927
927
// If a new mode is not specified report the current mode.
928
928
if (!command || llvm::StringRef (command[0 ]).empty ()) {
929
929
std::string mode;
930
- switch (g_dap .repl_mode ) {
930
+ switch (dap .repl_mode ) {
931
931
case ReplMode::Variable:
932
932
mode = " variable" ;
933
933
break ;
@@ -948,11 +948,11 @@ bool ReplModeRequestHandler::DoExecute(lldb::SBDebugger debugger,
948
948
llvm::StringRef new_mode{command[0 ]};
949
949
950
950
if (new_mode == " variable" ) {
951
- g_dap .repl_mode = ReplMode::Variable;
951
+ dap .repl_mode = ReplMode::Variable;
952
952
} else if (new_mode == " command" ) {
953
- g_dap .repl_mode = ReplMode::Command;
953
+ dap .repl_mode = ReplMode::Command;
954
954
} else if (new_mode == " auto" ) {
955
- g_dap .repl_mode = ReplMode::Auto;
955
+ dap .repl_mode = ReplMode::Auto;
956
956
} else {
957
957
lldb::SBStream error_message;
958
958
error_message.Printf (" Invalid repl-mode '%s'. Expected one of 'variable', "
@@ -1024,7 +1024,7 @@ bool SendEventRequestHandler::DoExecute(lldb::SBDebugger debugger,
1024
1024
event.try_emplace (" body" , std::move (*body));
1025
1025
}
1026
1026
1027
- g_dap .SendJSON (llvm::json::Value (std::move (event)));
1027
+ dap .SendJSON (llvm::json::Value (std::move (event)));
1028
1028
result.SetStatus (lldb::eReturnStatusSuccessFinishNoResult);
1029
1029
return true ;
1030
1030
}
@@ -1033,29 +1033,27 @@ void DAP::SetFrameFormat(llvm::StringRef format) {
1033
1033
if (format.empty ())
1034
1034
return ;
1035
1035
lldb::SBError error;
1036
- g_dap. frame_format = lldb::SBFormat (format.str ().c_str (), error);
1036
+ frame_format = lldb::SBFormat (format.str ().c_str (), error);
1037
1037
if (error.Fail ()) {
1038
- g_dap.SendOutput (
1039
- OutputType::Console,
1040
- llvm::formatv (
1041
- " The provided frame format '{0}' couldn't be parsed: {1}\n " , format,
1042
- error.GetCString ())
1043
- .str ());
1038
+ SendOutput (OutputType::Console,
1039
+ llvm::formatv (
1040
+ " The provided frame format '{0}' couldn't be parsed: {1}\n " ,
1041
+ format, error.GetCString ())
1042
+ .str ());
1044
1043
}
1045
1044
}
1046
1045
1047
1046
void DAP::SetThreadFormat (llvm::StringRef format) {
1048
1047
if (format.empty ())
1049
1048
return ;
1050
1049
lldb::SBError error;
1051
- g_dap. thread_format = lldb::SBFormat (format.str ().c_str (), error);
1050
+ thread_format = lldb::SBFormat (format.str ().c_str (), error);
1052
1051
if (error.Fail ()) {
1053
- g_dap.SendOutput (
1054
- OutputType::Console,
1055
- llvm::formatv (
1056
- " The provided thread format '{0}' couldn't be parsed: {1}\n " ,
1057
- format, error.GetCString ())
1058
- .str ());
1052
+ SendOutput (OutputType::Console,
1053
+ llvm::formatv (
1054
+ " The provided thread format '{0}' couldn't be parsed: {1}\n " ,
1055
+ format, error.GetCString ())
1056
+ .str ());
1059
1057
}
1060
1058
}
1061
1059
0 commit comments