[Lldb-commits] [lldb] r354308 - Fix vscode tests for python3

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 19 00:25:26 PST 2019


Author: labath
Date: Tue Feb 19 00:25:25 2019
New Revision: 354308

URL: http://llvm.org/viewvc/llvm-project?rev=354308&view=rev
Log:
Fix vscode tests for python3

encode/decode the data before sending it over the socket. Since (AFAICT)
the vscode protocol (unlike the gdb-remote one) is fully textual, using
the utf8 codec here is appropriate.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py?rev=354308&r1=354307&r2=354308&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py Tue Feb 19 00:25:25 2019
@@ -54,7 +54,7 @@ def read_packet(f, verbose=False, trace_
     '''Decode a JSON packet that starts with the content length and is
        followed by the JSON bytes from a file 'f'
     '''
-    line = f.readline()
+    line = f.readline().decode("utf-8")
     if len(line) == 0:
         return None
 
@@ -121,7 +121,7 @@ class DebugCommunication(object):
 
     @classmethod
     def encode_content(cls, s):
-        return "Content-Length: %u\r\n\r\n%s" % (len(s), s)
+        return ("Content-Length: %u\r\n\r\n%s" % (len(s), s)).encode("utf-8")
 
     @classmethod
     def validate_response(cls, command, response):




More information about the lldb-commits mailing list