Commit graph

1225 commits

Author SHA1 Message Date
Fabio Zadrozny
5fcc3e4cd5 Provide api to skip terminating child processes on terminate. Fixes #1786 2019-09-23 16:21:26 -03:00
Pavel Minaev
3908192ce7 Work around import deadlock in enable_attach() on Python 2 (#1788). 2019-09-20 12:50:52 -07:00
Fabio Zadrozny
8efec2b3f6 Properly show stack trace exception for unhandled exceptions with generator. Fixes #1744 2019-09-20 16:34:25 -03:00
Karthik Nadig
d8d8f36058
Add ppid to PydevdProcessInfo (#1791)
* Add ppid to PydevdProcessInfo

* Update tests
2019-09-20 08:44:46 -07:00
Karthik Nadig
2b429c7b21
Linter remove unused threading in util 2019-09-19 10:55:56 -07:00
Karthik Nadig
636400a24a
enable_attach should spawn adapter (#1784)
* Spawn adapter in enable attach.

* Addressing comments and simplifying

* Minor tweaks
2019-09-19 10:51:21 -07:00
Pavel Minaev
0825dbeb37 Add code coverage for tests (excluding ptvsd.server and pydevd).
Fix some issues on Python 2.7.

Remove dead code.
2019-09-18 21:42:51 -07:00
Fabio Zadrozny
b7c48cc9fe Provide api to launch python executable without subprocess patching. Fixes #1711 (#1779) 2019-09-17 22:24:52 -07:00
Fabio Zadrozny
c4ef317009 Provide a way to peek at DAP messages received and sent by pydevd. Fixes #1765 (#1774) 2019-09-16 19:19:22 -07:00
Pavel Minaev
0be597c4b2 Fix #1769: Logpoint messages aren't printed for "launch"
When using launcher to redirect output, tell pydevd to not perform redirection.

Always propagate "output" events from the server to the IDE.

Fix test_log_point to not assume that logpoint output is strictly ordered wrt regular output.
2019-09-16 12:49:28 -07:00
Pavel Minaev
9692e9770f Replace --multiprocess CLI switch with --no-subprocesses to reflect multiproc debugging being on by default.
Fix test_parse_args accordingly.
2019-09-14 01:54:08 -07:00
Pavel Minaev
76a21e19d9 Rename ptvsd.server.main -> ptvsd.server.cli, for consistency with ptvsd.server.api. 2019-09-14 01:54:08 -07:00
Pavel Minaev
e729b32ee6 Fix "output" event propagation from server to only exclude stdout and stderr when launcher is present. 2019-09-13 11:05:41 -07:00
Pavel Minaev
03b04928e1 Fix test_vs_specific 2019-09-13 11:05:41 -07:00
Pavel Minaev
f00075ffd3 Fix test_disconnect 2019-09-13 11:05:41 -07:00
Pavel Minaev
d5441a0363 Fix feature flags in pydevd "initialize" response. 2019-09-13 11:05:41 -07:00
Pavel Minaev
bb4bc24abf Don't try to gracefully disconnect from the adapter if test fails. 2019-09-13 11:05:41 -07:00
Pavel Minaev
b6d23c4356 test_exception fixes. 2019-09-12 22:33:26 -07:00
Pavel Minaev
fef15c91c9 Fix \r\n not processed in output captured by the launcher. 2019-09-12 22:33:26 -07:00
Pavel Minaev
8ab0d0d0d6 Fix multiprocessing in Django and Flask tests. 2019-09-12 22:33:26 -07:00
Pavel Minaev
823e221c98 Add support for ptvsd.attach() in "attach" request. 2019-09-12 22:33:26 -07:00
Pavel Minaev
1b9688652d Don't apply timeout to the IDE->adapter connection. 2019-09-12 22:33:26 -07:00
Fabio Zadrozny
63768ba41c Support for terminate and terminateDebuggee. Fixes #1755 2019-09-12 12:05:26 -03:00
Pavel Minaev
eb1bb4dd5b Test fixes. 2019-09-11 20:12:12 -07:00
Fabio Zadrozny
d2055ed968
Merge pull request #1758 from fabioz/dbg_adapter_refactor_merge
Merging master > dbg_adapter_refactor.
2019-09-11 10:22:04 -03:00
Pavel Minaev
340942aafc Fix #1695: Handle IDE, launcher, debug server, and no-debug disconnect
Fix #1721 "runInTerminal" is broken on non-Windows platforms.

Fix #1722: Output is not captured in "noDebug" with "runInTerminal"

Groundwork for #1713: adapter: multiple concurrent sessions

Move "launch" request parsing and debuggee process spawning, PID reporting and tracking, stdio "output" capture, and exit code reporting into launcher. Launcher now communicates to the adapter via a full-fledged message channel.

Refactor adapter. Add an abstraction for a debug session, and treat IDE, launcher, and debug server as separate components managed by that session.

Improve adapter logging to capture information about current debug session, and current message handler if any.

Fix reporting exceptions from message handlers.

Various test fixes.
2019-09-10 15:12:23 -07:00
Fabio Zadrozny
fd20f005e1 Merge master > dbg_adapter_refactor 2019-09-10 09:52:59 -03:00
Karthik Nadig
30615996ba
More test fixes (#1753)
* Migrate tracing feature and update tracing tests

* Other minor fixes

* fix resume on stepping
2019-09-07 10:46:00 -07:00
Karthik Nadig
7623560e3d
Fixes and move more helpers. (#1752) 2019-09-06 14:47:47 -07:00
Karthik Nadig
90d3a6f1ca
Move new tests from master to refactor branch (#1750)
* Add test_step_multi_threads

* Add more tests
2019-09-06 13:39:10 -07:00
Karthik Nadig
6e44d161ca
Fix for attach to pid tests (#1747)
* Fix for attach to pid tests

* Address comments.

* More asserts and comments.
2019-09-05 18:12:22 -07:00
Fabio Zadrozny
90298c4e79 Password no longer echoed in getpass (in Windows). Fixes #1723 2019-08-30 08:04:27 -03:00
Fabio Zadrozny
f45444f9f9 Make it possible to evaluate without a frameId. Fixes #1716 2019-08-30 08:01:54 -03:00
Karthik Nadig
2a367b2f4b
Bunch of minor test fixes (#1726)
* Bunch of minor test fixes

* Fix linter and multiproc

* Remove missed os.environ

* Rename and move stop_debugging

* Add evaluate helper

* Add exit_code property

* Enable pytest and flake8 in workspace

* Fix test failure

* Set ptvsd python path in tests

* Rename exit_code to expected_exit_code
2019-08-29 00:19:50 -07:00
Fabio Zadrozny
20d0f1a0bc Add processId to initialize response. Fixes #1717 2019-08-28 07:43:17 -03:00
Fabio Zadrozny
816ccb631b Provide access tokens in debugger. Fixes #1710 2019-08-28 07:43:17 -03:00
Pavel Minaev
5f2cb304a6 Use pydevd.settrace() argument instead of patch_new_process_functions() to enable multiprocessing.
Add multiprocessing= argument to attach() and enable_attach().

Refactor common code in attach() and enable_attach().

Remove broken legacy multiproc implementation.
2019-08-24 15:38:48 -07:00
Pavel Minaev
915515d910 Fix output capture for "noDebug".
Ensure that all captured output is reported to the IDE before reporting process exit.

Correctly report "process", "exited", and "terminated" events for "noDebug".

Don't treat partial message reads as fatal error.

Switch test_nodebug to "internalConsole", so that it can properly produce "output" events.

Expect failure response from "setBreakpoints" in test_nodebug.

Fix environment dict being shared between subsequent test runs, causing spurious enable_attach() in debuggee.

Fix ordering in debuggee and adapter cleanup in debug.Session.

Fix launcher.py on Python 2.7
2019-08-24 15:38:48 -07:00
Karthik Nadig
3158583bd3
Fix some tests. (#1719)
* Don't wait for thread event

* Fix get variables

* Fix completion tests

* Fix evaluate tests

* Fix linter
2019-08-23 10:28:46 -07:00
Karthik Nadig
2afcdc91f5
Minor fixes (#1718)
* Fix missed return

* Remove threading check
2019-08-22 17:39:35 -07:00
Fabio Zadrozny
15a9befccf
Merge master > dbg_adapter_refactor (#1709) 2019-08-22 08:55:01 -03:00
Fabio Zadrozny
a08708dc8b
Autoreload in CherryPy no longer blocked by pydevd threads. Fixes #1691 (#1702)
* Autoreload in CherryPy no longer blocked by pydevd threads. Fixes #1691

* Don't send CMD_EXIT to the IDE.
2019-08-20 14:42:15 -03:00
Karthik Nadig
9ece432dff
Attach to pid support (#1701)
* Fix launcher test

* Attach to pid support

* Address comments.

* Minor tweaks
2019-08-19 14:08:23 -07:00
Pavel Minaev
e94980f86c Do not load ptvsd.server (and hence, pydevd) unless the subpackage is loaded explicitly or via a public API entrypoint that requires it.
Move docstrings to top-level package, and update them to reflect the current behavior.

Remove unused code in ptvsd.common.log.

Move sys.path/prefix/site_packages logging into ptvsd.common.log, and log it from adapter and server to the same level of detail as the tests.

Fix injected code snipped for attach-by-PID.

Fix some Unicode issues in adapter and tests.

Refactor Timeline, debug.Session, and start methods.
2019-08-18 11:43:23 -07:00
Karthik Nadig
6eb65d8a7e
Support for noDebug (#1696)
* noDebug mode support

* Ensure we get the debuggee pid on launch

* Fix state change bug

* Tweaking pid retreival

* Use makefile and simplify pid retreival

* Addressing comments

* Run formatter

* Change name common.socket to common.sockets

* Add some timeouts

* Fix linter
2019-08-17 20:23:06 -07:00
Pavel Minaev
99c0a5d82d Fix #1697: Adapter doesn't handle "env" properly in "internalConsole" mode on Python 2.7
Encode environment variables on Python 2.

Fix #1659: Debuggee output breaks adapter with "internalConsole"

Use os.devnull for debuggee stdin, and redirect debuggee stdout to stderr.

Capture output for debuggee stdout and stderr, generate DAP "output" events from it, and suppress the same coming from the debug server.
2019-08-16 22:26:12 -07:00
Karthik Nadig
2781f712a2
Fix windows build path 2019-08-14 01:27:02 -07:00
Karthik Nadig
2cfdd9d1cf
Fix root path 2019-08-14 01:19:57 -07:00
Fabio Zadrozny
46e1b758bc Only set PyDB as the global debugger after it's initialized. Fixes #1688 (#1690) 2019-08-13 11:42:18 -07:00
Pavel Minaev
9f37496b4c Fix parsing "host" and "post" in "attach" request. 2019-08-12 14:48:01 -07:00