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
1 change: 1 addition & 0 deletions eng/pipelines/runtime-diagnostics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ parameters:
- linux_x64
- windows_arm64
- linux_arm64
- linux_arm

resources:
repositories:
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/vm/datadescriptor/datadescriptor.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ CDAC_TYPE_END(Frame)
CDAC_TYPE_BEGIN(InlinedCallFrame)
CDAC_TYPE_SIZE(sizeof(InlinedCallFrame))
CDAC_TYPE_FIELD(InlinedCallFrame, T_POINTER, CallSiteSP, offsetof(InlinedCallFrame, m_pCallSiteSP))
CDAC_TYPE_FIELD(InlinedCallFrame, T_POINTER, CallerReturnAddress, offsetof(InlinedCallFrame, m_pCallerReturnAddress))
CDAC_TYPE_FIELD(InlinedCallFrame, TYPE(CodePointer), CallerReturnAddress, offsetof(InlinedCallFrame, m_pCallerReturnAddress))
CDAC_TYPE_FIELD(InlinedCallFrame, T_POINTER, CalleeSavedFP, offsetof(InlinedCallFrame, m_pCalleeSavedFP))
CDAC_TYPE_FIELD(InlinedCallFrame, T_POINTER, Datum, offsetof(InlinedCallFrame, m_Datum))
#ifdef TARGET_ARM
Expand All @@ -1131,7 +1131,7 @@ CDAC_TYPE_END(InlinedCallFrame)
CDAC_TYPE_BEGIN(SoftwareExceptionFrame)
CDAC_TYPE_SIZE(sizeof(SoftwareExceptionFrame))
CDAC_TYPE_FIELD(SoftwareExceptionFrame, EXTERN_TYPE(Context), TargetContext, cdac_data<SoftwareExceptionFrame>::TargetContext)
CDAC_TYPE_FIELD(SoftwareExceptionFrame, T_POINTER, ReturnAddress, cdac_data<SoftwareExceptionFrame>::ReturnAddress)
CDAC_TYPE_FIELD(SoftwareExceptionFrame, TYPE(CodePointer), ReturnAddress, cdac_data<SoftwareExceptionFrame>::ReturnAddress)
CDAC_TYPE_END(SoftwareExceptionFrame)

CDAC_TYPE_BEGIN(FramedMethodFrame)
Expand All @@ -1150,7 +1150,7 @@ CDAC_TYPE_END(InterpreterFrame)

CDAC_TYPE_BEGIN(TransitionBlock)
CDAC_TYPE_SIZE(sizeof(TransitionBlock))
CDAC_TYPE_FIELD(TransitionBlock, T_POINTER, ReturnAddress, offsetof(TransitionBlock, m_ReturnAddress))
CDAC_TYPE_FIELD(TransitionBlock, TYPE(CodePointer), ReturnAddress, offsetof(TransitionBlock, m_ReturnAddress))
CDAC_TYPE_FIELD(TransitionBlock, TYPE(CalleeSavedRegisters), CalleeSavedRegisters, offsetof(TransitionBlock, m_calleeSavedRegisters))
// Offset to where stack arguments begin (just past the end of the TransitionBlock)
CDAC_TYPE_FIELD(TransitionBlock, T_UINT32, OffsetOfArgs, sizeof(TransitionBlock))
Expand Down Expand Up @@ -1208,7 +1208,7 @@ CDAC_TYPE_END(ResumableFrame)

CDAC_TYPE_BEGIN(HijackFrame)
CDAC_TYPE_SIZE(sizeof(HijackFrame))
CDAC_TYPE_FIELD(HijackFrame, T_POINTER, ReturnAddress, cdac_data<HijackFrame>::ReturnAddress)
CDAC_TYPE_FIELD(HijackFrame, TYPE(CodePointer), ReturnAddress, cdac_data<HijackFrame>::ReturnAddress)
CDAC_TYPE_FIELD(HijackFrame, T_POINTER, HijackArgsPtr, cdac_data<HijackFrame>::HijackArgsPtr)
CDAC_TYPE_END(HijackFrame)

