Skip to content

f_trace_opcodes frame attribute to switch to per-opcode tracing #75525

Closed

Description

@ncoghlan
BPO 31344
Nosy @gpshead, @ncoghlan, @nedbat, @njsmith, @serhiy-storchaka, @zooba
PRs
  • bpo-31344: Per-frame control of trace events #3417
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ncoghlan'
    closed_at = <Date 2017-09-08.00:14:59.760>
    created_at = <Date 2017-09-04.22:03:40.531>
    labels = ['type-feature', '3.7']
    title = 'f_trace_opcodes frame attribute to switch to per-opcode tracing'
    updated_at = <Date 2017-09-08.00:14:59.759>
    user = 'https://github.com/ncoghlan'

    bugs.python.org fields:

    activity = <Date 2017-09-08.00:14:59.759>
    actor = 'ncoghlan'
    assignee = 'ncoghlan'
    closed = True
    closed_date = <Date 2017-09-08.00:14:59.760>
    closer = 'ncoghlan'
    components = []
    creation = <Date 2017-09-04.22:03:40.531>
    creator = 'ncoghlan'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31344
    keywords = []
    message_count = 6.0
    messages = ['301273', '301362', '301366', '301374', '301565', '301655']
    nosy_count = 6.0
    nosy_names = ['gregory.p.smith', 'ncoghlan', 'nedbat', 'njs', 'serhiy.storchaka', 'steve.dower']
    pr_nums = ['3417']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue31344'
    versions = ['Python 3.7']

    Activity

    1. ncoghlan commented on Sep 4, 2017

      @ncoghlan
      ContributorAuthor

      In order to test bpo-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.

    2. serhiy-storchaka commented on Sep 5, 2017

      @serhiy-storchaka
      Member

      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.

    3. njsmith commented on Sep 5, 2017

      @njsmith
      Contributor

      Adding Ned to CC in case he wants to comment on the utility of per-opcode tracing from the perspective of coverage.py.

    4. ncoghlan commented on Sep 5, 2017

      @ncoghlan
      ContributorAuthor

      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)

    5. self-assigned this
      on Sep 7, 2017
    6. ncoghlan commented on Sep 7, 2017

      @ncoghlan
      ContributorAuthor

      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).

    7. ncoghlan commented on Sep 8, 2017

      @ncoghlan
      ContributorAuthor

      New changeset 5a85167 by Nick Coghlan in branch 'master':
      bpo-31344: Per-frame control of trace events (GH-3417)
      5a85167

    8. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    3.7 (EOL)end of lifetype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions