Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/coreclr/vm/datadescriptor/datadescriptor.inc
Original file line number Diff line number Diff line change
Expand Up @@ -989,10 +989,21 @@ CDAC_TYPES_END()

CDAC_GLOBALS_BEGIN()

#if defined(TARGET_UNIX)
CDAC_GLOBAL_STRING(OperatingSystem, unix)
#if defined(TARGET_BROWSER)
#ifdef Browser
#error Handle 'Browser' define
#endif // Browser
CDAC_GLOBAL_STRING(OperatingSystem, Browser)
#elif defined(TARGET_UNIX)
#ifdef Unix
#error Handle 'Unix' define
#endif // Unix
CDAC_GLOBAL_STRING(OperatingSystem, Unix)
#elif defined(TARGET_WINDOWS)
CDAC_GLOBAL_STRING(OperatingSystem, windows)
#ifdef Windows
#error Handle 'Windows' define
#endif // Windows
CDAC_GLOBAL_STRING(OperatingSystem, Windows)
#else
#error TARGET_{OS} define is not recognized by the cDAC. Update this switch and the enum values in IRuntimeInfo.cs
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public enum RuntimeInfoOperatingSystem : uint
Unknown = 0,
Windows,
Unix,
Browser,
}

public interface IRuntimeInfo : IContract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal class AMD64Unwinder(Target target)
private readonly Target _target = target;
private readonly IExecutionManager _eman = target.Contracts.ExecutionManager;

private readonly bool _unix = target.Contracts.RuntimeInfo.GetTargetOperatingSystem() == RuntimeInfoOperatingSystem.Unix;
private readonly bool _unixAMD64ABI = target.Contracts.RuntimeInfo.GetTargetOperatingSystem() != RuntimeInfoOperatingSystem.Windows;

public bool Unwind(ref AMD64Context context)
{
Expand Down Expand Up @@ -97,7 +97,7 @@ public bool Unwind(ref AMD64Context context)
{
frameOffset = unwindInfo.FrameOffset;

if (_unix)
if (_unixAMD64ABI)
{
// If UnwindInfo->FrameOffset == 15 (the maximum value), then there might be a UWOP_SET_FPREG_LARGE.
// However, it is still legal for a UWOP_SET_FPREG to set UnwindInfo->FrameOffset == 15 (since this
Expand Down Expand Up @@ -133,7 +133,7 @@ public bool Unwind(ref AMD64Context context)
unwindOp = GetUnwindCode(unwindInfo, index);
if (unwindOp.UnwindOp == UnwindCode.OpCodes.UWOP_SET_FPREG)
break;
if (_unix)
if (_unixAMD64ABI)
{
if (unwindOp.UnwindOp == UnwindCode.OpCodes.UWOP_SET_FPREG_LARGE)
{
Expand Down Expand Up @@ -835,7 +835,7 @@ private bool UnwindPrologue(

UnwindCode unwindOp = GetUnwindCode(unwindInfo, index);

if (_unix)
if (_unixAMD64ABI)
{
if (unwindOp.UnwindOp > UnwindCode.OpCodes.UWOP_SET_FPREG_LARGE)
{
Expand All @@ -845,7 +845,8 @@ private bool UnwindPrologue(
}
else
{
if (unwindOp.UnwindOp == UnwindCode.OpCodes.UWOP_SET_FPREG_LARGE)
Debug.Assert(_target.Contracts.RuntimeInfo.GetTargetOperatingSystem() == RuntimeInfoOperatingSystem.Windows);
if (unwindOp.UnwindOp > UnwindCode.OpCodes.UWOP_PUSH_MACHFRAME)
{
Debug.Fail("Expected unwind code");
return false;
Expand Down Expand Up @@ -929,7 +930,7 @@ private bool UnwindPrologue(
//
case UnwindCode.OpCodes.UWOP_SET_FPREG_LARGE:
{
UnwinderAssert(_unix);
UnwinderAssert(_unixAMD64ABI);
UnwinderAssert(unwindInfo.FrameOffset == 15);
uint frameOffset = GetUnwindCode(unwindInfo, index + 1).FrameOffset;
frameOffset += (uint)(GetUnwindCode(unwindInfo, index + 2).FrameOffset << 16);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class X86Unwinder(Target target)
private readonly Target _target = target;
private readonly uint _pointerSize = (uint)target.PointerSize;
private readonly bool _updateAllRegs = true;
private readonly bool _unixX86ABI = target.Contracts.RuntimeInfo.GetTargetOperatingSystem() == RuntimeInfoOperatingSystem.Unix;
private readonly bool _unixX86ABI = target.Contracts.RuntimeInfo.GetTargetOperatingSystem() != RuntimeInfoOperatingSystem.Windows;

private static readonly RegMask[] registerOrder =
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,10 @@ int ISOSDacInterface.GetClrWatsonBuckets(ClrDataAddress thread, void* pGenericMo
byte[] buckets = Array.Empty<byte>();
try
{
if (_target.Contracts.RuntimeInfo.GetTargetOperatingSystem() == RuntimeInfoOperatingSystem.Unix)
if (_target.Contracts.RuntimeInfo.GetTargetOperatingSystem() != RuntimeInfoOperatingSystem.Windows)
throw Marshal.GetExceptionForHR(HResults.E_FAIL)!;
else if (thread == 0 || pGenericModeBlock == null)

if (thread == 0 || pGenericModeBlock == null)
throw new ArgumentException();

buckets = threadContract.GetWatsonBuckets(thread.ToTargetPointer(_target));
Expand Down
Loading