Closed DJManas closed 8 months ago
Can you run Debugger: Show Protocol
and attach the response
Sure:
-- platform: linux-x64
-- theme: auto
-- color_scheme: Packages/Darkula Color Scheme/darkula.tmTheme
-- font_face: Monospace
-- font_size: 9
-- adapter: type=python version=2023.8.0
-- stdio transport: ['/home/djmanas/.virtualenv/django/bin/python', '/home/djmanas/.config/sublime-text/Packages/Debugger/data/python/extension/pythonFiles/lib/python/debugpy/adapter']
-- begin transport protocol
<- initialize(1) :: {"seq": 1, "type": "request", "command": "initialize", "arguments": {"clientID": "sublime", "clientName": "Sublime Text", "adapterID": "python", "pathFormat": "path", "linesStartAt1": true, "columnsStartAt1": true, "supportsVariableType": true, "supportsVariablePaging": false, "supportsRunInTerminalRequest": true, "supportsMemoryReferences": true, "locale": "en-us"}}
-> output .. {"seq": 1, "type": "event", "event": "output", "body": {"category": "telemetry", "output": "ptvsd", "data": {"packageVersion": "1.6.7"}}}
-> output .. {"seq": 2, "type": "event", "event": "output", "body": {"category": "telemetry", "output": "debugpy", "data": {"packageVersion": "1.6.7"}}}
-> initialize(1) :: {"seq": 3, "type": "response", "request_seq": 1, "success": true, "command": "initialize", "body": {"supportsCompletionsRequest": true, "supportsConditionalBreakpoints": true, "supportsConfigurationDoneRequest": true, "supportsDebuggerProperties": true, "supportsDelayedStackTraceLoading": true, "supportsEvaluateForHovers": true, "supportsExceptionInfoRequest": true, "supportsExceptionOptions": true, "supportsFunctionBreakpoints": true, "supportsHitConditionalBreakpoints": true, "supportsLogPoints": true, "supportsModulesRequest": true, "supportsSetExpression": true, "supportsSetVariable": true, "supportsValueFormattingOptions": true, "supportsTerminateRequest": true, "supportsGotoTargetsRequest": true, "supportsClipboardContext": true, "exceptionBreakpointFilters": [{"filter": "raised", "label": "Raised Exceptions", "default": false, "description": "Break whenever any exception is raised."}, {"filter": "uncaught", "label": "Uncaught Exceptions", "default": true, "description": "Break when the process is exiting due to unhandled exception."}, {"filter": "userUnhandled", "label": "User Uncaught Exceptions", "default": false, "description": "Break when exception escapes into library code."}], "supportsStepInTargetsRequest": true}}
<- launch(2) :: {"seq": 2, "type": "request", "command": "launch", "arguments": {"args": ["runserver", "--noreload"], "django": true, "env": {"PYTHONPATH": "/home/djmanas/cloud/Projekty/Python/__Libraries__/"}, "name": "HomeImprovement, Django", "program": "/home/djmanas/cloud/Projekty/Python/HomeImprovement/manage.py", "python": "/home/djmanas/.virtualenv/django/bin/python", "request": "launch", "showDebugOutput": true, "type": "python"}}
-> initialized .. {"seq": 4, "type": "event", "event": "initialized"}
<- setExceptionBreakpoints(3) :: {"seq": 3, "type": "request", "command": "setExceptionBreakpoints", "arguments": {"filters": ["uncaught"], "filterOptions": [{"filterId": "uncaught", "condition": null}]}}
<- setFunctionBreakpoints(4) :: {"seq": 4, "type": "request", "command": "setFunctionBreakpoints", "arguments": {"breakpoints": [{"name": "", "condition": null, "hitCondition": null}]}}
<- setBreakpoints(5) :: {"seq": 5, "type": "request", "command": "setBreakpoints", "arguments": {"source": {"path": "/home/djmanas/cloud/Projekty/Python/HomeImprovement/EnergyWatch/views/consumptionView.py"}, "breakpoints": [{"line": 25, "column": null, "condition": null, "hitCondition": null, "logMessage": null}, {"line": 51, "column": null, "condition": null, "hitCondition": null, "logMessage": null}, {"line": 58, "column": null, "condition": null, "hitCondition": null, "logMessage": null}, {"line": 70, "column": null, "condition": null, "hitCondition": null, "logMessage": null}], "lines": [25, 51, 58, 70]}}
<- setBreakpoints(6) :: {"seq": 6, "type": "request", "command": "setBreakpoints", "arguments": {"source": {"path": "/home/djmanas/cloud/Projekty/Python/HomeImprovement/EnergyWatch/views/indexView.py"}, "breakpoints": [{"line": 21, "column": null, "condition": null, "hitCondition": null, "logMessage": null}], "lines": [21]}}
-> setExceptionBreakpoints(3) :: {"seq": 5, "type": "response", "request_seq": 3, "success": true, "command": "setExceptionBreakpoints"}
-> setFunctionBreakpoints(4) :: {"seq": 6, "type": "response", "request_seq": 4, "success": true, "command": "setFunctionBreakpoints", "body": {"breakpoints": [{"verified": true, "id": 0, "source": {}}]}}
-> setBreakpoints(5) :: {"seq": 7, "type": "response", "request_seq": 5, "success": true, "command": "setBreakpoints", "body": {"breakpoints": [{"verified": true, "id": 1, "source": {"path": "/home/djmanas/cloud/Projekty/Python/HomeImprovement/EnergyWatch/views/consumptionView.py"}, "line": 25}, {"verified": true, "id": 2, "source": {"path": "/home/djmanas/cloud/Projekty/Python/HomeImprovement/EnergyWatch/views/consumptionView.py"}, "line": 51}, {"verified": true, "id": 3, "source": {"path": "/home/djmanas/cloud/Projekty/Python/HomeImprovement/EnergyWatch/views/consumptionView.py"}, "line": 58}, {"verified": true, "id": 4, "source": {"path": "/home/djmanas/cloud/Projekty/Python/HomeImprovement/EnergyWatch/views/consumptionView.py"}, "line": 70}]}}
-> setBreakpoints(6) :: {"seq": 8, "type": "response", "request_seq": 6, "success": true, "command": "setBreakpoints", "body": {"breakpoints": [{"verified": true, "id": 5, "source": {"path": "/home/djmanas/cloud/Projekty/Python/HomeImprovement/EnergyWatch/views/indexView.py"}, "line": 21}]}}
<- configurationDone(7) :: {"seq": 7, "type": "request", "command": "configurationDone", "arguments": {}}
-> configurationDone(7) :: {"seq": 9, "type": "response", "request_seq": 7, "success": true, "command": "configurationDone"}
-> launch(2) :: {"seq": 10, "type": "response", "request_seq": 2, "success": true, "command": "launch"}
-> process .. {"seq": 11, "type": "event", "event": "process", "body": {"startMethod": "launch", "isLocalProcess": true, "systemProcessId": 737056, "name": "/home/djmanas/cloud/Projekty/Python/HomeImprovement/manage.py", "pointerSize": 64}}
-> thread .. {"seq": 12, "type": "event", "event": "thread", "body": {"reason": "started", "threadId": 1}}
<- threads(8) :: {"seq": 8, "type": "request", "command": "threads", "arguments": {}}
<- threads(9) :: {"seq": 9, "type": "request", "command": "threads", "arguments": {}}
-> threads(8) :: {"seq": 13, "type": "response", "request_seq": 8, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
-> threads(9) :: {"seq": 14, "type": "response", "request_seq": 9, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}}
-> output .. {"seq": 15, "type": "event", "event": "output", "body": {"category": "stdout", "output": "Performing system checks...\n\n"}}
-> output .. {"seq": 16, "type": "event", "event": "output", "body": {"category": "stdout", "output": "System check identified no issues (0 silenced).\n"}}
-> output .. {"seq": 17, "type": "event", "event": "output", "body": {"category": "stdout", "output": "January 12, 2024 - 21:52:10\nDjango version 4.2.7, using settings 'HomeImprovement.settings'\nStarting development server at http://127.0.0.1:8000/\nQuit the server with CONTROL-C.\n\n"}}
-> thread .. {"seq": 18, "type": "event", "event": "thread", "body": {"reason": "started", "threadId": 2}}
<- threads(10) :: {"seq": 10, "type": "request", "command": "threads", "arguments": {}}
-> threads(10) :: {"seq": 19, "type": "response", "request_seq": 10, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}, {"id": 2, "name": "Thread-6 (process_request_thread)"}]}}
-> stopped .. {"seq": 20, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "threadId": 2, "preserveFocusHint": false, "allThreadsStopped": true}}
<- threads(11) :: {"seq": 11, "type": "request", "command": "threads", "arguments": {}}
<- stackTrace(12) :: {"seq": 12, "type": "request", "command": "stackTrace", "arguments": {"threadId": 2}}
-> threads(11) :: {"seq": 21, "type": "response", "request_seq": 11, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}, {"id": 2, "name": "Thread-6 (process_request_thread)"}]}}
-> stackTrace(12) :: {"seq": 22, "type": "response", "request_seq": 12, "success": true, "command": "stackTrace", "body": {"stackFrames": [{"id": 3, "name": "get", "line": 25, "column": 1, "source": {"path": "/home/djmanas/cloud/Projekty/Python/HomeImprovement/EnergyWatch/views/consumptionView.py", "sourceReference": 0}}], "totalFrames": 1}}
-> module .. {"seq": 23, "type": "event", "event": "module", "body": {"reason": "new", "module": {"id": 0, "name": "EnergyWatch.views.consumptionView", "path": "/home/djmanas/cloud/Projekty/Python/HomeImprovement/EnergyWatch/views/consumptionView.py", "package": "EnergyWatch.views"}}}
-> module .. {"seq": 24, "type": "event", "event": "module", "body": {"reason": "new", "module": {"id": 1, "name": "django.views.generic.base", "path": "/home/djmanas/.virtualenv/django/lib/python3.11/site-packages/django/views/generic/base.py", "package": "django.views.generic"}}}
-> module .. {"seq": 25, "type": "event", "event": "module", "body": {"reason": "new", "module": {"id": 2, "name": "django.core.handlers.base", "path": "/home/djmanas/.virtualenv/django/lib/python3.11/site-packages/django/core/handlers/base.py", "package": "django.core.handlers"}}}
-> module .. {"seq": 26, "type": "event", "event": "module", "body": {"reason": "new", "module": {"id": 3, "name": "django.core.handlers.exception", "path": "/home/djmanas/.virtualenv/django/lib/python3.11/site-packages/django/core/handlers/exception.py", "package": "django.core.handlers"}}}
-> module .. {"seq": 27, "type": "event", "event": "module", "body": {"reason": "new", "module": {"id": 4, "name": "django.utils.deprecation", "path": "/home/djmanas/.virtualenv/django/lib/python3.11/site-packages/django/utils/deprecation.py", "package": "django.utils"}}}
-> module .. {"seq": 28, "type": "event", "event": "module", "body": {"reason": "new", "module": {"id": 5, "name": "django.core.handlers.wsgi", "path": "/home/djmanas/.virtualenv/django/lib/python3.11/site-packages/django/core/handlers/wsgi.py", "package": "django.core.handlers"}}}
-> module .. {"seq": 29, "type": "event", "event": "module", "body": {"reason": "new", "module": {"id": 6, "name": "django.contrib.staticfiles.handlers", "path": "/home/djmanas/.virtualenv/django/lib/python3.11/site-packages/django/contrib/staticfiles/handlers.py", "package": "django.contrib.staticfiles"}}}
-> module .. {"seq": 30, "type": "event", "event": "module", "body": {"reason": "new", "module": {"id": 7, "name": "wsgiref.handlers", "path": "/usr/lib/python3.11/wsgiref/handlers.py", "package": "wsgiref"}}}
-> module .. {"seq": 31, "type": "event", "event": "module", "body": {"reason": "new", "module": {"id": 8, "name": "django.core.servers.basehttp", "path": "/home/djmanas/.virtualenv/django/lib/python3.11/site-packages/django/core/servers/basehttp.py", "package": "django.core.servers"}}}
-> module .. {"seq": 32, "type": "event", "event": "module", "body": {"reason": "new", "module": {"id": 9, "name": "socketserver", "path": "/usr/lib/python3.11/socketserver.py", "version": "0.4"}}}
-> module .. {"seq": 33, "type": "event", "event": "module", "body": {"reason": "new", "module": {"id": 10, "name": "threading", "path": "/usr/lib/python3.11/threading.py"}}}
<- scopes(13) :: {"seq": 13, "type": "request", "command": "scopes", "arguments": {"frameId": 3}}
-> scopes(13) :: {"seq": 34, "type": "response", "request_seq": 13, "success": true, "command": "scopes", "body": {"scopes": [{"name": "Locals", "variablesReference": 4, "expensive": false, "presentationHint": "locals", "source": {}}, {"name": "Globals", "variablesReference": 5, "expensive": false, "source": {}}]}}
<- variables(14) :: {"seq": 14, "type": "request", "command": "variables", "arguments": {"variablesReference": 4}}
-> variables(14) :: {"seq": 35, "type": "response", "request_seq": 14, "success": true, "command": "variables", "body": {"variables": [{"name": "request", "value": "<WSGIRequest: GET '/EnergyWatch/consumption'>", "type": "WSGIRequest", "evaluateName": "request", "variablesReference": 6}, {"name": "self", "value": "<EnergyWatch.views.consumptionView.consumptionView object at 0x7f5230ed3dd0>", "type": "consumptionView", "evaluateName": "self", "variablesReference": 7}]}}
<- stepIn(15) :: {"seq": 15, "type": "request", "command": "stepIn", "arguments": {"threadId": 1, "granularity": null}}
-> stepIn(15) :: {"seq": 36, "type": "response", "request_seq": 15, "success": true, "command": "stepIn"}
It looks like its stepping the wrong thread id it should be stepping "threadId": 2
. If you step the main thread in vscode does it do the same thing?
In vscode, almost the same configuration, because I think its taking PYTHONPATH from .env file and noreload is not needed, since VSCode is able to restart debugger on file change.
{
// 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": "HomeImprovement, Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver"
],
"django": true,
}
]
}
But when i launch it, i stop at breakpoint. Same line of code as in Sublime.
Press F11 as step in or F10 step over. It normally works as expected.
Maybee it could be problem in launch command? But from the debugger protocol it seems the same for me.
cd /home/djmanas/cloud/Projekty/Python/HomeImprovement ; /usr/bin/env /home/djmanas/.virtualenv/django/bin/python /home/djmanas/.vscode/extensions/ms-python.python-2023.25.10111009/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 49065 -- /home/djmanas/cloud/Projekty/Python/HomeImprovement/manage.py runserver
When you stop at the breakpoint in vscode instead of stepping right away select the main thread first and then step so the step command is run on the main thread.
Ok, selected main thread, right click and in menu clicked on step into
And it seems stopped as well.
But still then, when I press F11 - step into, it selects correct thread and it continues correctly.
How am I able to achieve this in Sublime?
I think there is probably a bug where it always sends the wrong threadId
for these commands. I can look at it this weekend.
Thank you very much. I just looked around and it seems its python based. Wanted to give breakpoint into modules/dap/session.py, into some async (step_over/step_in) / normal (on_continued_event) functions, but without any luck. I guess it might need bigger understanding of how plugins work and should study it.
I believe this should resolve the issue https://github.com/daveleroy/SublimeDebugger/commit/33d1a829db62b0f26dfad51b1272bfc96f8dabb1
Thank you, it seems to be working.
Added break point here.
And through stepping I am further in code
Thanks again! Regards, petr Sourek
Hello,
I just recently switched to sublime and I like it more than VSCode, because its not just as slow under linux as VSCode is, but I have problems debugging django app. Python script, I had written few days ago works fine, but django somehow wont.
I got this configuration
It works fine in VSCode, I can even remove noreload, but it is not working out of VSCode without it, but thats not a biggie.
I set breakpoint, launch debugger, everything seems fine:
When I put breakpoint, load view in browser the debugger stops correctly (it even skips manage.py, so #142 is different issue). But when I go over it just hangs or whatever. I can't do anything, its like Schroedinger's debugger.
Debugger stopped
I have pushed "step over" and thats it.
Its dead. Thanks, Regards, Petr Sourek