-
Notifications
You must be signed in to change notification settings - Fork 67
Debugger Doesn't Stop At Breakpoints #1422
Comments
I've been trying to figure this out for a little while now, in my own circumstance, and am able to hit breakpoints, but only when a given python file is in my user directory and the interpreter is /usr/bin/python. I haven't been able to debug things with /usr/lib/ckan/default/bin/python. It seems to come down to filesystem location and maybe which python interpreter.
|
@LukeTully try `"justMyCode": false" in your launch config. That should allow you to debug everything. If files are getting ignored that is probably because we try to figure out which ones are user files and which ones aren't. that detection can miss things if the path is in any of the common interpreter or standard library locations. justMyCode set to false will turn off that filtering. |
@karthiknadig I have enough experience to know that something this trivial would be the solution, but thank you, it solved the problem. At least this validates the debugging outcomes I was seeing! Although I would add that I did have "Allow breakpoints everywhere" checked on in all 3 settings files through the settings UI. |
(previous thread on this: So, it seems that the current implementation is still not ideal because we're still hitting this issue... I'll take another look at this using |
Another thing that just occurred to me is that we should probably say that a breakpoint is not validated if the related file will not be traced and let the user know why. I'll use this issue to add this handling too. |
Note that I just provided a fix for discovering the paths to be considered standard libraries, I'll use #1298 for the breakpoints validation. |
@primalewden commented on Wed Mar 20 2019
Environment data
Version: 1.32.3 (system setup)
Commit: a3db5be9b5c6ba46bb7555ec5d60178ecc2eaae4
Date: 2019-03-14T23:43:35.476Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17763
Expected behaviour
When VSCode is used to debug a Python 3.6 script I anticipate for the execution of the code to stop when a breakpoint is 'hit'.
Actual behaviour
The code simply continues running as if the breakpoint wasn't there at all
Steps to reproduce:
python -m venv .
"python.pythonPath":
variable from the previously selected interpretter to be.\\Scripts\\python.exe
Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
; turn on source maps to make any tracebacks be useful by runningEnable source map support for extension debugging
)@DonJayamanne commented on Wed Mar 20 2019
Instead of creating a
venv
in the root directory of your project please create a sub-directory for your venv (i.e. a sub directory within your project folder).FYI - Generally its considered a bad practice to place your source files inside of a venv.
@primalewden commented on Wed Mar 20 2019
Hello,
As per your advisement however I have relocated the source files to a separate directory from the venv directory.
I now have the following structure :
/some_dir/venv_folder
/some_dir/source_folder
I open the source_folder with VSCode and first select one of the existing Python installations I have then edit the .vscode/settings.json file as per the description above, except now I am using an absolute path leading to the Python.exe instance within the venv_folder/scripts.
When I run debug it enters that venv , verified by the (venv_folder) that precedes the path the terminal is currently in.
Even with the abstraction away from the venv folder I am experiencing the same result. Did I misunderstand your suggestion?
Thank you for your time, I really appreciate it!
@marvingreenberg commented on Wed Apr 03 2019
I'm having the same issue with a different environment - not a remote debug, no venv, python 2.7. Making a simple test_foo.py module with a unittest class works, but my test_deploycfg,py module in the same folder of the same workspace, with a few unittest.TestCase classes each with a few dozen test_ methods does not. Setting breakpoints and running a single test case with "Debug Test" code lens behaves the same as "Run Test".
@marvingreenberg commented on Wed Apr 03 2019
Here is my Developer Tools output. The first 4 entries are the failing test_deploycfg.py, where breakpoints are ignored. The next 3 entries are from debugging a single test in test_foo.py, where breakpoints are hit and stepping works fine.
@marvingreenberg commented on Wed Apr 03 2019
And, the problem seems to be something about "Debug Test" code lens, perhaps. If I set breakpoints in a bunch of the individual tests, clicking "Debug Test" in one test method (test_generated) it is stopping at a breakpoint in a different test (test_refs)
@newdoug55 commented on Sat May 11 2019
I am having the same issue.
Program will not stop at breakpoint line 5.
Here is launch.json.
Here is my debug file:
2:16:29 PM, 5/11/2019
Started @ Sat May 11 2019 14:16:29 GMT-0500 (Central Daylight Time)
From Client:
Content-Length: 313
{"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"python","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us"},"type":"request","seq":1}
To Client:
Content-Length: 761
{"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsExceptionInfoRequest":true,"supportsConfigurationDoneRequest":true,"supportsDelayedStackTraceLoading":true,"supportsConditionalBreakpoints":true,"supportsSetVariable":true,"supportsExceptionOptions":true,"supportsGotoTargetsRequest":true,"supportsEvaluateForHovers":true,"supportsModulesRequest":true,"supportsValueFormattingOptions":true,"supportsHitConditionalBreakpoints":true,"supportsSetExpression":true,"supportsLogPoints":true,"supportTerminateDebuggee":true,"supportsCompletionsRequest":true,"exceptionBreakpointFilters":[{"filter":"raised","label":"Raised Exceptions","default":false},{"filter":"uncaught","label":"Uncaught Exceptions","default":true}]}}
From Client:
Content-Length: 554
{"command":"launch","arguments":{"name":"Python: Current File","type":"python","request":"launch","program":"c:\python\test.py","console":"integratedTerminal","logToFile":true,"pythonPath":"c:/python/my_env/Scripts/python.exe","cwd":"c:\python","envFile":"c:\python/.env","stopOnEntry":false,"showReturnValue":true,"internalConsoleOptions":"neverOpen","debugOptions":["ShowReturnValue","RedirectOutput","FixFilePathCase"],"justMyCode":true,"workspaceFolder":"c:\python","__sessionId":"84ca9619-8805-496e-967a-81ec8eb39fb4"},"type":"request","seq":2}
To Client:
Content-Length: 430
{"command":"runInTerminal","arguments":{"kind":"integrated","title":"Python Debug Console","cwd":"c:\python","args":["c:/python/my_env/Scripts/python.exe","c:\Users\dplummer\.vscode\extensions\ms-python.python-2019.4.12954\pythonFiles\ptvsd_launcher.py","--default","--client","--host","localhost","--port","64446","c:\python\test.py"],"env":{"PYTHONIOENCODING":"UTF-8","PYTHONUNBUFFERED":"1"}},"type":"request","seq":2}
From Client:
Content-Length: 115
{"type":"response","seq":3,"command":"runInTerminal","request_seq":2,"success":true,"body":{"shellProcessId":7504}}
To Client:
Content-Length: 554
To Client:
{"command":"launch","arguments":{"name":"Python: Current File","type":"python","request":"launch","program":"c:\python\test.py","console":"integratedTerminal","logToFile":true,"pythonPath":"c:/python/my_env/Scripts/python.exe","cwd":"c:\python","envFile":"c:\python/.env","stopOnEntry":false,"showReturnValue":true,"internalConsoleOptions":"neverOpen","debugOptions":["ShowReturnValue","RedirectOutput","FixFilePathCase"],"justMyCode":true,"workspaceFolder":"c:\python","__sessionId":"84ca9619-8805-496e-967a-81ec8eb39fb4"},"type":"request","seq":2}
To Client:
Content-Length: 313
To Client:
{"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"python","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us"},"type":"request","seq":1}
To Client:
Content-Length: 130
{"type": "event", "seq": 0, "event": "output", "body": {"category": "telemetry", "output": "ptvsd", "data": {"version": "4.2.8"}}}Content-Length: 113
{"type": "response", "seq": 1, "request_seq": 2, "success": true, "command": "launch", "message": "", "body": {}}Content-Length: 865
To Client:
{"type": "response", "seq": 2, "request_seq": 1, "success": true, "command": "initialize", "message": "", "body": {"supportsCompletionsRequest": true, "supportsConditionalBreakpoints": true, "supportsConfigurationDoneRequest": true, "supportsDebuggerProperties": true, "supportsDelayedStackTraceLoading": true, "supportsEvaluateForHovers": true, "supportsExceptionInfoRequest": true, "supportsExceptionOptions": true, "supportsHitConditionalBreakpoints": true, "supportsLogPoints": true, "supportsModulesRequest": true, "supportsSetExpression": true, "supportsSetVariable": true, "supportsValueFormattingOptions": true, "supportTerminateDebuggee": true, "supportsGotoTargetsRequest": true, "exceptionBreakpointFilters": [{"filter": "raised", "label": "Raised Exceptions", "default": false}, {"filter": "uncaught", "label": "Uncaught Exceptions", "default": true}]}}Content-Length: 63
{"type": "event", "seq": 3, "event": "initialized", "body": {}}
From Client:
Content-Length: 186
{"command":"setBreakpoints","arguments":{"source":{"name":"test.py","path":"c:\python\test.py"},"lines":[5],"breakpoints":[{"line":5}],"sourceModified":false},"type":"request","seq":4}
To Client:
Content-Length: 176
{"type": "response", "seq": 4, "request_seq": 4, "success": true, "command": "setBreakpoints", "message": "", "body": {"breakpoints": [{"id": 0, "verified": true, "line": 5}]}}
From Client:
Content-Length: 99
{"command":"setExceptionBreakpoints","arguments":{"filters":["uncaught"]},"type":"request","seq":5}
To Client:
Content-Length: 130
{"type": "response", "seq": 5, "request_seq": 5, "success": true, "command": "setExceptionBreakpoints", "message": "", "body": {}}
From Client:
Content-Length: 56
{"command":"configurationDone","type":"request","seq":6}
To Client:
Content-Length: 163
To Client:
{"type": "event", "seq": 6, "event": "process", "body": {"name": "c:\python\test.py", "systemProcessId": 16204, "isLocalProcess": true, "startMethod": "launch"}}Content-Length: 124
{"type": "response", "seq": 7, "request_seq": 6, "success": true, "command": "configurationDone", "message": "", "body": {}}
From Client:
Content-Length: 46
{"command":"threads","type":"request","seq":7}
To Client:
Content-Length: 92
{"type": "event", "seq": 8, "event": "thread", "body": {"reason": "started", "threadId": 1}}Content-Length: 158
To Client:
{"type": "response", "seq": 9, "request_seq": 7, "success": true, "command": "threads", "message": "", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
To Client:
Content-Length: 110
To Client:
{"type": "event", "seq": 10, "event": "output", "body": {"output": "dog", "category": "stdout", "source": {}}}
To Client:
Content-Length: 109
To Client:
{"type": "event", "seq": 11, "event": "output", "body": {"output": "\n", "category": "stdout", "source": {}}}
To Client:
Content-Length: 110
To Client:
{"type": "event", "seq": 12, "event": "output", "body": {"output": "cat", "category": "stdout", "source": {}}}
To Client:
Content-Length: 109
To Client:
{"type": "event", "seq": 13, "event": "output", "body": {"output": "\n", "category": "stdout", "source": {}}}
To Client:
Content-Length: 111
{"type": "event", "seq": 14, "event": "output", "body": {"output": "bird", "category": "stdout", "source": {}}}
To Client:
Content-Length: 109
{"type": "event", "seq": 15, "event": "output", "body": {"output": "\n", "category": "stdout", "source": {}}}
From Client:
Content-Length: 46
{"command":"threads","type":"request","seq":8}
To Client:
Content-Length: 128
{"type": "response", "seq": 16, "request_seq": 8, "success": true, "command": "threads", "message": "", "body": {"threads": []}}
To Client:
Content-Length: 72
{"type": "event", "seq": 17, "event": "exited", "body": {"exitCode": 0}}
onEventTerminated
To Client:
Content-Length: 63
{"type": "event", "seq": 18, "event": "terminated", "body": {}}
From Client:
Content-Length: 79
{"command":"disconnect","arguments":{"restart":false},"type":"request","seq":9}
onResponseDisconnect
To Client:
Content-Length: 118
{"type": "response", "seq": 19, "request_seq": 9, "success": true, "command": "disconnect", "message": "", "body": {}}
Socket Error
check and shutdown
shutdown
killing process
check and shutdown
Kill process now
Shutting down debug session
disposing
check and shutdown
The text was updated successfully, but these errors were encountered: