[debugger] Don't list finalizer gc thread if it's not executing managed code (mono...
authorThays Grazia <thaystg@gmail.com>
Mon, 15 Jul 2019 14:58:04 +0000 (11:58 -0300)
committerGitHub <noreply@github.com>
Mon, 15 Jul 2019 14:58:04 +0000 (11:58 -0300)
commita04e69b4454d5033fa42303477410b04aa93dca3
tree177c2954d25a3dc0c1b64603be5c53563d9a1b2c
parent843bca69c8778d0d5e284c7a3c575bc48b16f9c5
[debugger] Don't list finalizer gc thread if it's not executing managed code (mono/mono#15618)

* The example that reproduces the bug does this:
var thread = vm.GetThreads()[0];
greetingValue = program.InvokeMethod(thread, greeting, new Value[0]) as StringMirror;

But sometimes the Thread[0] was the MainThread of the program and it works, and other times was the GC Finalizer, but when it tries to run something on GC Finalizer thread, the thread is not suspended and throws an exception.
In the fix I removed the Finalizer thread if it's not executing a managed code of the list that is returned when CMD_VM_ALL_THREADS is called.

Fix mono/mono#13311

Commit migrated from https://github.com/mono/mono/commit/73128453daff8966f1c8eeacb734579971b02218
src/mono/mono/mini/debugger-agent.c