Expand Down Expand Up @@ -1312,7 +1312,7 @@ CDAC_TYPE_END(FaultingExceptionFrame)
CDAC_TYPE_BEGIN(TailCallFrame)
CDAC_TYPE_SIZE(sizeof(TailCallFrame))
CDAC_TYPE_FIELD(TailCallFrame, TYPE(CalleeSavedRegisters), CalleeSavedRegisters, cdac_data<TailCallFrame>::CalleeSavedRegisters)
CDAC_TYPE_FIELD(TailCallFrame, T_POINTER, ReturnAddress, cdac_data<TailCallFrame>::ReturnAddress)
CDAC_TYPE_FIELD(TailCallFrame, TYPE(CodePointer), ReturnAddress, cdac_data<TailCallFrame>::ReturnAddress)
CDAC_TYPE_END(TailCallFrame)
#endif // TARGET_X86 && !UNIX_X86_ABI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public interface IStackWalk : IContract
string GetFrameName(TargetPointer frameIdentifier) => throw new NotImplementedException();
TargetPointer GetMethodDescPtr(TargetPointer framePtr) => throw new NotImplementedException();
TargetPointer GetMethodDescPtr(IStackDataFrameHandle stackDataFrameHandle) => throw new NotImplementedException();
TargetPointer GetInstructionPointer(IStackDataFrameHandle stackDataFrameHandle) => throw new NotImplementedException();
TargetCodePointer GetInstructionPointer(IStackDataFrameHandle stackDataFrameHandle) => throw new NotImplementedException();
IEnumerable<StackFrameData> GetFrames(TargetPointer threadPointer) => throw new NotImplementedException();
Comment thread
max-charlamb marked this conversation as resolved.
bool IsExceptionHandlingHelperInlinedCallFrame(TargetPointer frameAddress) => throw new NotImplementedException();
DebuggerEvalData GetDebuggerEvalData(TargetPointer funcEvalFrameAddress) => throw new NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public bool Unwind(ref AMD64Context context)
Data.RuntimeFunction? primaryFunctionEntry;
UnwindCode unwindOp;

if (_eman.GetCodeBlockHandle(context.InstructionPointer.Value) is not CodeBlockHandle cbh)
if (_eman.GetCodeBlockHandle(context.InstructionPointer) is not CodeBlockHandle cbh)
return false;

TargetPointer controlPC = context.InstructionPointer;
TargetPointer controlPC = context.InstructionPointer.AsTargetPointer;

