Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger does not stop at breakpoints when relative path to script contains spaces #185

Open
j-ulrich opened this issue Jun 15, 2023 · 0 comments

Comments

@j-ulrich
Copy link

j-ulrich commented Jun 15, 2023

The debugger does not stop at breakpoints when the relative path of the script being debugged contains spaces. Stepping works but not breakpoints.

With "relative path" I mean the path relative to the cwd.

For example, the following launch.json shows a problematic configuration:

{
	"version": "0.2.0",
	"configurations": [
		{
			"type": "bashdb",
			"request": "launch",
			"name": "Bash-Debug (hardcoded script name)",
			"cwd": "${workspaceFolder}",
			"program": "${workspaceFolder}/directory with space/test.sh",
			"args": [],
			"trace": true,
			"showDebugOutput": true
		}
	]
}

In contrast, with the following launch.json, the debugger stops at breakpoints as expected (note the different cwd):

{
	"version": "0.2.0",
	"configurations": [
		{
			"type": "bashdb",
			"request": "launch",
			"name": "Bash-Debug (hardcoded script name)",
			"cwd": "${workspaceFolder}/directory with space",
			"program": "${workspaceFolder}/directory with space/test.sh",
			"args": [],
			"trace": true,
			"showDebugOutput": true
		}
	]
}

System

macOS 12.6.5 Darwin Kernel Version 21.6.0
Version of bash-debug: v0.3.9
Version of bash: GNU bash, version 5.1.16(1)-release (x86_64-apple-darwin20.6.0)
VSCode: 1.78.2

Debug output

