Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Merge pull request #4079 from dotnet-bot/from-tfs
Browse files Browse the repository at this point in the history
Merge changes from TFS
  • Loading branch information
MichalStrehovsky authored Jul 5, 2017
2 parents cfd83ef + dc5855e commit e70f54b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Native/Runtime/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum FuncEvalMode : uint32_t
RegularFuncEval = 1,
NewStringWithLength = 2,
NewArray = 3,
NewParameterizedObjectNoConstructor = 4,
};

enum DebuggerGcProtectionRequestKind : uint16_t
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ private unsafe static void HighLevelDebugFuncEvalHelper()
case FuncEvalMode.NewArray:
CreateNewArray(parameterBuffer, parameterBufferSize);
break;
case FuncEvalMode.NewParameterizedObjectNoConstructor:
NewParameterizedObjectNoConstructor(parameterBuffer, parameterBufferSize);
break;

default:
Debug.Assert(false, "Debugger provided an unexpected func eval mode.");
Expand Down Expand Up @@ -223,6 +226,33 @@ private unsafe static void RegularFuncEval(byte* parameterBuffer, uint parameter
LocalVariableSet.SetupArbitraryLocalVariableSet<TypesAndValues>(HighLevelDebugFuncEvalHelperWithVariables, ref typesAndValues, argumentTypes);
}

private unsafe static void NewParameterizedObjectNoConstructor(byte* parameterBuffer, uint parameterBufferSize)
{
uint offset = 0;
NativeReader reader = new NativeReader(parameterBuffer, parameterBufferSize);
ulong[] debuggerPreparedExternalReferences;
offset = BuildDebuggerPreparedExternalReferences(reader, offset, out debuggerPreparedExternalReferences);

NativeLayoutInfoLoadContext nativeLayoutContext = new NativeLayoutInfoLoadContext();
TypeSystemContext typeSystemContext = TypeSystemContextFactory.Create();
nativeLayoutContext._module = null;
nativeLayoutContext._typeSystemContext = typeSystemContext;
nativeLayoutContext._typeArgumentHandles = Instantiation.Empty;
nativeLayoutContext._methodArgumentHandles = Instantiation.Empty;
nativeLayoutContext._debuggerPreparedExternalReferences = debuggerPreparedExternalReferences;

NativeParser parser = new NativeParser(reader, offset);
TypeDesc objectTypeDesc = TypeLoaderEnvironment.Instance.GetConstructedTypeFromParserAndNativeLayoutContext(ref parser, nativeLayoutContext);

RuntimeTypeHandle objectTypeHandle = objectTypeDesc.GetRuntimeTypeHandle();
object returnValue = RuntimeAugments.NewObject(objectTypeHandle);

GCHandle returnValueHandle = GCHandle.Alloc(returnValue);
IntPtr returnValueHandlePointer = GCHandle.ToIntPtr(returnValueHandle);
uint returnHandleIdentifier = RuntimeAugments.RhpRecordDebuggeeInitiatedHandle(returnValueHandlePointer);
ReturnToDebuggerWithReturn(returnHandleIdentifier, returnValueHandlePointer, false);
}

private unsafe static void CreateNewArray(byte* parameterBuffer, uint parameterBufferSize)
{
uint offset = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ internal enum FuncEvalMode : uint
RegularFuncEval = 1,
NewStringWithLength = 2,
NewArray = 3,
NewParameterizedObjectNoConstructor = 4,
}

internal enum DebuggerResponseKind : uint
Expand Down

0 comments on commit e70f54b

Please sign in to comment.