TargetPointer imageBase = _eman.GetUnwindInfoBaseAddress(cbh);
TargetPointer unwindInfoAddr = _eman.GetUnwindInfo(cbh);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public TargetPointer StackPointer
readonly get => new(Rsp);
set => Rsp = value.Value;
}
public TargetPointer InstructionPointer
public TargetCodePointer InstructionPointer
{
readonly get => new(Rip);
set => Rip = value.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal class ARMUnwinder(Target target)

public bool Unwind(ref ARMContext context)
{
if (_eman.GetCodeBlockHandle(context.InstructionPointer.Value) is not CodeBlockHandle cbh)
if (_eman.GetCodeBlockHandle(context.InstructionPointer) is not CodeBlockHandle cbh)
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ internal class ARM64Unwinder(Target target)

public bool Unwind(ref ARM64Context context)
{
if (_eman.GetCodeBlockHandle(context.InstructionPointer.Value) is not CodeBlockHandle cbh)
if (_eman.GetCodeBlockHandle(context.InstructionPointer) is not CodeBlockHandle cbh)
return false;

TargetPointer imageBase = _eman.GetUnwindInfoBaseAddress(cbh);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public TargetPointer StackPointer
readonly get => new(Sp);
set => Sp = value.Value;
}
public TargetPointer InstructionPointer
public TargetCodePointer InstructionPointer
{
readonly get => new(Pc);
set => Pc = value.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public TargetPointer StackPointer
set => Sp = (uint)value.Value;
}

public TargetPointer InstructionPointer
public TargetCodePointer InstructionPointer
{
readonly get => new(Pc);
set => Pc = (uint)value.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public sealed class ContextHolder<T> : IPlatformAgnosticContext, IEquatable<Cont
public int StackPointerRegister => Context.StackPointerRegister;

public TargetPointer StackPointer { get => Context.StackPointer; set => Context.StackPointer = value; }
public TargetPointer InstructionPointer { get => Context.InstructionPointer; set => Context.InstructionPointer = value; }
public TargetCodePointer InstructionPointer { get => Context.InstructionPointer; set => Context.InstructionPointer = value; }
public TargetPointer FramePointer { get => Context.FramePointer; set => Context.FramePointer = value; }

public uint RawContextFlags { get => Context.RawContextFlags; set => Context.RawContextFlags = value; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public interface IPlatformAgnosticContext
public int StackPointerRegister { get; }

public TargetPointer StackPointer { get; set; }
public TargetPointer InstructionPointer { get; set; }
public TargetCodePointer InstructionPointer { get; set; }
public TargetPointer FramePointer { get; set; }

public uint RawContextFlags { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface IPlatformContext
int StackPointerRegister { get; }

TargetPointer StackPointer { get; set; }
TargetPointer InstructionPointer { get; set; }
TargetCodePointer InstructionPointer { get; set; }
TargetPointer FramePointer { get; set; }

uint RawContextFlags { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal class LoongArch64Unwinder(Target target)

public bool Unwind(ref LoongArch64Context context)
{
if (_eman.GetCodeBlockHandle(context.InstructionPointer.Value) is not CodeBlockHandle cbh)
if (_eman.GetCodeBlockHandle(context.InstructionPointer) is not CodeBlockHandle cbh)
return false;

TargetPointer imageBase = _eman.GetUnwindInfoBaseAddress(cbh);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public TargetPointer StackPointer
readonly get => new(Sp);
set => Sp = value.Value;
}
public TargetPointer InstructionPointer
public TargetCodePointer InstructionPointer
{
readonly get => new(Pc);
set => Pc = value.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ internal class RISCV64Unwinder(Target target)

public bool Unwind(ref RISCV64Context context)
{
if (_eman.GetCodeBlockHandle(context.InstructionPointer.Value) is not CodeBlockHandle cbh)
if (_eman.GetCodeBlockHandle(context.InstructionPointer) is not CodeBlockHandle cbh)
return false;

TargetPointer imageBase = _eman.GetUnwindInfoBaseAddress(cbh);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public TargetPointer StackPointer
readonly get => new(Sp);
set => Sp = value.Value;
}
public TargetPointer InstructionPointer
public TargetCodePointer InstructionPointer
{
readonly get => new(Pc);
set => Pc = value.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public bool Unwind(ref X86Context context)
{
IExecutionManager eman = _target.Contracts.ExecutionManager;

if (eman.GetCodeBlockHandle(context.InstructionPointer.Value) is not CodeBlockHandle cbh)
if (eman.GetCodeBlockHandle(context.InstructionPointer) is not CodeBlockHandle cbh)
{
throw new InvalidOperationException("Unwind failed, unable to find code block for the instruction pointer.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public TargetPointer StackPointer
readonly get => new(Esp);
set => Esp = (uint)value.Value;
}
public TargetPointer InstructionPointer
public TargetCodePointer InstructionPointer
{
readonly get => new(Eip);
set => Eip = (uint)value.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,18 @@ public void UpdateContextFromFrame(Data.Frame frame, IPlatformAgnosticContext co

/// <summary>
/// Returns the return address for <paramref name="frame"/>, matching native Frame::GetReturnAddress().
/// Returns TargetPointer.Null if the Frame has no return address (e.g., non-active ICF,
/// Returns TargetCodePointer.Null if the Frame has no return address (e.g., non-active ICF,
/// base Frame types, FuncEvalFrame during exception eval).
/// </summary>
public TargetPointer GetReturnAddress(Data.Frame frame)
public TargetCodePointer GetReturnAddress(Data.Frame frame)
{
FrameType frameType = GetFrameType(frame.Identifier);
switch (frameType)
{
// InlinedCallFrame: returns 0 if inactive, else m_pCallerReturnAddress
case FrameType.InlinedCallFrame:
Data.InlinedCallFrame icf = _target.ProcessedData.GetOrAdd<Data.InlinedCallFrame>(frame.Address);
return InlinedCallFrameHasActiveCall(icf) ? icf.CallerReturnAddress : TargetPointer.Null;
return InlinedCallFrameHasActiveCall(icf) ? icf.CallerReturnAddress : TargetCodePointer.Null;

Comment thread
max-charlamb marked this conversation as resolved.
Comment thread
max-charlamb marked this conversation as resolved.
// TransitionFrame types: read return address from the transition block
case FrameType.FramedMethodFrame:
Expand Down Expand Up @@ -275,14 +275,14 @@ public TargetPointer GetReturnAddress(Data.Frame frame)
Data.FuncEvalFrame funcEval = _target.ProcessedData.GetOrAdd<Data.FuncEvalFrame>(frame.Address);
Data.DebuggerEval dbgEval = _target.ProcessedData.GetOrAdd<Data.DebuggerEval>(funcEval.DebuggerEvalPtr);
if (dbgEval.EvalUsesHijack)
return TargetPointer.Null;
return TargetCodePointer.Null;
Data.FramedMethodFrame funcEvalFmf = _target.ProcessedData.GetOrAdd<Data.FramedMethodFrame>(frame.Address);
Data.TransitionBlock funcEvalTb = _target.ProcessedData.GetOrAdd<Data.TransitionBlock>(funcEvalFmf.TransitionBlockPtr);
return funcEvalTb.ReturnAddress;

// Base Frame and unknown types: return 0 (matches native Frame::GetReturnAddressPtr_Impl)
default:
return TargetPointer.Null;
return TargetCodePointer.Null;
}
}

Expand Down Expand Up @@ -375,7 +375,7 @@ private IPlatformFrameHandler GetFrameHandler(IPlatformAgnosticContext context)

private static bool InlinedCallFrameHasActiveCall(Data.InlinedCallFrame frame)
{
return frame.CallerReturnAddress != TargetPointer.Null;
return frame.CallerReturnAddress != TargetCodePointer.Null;
}

private bool InlinedCallFrameHasFunction(Data.InlinedCallFrame frame)
Expand Down Expand Up @@ -467,7 +467,7 @@ public void SetContextToInterpMethodContextFrame(
return;

Data.InterpMethodContextFrame topContextFrame = _target.ProcessedData.GetOrAdd<Data.InterpMethodContextFrame>(topContextFramePtr);
context.InstructionPointer = new TargetPointer((ulong)topContextFrame.Ip);
context.InstructionPointer = new TargetCodePointer((ulong)topContextFrame.Ip);
context.StackPointer = topContextFramePtr;
context.FramePointer = topContextFrame.Stack;
SetFirstArgRegister(context, interpreterFrame.Address);
Expand Down Expand Up @@ -516,7 +516,7 @@ private bool VirtualUnwindInterpreterCallFrame(IPlatformAgnosticContext context)
if (parentFrame.Ip == TargetPointer.Null)
return false;

context.InstructionPointer = new TargetPointer((ulong)parentFrame.Ip);
context.InstructionPointer = new TargetCodePointer((ulong)parentFrame.Ip);
context.StackPointer = currentFrame.ParentPtr;
context.FramePointer = parentFrame.Stack;
context.RawContextFlags = context.FullContextFlags;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public FrameType GetCurrentFrameType()
/// <summary>
/// Returns the return address of the current frame, matching native Frame::GetReturnAddress().
/// </summary>
public TargetPointer GetCurrentReturnAddress()
public TargetCodePointer GetCurrentReturnAddress()
=> frameHelpers.GetReturnAddress(CurrentFrame);

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal class GcScanContext
public bool ResolveInteriorPointers { get; }
public List<StackRefData> StackRefs { get; } = [];
public TargetPointer StackPointer { get; private set; }
public TargetPointer InstructionPointer { get; private set; }
public TargetCodePointer InstructionPointer { get; private set; }
public TargetPointer Frame { get; private set; }

// When set, overrides the default IP/Frame source-type classification for reported roots.
Expand All @@ -27,7 +27,7 @@ public GcScanContext(Target target, bool resolveInteriorPointers)
ResolveInteriorPointers = resolveInteriorPointers;
}

public void UpdateScanContext(TargetPointer sp, TargetPointer ip, TargetPointer frame, StackRefData.SourceTypes? sourceTypeOverride = null)
public void UpdateScanContext(TargetPointer sp, TargetCodePointer ip, TargetPointer frame, StackRefData.SourceTypes? sourceTypeOverride = null)
{
StackPointer = sp;
InstructionPointer = ip;
Expand All @@ -50,7 +50,7 @@ private void SetSource(StackRefData data)
else
{
data.SourceType = StackRefData.SourceTypes.StackSourceIP;
data.Source = InstructionPointer;
data.Source = CodePointerUtils.AddressFromCodePointer(InstructionPointer, _target);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private TargetPointer FindParentStackFrameHelper(
// Check for out-of-line finally funclets. Filter funclets can't be out-of-line.
if (!isFilterFunclet)
{
TargetPointer callerIp = callerContext.InstructionPointer;
TargetCodePointer callerIp = callerContext.InstructionPointer;

// In the runtime, on Windows, we check with that the IP is in the runtime
// TODO(stackref): make sure this difference doesn't matter
Expand Down
Loading