From client: initialize({"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"bashdb","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsArgsCanBeInterpretedByShell":true,"supportsMemoryEvent":true,"supportsStartDebuggingRequest":true})
To client: {"seq":0,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":false,"supportsEvaluateForHovers":true,"supportsStepBack":false,"supportsSetVariable":false}}
From client: launch({"type":"bashdb","request":"launch","name":"Bash-Debug (hardcoded script name)","cwd":"/Users/julrich/workspace/bashdb-test","program":"/Users/julrich/workspace/bashdb-test/directory with space/test.sh","args":[],"trace":true,"showDebugOutput":true,"__configurationTarget":6,"argsString":"","env":{},"pathBash":"bash","pathBashdb":"/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb","pathBashdbLib":"/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir","pathCat":"cat","pathMkfifo":"mkfifo","pathPkill":"pkill","__sessionId":"ded1e9cf-0d5f-4e4d-9581-104d5be87322"})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"::PROXYID::57878\n"}}
::PROXYID::57878
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"(/Users/julrich/workspace/bashdb-test/directory with space/test.sh:3):\n3:\techo \"one\"\n"}}
(/Users/julrich/workspace/bashdb-test/directory with space/test.sh:3):
3:	echo "one"
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"Sending StoppedEvent"}}
To client: {"seq":0,"type":"event","event":"stopped","body":{"reason":"break","threadId":42}}
From client: threads(undefined)
To client: {"seq":0,"type":"response","request_seq":3,"command":"threads","success":true,"body":{"threads":[{"id":42,"name":"Bash thread"}]}}
From client: stackTrace({"threadId":42,"startFrame":0,"levels":20})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"Debug environment: bash_ver=5.1.16(1)-release, bashdb_ver=4.4-0.94-mod, program=/Users/julrich/workspace/bashdb-test/directory with space/test.sh, args=\n"}}
Debug environment: bash_ver=5.1.16(1)-release, bashdb_ver=4.4-0.94-mod, program=/Users/julrich/workspace/bashdb-test/directory with space/test.sh, args=
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"57872\n"}}
57872
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"############################################################\n"}}
############################################################
To client: {"seq":0,"type":"response","request_seq":2,"command":"launch","success":true}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"Sending InitializedEvent"}}
To client: {"seq":0,"type":"event","event":"initialized"}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"backtrace\n"}}
backtrace
From client: setBreakpoints({"source":{"name":"test.sh","path":"/Users/julrich/workspace/bashdb-test/directory with space/test.sh"},"lines":[5],"breakpoints":[{"line":5}],"sourceModified":false})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"->0 in file `/Users/julrich/workspace/bashdb-test/directory with space/test.sh' at line 3\n"}}
->0 in file `/Users/julrich/workspace/bashdb-test/directory with space/test.sh' at line 3
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"##1 source"}}
##1 sourceTo client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"(\"/Users/julrich/workspace/bashdb-test/directory with space/test.sh\") called from file `/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb' at line 102\n"}}
("/Users/julrich/workspace/bashdb-test/directory with space/test.sh") called from file `/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb' at line 102
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"##2 main"}}
##2 mainFrom client: stackTrace({"threadId":42,"startFrame":0,"levels":20})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"(\"--quiet\", \"--tty\", \"/tmp/vscode-bash-debug-fifo-14552\", \"--tty_in\", \"/tmp/vscode-bash-debug-fifo-14552_in\", \"--library\", \"/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir\", \"--\", \"/Users/julrich/workspace/bashdb-test/directory with space/test.sh\") called from file `/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb' at line 0\n"}}
("--quiet", "--tty", "/tmp/vscode-bash-debug-fifo-14552", "--tty_in", "/tmp/vscode-bash-debug-fifo-14552_in", "--library", "/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir", "--", "/Users/julrich/workspace/bashdb-test/directory with space/test.sh") called from file `/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb' at line 0
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"57872############################################################\n"}}
57872############################################################
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"Execution breaks at '->0 in file `/Users/julrich/workspace/bashdb-test/directory with space/test.sh' at line 3'\n"}}
To client: {"seq":0,"type":"response","request_seq":4,"command":"stackTrace","success":true,"body":{"stackFrames":[{"id":0,"source":{"name":"test.sh","path":"/Users/julrich/workspace/bashdb-test/directory with space/test.sh","sourceReference":0,"adapterData":"bash-adapter-data"},"line":3,"column":0,"name":"->0 in file `/Users/julrich/workspace/bashdb-test/directory with space/test.sh' at line 3"},{"id":1,"source":{"name":"bashdb","path":"/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb","sourceReference":0,"adapterData":"bash-adapter-data"},"line":102,"column":0,"name":"##1 source(\"/Users/julrich/workspace/bashdb-test/directory with space/test.sh\") called from file `/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb' at line 102"},{"id":2,"source":{"name":"bashdb","path":"/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb","sourceReference":0,"adapterData":"bash-adapter-data"},"line":0,"column":0,"name":"##2 main(\"--quiet\", \"--tty\", \"/tmp/vscode-bash-debug-fifo-14552\", \"--tty_in\", \"/tmp/vscode-bash-debug-fifo-14552_in\", \"--library\", \"/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir\", \"--\", \"/Users/julrich/workspace/bashdb-test/directory with space/test.sh\") called from file `/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb' at line 0"}],"totalFrames":4}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"File /Users/julrich/workspace/bashdb-test/directory with space/test.sh loaded.\n"}}
File /Users/julrich/workspace/bashdb-test/directory with space/test.sh loaded.
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"break </Users/julrich/workspace/bashdb-test/directory with space/test.sh:5 > \n"}}
break </Users/julrich/workspace/bashdb-test/directory with space/test.sh:5 >
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"** \u001b[4mFile \"\" not found in read-in files.\u001b[0m\n"}}
** File "" not found in read-in files.
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"** \u001b[4mSee 'info files' for a list of known files and\u001b[0m\n"}}
** See 'info files' for a list of known files and
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"** \u001b[4m'load' to read in a file.\u001b[0m\n"}}
** 'load' to read in a file.
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"Source files which we have recorded info about:\n"}}
Source files which we have recorded info about:
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"  /Users/julrich/workspace/bashdb-test/directory with space/test.sh: /Users/julrich/workspace/bashdb-test/directory with space/test.sh, 5 lines\n"}}
  /Users/julrich/workspace/bashdb-test/directory with space/test.sh: /Users/julrich/workspace/bashdb-test/directory with space/test.sh, 5 lines
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"No breakpoints have been set.\n"}}
No breakpoints have been set.
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"57872############################################################\n"}}
57872############################################################
To client: {"seq":0,"type":"response","request_seq":5,"command":"setBreakpoints","success":true,"body":{"breakpoints":[{"verified":true,"line":null,"id":null}]}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"backtrace\n"}}
backtrace
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"->0 in file `/Users/julrich/workspace/bashdb-test/directory with space/test.sh' at line 3\n"}}
->0 in file `/Users/julrich/workspace/bashdb-test/directory with space/test.sh' at line 3
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"##1 source"}}
##1 sourceTo client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"(\"/Users/julrich/workspace/bashdb-test/directory with space/test.sh\") called from file `/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb' at line 102\n"}}
("/Users/julrich/workspace/bashdb-test/directory with space/test.sh") called from file `/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb' at line 102
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"##2 main"}}
##2 mainTo client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"(\"--quiet\", \"--tty\", \"/tmp/vscode-bash-debug-fifo-14552\", \"--tty_in\", \"/tmp/vscode-bash-debug-fifo-14552_in\", \"--library\", \"/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir\", \"--\", \"/Users/julrich/workspace/bashdb-test/directory with space/test.sh\") called from file `/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb' at line 0\n"}}
("--quiet", "--tty", "/tmp/vscode-bash-debug-fifo-14552", "--tty_in", "/tmp/vscode-bash-debug-fifo-14552_in", "--library", "/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir", "--", "/Users/julrich/workspace/bashdb-test/directory with space/test.sh") called from file `/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb' at line 0
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"57872############################################################\n"}}
57872############################################################
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"Execution breaks at '->0 in file `/Users/julrich/workspace/bashdb-test/directory with space/test.sh' at line 3'\n"}}
To client: {"seq":0,"type":"response","request_seq":6,"command":"stackTrace","success":true,"body":{"stackFrames":[{"id":0,"source":{"name":"test.sh","path":"/Users/julrich/workspace/bashdb-test/directory with space/test.sh","sourceReference":0,"adapterData":"bash-adapter-data"},"line":3,"column":0,"name":"->0 in file `/Users/julrich/workspace/bashdb-test/directory with space/test.sh' at line 3"},{"id":1,"source":{"name":"bashdb","path":"/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb","sourceReference":0,"adapterData":"bash-adapter-data"},"line":102,"column":0,"name":"##1 source(\"/Users/julrich/workspace/bashdb-test/directory with space/test.sh\") called from file `/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb' at line 102"},{"id":2,"source":{"name":"bashdb","path":"/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb","sourceReference":0,"adapterData":"bash-adapter-data"},"line":0,"column":0,"name":"##2 main(\"--quiet\", \"--tty\", \"/tmp/vscode-bash-debug-fifo-14552\", \"--tty_in\", \"/tmp/vscode-bash-debug-fifo-14552_in\", \"--library\", \"/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir\", \"--\", \"/Users/julrich/workspace/bashdb-test/directory with space/test.sh\") called from file `/Users/julrich/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb' at line 0"}],"totalFrames":4}}
From client: setExceptionBreakpoints({"filters":[]})
To client: {"seq":0,"type":"response","request_seq":7,"command":"setExceptionBreakpoints","success":true}
From client: threads(undefined)
To client: {"seq":0,"type":"response","request_seq":8,"command":"threads","success":true,"body":{"threads":[{"id":42,"name":"Bash thread"}]}}
From client: scopes({"frameId":0})
To client: {"seq":0,"type":"response","request_seq":9,"command":"scopes","success":true,"body":{"scopes":[{"name":"Local","variablesReference":24,"expensive":false}]}}
From client: variables({"variablesReference":24})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"Program stopped.\n"}}
Program stopped.
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"It stopped after being stepped.\n"}}
It stopped after being stepped.
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"Next statement to be run is:\n\techo \"one\"\n"}}
Next statement to be run is:
	echo "one"
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"examine <$PWD> \n"}}
examine <$PWD>
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"/Users/julrich/workspace/bashdb-test\n"}}
/Users/julrich/workspace/bashdb-test
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"examine <$? # from . \"$_Dbg_script_file\"> \n"}}
examine <$? # from . "$_Dbg_script_file">
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"0 # from '. \"$_Dbg_script_file\"'\n"}}
0 # from '. "$_Dbg_script_file"'
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"57872############################################################\n"}}
57872############################################################
To client: {"seq":0,"type":"response","request_seq":10,"command":"variables","success":true,"body":{"variables":[{"name":"$PWD","type":"string","value":"/Users/julrich/workspace/bashdb-test","variablesReference":0},{"name":"$? ","type":"string","value":"0 # from '. \"$_Dbg_script_file\"'","variablesReference":0}]}}
From client: continue({"threadId":42})
To client: {"seq":0,"type":"response","request_seq":11,"command":"continue","success":true}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"continue\n"}}
continue
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"one\n"}}
one
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"two\n"}}
two
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"Debugged program terminated normally. Use q to quit or R to restart.\n"}}
Debugged program terminated normally. Use q to quit or R to restart.
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"Sending TerminatedEvent"}}
To client: {"seq":0,"type":"event","event":"terminated"}
From client: disconnect({"restart":false})
To client: {"seq":0,"type":"response","request_seq":12,"command":"disconnect","success":true}

Note that this problem was already report in #146 but that issue was closed without any comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant