diff --git a/adapter/debugsession.py b/adapter/debugsession.py index 974a60dc..6484f1e2 100644 --- a/adapter/debugsession.py +++ b/adapter/debugsession.py @@ -185,7 +185,7 @@ def DEBUG_attach(self, args): pid = args.get('pid', None) program = args.get('program', None) if pid is None and program is None: - raise UserError('One of \'program\', \'pid\' properties is required for attach.') + raise UserError('Either \'program\' or \'pid\' is required for attach.') self.exec_commands(args.get('initCommands')) self.target = self.create_target(args) self.disassembly = disassembly.AddressSpace(self.target) @@ -276,7 +276,7 @@ def create_target(self, args): raise UserError('Could not initialize debug target: ' + error.GetCString()) else: if args['request'] == 'launch': - raise UserError('\program\' is required for launch.') + raise UserError('\'program\' property is required for launch.') target = self.debugger.CreateTarget('') # OK if attaching by pid target.GetBroadcaster().AddListener(self.event_listener, lldb.SBTarget.eBroadcastBitBreakpointChanged) return target @@ -324,7 +324,7 @@ def configure_stdio(self, args): title = 'Debug - ' + args.get('name', '?') self.terminal = terminal.create( lambda args: self.spawn_vscode_terminal(kind=term_type, args=args, title=title)) - term_fd = self.terminal.tty + term_fd = to_lldb_str(self.terminal.tty) else: term_fd = None # that'll send them to VSCode debug console else: # Windows @@ -845,7 +845,11 @@ def DEBUG_stackTrace(self, args): fs = le.GetFileSpec() local_path = self.map_filespec_to_local(fs) if local_path is not None: - stack_frame['source'] = { 'name': fs.GetFilename(), 'path': local_path } + stack_frame['source'] = { + 'name': fs.GetFilename(), + 'path': local_path, + 'origin': frame.GetModule().GetFileSpec().GetFilename() + } stack_frame['line'] = le.GetLine() stack_frame['column'] = le.GetColumn() else: @@ -854,7 +858,11 @@ def DEBUG_stackTrace(self, args): if not dasm: dasm = self.disassembly.create_from_address(pc_addr) if dasm: - stack_frame['source'] = { 'name': dasm.source_name, 'sourceReference': dasm.source_ref } + stack_frame['source'] = { + 'name': dasm.source_name, + 'sourceReference': dasm.source_ref, + 'origin': frame.GetModule().GetFileSpec().GetFilename() + } stack_frame['line'] = dasm.line_num_by_address(pc_addr.GetLoadAddress(self.target)) stack_frame['column'] = 0 diff --git a/adapter/terminal.py b/adapter/terminal.py index e9a8a748..5b03e42c 100644 --- a/adapter/terminal.py +++ b/adapter/terminal.py @@ -1,7 +1,6 @@ import os import socket import subprocess -import string import logging log = logging.getLogger('terminal') @@ -21,9 +20,9 @@ def create(spawn_terminal=None): ls.bind(('127.0.0.1', 0)) ls.listen(1) addr, port = ls.getsockname() - # terminal.sh opens a TCP connection, sends output of `tty`, + # terminal.sh opens a TCP connection, sends output of `tty`, # waits till the socket gets closed from our end - args = [os.path.join(os.path.dirname(__file__), 'terminal.sh'), str(port)] + args = ['/bin/bash', '-c', 'exec 3<>/dev/tcp/127.0.0.1/%d; tty >&3; clear; read <&3' % port] if spawn_terminal is not None: spawn_terminal(args) else: @@ -40,8 +39,8 @@ def create(spawn_terminal=None): reason = 'connection aborted' break log.info('received %s', data) - output += data - lines = string.split(output, '\n') + output += data.decode('utf8') + lines = output.split('\n') if len(lines) > 1: return Terminal(lines[0], conn) except (OSError, socket.timeout): diff --git a/package.json b/package.json index 3ca44a6e..5e4c4b2e 100644 --- a/package.json +++ b/package.json @@ -394,7 +394,7 @@ "default": null }, "terminal": { - "description": "Terminal type to use for the program.", + "description": "Terminal type to use.", "type": "string", "enum": [ "integrated",