mssf_core/debug/
mod.rs

1// ------------------------------------------------------------
2// Copyright (c) Microsoft Corporation.  All rights reserved.
3// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
4// ------------------------------------------------------------
5
6#[cfg(target_os = "windows")]
7pub fn wait_for_debugger() {
8    loop {
9        if unsafe { windows::Win32::System::Diagnostics::Debug::IsDebuggerPresent().as_bool() } {
10            #[cfg(feature = "tracing")]
11            tracing::info!("Debugger found.");
12            break;
13        } else {
14            #[cfg(feature = "tracing")]
15            tracing::info!("Waiting for debugger.");
16            std::thread::sleep(std::time::Duration::from_secs(5));
17        }
18    }
19}
20
21#[cfg(target_os = "linux")]
22pub fn wait_for_debugger() {}
23
24/// macOS is not supported. This is merely to make this library to compile on macOS.
25#[cfg(target_os = "macos")]
26pub fn wait_for_debugger() {}