prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Debugging modules (using -m switch)
  This is currently not supported
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `ptvsd/debugger.py`
  Content:
  ```
  1 # Copyright (c) Microsoft Corporation. All rights reserved.
  2 # Licensed under the MIT License. See LICENSE in the project root
  3 # for license information.
  4 
  5 import sys
  6 
  7 
  8 __author__ = "Microsoft Corporation <ptvshelp@microsoft.com>"
  9 __version__ = "4.0.0a1"
  10 
  11 DONT_DEBUG = []
  12 
  13 
  14 def debug(filename, port_num, debug_id, debug_options, run_as):
  15     # TODO: docstring
  16 
  17     # import the wrapper first, so that it gets a chance
  18     # to detour pydevd socket functionality.
  19     import ptvsd.wrapper
  20     import pydevd
  21 
  22     sys.argv[1:0] = [
  23             '--port', str(port_num),
  24             '--client', '127.0.0.1',
  25             '--file', filename,
  26             ]
  27     try:
  28         pydevd.main()
  29     except SystemExit as ex:
  30         ptvsd.wrapper.ptvsd_sys_exit_code = ex.code
  31         raise
  32
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/ptvsd/debugger.py b/ptvsd/debugger.py
  --- a/ptvsd/debugger.py
  +++ b/ptvsd/debugger.py
  @@ -19,11 +19,16 @@
       import ptvsd.wrapper
       import pydevd
   
  -    sys.argv[1:0] = [
  +    args = [
               '--port', str(port_num),
               '--client', '127.0.0.1',
  -            '--file', filename,
               ]
  +    if run_as == 'module':
  +        args.append('--module')
  +        args.extend(('--file', filename + ":"))
  +    else:
  +        args.extend(('--file', filename))
  +    sys.argv[1:0] = args
       try:
           pydevd.main()
       except SystemExit as ex:
  
verification_info: {"golden_diff": "diff --git a/ptvsd/debugger.py b/ptvsd/debugger.py\n--- a/ptvsd/debugger.py\n+++ b/ptvsd/debugger.py\n@@ -19,11 +19,16 @@\n     import ptvsd.wrapper\n     import pydevd\n \n-    sys.argv[1:0] = [\n+    args = [\n             '--port', str(port_num),\n             '--client', '127.0.0.1',\n-            '--file', filename,\n             ]\n+    if run_as == 'module':\n+        args.append('--module')\n+        args.extend(('--file', filename + \":\"))\n+    else:\n+        args.extend(('--file', filename))\n+    sys.argv[1:0] = args\n     try:\n         pydevd.main()\n     except SystemExit as ex:\n", "issue": "Debugging modules (using -m switch)\nThis is currently not supported\n", "before_files": [{"content": "# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License. See LICENSE in the project root\n# for license information.\n\nimport sys\n\n\n__author__ = \"Microsoft Corporation <ptvshelp@microsoft.com>\"\n__version__ = \"4.0.0a1\"\n\nDONT_DEBUG = []\n\n\ndef debug(filename, port_num, debug_id, debug_options, run_as):\n    # TODO: docstring\n\n    # import the wrapper first, so that it gets a chance\n    # to detour pydevd socket functionality.\n    import ptvsd.wrapper\n    import pydevd\n\n    sys.argv[1:0] = [\n            '--port', str(port_num),\n            '--client', '127.0.0.1',\n            '--file', filename,\n            ]\n    try:\n        pydevd.main()\n    except SystemExit as ex:\n        ptvsd.wrapper.ptvsd_sys_exit_code = ex.code\n        raise\n", "path": "ptvsd/debugger.py"}], "after_files": [{"content": "# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License. See LICENSE in the project root\n# for license information.\n\nimport sys\n\n\n__author__ = \"Microsoft Corporation <ptvshelp@microsoft.com>\"\n__version__ = \"4.0.0a1\"\n\nDONT_DEBUG = []\n\n\ndef debug(filename, port_num, debug_id, debug_options, run_as):\n    # TODO: docstring\n\n    # import the wrapper first, so that it gets a chance\n    # to detour pydevd socket functionality.\n    import ptvsd.wrapper\n    import pydevd\n\n    args = [\n            '--port', str(port_num),\n            '--client', '127.0.0.1',\n            ]\n    if run_as == 'module':\n        args.append('--module')\n        args.extend(('--file', filename + \":\"))\n    else:\n        args.extend(('--file', filename))\n    sys.argv[1:0] = args\n    try:\n        pydevd.main()\n    except SystemExit as ex:\n        ptvsd.wrapper.ptvsd_sys_exit_code = ex.code\n        raise\n", "path": "ptvsd/debugger.py"}]}