Skip to content

Commit 414e5c5

Browse files
authored
[lldb-dap] Migrating terminated statistics to the event body. (#130454)
Per the DAP spec, the event 'body' field should contain any additional data related to the event. I updated the lldb-dap 'statistics' extension into the terminated event's body like: ``` { "type": "event", "seq": 0, "event": "terminated", "body": { "$__lldb_statistics": {...} } } ``` This allows us to more uniformly handle event messages.
1 parent 5ba7a3b commit 414e5c5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lldb/test/API/tools/lldb-dap/terminated-event/TestDAP_terminatedEvent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_terminated_event(self):
4343
self.continue_to_breakpoints(breakpoint_ids)
4444
self.continue_to_exit()
4545

46-
statistics = self.dap_server.wait_for_terminated()["statistics"]
46+
statistics = self.dap_server.wait_for_terminated()["body"]["$__lldb_statistics"]
4747
self.assertGreater(statistics["totalDebugInfoByteSize"], 0)
4848
self.assertGreater(statistics["totalDebugInfoEnabled"], 0)
4949
self.assertGreater(statistics["totalModuleCountHasDebugInfo"], 0)

lldb/tools/lldb-dap/JSONUtils.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,8 @@ static void addStatistic(lldb::SBTarget &target, llvm::json::Object &event) {
15261526
const char *key = keys.GetStringAtIndex(i);
15271527
FilterAndGetValueForKey(statistics, key, stats_body);
15281528
}
1529-
event.try_emplace("statistics", std::move(stats_body));
1529+
llvm::json::Object body{{"$__lldb_statistics", std::move(stats_body)}};
1530+
event.try_emplace("body", std::move(body));
15301531
}
15311532

15321533
llvm::json::Object CreateTerminatedEventObject(lldb::SBTarget &target) {

0 commit comments

Comments
 (0)