@@ -477,21 +477,21 @@ lldb::SBFrame DAP::GetLLDBFrame(const llvm::json::Object &arguments) {
477
477
478
478
llvm::json::Value DAP::CreateTopLevelScopes () {
479
479
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 ));
482
482
scopes.emplace_back (CreateScope (" Globals" , VARREF_GLOBALS,
483
- g_dap. variables .globals .GetSize (), false ));
483
+ variables.globals .GetSize (), false ));
484
484
scopes.emplace_back (CreateScope (" Registers" , VARREF_REGS,
485
- g_dap. variables .registers .GetSize (), false ));
485
+ variables.registers .GetSize (), false ));
486
486
return llvm::json::Value (std::move (scopes));
487
487
}
488
488
489
489
ReplMode DAP::DetectReplMode (lldb::SBFrame frame, std::string &expression,
490
490
bool partial_expression) {
491
491
// Check for the escape hatch prefix.
492
492
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 ());
495
495
return ReplMode::Command;
496
496
}
497
497
@@ -531,7 +531,7 @@ ReplMode DAP::DetectReplMode(lldb::SBFrame frame, std::string &expression,
531
531
<< " Warning: Expression '" << term
532
532
<< " ' is both an LLDB command and variable. It will be evaluated as "
533
533
" 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 " ;
535
535
}
536
536
537
537
// Variables take preference to commands in auto, since commands can always
@@ -901,7 +901,7 @@ bool StartDebuggingRequestHandler::DoExecute(
901
901
return false ;
902
902
}
903
903
904
- g_dap .SendReverseRequest (
904
+ dap .SendReverseRequest (
905
905
" startDebugging" ,
906
906
llvm::json::Object{{" request" , request},
907
907
{" configuration" , std::move (*configuration)}},
@@ -925,7 +925,7 @@ bool ReplModeRequestHandler::DoExecute(lldb::SBDebugger debugger,
925
925
// If a new mode is not specified report the current mode.
926
926
if (!command || llvm::StringRef (command[0 ]).empty ()) {
927
927
std::string mode;
928
- switch (g_dap .repl_mode ) {
928
+ switch (dap .repl_mode ) {
929
929
case ReplMode::Variable:
930
930
mode = " variable" ;
931
931
break ;
@@ -946,11 +946,11 @@ bool ReplModeRequestHandler::DoExecute(lldb::SBDebugger debugger,
946
946
llvm::StringRef new_mode{command[0 ]};
947
947
948
948
if (new_mode == " variable" ) {
949
- g_dap .repl_mode = ReplMode::Variable;
949
+ dap .repl_mode = ReplMode::Variable;
950
950
} else if (new_mode == " command" ) {
951
- g_dap .repl_mode = ReplMode::Command;
951
+ dap .repl_mode = ReplMode::Command;
952
952
} else if (new_mode == " auto" ) {
953
- g_dap .repl_mode = ReplMode::Auto;
953
+ dap .repl_mode = ReplMode::Auto;
954
954
} else {
955
955
lldb::SBStream error_message;
956
956
error_message.Printf (" Invalid repl-mode '%s'. Expected one of 'variable', "
@@ -1022,7 +1022,7 @@ bool SendEventRequestHandler::DoExecute(lldb::SBDebugger debugger,
1022
1022
event.try_emplace (" body" , std::move (*body));
1023
1023
}
1024
1024
1025
- g_dap .SendJSON (llvm::json::Value (std::move (event)));
1025
+ dap .SendJSON (llvm::json::Value (std::move (event)));
1026
1026
result.SetStatus (lldb::eReturnStatusSuccessFinishNoResult);
1027
1027
return true ;
1028
1028
}
@@ -1031,29 +1031,27 @@ void DAP::SetFrameFormat(llvm::StringRef format) {
1031
1031
if (format.empty ())
1032
1032
return ;
1033
1033
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);
1035
1035
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 ());
1042
1041
}
1043
1042
}
1044
1043
1045
1044
void DAP::SetThreadFormat (llvm::StringRef format) {
1046
1045
if (format.empty ())
1047
1046
return ;
1048
1047
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);
1050
1049
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 ());
1057
1055
}
1058
1056
}
1059
1057
0 commit comments