mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-21 17:28:00 +02:00
Debug Break,SafeBreak,IsDebuggerPresent. [NoDebug]
This commit is contained in:
parent
42a361a8c0
commit
06f6c41679
6 changed files with 43 additions and 1 deletions
|
@ -163,6 +163,12 @@ namespace System
|
|||
|
||||
}
|
||||
|
||||
[AttributeUsage(.Method | .Class | .Struct | .Enum)]
|
||||
public struct NoDebugAttribute : Attribute
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[AttributeUsage(.Method | .Class | .Struct | .Enum)]
|
||||
public struct UseLLVMAttribute : Attribute
|
||||
{
|
||||
|
|
|
@ -76,5 +76,28 @@ namespace System.Diagnostics
|
|||
paramStr.Append('\n');
|
||||
Write(paramStr.Ptr, paramStr.Length);
|
||||
}
|
||||
|
||||
static bool gIsDebuggerPresent = IsDebuggerPresent;
|
||||
[LinkName("IsDebuggerPresent"), CallingConvention(.Stdcall)]
|
||||
static extern int32 Internal_IsDebuggerPresent();
|
||||
|
||||
public static bool IsDebuggerPresent
|
||||
{
|
||||
#if BF_PLATFORM_WINDOWS
|
||||
get => gIsDebuggerPresent = Internal_IsDebuggerPresent() != 0;
|
||||
#else
|
||||
get => false;
|
||||
#endif
|
||||
}
|
||||
|
||||
[Intrinsic("debugtrap")]
|
||||
public static extern void Break();
|
||||
|
||||
[NoDebug]
|
||||
public static void SafeBreak()
|
||||
{
|
||||
if (gIsDebuggerPresent)
|
||||
Break();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue