Determine if a debugger was attached during a test task?

Is there a way to tell if a debugger (e.g. an IDE) was attached to a build when it was running, specifically for test runs? We are trying to gather telemetry from build scans on how long it takes to run tests on developer machines, but we need to weed out when a dev stops a test on a breakpoint. The problem is there is a gray area between “this is a really long test” and “things were stopped on a breakpoint”. If we can tell that a debugger was attached, or at least that the JRE options to enable a debugger to be attached were set, that would help get better data, even if not perfect.