Skip to content

Commit 22887ff

Browse files
committed
Revert "Send statistics in initialized event"
The test is failing on linux. This reverts commits 7fe3586 and d599ac4.
1 parent 1814921 commit 22887ff

File tree

9 files changed

+17
-66
lines changed

9 files changed

+17
-66
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ def __init__(self, recv, send, init_commands, log_file=None):
134134
self.configuration_done_sent = False
135135
self.frame_scopes = {}
136136
self.init_commands = init_commands
137-
self.initialized_event = None
138137

139138
@classmethod
140139
def encode_content(cls, s):
@@ -232,8 +231,6 @@ def handle_recv_packet(self, packet):
232231
self._process_stopped()
233232
tid = body['threadId']
234233
self.thread_stop_reasons[tid] = body
235-
elif event == 'initialized':
236-
self.initialized_event = packet
237234
elif event == 'breakpoint':
238235
# Breakpoint events come in when a breakpoint has locations
239236
# added or removed. Keep track of them so we can look for them

lldb/test/API/tools/lldb-vscode/eventStatistic/TestVSCode_eventStatistic.py renamed to lldb/test/API/tools/lldb-vscode/terminated-event/TestVSCode_terminatedEvent.py

Lines changed: 15 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,7 @@
1010
import re
1111
import json
1212

13-
class TestVSCode_eventStatistic(lldbvscode_testcase.VSCodeTestCaseBase):
14-
15-
def check_statistic(self, statistics):
16-
self.assertTrue(statistics['totalDebugInfoByteSize'] > 0)
17-
self.assertTrue(statistics['totalDebugInfoEnabled'] > 0)
18-
self.assertTrue(statistics['totalModuleCountHasDebugInfo'] > 0)
19-
20-
self.assertIsNotNone(statistics['memory'])
21-
self.assertNotIn('modules', statistics.keys())
22-
23-
def check_target(self, statistics):
24-
# lldb-vscode debugs one target at a time
25-
target = json.loads(statistics['targets'])[0]
26-
self.assertTrue(target['totalBreakpointResolveTime'] > 0)
27-
28-
breakpoints = target['breakpoints']
29-
self.assertIn('foo',
30-
breakpoints[0]['details']['Breakpoint']['BKPTResolver']['Options']['SymbolNames'],
31-
'foo is a symbol breakpoint')
32-
self.assertTrue(breakpoints[1]['details']['Breakpoint']['BKPTResolver']['Options']['FileName'].endswith('main.cpp'),
33-
'target has source line breakpoint in main.cpp')
13+
class TestVSCode_terminatedEvent(lldbvscode_testcase.VSCodeTestCaseBase):
3414

3515
@skipIfWindows
3616
@skipIfRemote
@@ -65,34 +45,20 @@ def test_terminated_event(self):
6545
self.continue_to_exit()
6646

6747
statistics = self.vscode.wait_for_terminated()['statistics']
68-
self.check_statistic(statistics)
69-
self.check_target(statistics)
48+
self.assertTrue(statistics['totalDebugInfoByteSize'] > 0)
49+
self.assertTrue(statistics['totalDebugInfoEnabled'] > 0)
50+
self.assertTrue(statistics['totalModuleCountHasDebugInfo'] > 0)
7051

71-
@skipIfWindows
72-
@skipIfRemote
73-
@expectedFailureAll(oslist=['linux'], archs=['arm', 'aarch64'])
74-
def test_initialized_event(self):
75-
'''
76-
Initialized Event
77-
Now contains the statistics of a debug session:
78-
totalDebugInfoByteSize > 0
79-
totalDebugInfoEnabled > 0
80-
totalModuleCountHasDebugInfo > 0
81-
totalBreakpointResolveTime > 0
82-
...
83-
'''
52+
self.assertIsNotNone(statistics['memory'])
53+
self.assertNotIn('modules', statistics.keys())
8454

85-
program_basename = "a.out.stripped"
86-
program = self.getBuildArtifact(program_basename)
87-
self.build_and_launch(program)
88-
# Set breakpoints
89-
functions = ['foo']
90-
breakpoint_ids = self.set_function_breakpoints(functions)
91-
self.assertEquals(len(breakpoint_ids), len(functions), 'expect one breakpoint')
92-
main_bp_line = line_number('main.cpp', '// main breakpoint 1')
93-
breakpoint_ids.append(self.set_source_breakpoints('main.cpp', [main_bp_line]))
55+
# lldb-vscode debugs one target at a time
56+
target = json.loads(statistics['targets'])[0]
57+
self.assertTrue(target['totalBreakpointResolveTime'] > 0)
9458

95-
self.continue_to_breakpoints(breakpoint_ids)
96-
statistics = self.vscode.initialized_event['statistics']
97-
self.check_statistic(statistics)
98-
self.continue_to_exit()
59+
breakpoints = target['breakpoints']
60+
self.assertIn('foo',
61+
breakpoints[0]['details']['Breakpoint']['BKPTResolver']['Options']['SymbolNames'],
62+
'foo is a symbol breakpoint')
63+
self.assertTrue(breakpoints[1]['details']['Breakpoint']['BKPTResolver']['Options']['FileName'].endswith('main.cpp'),
64+
'target has source line breakpoint in main.cpp')

lldb/tools/lldb-vscode/JSONUtils.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,12 +1209,6 @@ llvm::json::Object CreateTerminatedEventObject() {
12091209
return event;
12101210
}
12111211

1212-
llvm::json::Object CreateInitializedEventObject() {
1213-
llvm::json::Object event(CreateEventObject("initialized"));
1214-
addStatistic(event);
1215-
return event;
1216-
}
1217-
12181212
std::string JSONToString(const llvm::json::Value &json) {
12191213
std::string data;
12201214
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
@@ -491,12 +491,6 @@ CreateRunInTerminalReverseRequest(const llvm::json::Object &launch_request,
491491
/// A body JSON object with debug info and breakpoint info
492492
llvm::json::Object CreateTerminatedEventObject();
493493

494-
/// Create a "Initialized" JSON object that contains statistics
495-
///
496-
/// \return
497-
/// A body JSON object with debug info
498-
llvm::json::Object CreateInitializedEventObject();
499-
500494
/// Convert a given JSON object to a string.
501495
std::string JSONToString(const llvm::json::Value &json);
502496

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ void request_attach(const llvm::json::Object &request) {
687687
g_vsc.SendJSON(llvm::json::Value(std::move(response)));
688688
if (error.Success()) {
689689
SendProcessEvent(Attach);
690-
g_vsc.SendJSON(CreateInitializedEventObject());
690+
g_vsc.SendJSON(CreateEventObject("initialized"));
691691
}
692692
}
693693

@@ -1754,7 +1754,7 @@ void request_launch(const llvm::json::Object &request) {
17541754
SendProcessEvent(Attach); // this happens when doing runInTerminal
17551755
else
17561756
SendProcessEvent(Launch);
1757-
g_vsc.SendJSON(CreateInitializedEventObject());
1757+
g_vsc.SendJSON(llvm::json::Value(CreateEventObject("initialized")));
17581758
}
17591759

17601760
// "NextRequest": {

0 commit comments

Comments
 (0)