[Lldb-commits] [lldb] 22887ff - Revert "Send statistics in initialized event"
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 16 03:20:36 PST 2022
Author: Pavel Labath
Date: 2022-11-16T12:20:21+01:00
New Revision: 22887ff964ee9135417f7c0f99915296b710934f
URL: https://github.com/llvm/llvm-project/commit/22887ff964ee9135417f7c0f99915296b710934f
DIFF: https://github.com/llvm/llvm-project/commit/22887ff964ee9135417f7c0f99915296b710934f.diff
LOG: Revert "Send statistics in initialized event"
The test is failing on linux.
This reverts commits 7fe3586cda5b683766ec6b6d5ca2d98c2baaf162 and
d599ac41aabddeb2442db7b31faacf143d63abe4.
Added:
lldb/test/API/tools/lldb-vscode/terminated-event/Makefile
lldb/test/API/tools/lldb-vscode/terminated-event/TestVSCode_terminatedEvent.py
lldb/test/API/tools/lldb-vscode/terminated-event/foo.cpp
lldb/test/API/tools/lldb-vscode/terminated-event/foo.h
lldb/test/API/tools/lldb-vscode/terminated-event/main.cpp
Modified:
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
lldb/tools/lldb-vscode/JSONUtils.cpp
lldb/tools/lldb-vscode/JSONUtils.h
lldb/tools/lldb-vscode/lldb-vscode.cpp
Removed:
lldb/test/API/tools/lldb-vscode/eventStatistic/Makefile
lldb/test/API/tools/lldb-vscode/eventStatistic/TestVSCode_eventStatistic.py
lldb/test/API/tools/lldb-vscode/eventStatistic/foo.cpp
lldb/test/API/tools/lldb-vscode/eventStatistic/foo.h
lldb/test/API/tools/lldb-vscode/eventStatistic/main.cpp
################################################################################
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
index 49f268ae28793..c2de4ad5c7d9a 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -134,7 +134,6 @@ def __init__(self, recv, send, init_commands, log_file=None):
self.configuration_done_sent = False
self.frame_scopes = {}
self.init_commands = init_commands
- self.initialized_event = None
@classmethod
def encode_content(cls, s):
@@ -232,8 +231,6 @@ def handle_recv_packet(self, packet):
self._process_stopped()
tid = body['threadId']
self.thread_stop_reasons[tid] = body
- elif event == 'initialized':
- self.initialized_event = packet
elif event == 'breakpoint':
# Breakpoint events come in when a breakpoint has locations
# added or removed. Keep track of them so we can look for them
diff --git a/lldb/test/API/tools/lldb-vscode/eventStatistic/Makefile b/lldb/test/API/tools/lldb-vscode/terminated-event/Makefile
similarity index 100%
rename from lldb/test/API/tools/lldb-vscode/eventStatistic/Makefile
rename to lldb/test/API/tools/lldb-vscode/terminated-event/Makefile
diff --git a/lldb/test/API/tools/lldb-vscode/eventStatistic/TestVSCode_eventStatistic.py b/lldb/test/API/tools/lldb-vscode/terminated-event/TestVSCode_terminatedEvent.py
similarity index 63%
rename from lldb/test/API/tools/lldb-vscode/eventStatistic/TestVSCode_eventStatistic.py
rename to lldb/test/API/tools/lldb-vscode/terminated-event/TestVSCode_terminatedEvent.py
index 2b7630795dcab..ae364a5fe1f0d 100644
--- a/lldb/test/API/tools/lldb-vscode/eventStatistic/TestVSCode_eventStatistic.py
+++ b/lldb/test/API/tools/lldb-vscode/terminated-event/TestVSCode_terminatedEvent.py
@@ -10,27 +10,7 @@
import re
import json
-class TestVSCode_eventStatistic(lldbvscode_testcase.VSCodeTestCaseBase):
-
- def check_statistic(self, statistics):
- self.assertTrue(statistics['totalDebugInfoByteSize'] > 0)
- self.assertTrue(statistics['totalDebugInfoEnabled'] > 0)
- self.assertTrue(statistics['totalModuleCountHasDebugInfo'] > 0)
-
- self.assertIsNotNone(statistics['memory'])
- self.assertNotIn('modules', statistics.keys())
-
- def check_target(self, statistics):
- # lldb-vscode debugs one target at a time
- target = json.loads(statistics['targets'])[0]
- self.assertTrue(target['totalBreakpointResolveTime'] > 0)
-
- breakpoints = target['breakpoints']
- self.assertIn('foo',
- breakpoints[0]['details']['Breakpoint']['BKPTResolver']['Options']['SymbolNames'],
- 'foo is a symbol breakpoint')
- self.assertTrue(breakpoints[1]['details']['Breakpoint']['BKPTResolver']['Options']['FileName'].endswith('main.cpp'),
- 'target has source line breakpoint in main.cpp')
+class TestVSCode_terminatedEvent(lldbvscode_testcase.VSCodeTestCaseBase):
@skipIfWindows
@skipIfRemote
@@ -65,34 +45,20 @@ def test_terminated_event(self):
self.continue_to_exit()
statistics = self.vscode.wait_for_terminated()['statistics']
- self.check_statistic(statistics)
- self.check_target(statistics)
+ self.assertTrue(statistics['totalDebugInfoByteSize'] > 0)
+ self.assertTrue(statistics['totalDebugInfoEnabled'] > 0)
+ self.assertTrue(statistics['totalModuleCountHasDebugInfo'] > 0)
- @skipIfWindows
- @skipIfRemote
- @expectedFailureAll(oslist=['linux'], archs=['arm', 'aarch64'])
- def test_initialized_event(self):
- '''
- Initialized Event
- Now contains the statistics of a debug session:
- totalDebugInfoByteSize > 0
- totalDebugInfoEnabled > 0
- totalModuleCountHasDebugInfo > 0
- totalBreakpointResolveTime > 0
- ...
- '''
+ self.assertIsNotNone(statistics['memory'])
+ self.assertNotIn('modules', statistics.keys())
- program_basename = "a.out.stripped"
- program = self.getBuildArtifact(program_basename)
- self.build_and_launch(program)
- # Set breakpoints
- functions = ['foo']
- breakpoint_ids = self.set_function_breakpoints(functions)
- self.assertEquals(len(breakpoint_ids), len(functions), 'expect one breakpoint')
- main_bp_line = line_number('main.cpp', '// main breakpoint 1')
- breakpoint_ids.append(self.set_source_breakpoints('main.cpp', [main_bp_line]))
+ # lldb-vscode debugs one target at a time
+ target = json.loads(statistics['targets'])[0]
+ self.assertTrue(target['totalBreakpointResolveTime'] > 0)
- self.continue_to_breakpoints(breakpoint_ids)
- statistics = self.vscode.initialized_event['statistics']
- self.check_statistic(statistics)
- self.continue_to_exit()
+ breakpoints = target['breakpoints']
+ self.assertIn('foo',
+ breakpoints[0]['details']['Breakpoint']['BKPTResolver']['Options']['SymbolNames'],
+ 'foo is a symbol breakpoint')
+ self.assertTrue(breakpoints[1]['details']['Breakpoint']['BKPTResolver']['Options']['FileName'].endswith('main.cpp'),
+ 'target has source line breakpoint in main.cpp')
diff --git a/lldb/test/API/tools/lldb-vscode/eventStatistic/foo.cpp b/lldb/test/API/tools/lldb-vscode/terminated-event/foo.cpp
similarity index 100%
rename from lldb/test/API/tools/lldb-vscode/eventStatistic/foo.cpp
rename to lldb/test/API/tools/lldb-vscode/terminated-event/foo.cpp
diff --git a/lldb/test/API/tools/lldb-vscode/eventStatistic/foo.h b/lldb/test/API/tools/lldb-vscode/terminated-event/foo.h
similarity index 100%
rename from lldb/test/API/tools/lldb-vscode/eventStatistic/foo.h
rename to lldb/test/API/tools/lldb-vscode/terminated-event/foo.h
diff --git a/lldb/test/API/tools/lldb-vscode/eventStatistic/main.cpp b/lldb/test/API/tools/lldb-vscode/terminated-event/main.cpp
similarity index 100%
rename from lldb/test/API/tools/lldb-vscode/eventStatistic/main.cpp
rename to lldb/test/API/tools/lldb-vscode/terminated-event/main.cpp
diff --git a/lldb/tools/lldb-vscode/JSONUtils.cpp b/lldb/tools/lldb-vscode/JSONUtils.cpp
index f57fae727114c..53f1d509d08bd 100644
--- a/lldb/tools/lldb-vscode/JSONUtils.cpp
+++ b/lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -1209,12 +1209,6 @@ llvm::json::Object CreateTerminatedEventObject() {
return event;
}
-llvm::json::Object CreateInitializedEventObject() {
- llvm::json::Object event(CreateEventObject("initialized"));
- addStatistic(event);
- return event;
-}
-
std::string JSONToString(const llvm::json::Value &json) {
std::string data;
llvm::raw_string_ostream os(data);
diff --git a/lldb/tools/lldb-vscode/JSONUtils.h b/lldb/tools/lldb-vscode/JSONUtils.h
index 2400cbc0aca4a..c812ec87beab0 100644
--- a/lldb/tools/lldb-vscode/JSONUtils.h
+++ b/lldb/tools/lldb-vscode/JSONUtils.h
@@ -491,12 +491,6 @@ CreateRunInTerminalReverseRequest(const llvm::json::Object &launch_request,
/// A body JSON object with debug info and breakpoint info
llvm::json::Object CreateTerminatedEventObject();
-/// Create a "Initialized" JSON object that contains statistics
-///
-/// \return
-/// A body JSON object with debug info
-llvm::json::Object CreateInitializedEventObject();
-
/// Convert a given JSON object to a string.
std::string JSONToString(const llvm::json::Value &json);
diff --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp
index 269ff4c6552b8..21d2bc2229043 100644
--- a/lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -687,7 +687,7 @@ void request_attach(const llvm::json::Object &request) {
g_vsc.SendJSON(llvm::json::Value(std::move(response)));
if (error.Success()) {
SendProcessEvent(Attach);
- g_vsc.SendJSON(CreateInitializedEventObject());
+ g_vsc.SendJSON(CreateEventObject("initialized"));
}
}
@@ -1754,7 +1754,7 @@ void request_launch(const llvm::json::Object &request) {
SendProcessEvent(Attach); // this happens when doing runInTerminal
else
SendProcessEvent(Launch);
- g_vsc.SendJSON(CreateInitializedEventObject());
+ g_vsc.SendJSON(llvm::json::Value(CreateEventObject("initialized")));
}
// "NextRequest": {
More information about the lldb-commits
mailing list