Skip to content

Commit

Permalink
Sync pydevd -> debugpy
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Jan 5, 2021
1 parent f118b10 commit 2182480
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
CMD_STEP_RETURN_MY_CODE = 160

CMD_SET_PY_EXCEPTION_JSON = 161
CMD_SET_PATH_MAPPING_JSON = 162

CMD_REDIRECT_OUTPUT = 200
CMD_GET_NEXT_STATEMENT_TARGETS = 201
Expand Down Expand Up @@ -174,6 +175,7 @@
'160': 'CMD_STEP_RETURN_MY_CODE',

'161': 'CMD_SET_PY_EXCEPTION_JSON',
'162': 'CMD_SET_PATH_MAPPING_JSON',

'200': 'CMD_REDIRECT_OUTPUT',
'201': 'CMD_GET_NEXT_STATEMENT_TARGETS',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,40 @@ def cmd_console_exec(self, py_db, cmd_id, seq, text):
thread_id, frame_id, scope, expression = text.split('\t', 3)
self.api.request_console_exec(py_db, seq, thread_id, frame_id, expression)

def cmd_set_path_mapping_json(self, py_db, cmd_id, seq, text):
'''
:param text:
Json text. Something as:
{
"pathMappings": [
{
"localRoot": "c:/temp",
"remoteRoot": "/usr/temp"
}
],
"debug": true,
"force": false
}
'''
as_json = json.loads(text)
force = as_json.get('force', False)

path_mappings = []
for pathMapping in as_json.get('pathMappings', []):
localRoot = pathMapping.get('localRoot', '')
remoteRoot = pathMapping.get('remoteRoot', '')
if (localRoot != '') and (remoteRoot != ''):
path_mappings.append((localRoot, remoteRoot))

if bool(path_mappings) or force:
pydevd_file_utils.setup_client_server_paths(path_mappings)

debug = as_json.get('debug', False)
if debug or force:
pydevd_file_utils.DEBUG_CLIENT_SERVER_TRANSLATION = debug


def cmd_set_py_exception_json(self, py_db, cmd_id, seq, text):
# This API is optional and works 'in bulk' -- it's possible
# to get finer-grained control with CMD_ADD_EXCEPTION_BREAK/CMD_REMOVE_EXCEPTION_BREAK
Expand Down

0 comments on commit 2182480

Please sign in to comment.