-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix tracing of BIFs for multiple trace sessions #10349
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
base: maint
Are you sure you want to change the base?
Fix tracing of BIFs for multiple trace sessions #10349
Conversation
Problem: Export.is_bif_traced was prematurely cleared when the first GenericBp breakpoint was unlinked which caused tracing of the BIF for remaining sessions to be ignored. Solution: Set 'is_bif_traced' if we have at least one GenericBp. Clear 'is_bif_traced' when the last GenericBp disappears.
CT Test Results 3 files 142 suites 49m 58s ⏱️ Results for commit a26f3ac. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
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.
Pull Request Overview
This PR fixes the handling of the is_bif_traced flag in export entries to work correctly with multiple trace sessions (OTP-19840). Previously, the flag was set/cleared incorrectly when multiple sessions were tracing the same BIF, leading to premature clearing or incorrect state.
- Moved
is_bif_tracedflag management fromerts_set_trace_patterntoerts_set_export_traceandconsolidate_bp_data - Updated function signature of
erts_set_export_traceto acceptExport*instead ofErtsCodeInfo*to access BIF metadata - Added comprehensive test case
is_bif_traced/1to verify correct behavior with multiple trace sessions
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| erts/emulator/beam/erl_bif_trace.c | Removed incorrect single-session handling of is_bif_traced flag from erts_set_trace_pattern and prepare_clear_all_trace_pattern |
| erts/emulator/beam/beam_bp.h | Updated function signature for erts_set_export_trace to accept Export* |
| erts/emulator/beam/beam_bp.c | Implemented proper multi-session handling by setting flag in erts_set_export_trace and clearing in consolidate_bp_data when last session is removed |
| erts/emulator/beam/beam_bif_load.c | Changed to assert that is_bif_traced is cleared during code unloading instead of manually clearing it |
| erts/emulator/test/trace_session_SUITE.erl | Added test case to verify correct is_bif_traced flag management across multiple sessions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Disabling tracing of a BIF in one trace session did affect other sessions tracing the same BIF.