vscode-rdbg
vscode-rdbg copied to clipboard
localfsMap is not being set correctly, unable to set breakpoints
It seems that the localfsMap configuration is not being set on rdbg when attaching I am able to attach successfully but when trying to set a breakpoint it fails because the path is incorrect
also when trying to place a debugger
command in the code, the editor will pause on a breakpoint but I get an error:
Could not load source 'C/app/controllers/base_controller.rb': not found....
launch.json configuration:
{
"type": "rdbg",
"name": "Attach to api",
"request": "attach",
"debugPort": "9200",
"localfsMap": "/usr/app:${workspaceFolder}\\api",
"showProtocolLog": true
}
Extension Log:
[Start session]
{"_debugServiceProxy":{},"_id":"3329cf49-3126-4dda-845d-ef9f2544a442","_type":"rdbg","_name":"api","_workspaceFolder":{"uri":{"$mid":1,"fsPath":"c:\\Users\\User\\Projects\\myproject","_sep":1,"external":"file:///c%3A/Users/User/Projects/myproject","path":"/c:/Users/User/Projects/myproject","scheme":"file"},"name":"myproject","index":0},"_configuration":{"type":"rdbg","name":"api","request":"attach","debugPort":"9200","localfsMap":"/usr/app:C:\\Users\\User\\Projects\\myproject\\api","showProtocolLog":true,"__configurationTarget":6}}
[VSCode->DA] {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"rdbg","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsArgsCanBeInterpretedByShell":true},"type":"request","seq":1}
[DA->VSCode] {"type":"response","command":"initialize","request_seq":1,"success":true,"message":"Success","body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":true,"supportsConditionalBreakpoints":true,"supportTerminateDebuggee":true,"supportsTerminateRequest":true,"exceptionBreakpointFilters":[{"filter":"any","label":"rescue any exception","supportsCondition":true},{"filter":"RuntimeError","label":"rescue RuntimeError","supportsCondition":true}],"supportsExceptionFilterOptions":true,"supportsStepBack":true,"supportsEvaluateForHovers":true,"supportsCompletionsRequest":true},"seq":1}
[DA->VSCode] {"type":"event","event":"initialized","seq":2}
[VSCode->DA] {"command":"attach","arguments":{"type":"rdbg","name":"api","request":"attach","debugPort":"9200","localfsMap":"/usr/app:C:\\Users\\User\\Projects\\myproject\\api","showProtocolLog":true,"__configurationTarget":6,"__sessionId":"3329cf49-3126-4dda-845d-ef9f2544a442"},"type":"request","seq":2}
[DA->VSCode] {"type":"response","command":"attach","request_seq":2,"success":true,"message":"Success","seq":3}
[VSCode->DA] {"command":"setBreakpoints","arguments":{"source":{"name":"base_controller.rb","path":"c:\\Users\\User\\Projects\\myproject\\api\\app\\controllers\\base_controller.rb"},"lines":[5],"breakpoints":[{"line":5}],"sourceModified":false},"type":"request","seq":3}
[DA->VSCode] {"type":"response","command":"setBreakpoints","request_seq":3,"success":false,"message":"c:\\Users\\User\\Projects\\myproject\\api\\app\\controllers\\base_controller.rb is not available","seq":4}
[VSCode->DA] {"command":"configurationDone","type":"request","seq":4}
[DA->VSCode] {"type":"response","command":"configurationDone","request_seq":4,"success":true,"message":"Success","seq":5}
[VSCode->DA] {"command":"threads","type":"request","seq":5}
[DA->VSCode] {"type":"response","command":"threads","request_seq":5,"success":true,"message":"Success","body":{"threads":[{"id":1,"name":"#1 bin/rails:4:in `<main>'"},{"id":4,"name":"#4 puma plgn bg 0"},{"id":5,"name":"#5 puma srv tp 001"},{"id":6,"name":"#6 puma srv tp 002"},{"id":7,"name":"#7 puma srv tp 003"},{"id":8,"name":"#8 puma srv tp 004"},{"id":9,"name":"#9 puma srv tp 005"},{"id":10,"name":"#10 puma reactor"},{"id":11,"name":"#11 puma srv threadpool reaper"},{"id":12,"name":"#12 puma srv threadpool trimmer"},{"id":13,"name":"#13 puma srv"},{"id":14,"name":"#14 /usr/local/bundle/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb:46:in `block in spawn_thread'"}]},"seq":6}
rdbg logs:
api | DEBUGGER: Connected.
api | #1:[>] {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"rdbg","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsArgsCanBeInterpretedByShell":true},"type":"request","seq":1}
api | #1:[<] {"type":"response","command":"initialize","request_seq":1,"success":true,"message":"Success","body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":true,"supportsConditionalBreakpoints":true,"supportTerminateDebuggee":true,"supportsTerminateRequest":true,"exceptionBreakpointFilters":[{"filter":"any","label":"rescue any exception","supportsCondition":true},{"filter":"RuntimeError","label":"rescue RuntimeError","supportsCondition":true}],"supportsExceptionFilterOptions":true,"supportsStepBack":true,"supportsEvaluateForHovers":true,"supportsCompletionsRequest":true},"seq":1}
api | #1:[<] {"type":"event","event":"initialized","seq":2}
api | #1:[>] {"command":"attach","arguments":{"type":"rdbg","name":"api","request":"attach","debugPort":"9200","localfsMap":"/usr/app:C:\\Users\\User\\Projects\\myproject\\api","showProtocolLog":true,"__configurationTarget":6,"__sessionId":"3329cf49-3126-4dda-845d-ef9f2544a442"},"type":"request","seq":2}
api | #1:[<] {"type":"response","command":"attach","request_seq":2,"success":true,"message":"Success","seq":3}
api | #1:[>] {"command":"setBreakpoints","arguments":{"source":{"name":"base_controller.rb","path":"c:\\Users\\User\\Projects\\myproject\\api\\app\\controllers\\base_controller.rb"},"lines":[5],"breakpoints":[{"line":5}],"sourceModified":false},"type":"request","seq":3}
api | #1:[<] {"type":"response","command":"setBreakpoints","request_seq":3,"success":false,"message":"c:\\Users\\User\\Projects\\myproject\\api\\app\\controllers\\base_controller.rb is not available","seq":4}
api | #1:[>] {"command":"configurationDone","type":"request","seq":4}
api | #1:[<] {"type":"response","command":"configurationDone","request_seq":4,"success":true,"message":"Success","seq":5}
api | #1:[>] {"command":"threads","type":"request","seq":5}
api | #1:[<] {"type":"response","command":"threads","request_seq":5,"success":true,"message":"Success","body":{"threads":[{"id":1,"name":"#1 bin/rails:4:in `<main>'"},{"id":4,"name":"#4 puma plgn bg 0"},{"id":5,"name":"#5 puma srv tp 001"},{"id":6,"name":"#6 puma srv tp 002"},{"id":7,"name":"#7 puma srv tp 003"},{"id":8,"name":"#8 puma srv tp 004"},{"id":9,"name":"#9 puma srv tp 005"},{"id":10,"name":"#10 puma reactor"},{"id":11,"name":"#11 puma srv threadpool reaper"},{"id":12,"name":"#12 puma srv threadpool trimmer"},{"id":13,"name":"#13 puma srv"},{"id":14,"name":"#14 /usr/local/bundle/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb:46:in `block in spawn_thread'"}]},"seq":6}
I think I have an idea of why it's happening, looking a bit further into the extension it might be beacuse Windows has a colon in it's path
so when you split the localfsMap:
/usr/app:${workspaceFolder}\\api
which is really:
/usr/app:C:\Users\User\Projects\myroject\api
on a colon you get:
/usr/app,C,\Users\User\Projects\myproject\api
That might explain why i'm getting the error:
Could not load source 'C/app/controllers/base_controller.rb': not found....
could you tell me your environment? vscode on Windows?
Hi, I got a similar problem using Win 11 with WSL2 running rails app (redmine) in a docker-container. The debugger connects, but the localfsMap seems not to be applied at all.
Debug config:
{
"type": "rdbg",
"name": "Attach rdbg",
"request": "attach",
"debugPort": "20138",
"localfsMap": "/var/redmine:${workspaceFolder}/redmine-dev",
"showProtocolLog": true
}
When placing a breakpoint I receive
[VSCode->DA] {"command":"setBreakpoints","arguments":{"source":{"name":"projects_controller.rb","path":"/home/lm/redmine/redmine-dev/app/controllers/projects_controller.rb"},"lines":[50],"breakpoints":[{"line":50}],"sourceModified":false},"type":"request","seq":13}
[DA->VSCode] {"type":"event","event":"output","body":{"category":"console","output":"No such file or directory @ rb_check_realpath_internal - /home/lm/redmine/redmine-dev/app/controllers/projects_controller.rb\n"},"seq":18}
[DA->VSCode] {"type":"response","command":"setBreakpoints","request_seq":13,"success":true,"message":"Success","body":{"breakpoints":[{"verified":true}]},"seq":19}
The mapping seems to be passed, I am not sure whether the extension or rdbg does the path substitution... When attaching the debugger the mapping seems to be passed (note the workspace root is /home/lm/redmine
while redmine is in a subfolder redmine-dev
, but that should not affect the mapping, I guess...)
[Start session]
{"d":{},"f":"8f01a5e5-26ba-4ca7-b1f5-22ec147abaf5","g":"rdbg","h":"Attach rdbg","i":{"uri":{"$mid":1,"fsPath":"/home/lm/redmine","external":"file:///home/lm/redmine","path":"/home/lm/redmine","scheme":"file"},"name":"redmine","index":0},"j":{"type":"rdbg","name":"Attach rdbg","request":"attach","debugPort":"20138","localfsMap":"/var/redmine:/home/lm/redmine/redmine-dev,","showProtocolLog":true,"__configurationTarget":6}}
After changing literally nothing but restarting VSCode it suddenly worked 🤔 Sorry, my post will probably not help to solve the problem...
LoL