Skip to content

python debugger ignores breakpoints? #1593

Open

Description

@kaare-mikkelsen

Discussed in microsoft/vscode-python#23522

I have made a cell and marked some break points:

image

However, when I click 'debug cell', the debugger just executes the cell, ignoring the break points?

The behavior is erratic. This is a few lines earlier in the same file:

image

Here the breakpoint at l. 93 works, but all else is ignored.

My launch.json looks like this:

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false,
"noDebug": false, }
]
}

My python version is 3.11.9.

What am I doing wrong?

Activity

  1. rchiodo commented on Jun 3, 2024

    @rchiodo
    Contributor

    Thanks for the issue. It looks like all the breakpoints that aren't hitting, the lines they're on don't have any executable code. Only the breakpoint on line 93 does.

    Can you try it again and put the breakpoints on lines with actual code on them? I believe debugpy does try to look around the breakpoint for lines with code, but it's not a perfect search. It should work though if you move your breakpoints.

    Like this one:

    image

    Try putting the breapoint on line 103 intead of line 104.

    I can reproduce the problem myself:

    image

    If I debug this with Debug Python File, the first breakpoint is rebound to the line above it.
    If I debug this with Debug Cell, the first breakpoint is skipped.

    So I'm guessing either we don't do the special remapping to near lines in cell debugging or there's a bug in our remapping. But for now you should be able to get those breakpoints to work if you put them on lines with actual code.

  2. kaare-mikkelsen commented on Jun 3, 2024

    @kaare-mikkelsen
    Author

    you're right, this fixes it. Thanks a lot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnotebookrelated to jupyter notebook debugging

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions