Skip to content

Commit 03c7cd3

Browse files
committed
Revert "[lldb-vscode] Send Statistics Dump in terminated event"
This reverts commit e3ccbae. There is a bug which is failing the test running on mac.
1 parent de14bef commit 03c7cd3

File tree

9 files changed

+3
-174
lines changed

9 files changed

+3
-174
lines changed

lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -369,13 +369,7 @@ def wait_for_stopped(self, timeout=None):
369369
def wait_for_exited(self):
370370
event_dict = self.wait_for_event('exited')
371371
if event_dict is None:
372-
raise ValueError("didn't get exited event")
373-
return event_dict
374-
375-
def wait_for_terminated(self):
376-
event_dict = self.wait_for_event('terminated')
377-
if event_dict is None:
378-
raise ValueError("didn't get terminated event")
372+
raise ValueError("didn't get stopped event")
379373
return event_dict
380374

381375
def get_initialize_value(self, key):

lldb/test/API/tools/lldb-vscode/terminated-event/Makefile

Lines changed: 0 additions & 17 deletions
This file was deleted.

lldb/test/API/tools/lldb-vscode/terminated-event/TestVSCode_terminatedEvent.py

Lines changed: 0 additions & 61 deletions
This file was deleted.

lldb/test/API/tools/lldb-vscode/terminated-event/foo.cpp

Lines changed: 0 additions & 3 deletions
This file was deleted.

lldb/test/API/tools/lldb-vscode/terminated-event/foo.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

lldb/test/API/tools/lldb-vscode/terminated-event/main.cpp

Lines changed: 0 additions & 8 deletions
This file was deleted.

lldb/tools/lldb-vscode/JSONUtils.cpp

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include "lldb/API/SBBreakpoint.h"
2020
#include "lldb/API/SBBreakpointLocation.h"
2121
#include "lldb/API/SBDeclaration.h"
22-
#include "lldb/API/SBStringList.h"
23-
#include "lldb/API/SBStructuredData.h"
2422
#include "lldb/API/SBValue.h"
2523
#include "lldb/Host/PosixApi.h"
2624

@@ -1142,73 +1140,6 @@ CreateRunInTerminalReverseRequest(const llvm::json::Object &launch_request,
11421140
return reverse_request;
11431141
}
11441142

1145-
// Keep all the top level items from the statistics dump, except for the
1146-
// "modules" array. It can be huge and cause delay
1147-
// Array and dictionary value will return as <key, JSON string> pairs
1148-
void FilterAndGetValueForKey(const lldb::SBStructuredData data, const char *key,
1149-
llvm::json::Object &out) {
1150-
lldb::SBStructuredData value = data.GetValueForKey(key);
1151-
std::string key_utf8 = llvm::json::fixUTF8(key);
1152-
if (strcmp(key, "modules") == 0)
1153-
return;
1154-
switch (value.GetType()) {
1155-
case lldb::eStructuredDataTypeFloat:
1156-
out.try_emplace(key_utf8, value.GetFloatValue());
1157-
break;
1158-
case lldb::eStructuredDataTypeInteger:
1159-
out.try_emplace(key_utf8, value.GetIntegerValue());
1160-
break;
1161-
case lldb::eStructuredDataTypeArray: {
1162-
lldb::SBStream contents;
1163-
value.GetAsJSON(contents);
1164-
EmplaceSafeString(out, key, contents.GetData());
1165-
} break;
1166-
case lldb::eStructuredDataTypeBoolean:
1167-
out.try_emplace(key_utf8, value.GetBooleanValue());
1168-
break;
1169-
case lldb::eStructuredDataTypeString: {
1170-
// Get the string size before reading
1171-
const size_t str_length = value.GetStringValue(nullptr, 0);
1172-
std::string str(str_length + 1, 0);
1173-
value.GetStringValue(&str[0], str_length);
1174-
EmplaceSafeString(out, key, str);
1175-
} break;
1176-
case lldb::eStructuredDataTypeDictionary: {
1177-
lldb::SBStream contents;
1178-
value.GetAsJSON(contents);
1179-
EmplaceSafeString(out, key, contents.GetData());
1180-
} break;
1181-
case lldb::eStructuredDataTypeNull:
1182-
case lldb::eStructuredDataTypeGeneric:
1183-
case lldb::eStructuredDataTypeInvalid:
1184-
break;
1185-
}
1186-
}
1187-
1188-
void addStatistic(llvm::json::Object &event) {
1189-
lldb::SBStructuredData statistics = g_vsc.target.GetStatistics();
1190-
bool is_dictionary =
1191-
statistics.GetType() == lldb::eStructuredDataTypeDictionary;
1192-
if (!is_dictionary)
1193-
return;
1194-
llvm::json::Object stats_body;
1195-
1196-
lldb::SBStringList keys;
1197-
if (!statistics.GetKeys(keys))
1198-
return;
1199-
for (size_t i = 0; i < keys.GetSize(); i++) {
1200-
const char *key = keys.GetStringAtIndex(i);
1201-
FilterAndGetValueForKey(statistics, key, stats_body);
1202-
}
1203-
event.try_emplace("statistics", std::move(stats_body));
1204-
}
1205-
1206-
llvm::json::Object CreateTerminatedEventObject() {
1207-
llvm::json::Object event(CreateEventObject("terminated"));
1208-
addStatistic(event);
1209-
return event;
1210-
}
1211-
12121143
std::string JSONToString(const llvm::json::Value &json) {
12131144
std::string data;
12141145
llvm::raw_string_ostream os(data);

lldb/tools/lldb-vscode/JSONUtils.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -485,12 +485,6 @@ CreateRunInTerminalReverseRequest(const llvm::json::Object &launch_request,
485485
llvm::StringRef debug_adaptor_path,
486486
llvm::StringRef comm_file);
487487

488-
/// Create a "Terminated" JSON object that contains statistics
489-
///
490-
/// \return
491-
/// A body JSON object with debug info and breakpoint info
492-
llvm::json::Object CreateTerminatedEventObject();
493-
494488
/// Convert a given JSON object to a string.
495489
std::string JSONToString(const llvm::json::Value &json);
496490

lldb/tools/lldb-vscode/lldb-vscode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void SendTerminatedEvent() {
204204
g_vsc.sent_terminated_event = true;
205205
g_vsc.RunTerminateCommands();
206206
// Send a "terminated" event
207-
llvm::json::Object event(CreateTerminatedEventObject());
207+
llvm::json::Object event(CreateEventObject("terminated"));
208208
g_vsc.SendJSON(llvm::json::Value(std::move(event)));
209209
}
210210
}
@@ -2949,7 +2949,7 @@ void request_variables(const llvm::json::Object &request) {
29492949
const uint32_t addr_size = g_vsc.target.GetProcess().GetAddressByteSize();
29502950
lldb::SBValue reg_set = g_vsc.variables.registers.GetValueAtIndex(0);
29512951
const uint32_t num_regs = reg_set.GetNumChildren();
2952-
for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
2952+
for (uint32_t reg_idx=0; reg_idx<num_regs; ++reg_idx) {
29532953
lldb::SBValue reg = reg_set.GetChildAtIndex(reg_idx);
29542954
const lldb::Format format = reg.GetFormat();
29552955
if (format == lldb::eFormatDefault || format == lldb::eFormatHex) {

0 commit comments

Comments
 (0)