Skip to content

Commit 7bbd0fb

Browse files
committed
Revert "[lldb-vscode] Send Statistics Dump in terminated event"
This reverts commit c8a26f8. Returning full statistics result in "terminated" (DAP) event could result in delay in the UI when debugging from VSCode. If the program run to exit and debug session terminates. The DAP event order will be: exited event --> terminateCommands --> terminated event --> disconnect request --> disconnect response. The debugging UI in VSCode corresponds to "disconnect" request/response. If the terminated event is taking long to process, the IDE won't quit debugging UI until it's done. For big binary (tested example has 29 GB of debug info), it can cause ~15s delay in terminated event itself. And the UI could take ~20s to reflect. This may cause confusion in debug sessions. We should persuit a more lightweight return or other solution to return such info.
1 parent ada9ab6 commit 7bbd0fb

File tree

9 files changed

+2
-119
lines changed

9 files changed

+2
-119
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 & 60 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 & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "lldb/API/SBBreakpoint.h"
2020
#include "lldb/API/SBBreakpointLocation.h"
2121
#include "lldb/API/SBDeclaration.h"
22-
#include "lldb/API/SBStructuredData.h"
2322
#include "lldb/API/SBValue.h"
2423
#include "lldb/Host/PosixApi.h"
2524

@@ -1140,21 +1139,6 @@ CreateRunInTerminalReverseRequest(const llvm::json::Object &launch_request,
11401139
return reverse_request;
11411140
}
11421141

1143-
llvm::json::Object CreateTerminatedEventObject() {
1144-
llvm::json::Object event(CreateEventObject("terminated"));
1145-
lldb::SBStructuredData statistics = g_vsc.target.GetStatistics();
1146-
bool is_dictionary =
1147-
statistics.GetType() == lldb::eStructuredDataTypeDictionary;
1148-
if (!is_dictionary) {
1149-
return event;
1150-
}
1151-
1152-
lldb::SBStream stats_stream;
1153-
statistics.GetAsJSON(stats_stream);
1154-
event.try_emplace("statistics", llvm::json::fixUTF8(stats_stream.GetData()));
1155-
return event;
1156-
}
1157-
11581142
std::string JSONToString(const llvm::json::Value &json) {
11591143
std::string data;
11601144
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: 1 addition & 1 deletion
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
}

0 commit comments

Comments
 (0)