[Lldb-commits] [PATCH] D76314: [lldb-vscode] stop read loop after termination
Phabricator via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 20 14:40:57 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG576105c322b6: [lldb-vscode] stop read loop after termination (authored by Walter Erquinigo <waltermelon at fb.com>).
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
@@ -2818,7 +2818,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,31 @@
@skipIfWindows
@skipIfRemote
+ def test_termination(self):
+ '''
+ Tests the correct termination of lldb-vscode upon a 'disconnect'
+ request.
+ '''
+ self.create_debug_adaptor()
+ # The underlying lldb-vscode process must be alive
+ self.assertEqual(self.vscode.process.poll(), None)
+
+ # The lldb-vscode process should finish even though
+ # we didn't close the communication socket explicitly
+ self.vscode.request_disconnect()
+
+ # Wait until the underlying lldb-vscode process dies.
+ # We need to do this because the popen.wait function in python2.7
+ # doesn't have a timeout argument.
+ for _ in range(10):
+ time.sleep(1)
+ if self.vscode.process.poll() is not None:
+ break
+ # Check the return code
+ 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76314.251773.patch
Type: text/x-patch
Size: 1970 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200320/4b9a63e5/attachment-0001.bin>
More information about the lldb-commits
mailing list