Commit graph

1945 commits

Author SHA1 Message Date
Pavel Minaev
3cb99794d9 Log connection errors in wait_until_port_is_listening() test helper.
Do not reuse socket in wait_until_port_is_listening() to avoid issues on macOS.
2019-07-18 10:13:02 -07:00
Pavel Minaev
4aec028c32 Improve multiprocess and reattach scenario handling in debug.Session.
Use unbuffered pipes for subprocesses on all Python versions.

Make test watchdog more lenient with respect to process ID reuse - warn, but don't fail.
2019-07-18 10:13:02 -07:00
Pavel Minaev
045fb03888 Detect and log watchdog errors in the tests process.
Do not indent messages that are arrays in the log, to reduce watchdog log verbosity.
2019-07-18 10:13:02 -07:00
Pavel Minaev
32e95c434f Fix #1585 for test_add_and_remove_breakpoint 2019-07-18 10:13:02 -07:00
Pavel Minaev
becee1f697 Properly handle partial writes in JsonIOStream. 2019-07-18 10:13:02 -07:00
Pavel Minaev
1da62fa7b2 Fix JsonIOStream.read_json not correctly detecting EOF over pipes. 2019-07-18 10:13:02 -07:00
Pavel Minaev
a5312fdc8a Fix #1585 for test_log_point 2019-07-18 10:13:02 -07:00
Pavel Minaev
40f1ded82c Explicitly stop the test watchdog at exit. 2019-07-18 10:13:02 -07:00
Pavel Minaev
c04d394a73 Make test_attach parameters clearer. 2019-07-18 10:13:02 -07:00
Pavel Minaev
2963bf98fe Skip test_reattach (#1594) 2019-07-18 10:13:02 -07:00
Pavel Minaev
44ca8fa3fc Fix #1555: Child process watchdog for tests
Implement per-test-runner out-of-process watchdog for processes spawned by tests.

Add file logging for tests and watchdog.

Improve stdio capture in debug.Session when test fails.

Remove redundant logging in debug.Session.
2019-07-18 10:13:02 -07:00
Pavel Minaev
5dcca5fce0 Fix wrapping in timeline logs, and increase the repr length limit accordingly. 2019-07-18 10:13:02 -07:00
Pavel Minaev
4cd1d4163f Fix #1585: Output tests fail sporadically
Wait on a breakpoint before checking output.

Add temp workaround for #1574: Flask tests fail with "no such option: --wait" on windows py27

Pin Flask version to last known good one in tests/requirements.txt.

Other fixes and improvements:

Make start_method mandatory for debug.Session to avoid problems with tests forgetting to specify it.

Add debug_me.scratchpad to enable async communication between test code and debuggee.

Improve debug.Session logging.

Improve test_attach.
2019-07-18 10:13:02 -07:00
Pavel Minaev
edd5753d7e Further improve timeline logging:
Reformat various timeline log entries to improve readability.

Add pretty-printing of composite expectations, to match pretty-printed JSON.

Avoid redundant repetitions of messages when explaining how occurrences matched expectations.
2019-07-18 10:13:02 -07:00
Pavel Minaev
22f25c8d04 Fix timeline logging on Python 2. 2019-07-18 10:13:02 -07:00
Pavel Minaev
c511e98b02 Remove prints in tests outside of the code being debugged - use logging instead. 2019-07-18 10:13:02 -07:00
Pavel Minaev
8d189c8e91 Improve timeline logging for DAP messages:
Show only the metadata necessary to identify the message to reduce verbosiy.

Use JSON representation for easy matching against message logs.
2019-07-18 10:13:02 -07:00
Karthik Nadig
0e173e9170
Fix for breakpoint binding issue in VS (#1601)
* Fix for breakpoint binding issue in VS

* Fix tests
2019-07-17 13:48:53 -07:00
Karthik Nadig
60434f405d
Minor fixes to get debugger working (#1597) 2019-07-15 19:45:28 -07:00
Karthik Nadig
12ea929457
Update DAP (#1598) 2019-07-15 19:24:06 -07:00
Karthik Nadig
d24a39de31
Create client socket and connect to debug server (#1595)
* Create client socket and connect to debug server

* Addressing comments

* Some minor fixes
2019-07-15 14:35:47 -07:00
Karthik Nadig
8929cbb5bb
Minor update to TROUBLESHOOTING.md 2019-07-13 21:52:58 -07:00
Fabio Zadrozny
62501bac94 Don't try to patch arguments when not dealing with python. Fixes #1548 (#1588)
* Properly try to resolve_label multiple times in attach to pid.

* Don't try to patch arguments when not dealing with python. Fixes #1548
2019-07-12 14:54:29 -07:00
Fabio Zadrozny
76863a9340
Attach to pid fixes with threading. Fixes #1542,#1520 (#1582)
* Attach to pid fixes with threading. Fixes #1542,#1520

* Make sure that the python code is actually in bytes.

* Fix folder for attach to pid in mac os.

* Better error message if unable to get the threadStateIndex for the current thread.

* Raise number of attempts to resolve_label during attach to pid (windows).
2019-07-12 14:58:27 -03:00
Fabio Zadrozny
62837418c1
Use set_additional_thread_info to obtain the additional thread info. Fixes #1581 (#1583) 2019-07-12 09:11:19 -03:00
Pavel Minaev
c03206972d Fix remaining tests to reflect the debug adapter refactoring changes.
Fix Flask and Django multiprocess tests.

Fix test logs not being captured by pytest.

Fix "import debug_me" check improperly applied in tests where it is unnecessary.

Fix some clarifying patterns not respecting the underlying pattern.

Add pattern helpers for strings: starting_with, ending_with, containing.

Move DAP test helpers to a separate module, and add a helper for frames.

Add support for line markers when setting breakpoints and matching frames.

Assorted test fixes around handling of Unicode and paths.
2019-07-11 16:19:06 -07:00
Karthik Nadig
70ae96f881
Temporarily use older flask for CI (#1584) 2019-07-11 12:54:11 -07:00
Dave Hirschfeld
4d87f5654c Add a conda-forge badge (#1572) 2019-07-10 15:17:10 -07:00
Fabio Zadrozny
95c456d2e7 Don't trace <string> files unless it's the one from python -c. Fixes #1398 2019-07-10 13:04:53 -07:00
Fabio Zadrozny
65c50f8769 Add source mapping to support ipython cells. Fixes #1503 2019-07-10 13:04:53 -07:00
Pavel Minaev
746bda561e Test fixes. 2019-07-09 12:01:13 -07:00
Pavel Minaev
af768a7611 Blacken more modules. 2019-07-08 12:03:31 -07:00
Pavel Minaev
42bbc0946d Test fixes. 2019-07-08 12:03:31 -07:00
Pavel Minaev
0f76b660ed Fix and refactor debugServer mode for ptvsd.adapter. (#1567)
Add launch.json for convenient testing of ptvsd.adapter.

Various minor fixes.
2019-07-08 11:38:25 -07:00
Fabio Zadrozny
f3aaa3b28a
Option to break on SystemExit == 0 in pydevd. Fixes #1223 (#1565) 2019-07-07 07:34:44 -03:00
Karthik Nadig
e14ae2c0f9
Add option to connect to adapter via port from IDE (#1562)
* Add option to connect to adapter via port from IDE

* Addressing comments.
2019-07-03 20:11:36 -07:00
Karthik Nadig
4df853178a
Update debugOptions in docs (#1561) 2019-07-03 16:48:06 -07:00
Fabio Zadrozny
27e638846d
Send continued event when all threads resume. Fixes #1530. (#1554)
* Send continued event when all threads resume. Fixes #1530.

* Don't hide exception if connect_with_new_session fails.

* Don't send resumed event if we haven't initialized first (fix test_reattach).
2019-07-03 09:51:59 -03:00
Pavel Minaev
773ecb5643 Fix #1552: attach_socket_import tests hang waiting for "process" event
Preload codecs used by ptvsd and pydevd to avoid deadlocks when calling wait_for_attach()  while importing a module on Python 2.
2019-07-02 22:38:37 -07:00
Pavel Minaev
82b62b77b5 Fix #1551: Backchannel failures in tests
Fix various bugs around handling of disconnect in JsonIOStream and JsonMessageChannel.

Fix handling of DAP "terminated" event in debug.Session.

Add --ptvsd-logs and --pydevd-logs switches to pytest.

Improve message logging to fully capture the raw message data in the logs if deserialization fails.

Log all debuggee environment variables in debug.Session, and improve log readability.
2019-07-02 17:05:51 -07:00
Karthik Nadig
1e6d2269dd
Replace wait_for_thread_stopped with wait_for_stop (#1550)
* Replace wait_for_thread_stopped with wait_for_stop

* Switch flask tests to use flask server

* Assert linter

* Use marked lines

* Fix stack logging in tests

* Prevent black from formating some debug code

* Simplify flask tests

* Replace send_request(continue) with send_continue

* fix typo
2019-07-01 14:38:07 -07:00
Karthik Nadig
833011d901
Custom pydevd event to support InputRequested (#1546) 2019-07-01 10:24:51 -07:00
Samuel Bronson
9666eac569 Update Debug Adapter Protocol links
There's a [new home for the Debug Adapter Protocol][1], so we might as well link to it.

[1]: https://code.visualstudio.com/blogs/2018/08/07/debug-adapter-protocol-website
2019-06-29 14:42:22 -07:00
Karthik Nadig
8d75d6d819
Test refactoring migrated to new api (#1544)
* Update ANY to some

* Refactor breakpoint lines in tests

* Replace old import and emable debug with debug_me

* Remove unused code

* Fix some linter issues

* Change from some.such_that to some.str.such_that

* Linting with black
2019-06-28 16:27:38 -07:00
Pavel Minaev
f71f0a5b0a Tests refactoring. (#1543) 2019-06-28 10:13:00 -07:00
Fabio Zadrozny
57e50a6143
Trace existing threads on settrace. Fixes #509 (#1541) 2019-06-26 09:19:35 -03:00
Karthik Nadig
1b5f6ef6bb
Ensure port is set on enable_attach (#1537)
* Ensure port is set to server listening port.

* Remove debug code

* Address comments.
2019-06-24 16:17:24 -07:00
Karthik Nadig
b29c459ff8
Migrate bunch of requests, Fix #1491, Fix #1492, Fix #1493 (#1517)
* Migrate bunch of requests, Fix #1491, #1492, #1493

* Use new api

* Tweak some requests

* fix linter

* Address comments.

* linter fixes
2019-06-21 16:44:17 -07:00
Pavel Minaev
161b201fd4 Add API to selectively enable and disable tracing. (#1536) 2019-06-20 16:33:45 -07:00
Pavel Minaev
71e90ff2b5 Restore formatting of command line switch table. 2019-06-19 14:46:45 -07:00