Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek-r1-0528· DeepSeekHugging Face LMArena Human Preference 140K

vscode cannot enter function during debug mode

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-sonnet-4-20250514-thinking-32k’s answer.
  1. User

    vscode cannot enter function during debug mode

  2. DeepSeek Assistant

    If you're experiencing issues where Visual Studio Code (VS Code) doesn't step into functions during debugging, here are the most common solutions:

    1. Disable justMyCode (Python/JavaScript)

    • Problem: The debugger skips external/library code by default.
    • Solution: Add this to your launch.json:
      "justMyCode": false
      
      • For Python (in launch.json):
        "configurations": [
          {
            "name": "Python Debugger",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "justMyCode": false  // 👈 Add this
          }
        ]
        
      • For Node.js (in launch.json):
        "configurations": [
          {
            "type": "node",
            "request": "launch",
            "name": "Debug",
            "skipFiles": [],  // Clear this array
            "program": "${file}",
            "console": "integratedTerminal"
          }
        ]
        

    2. Check Compiler Flags (C/C++)

    • Problem: Debug symbols (-g) are missing, or optimizations (-O2, -O3) interfere.
    • Solution:
      • Add -g to your compiler flags.
      • Disable optimizations with -O0.
      • Example tasks.json (for GCC):
        "tasks": [
          {
            "type": "cppbuild",
            "args": [
              "-g",   // Debug symbols
              "-O0",  // No optimizations
              "${file}",
              "-o",
              "${fileDirname}/${fileBasenameNoExtension}"
            ],
          }
        ]
        

    3. Disable skipFiles (JavaScript/Node.js)

    • Problem: The debugger is configured to skip files.
    • Solution: Clear skipFiles in launch.json:
      "skipFiles": [],  // Remove any entries here
      

    4. Verify Breakpoint Placement

    • Ensure breakpoints are set inside the function (not just on the declaration).
    • Breakpoints must be in executable lines (e.g., avoid comments, empty lines).

    5. Check for Inline Functions (C/C++)

    • Problem: Functions may be inlined by the compiler.
    • Solution: Disable inlining:
      "args": ["-g", "-O0", "-fno-inline", ...]
      

    6. Reinstall Debugger Extensions

    • Sometimes extensions get corrupted:
      1. Go to Extensions (Ctrl+Shift+X).
      2. Reinstall your language's debugger (e.g., Python, C/C++, Node.js).

    7. Use Debug Console Commands

    • When paused, manually step into a function using:
      • Command Palette (Ctrl+Shift+P) → Debug: Step Into Specific Function...
      • Type the function name to force entry.

    Verify Your Setup

    1. launch.json Configuration:

      • Open launch.json (.vscode/launch.json in your workspace).
      • Ensure settings match your project type (Python, C++, Node.js, etc.).
    2. Compiler/Debugger Logs:

      • Check the Debug Console in VS Code for warnings (e.g., missing symbols).
      • For C/C++, run in terminal:
        gdb -ex "file your_program" -ex "info sources"
        
        (Verify your function's source file appears).

    Example Fixes by Language

    LanguageKey Fix
    Python"justMyCode": false in launch.json
    Node.js"skipFiles": [] and "justMyCode": false in launch.json
    C/C++Compile with -g -O0 -fno-inline; verify launch.json uses correct debugger

    If the issue persists, share:

    1. Your programming language.
    2. Relevant snippets from .vscode/launch.json.
    3. Compiler/debugger logs (from the Debug Console).
  3. User

    i'm using python

  4. DeepSeek Assistant

    For Python debugging in VS Code where you can't step into functions, follow these steps:

    1. Enable justMyCode Setting

    This is the most common fix. Add this to your launch.json:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Python Debugger",
                "type": "debugpy",
                "request": "launch",
                "program": "${file}",
                "console": "integratedTerminal",
                "justMyCode": false  // 👈 CRITICAL SETTING
            }
        ]
    }
    

    2. Verify Breakpoint Placement

    • Set breakpoints inside the function body (not just on the def line)
    • Avoid lines with decorators (@), comments, or empty lines

    3. Check Debugger Console

    Look for these warnings in the debug console:

    User code loaded
    Non-user code loaded
    

    If you see "Non-user code loaded," it confirms justMyCode needs to be disabled.

    4. Update Python Extensions

    1. Go to Extensions (Ctrl+Shift+X)
    2. Update these:
      • Python (ms-python.python)
      • Pylance (ms-python.vscode-pylance)
    3. Reload VS Code

    5. Force Debugger Reattach

    If stepping fails during debugging:

    1. Pause execution at a breakpoint
    2. Open command palette (Ctrl+Shift+P)
    3. Run: Debug: Step Into Specific Function...
    4. Type the function name to force entry

    6. Verify Python Path

    Ensure you're using the correct interpreter:

    1. Ctrl+Shift+P → "Python: Select Interpreter"
    2. Choose the same environment where your dependencies are installed

    7. Debugger-Specific Settings

    For virtual environments or special cases, add to launch.json:

    "cwd": "${workspaceFolder}",
    "env": {
        "PYTHONPATH": "${workspaceFolder}${pathSeparator}${env:PYTHONPATH}"
    },
    

    If Still Not Working:

    1. Share your launch.json (redact sensitive paths)
    2. Check debug console for errors
    3. Try with this minimal test case:
    def test_debug():
        print("Debug me")  # Set breakpoint here 🛑
        
    if __name__ == "__main__":
        test_debug()  # Step into this call
    

    Common Culprits:

    • Optimized C extensions (numpy/pandas) - debugger can't step into C code
    • Async functions - try adding "python.terminal.launchArgs": ["-X", "frozen_modules=off"]
    • Corrupted debug symbols - delete __pycache__ folders and restart

    Note: Stepping into standard library functions (like print()) still won't work even with these settings - this is normal behavior.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.