-
-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-103082: Implementation of PEP 669: Low Impact Monitoring for CPython #103083
Merged
Merged
Changes from 1 commit
Commits
Show all changes
127 commits
Select commit
Hold shift + click to select a range
e85d910
Initial experimental implementation of PEP 669.
markshannon 6283ee8
First draft implementing small subset of PEP 669.
markshannon 4edb7b7
Support disabling and restarting.
markshannon 852c40b
Support multiple tools per event.
markshannon 416b314
Tidy up of monitoring internals
markshannon 7971979
Fix legacy tracing.
markshannon 9896902
Implement support for multiple tools.
markshannon f432a66
Get support for line tracing mostly working. Needs to wait for regist…
markshannon fb29b34
Merge branch 'main' into pep-669-incremental
markshannon 15a1ccd
Fix up INSTRUMENTED_OPCODES vector.
markshannon 9abb339
Fix instrumented branches to call instrumentation with correct target.
markshannon 3ba6a39
Merge main and assorted fixups to handle new instruction.
markshannon aa09895
Add PY_THROW event handling and fix up line table.
markshannon 9e5d87d
LINE events working for sys.setrace.
markshannon e52cbe6
Add lots of internal debugging for instrumentation.
markshannon 6c8be7e
Add more tests. Get those and some other passing.
markshannon c9e1e21
Fix LINE instrumentation and frame.set_lineno support (mostly)
markshannon e52e8d3
Refining line event generation.
markshannon f434ec7
Get sys.settrace tests passing.
markshannon b680084
Monitor 'internal' StopIteration raises.
markshannon e6e7cf1
Check for NULLs.
markshannon 5bbc83e
Fix up a few tests
markshannon 7fe9a43
Turn off debugging output by default.
markshannon 8b9f996
Remove debugging printfs
markshannon 9b02640
Avoid refleak.
markshannon 2cadf32
Record last traced line on frame object.
markshannon 1f54d77
Get a couple more top-level tests passing.
markshannon 43a3f3e
Update magic number
markshannon 3d436cf
Remove debug print statement.
markshannon 691bcf5
Raise SystemError if frame is missing.
markshannon f07be07
Restore a few tests and better handle EXTENDED_ARG.
markshannon 8b8f67e
Make sure instrumentation respects instruction boundaries.
markshannon d0a2228
Fix handling of errors in jump instruments
markshannon 2a3a85e
Fix memory leaks.
markshannon c3724ab
Instrument FOR_ITER.
markshannon d64823c
Fix legacy profiling of calls.
markshannon 284d0b1
Fix up instrumented yield.
markshannon b9e1f3b
Merge branch 'main' into pep-669-incremental
markshannon 1440473
Fix instrumentation of SEND and tidy up instrumented bytecode numbering.
markshannon 825f42a
Handle line numbers in exception handled event.
markshannon ce5ddb3
Instrument END_FOR to mimic PEP 380 StopIteration and add more tests.
markshannon 5740c47
Merge branch 'main' into pep-669-incremental
markshannon da83abe
Add END_SEND for instrumentation.
markshannon cdb2bda
Correctly set StopIteration in INSTRUMENTED_END_FOR.
markshannon 0148fa3
Set last traced line when jumping in debugger.
markshannon c5fb4f4
Fix test_dis to account for END_SEND.
markshannon 7fa431b
Add a few more tests.
markshannon 25bbc61
delete commented out code
markshannon 5629a3e
Fix last (known) inconsistency in sys.settrace behaviour
markshannon 477cc53
More clearly differentiate between instrumented events and non-instru…
markshannon 23b5f5e
Add support for sys.monitoring.MISSING
markshannon dfc18c5
Add support for local (per-code-object) event monitoring.
markshannon 566adbe
Merge branch 'main' into pep-669
markshannon cfb17ed
Make sure that tracing/profiling thread counts are correct.
markshannon c535f76
Remove linearray field
markshannon d579d2e
Rename some fields, shortening names.
markshannon 0982e5e
Remove out of dat comments.
markshannon 0693423
Remove instrumentation for JUMP_IF_[FALS|TRUE]_OR_POP
markshannon d6453e5
Merge branch 'main' into pep-669
markshannon 0ee2aee
Minor fixups from merge.
markshannon acdca93
Remove instrumentation for COMPARE_AND_BRANCH.
markshannon f17ef14
Merge branch 'main' into pep-669
markshannon e7f6c37
Group instrumented opcodes.
markshannon e44ebc5
Remove last references to DO_TRACING
markshannon ece51e6
Merge branch 'main' into pep-669
markshannon e88921e
Remove unused function.
markshannon 2d9f22c
Streamline de-instrumentation a little.
markshannon b7579ac
Use modern API for saving and restoring exception.
markshannon 5a089a6
Refactor instrumentation calls to reduce duplication.
markshannon d5fdec8
Fix refleaks
markshannon c88741d
Remove commented out code.
markshannon b6744ca
Make sure that stacktop == -1 when stack_pointer is cached.
markshannon 6c3473a
Minor cleanups.
markshannon 899aecd
Remove useless asserts.
markshannon 80d2e2e
Make functions static
markshannon 94d35d8
Update Windows build files.
markshannon 5aa0805
Make _PyLegacyEventHandler_Type immortal
markshannon b39edd3
Make arrays const.
markshannon c9c40cb
Rename _PyFrame_GetStackPointer to _PyFrame_FetchStackPointer and mak…
markshannon 6611c72
Fixups from code review
markshannon 50d28f1
Improve debugging output and make a few things more robust.
markshannon 7165f52
Fix up frame.set_lineno().
markshannon 65c548e
Make line instrumentation able to handle multiple inits.
markshannon 575f7d1
Add brief comments on instrumentation data structures.
markshannon 415741d
Add symbol constant for min instrumented opcode.
markshannon d70a1a4
Code cleanup from review.
markshannon d580de6
A bit more cleanup.
markshannon 2076d5f
Add a few more comments.
markshannon 7b32d79
Remove unused code.
markshannon 662c16c
Fix leak of monitoring blocks.
markshannon d0139e9
Merge branch 'main' into pep-669
markshannon 51a93e7
Make function static.
markshannon 64bf37f
Use symbolic constants in line computations.
markshannon 5faec77
Make data static.
markshannon 0be1562
Add extra check.
markshannon b32a075
Make sure that instrumentation of line and instructions at the same t…
markshannon 85d6923
Remove incorrect assertion.
markshannon ebcc42f
Turn off instrumentation debugging.
markshannon 7cfbc7e
Fix a couple of errors.
markshannon d366364
Add minimal news entry.
markshannon fdb4860
Pacify the global object checker.
markshannon aee722f
Minor fixups.
markshannon bba53b8
Fix refleak when error in RETURN instrumentation.
markshannon 718fbc8
Merge branch 'main' into pep-669
markshannon 97ec1c5
Fix another refleak in error handling in instrumented instruction.
markshannon edc6709
Remove debug code ready for final review.
markshannon e40a68f
Fix another (and hopefully final) refleak when handling an error in a…
markshannon d9f8192
Comment and rename #defines to better reflect names in PEP.
markshannon 2d9a380
Add various IDs as defined in the PEP.
markshannon 29f41e7
Remove _PyThreadState_UpdateTracingState.
markshannon 38b7f43
Formatting fixes, and check error codes.
markshannon 9a40dad
Make sure tool API function names match PEP.
markshannon a551d65
A bit more cleanup.
markshannon 4951306
Tidy up imports.
markshannon 44a031e
Use clinic return converters.
markshannon c2155b7
Address code review.
markshannon b218428
Address further review comments.
markshannon 9c0429e
Use byte offset, to conform to the convention used in other APIs taki…
markshannon c6bf38e
Address code review.
markshannon 82fe16c
Merge branch 'main' into pep-669
markshannon 43618a9
Keep check-c-globals happy.
markshannon 821ae52
Don't crash if locals events aren't set.
markshannon 505a08d
Add NO_EVENTS.
markshannon f63da91
Flip order of LINE and INSTRUCTION events.
markshannon c324344
Check tool is in use when setting events.
markshannon 168b34a
Reset last traced line number when setting frame.f_trace only if set …
markshannon f07a080
Tidy up test case.
markshannon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add PY_THROW event handling and fix up line table.
- Loading branch information
commit aa09895e86b1f9568616fcaff41375be04ce4978
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
markshannon marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return value of
_Py_Instrument
is ignored here. Since it might set an exception, I'd expect agoto exit_unwind
on error here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are already handling an exception here, so the exception isn't lost, it replaces the thrown exception.
The question is whether to raise it back to the caller, or to inject into the coroutine/generator?
If unwinding were done in a separate function from evaluation, then the thrown exception would unwind the stack, then the new exception would be raised on continued execution, which would be better.
I'm inclined to leave it for now, and let it get fixed as a side effect of separating evaluation and unwinding.