Skip to content

Pdb does not stop at a breakpoint #58956

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

Closed
xdegaye mannequin opened this issue May 8, 2012 · 3 comments
Closed

Pdb does not stop at a breakpoint #58956

xdegaye mannequin opened this issue May 8, 2012 · 3 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@xdegaye
Copy link
Mannequin

xdegaye mannequin commented May 8, 2012

BPO 14751
Nosy @xdegaye
Files
  • pdb_default.patch
  • pdb_default_2.patch
  • 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 = None
    closed_at = None
    created_at = <Date 2012-05-08.13:00:17.907>
    labels = ['type-bug', 'library']
    title = 'Pdb does not stop at a breakpoint'
    updated_at = <Date 2012-05-13.15:48:49.831>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2012-05-13.15:48:49.831>
    actor = 'xdegaye'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2012-05-08.13:00:17.907>
    creator = 'xdegaye'
    dependencies = []
    files = ['25494', '25561']
    hgrepos = []
    issue_num = 14751
    keywords = ['patch']
    message_count = 2.0
    messages = ['160202', '160518']
    nosy_count = 1.0
    nosy_names = ['xdegaye']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue14751'
    versions = ['Python 2.7', 'Python 3.2', 'Python 3.3']

    Linked PRs

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented May 8, 2012

    When a breakpoint is set in one of the frames of the frame stack, Pdb
    may not stop at that breakpoint when the frame does not have a trace
    function. This problem is closely related to bpo-13183 and issue
    14728. The following scenario demonstrates this problem.

    ==== main.py ================================

    import bar
    
    def foo():
        bar.bar()
        x = 1
    
    foo()
    ====   bar.py  ==================================
    def bar():
        pass

    =================================================

    $ python3 -m pdb main.py 
    > /path_to/main.py(1)<module>()
    -> import bar
    (Pdb) import sys; print(sys.version)
    3.2.2 (default, Dec 27 2011, 17:35:55) 
    [GCC 4.3.2]
    (Pdb) break bar.bar
    Breakpoint 1 at /path_to/bar.py:1
    (Pdb) continue
    > /path_to/bar.py(2)bar()
    -> pass
    (Pdb) break main.py:5
    Breakpoint 2 at /path_to/main.py:5
    (Pdb) continue
    The program finished and will be restarted
    > /path_to/main.py(1)<module>()
    -> import bar
    (Pdb) quit

    =================================================

    The attached patch fixes this problem. A test case is included in the
    patch. The patch is made against the proposed fix of bpo-14728 (i.e.
    assumes this patch is applied), the reason being that self._curframe
    must be correctly set. Actually this issue and bpo-14728 should
    probably be merged.

    Note that the trace function does not need anymore to be set in all
    the frames of the frame stack in set_trace(), so setting the trace
    function has been removed from the while loop.

    @xdegaye xdegaye mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels May 8, 2012
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented May 13, 2012

    Uploaded pdb_default_2.patch that corrects the initial patch: the
    trace function must be set in all frames whose co_filename is the
    breakpoint file name and not just the first frame of this set.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @gaogaotiantian gaogaotiantian self-assigned this May 7, 2024
    miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 15, 2024
    …a new breakpoint (pythonGH-124454)
    
    (cherry picked from commit 12eaadc)
    
    Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
    miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 15, 2024
    …a new breakpoint (pythonGH-124454)
    
    (cherry picked from commit 12eaadc)
    
    Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
    @gaogaotiantian
    Copy link
    Member

    Fixed in #124454

    gaogaotiantian added a commit that referenced this issue Oct 15, 2024
    … a new breakpoint (GH-124454) (#125548)
    
    gh-58956: Set f_trace on frames with breakpoints after setting a new breakpoint (GH-124454)
    (cherry picked from commit 12eaadc)
    
    Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
    ebonnal pushed a commit to ebonnal/cpython that referenced this issue Jan 12, 2025
    miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 17, 2025
    (cherry picked from commit 767c89b)
    
    Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
    gaogaotiantian added a commit that referenced this issue Jan 17, 2025
    * gh-58956: Fix a frame refleak in bdb (GH-128190)
    (cherry picked from commit 767c89b)
    
    Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
    gaogaotiantian added a commit that referenced this issue Jan 17, 2025
    * [3.12] gh-58956: Fix a frame refleak in bdb (GH-128190)
    (cherry picked from commit 767c89b)
    
    Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
    gaogaotiantian added a commit to miss-islington/cpython that referenced this issue Jan 17, 2025
    …a new breakpoint (pythonGH-124454)
    
    (cherry picked from commit 12eaadc)
    
    Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
    srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Jan 21, 2025
    gaogaotiantian added a commit that referenced this issue Jan 25, 2025
    … a new breakpoint (GH-124454) (#125549)
    
    * gh-58956: Set f_trace on frames with breakpoints after setting a new breakpoint (GH-124454)
    (cherry picked from commit 12eaadc)
    
    Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant