skip to Main Content

I’m trying to debug some Django library code with the default VS Code Python and Django debugging settings (and "justMyCode" = True). I’ve set a breakpoint in one of the library functions:

breakpoint set in save()

I call this from some user code, eg. formset.save(). When I debug and hit the breakpoint, VS Code jumps to this user code instead of the library code as I’d have expected:

debugger jumps to user code

Pressing "Step Into" seems to progress the library code, but keeps jumping back to the user code which is calling it.

The call stack seems to know about the library code, although it is greyed out:

save is greyed out

If I click on save then the currently executing statement is highlighted:

current statement highlighted green

I can go through the tedious process of stepping through, clicking the top stack frame, and then doing usual things like inspecting locals. The issue just seems to be about where VS Code is jumping to every time the debugger breaks (or maybe where pdb is telling VS Code to jump — I’m not sure).

I want the library code which is currently being executed to be jumped to, and that’s what I would have expected to happen.

2

Answers


  1. for debugging the problem that you can’t get into the library code could be due to the just my code setting. Click on File and select Preferences and go to Settings. Search for the justMyCode setting and change this setting to false.
    enter image description here

    Login or Signup to reply.
  2. I see the same thing. Looks like a recent bug in VSCode.
    I rolled back to https://code.visualstudio.com/updates/v1_89 which works as expected

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search