Fix debugger late attach, suspend=n. (#45834)
authormonojenkins <jo.shields+jenkins@xamarin.com>
Thu, 10 Dec 2020 12:24:19 +0000 (07:24 -0500)
committerGitHub <noreply@github.com>
Thu, 10 Dec 2020 12:24:19 +0000 (13:24 +0100)
commit8dec5ad8c410c44e7e838ebc77d0115c2a24a6a9
treed28a0927d7ce0269e81e21c1082065a34ab06348
parentcfa7a19caa72e3655dd240d1becc6b5d25821b1e
Fix debugger late attach, suspend=n. (#45834)

Runtime workaround fix for incorrect VM resume when suspend policy none is in use. Real fix is in debugger-libs, mono/debugger-libs#264 but until that lands in VS installer (and tooling has been upgraded to VS2019) this workaround will prevent the error to be propagated back to client and VM will make sure the correct suspend state is maintained.

Fix also makes sure logging done within debugger engine/agent is not directly send to stdout/stderr on platforms where there is no console (or alternative console).

This is done to prevent scenarios where stdout/stderr has been redirected to for example the debug client, but logging into the same streams as part of debugger agent implementation will trigger new messages to redirect, flooding the message queue and suspending/resuming the VM for each message. This PR makes sure it is possible to get all logging done in debugger agent/engine (not just debug logging) into an alternative log implementation on platforms needing it.

Co-authored-by: lateralusX <lateralusX@users.noreply.github.com>
src/mono/mono/mini/debugger-agent.c
src/mono/mono/mini/debugger-engine.c
src/mono/mono/mini/debugger-engine.h
src/mono/mono/mini/mini-wasm-debugger.c