Issue 31344: f_trace_opcodes frame attribute to switch to per-opcode tracing (original) (raw)

Created on 2017-09-04 22:03 by ncoghlan, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 3417 merged ncoghlan,2017-09-07 03:29
Messages (6)
msg301273 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2017-09-04 22:03
In order to test issue 29988 reliably, we want the ability to run trace hooks for every opcode in a frame, rather than for every line. The simplest API we've been able to come up with for that is a "f_trace_opcodes" attribute on the frame which we set from the trace hook the first time that it runs.
msg301362 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-09-05 19:20
The f_trace attribute is writable from a tracing function. There are different restrictions, for example you can't jump inside a 'for' loop from outside. The code of the setter is complex and hard for modifications (see the discussion on PR 2827). Allowing to trace opcodes can make it more complex.
msg301366 - (view) Author: Nathaniel Smith (njs) * (Python committer) Date: 2017-09-05 20:05
Adding Ned to CC in case he wants to comment on the utility of per-opcode tracing from the perspective of coverage.py.
msg301374 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2017-09-05 21:05
Steve's also requested the ability to *turn off* line debugging, and I'm thinking it may make sense to allow all four configurations: * both line and opcode events disabled * only getting one or the other * getting both kinds of event Opcode events would definitely be off by default, and if you do turn them on, then you'd be in a situation similar to importing ctypes: the interpreter is no longer guaranteed to work correctly. (Although unlike ctypes, you shouldn't get segfaults because of it)
msg301565 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2017-09-07 03:31
My posted PR implements the "independent flags" option, where f_trace_lines and f_trace_opcodes allow per-line and per-opcode events to be requested independently. The default is to emit per-line events (as has historically been the case).
msg301655 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2017-09-08 00:14
New changeset 5a8516701f5140c8c989c40e261a4f4e20e8af86 by Nick Coghlan in branch 'master': bpo-31344: Per-frame control of trace events (GH-3417) https://github.com/python/cpython/commit/5a8516701f5140c8c989c40e261a4f4e20e8af86
History
Date User Action Args
2022-04-11 14:58:51 admin set github: 75525
2017-09-08 00:14:59 ncoghlan set status: open -> closedresolution: fixedstage: commit review -> resolved
2017-09-08 00:14:18 ncoghlan set messages: +
2017-09-07 03:31:25 ncoghlan set messages: + stage: needs patch -> commit review
2017-09-07 03:29:12 ncoghlan set pull_requests: + <pull%5Frequest3415>
2017-09-07 00:55:32 ncoghlan set assignee: ncoghlan
2017-09-05 21:06:03 ncoghlan set nosy: + steve.dower
2017-09-05 21:05:46 ncoghlan set messages: +
2017-09-05 20:05:36 njs set nosy: + nedbat, njsmessages: +
2017-09-05 19:20:19 serhiy.storchaka set nosy: + serhiy.storchakamessages: +
2017-09-04 22:04:42 ncoghlan link issue29988 dependencies
2017-09-04 22:03:40 ncoghlan create