@@ -151,4 +151,52 @@ Because some builds requires one or more environment files to be sourced before
151151command, you can use the ` ssh.bootstrap ` option to add some extra commands which will be prepended
152152to the debugger call (using ` && ` to join both).
153153
154+ ### Extra Debugger Arguments
155+
156+ Additional arguments can be supplied to the debugger if needed. These will be added when
157+ the debugger executable (e.g., gdb, lldb-mi, etc.) is launched. Extra debugger arguments
158+ are supplied via the ` debugger_args ` setting. Note that the behavior of escaping these
159+ options depends on the environment in which the debugger is started. For non-SSH
160+ debugging, the options are passed directly to the application and therefore no escaping is
161+ necessary (other than what is necessary for the JSON configuration). However, as a result
162+ of the options being passed directly to the application, care must be taken to place
163+ switches and switch values as separate entities in ` debugger_args ` , if they would normally
164+ be separated by a space. For example, supplying the option and value
165+ ` -iex "set $foo = \"bar\"" ` would consist of the following ` debugger_args ` :
166+ ``` json
167+ "debugger_args" : [" -iex" , " set $foo = \" bar\" " ]
168+ ```
169+ If ` = ` is used to associate switches with their values, than the switch and value should
170+ be placed together instead. In fact, the following example shows 4 different ways in
171+ which to specify the same switch and value, using both short and long format, as well as
172+ switch values supplied as a separate parameter or supplied via the ` = ` :
173+ - ``` json
174+ "debugger_args" : [" -iex" , " set $foo = \" bar\" " ]
175+ ```
176+ - ``` json
177+ "debugger_args" : [" -iex=set $foo = \" bar\" " ]
178+ ```
179+ - ``` json
180+ "debugger_args" : [" --init-eval-command" , " set $foo = \" bar\" " ]
181+ ```
182+ - ``` json
183+ "debugger_args" : [" --init-eval-command=set $foo = \" bar\" " ]
184+ ```
185+ Where escaping is really necessary is when running the debugger over SSH. In this case,
186+ the options are not passed directly to the application, but are instead combined with the
187+ application name, joined together with any other options, and sent to the remote system to
188+ be parsed and executed. Thus, depending on the remote system, different escaping may be
189+ necessary. The following shows how the same command as above needs to be escaped
190+ differently based on whether the remote system is a POSIX or a Windows system.
191+ - SSH to Linux machine:
192+ ``` json
193+ "debugger_args" : [" -iex" , " 'set $foo = \" bar\" '" ]
194+ ```
195+ - SSH to Windows machine:
196+ ``` json
197+ "debugger_args" : [" -iex" , " \" set $foo = \\\" bar\\\"\" " ]
198+ ```
199+ You may need to experiment to find the correct escaping necessary for the command to be
200+ sent to the debugger as you intended.
201+
154202## [ Issues] ( https://github.com/WebFreak001/code-debug )
0 commit comments