Fix docker example for python

The example was was using 'launchCommand' which is not valid according
to the schema; it should be 'runCommand'.

But also, it never really worked. Vimspector would start the "adapter"
(in this case, try and connect to the TCP port) before running the
"prepare" commands, wich in this case would actually start debugpy
listening. So to solve that we run the prepare commands earlier.
Hopefully this won't cause a regression for Java and C++ remote attach,
which we don't really have tests for.

Finally, due to the way docker works, when you forward a port and
nothing is listening on it, docker _accepts_ the connection then
immediately drops it. This is _super_ annoying meaning that it looks to
vimspector liek the server instantly dies if it takes nonzero time for
the remote commands to open the port. So to solve this we add loaunch
and attach delays which can be configured in the adapter config. This
actually solves a prolem where the java debugger just takes agest to
attach on remote launch too.

(Finally, finally...) updated the vimspector schema to represent
the real launch/attach remote configuration, which was incorrectly
spec'd at the adapter level, but it's actually per launch/attach block.
This commit is contained in:
Ben Jackson 2020-12-14 17:53:06 +00:00 • committed by Ben Jackson
commit 0942aa4523
6 changed files with 282 additions and 158 deletions

View file

@ -633,19 +633,24 @@ Vimspector then orchestrates the various tools to set you up.
// Command to launch the debugee and attach the debugger;
// %CMD% replaced with the remote-cmdLine configured in the launch
// configuration. (mandatory)
"launchCommmand": [
"runCommand": [
"python", "-m", "debugpy", "--listen", "0.0.0.0:${port}",
"%CMD%"
]
// Optional alternative to launchCommmand (if you need to run multiple
// Optional alternative to runCommand (if you need to run multiple
// commands)
// "launchCommmands": [
// "runCommands": [
// [ /* first command */ ],
// [ /* second command */ ]
// ]
}
// optional delay to wait after running runCommand(s). This is often
// needed because of the way docker handles TCP, or if you're using some
// wrapper (e.g. to start the JVM)
// "delay": "1000m" // format as per :help sleep
},
"attach": {
"remote": {
@ -685,6 +690,10 @@ Vimspector then orchestrates the various tools to set you up.
// "args": [ "-o", "StrictHostKeyChecking=no" ]
// },
}
// optional delay to wait after running runCommand(s). This is often
// needed because of the way docker handles TCP, or if you're using some
// wrapper (e.g. to start the JVM)
// "delay": "1000m" // format as per :help sleep
}
}
},
@ -754,7 +763,7 @@ and have to tell cpptools a few more options.
"remote": {
"host": "${host}",
"account": "${account}",
"launchCommmand": [
"runCommand": [
"gdbserver",
"--once",
"--no-startup-with-shell",
@ -838,19 +847,23 @@ port.
// Command to launch the debugee and attach the debugger;
// %CMD% replaced with the remote-cmdLine configured in the launch
// configuration. (mandatory)
"launchCommmand": [
"runCommand": [
"python", "-m", "debugpy", "--listen", "0.0.0.0:${port}",
"%CMD%"
]
// Optional alternative to launchCommmand (if you need to run multiple
// Optional alternative to runCommand (if you need to run multiple
// commands)
// "launchCommmands": [
// "runCommands": [
// [ /* first command */ ],
// [ /* second command */ ]
// ]
}
// optional delay to wait after running runCommand(s). This is often
// needed because of the way docker handles TCP
"delay": "1000m" // format as per :help sleep
},
"attach": {
"remote": {
@ -886,6 +899,11 @@ port.
// ]
}
// optional delay to wait after running runCommand(s). This is often
// needed because of the way docker handles TCP, or if you're using some
// wrapper (e.g. to start the JVM)
"delay": "1000m" // format as per :help sleep
}
}
},