eclipse-cdt-cloud / cdt-gdb-adapter

CDT GDB Debug Adapter
Eclipse Public License 2.0
30 stars 40 forks source link

GDB version update on GitHub Actions on Windows causes test failures #299

Closed jonahgraham closed 12 months ago

jonahgraham commented 1 year ago

GitHub updated chocolatey's preinstall mingw from version 11 to 12 in the last few days and that includes gdb going from 10.2 -> 11.2. So it looks like there is some instability in the new version causing us grief.

jonahgraham commented 1 year ago

The change to GHA was deployed yesterday - see https://github.com/actions/runner-images/issues/8266#issuecomment-1729310612

jonahgraham commented 1 year ago

The issue appears to be that the gdbserver process has changed how it is buffered when connected to the adapter. This leads to output events like this:

[17:21:57.837 UTC] To client: {"seq":0,"type":"event","event":"output","body":{"category":"server","output":"L"}}
[17:21:57.837 UTC] To client: {"seq":0,"type":"event","event":"output","body":{"category":"server","output":"i"}}
[17:21:57.837 UTC] To client: {"seq":0,"type":"event","event":"output","body":{"category":"server","output":"stening on port 63903\r\n"}}

which corresponds to what is being parsed. The gdbserver output is sniffed for a regex like this:

https://github.com/eclipse-cdt-cloud/cdt-gdb-adapter/blob/9d9a46322b26c626d9d57c921748bc018cb31000/src/GDBTargetDebugSession.ts#L241

but with the output split across multiple 'data' events from the process we never see that regex and the test timesouts:

https://github.com/eclipse-cdt-cloud/cdt-gdb-adapter/blob/9d9a46322b26c626d9d57c921748bc018cb31000/src/GDBTargetDebugSession.ts#L259-L262

I think the solution is to accumulate the output (line by line) before passing the accumulated output to checkTargetPort

jonahgraham commented 1 year ago

[...] (line by line) [...]

Not sure there is any need to do it line by line - that makes the code more complicated.