@@ -1017,45 +1017,6 @@ lldb::SBError DAP::WaitForProcessToStop(std::chrono::seconds seconds) {
10171017 return error;
10181018}
10191019
1020- void Variables::Clear () {
1021- locals.Clear ();
1022- globals.Clear ();
1023- registers.Clear ();
1024- referenced_variables.clear ();
1025- }
1026-
1027- int64_t Variables::GetNewVariableReference (bool is_permanent) {
1028- if (is_permanent)
1029- return next_permanent_var_ref++;
1030- return next_temporary_var_ref++;
1031- }
1032-
1033- bool Variables::IsPermanentVariableReference (int64_t var_ref) {
1034- return var_ref >= PermanentVariableStartIndex;
1035- }
1036-
1037- lldb::SBValue Variables::GetVariable (int64_t var_ref) const {
1038- if (IsPermanentVariableReference (var_ref)) {
1039- auto pos = referenced_permanent_variables.find (var_ref);
1040- if (pos != referenced_permanent_variables.end ())
1041- return pos->second ;
1042- } else {
1043- auto pos = referenced_variables.find (var_ref);
1044- if (pos != referenced_variables.end ())
1045- return pos->second ;
1046- }
1047- return lldb::SBValue ();
1048- }
1049-
1050- int64_t Variables::InsertVariable (lldb::SBValue variable, bool is_permanent) {
1051- int64_t var_ref = GetNewVariableReference (is_permanent);
1052- if (is_permanent)
1053- referenced_permanent_variables.insert (std::make_pair (var_ref, variable));
1054- else
1055- referenced_variables.insert (std::make_pair (var_ref, variable));
1056- return var_ref;
1057- }
1058-
10591020bool StartDebuggingRequestHandler::DoExecute (
10601021 lldb::SBDebugger debugger, char **command,
10611022 lldb::SBCommandReturnObject &result) {
@@ -1292,60 +1253,6 @@ DAP::GetInstructionBPFromStopReason(lldb::SBThread &thread) {
12921253 return inst_bp;
12931254}
12941255
1295- lldb::SBValueList *Variables::GetTopLevelScope (int64_t variablesReference) {
1296- switch (variablesReference) {
1297- case VARREF_LOCALS:
1298- return &locals;
1299- case VARREF_GLOBALS:
1300- return &globals;
1301- case VARREF_REGS:
1302- return ®isters;
1303- default :
1304- return nullptr ;
1305- }
1306- }
1307-
1308- lldb::SBValue Variables::FindVariable (uint64_t variablesReference,
1309- llvm::StringRef name) {
1310- lldb::SBValue variable;
1311- if (lldb::SBValueList *top_scope = GetTopLevelScope (variablesReference)) {
1312- bool is_duplicated_variable_name = name.contains (" @" );
1313- // variablesReference is one of our scopes, not an actual variable it is
1314- // asking for a variable in locals or globals or registers
1315- int64_t end_idx = top_scope->GetSize ();
1316- // Searching backward so that we choose the variable in closest scope
1317- // among variables of the same name.
1318- for (int64_t i = end_idx - 1 ; i >= 0 ; --i) {
1319- lldb::SBValue curr_variable = top_scope->GetValueAtIndex (i);
1320- std::string variable_name = CreateUniqueVariableNameForDisplay (
1321- curr_variable, is_duplicated_variable_name);
1322- if (variable_name == name) {
1323- variable = curr_variable;
1324- break ;
1325- }
1326- }
1327- } else {
1328- // This is not under the globals or locals scope, so there are no
1329- // duplicated names.
1330-
1331- // We have a named item within an actual variable so we need to find it
1332- // withing the container variable by name.
1333- lldb::SBValue container = GetVariable (variablesReference);
1334- variable = container.GetChildMemberWithName (name.data ());
1335- if (!variable.IsValid ()) {
1336- if (name.starts_with (" [" )) {
1337- llvm::StringRef index_str (name.drop_front (1 ));
1338- uint64_t index = 0 ;
1339- if (!index_str.consumeInteger (0 , index)) {
1340- if (index_str == " ]" )
1341- variable = container.GetChildAtIndex (index);
1342- }
1343- }
1344- }
1345- }
1346- return variable;
1347- }
1348-
13491256protocol::Capabilities DAP::GetCapabilities () {
13501257 protocol::Capabilities capabilities;
13511258
0 commit comments