1
0
Fork 0
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:
Brian Fiete 2020-10-10 07:08:30 -07:00
parent 42a361a8c0
commit 06f6c41679
6 changed files with 43 additions and 1 deletions

View file

@ -163,6 +163,12 @@ namespace System
}
[AttributeUsage(.Method | .Class | .Struct | .Enum)]
public struct NoDebugAttribute : Attribute
{
}
[AttributeUsage(.Method | .Class | .Struct | .Enum)]
public struct UseLLVMAttribute : Attribute
{

View file

@ -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();
}
}
}