[Lldb-commits] [PATCH] D76314: [lldb-vscode] stop read loop after termination
walter erquinigo via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 18 13:02:06 PDT 2020
wallace updated this revision to Diff 251149.
wallace added a comment.
add a test
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76314/new/
https://reviews.llvm.org/D76314
Files:
lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
lldb/tools/lldb-vscode/lldb-vscode.cpp
Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===================================================================
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -2821,7 +2821,7 @@
}
auto request_handlers = GetRequestHandlers();
uint32_t packet_idx = 0;
- while (true) {
+ while (!g_vsc.sent_terminated_event) {
std::string json = g_vsc.ReadJSON();
if (json.empty())
break;
Index: lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
===================================================================
--- lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
+++ lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
@@ -9,6 +9,7 @@
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
import lldbvscode_testcase
+import time
import os
@@ -37,6 +38,21 @@
@skipIfWindows
@skipIfRemote
+ def test_termination(self):
+ '''
+ Tests the correct termination of lldb-vscode upon a 'disconnect'
+ request.
+ '''
+ program = self.getBuildArtifact("a.out")
+ self.build_and_launch(program, stopOnEntry=True)
+ self.vscode.request_disconnect(terminateDebuggee=True)
+ time.sleep(1)
+ # The underlying lldb-vscode process must have already finished even though
+ # we didn't close the communication socket explicitly
+ self.assertEqual(self.vscode.process.poll(), 0)
+
+ @skipIfWindows
+ @skipIfRemote
def test_stopOnEntry(self):
'''
Tests the default launch of a simple program that stops at the
@@ -393,4 +409,4 @@
# Get output from the console. This should contain both the
# "exitCommands" that were run after the second breakpoint was hit
output = self.get_console(timeout=1.0)
- self.verify_commands('exitCommands', output, exitCommands)
+ self.verify_commands('exitCommands', output, exitCommands)
\ No newline at end of file
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76314.251149.patch
Type: text/x-patch
Size: 2014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200318/69519a80/attachment-0001.bin>
More information about the lldb-commits
mailing list