Exemplo n.º 1
0
 int GetContextStackTrace(
     IntPtr self,
     IntPtr startContext,
     uint startContextSize,
     DEBUG_STACK_FRAME[] frames,
     uint framesSize,
     IntPtr frameContexts,
     uint frameContextsSize,
     uint frameContextsEntrySize,
     uint *framesFilled)
 {
     // Don't fail, but always return 0 native frames so "clrstack -f" still prints the managed frames
     SOSHost.Write(framesFilled);
     return(HResult.S_OK);
 }
Exemplo n.º 2
0
 private HResult WriteVirtual(
     IntPtr self,
     ulong address,
     IntPtr buffer,
     uint bytesRequested,
     uint *bytesWritten)
 {
     address &= _ignoreAddressBitsMask;
     if (!_memoryService.WriteMemory(address, new Span <byte>(buffer.ToPointer(), unchecked ((int)bytesRequested)), out int written))
     {
         SOSHost.Write(bytesWritten);
         return(HResult.E_FAIL);
     }
     SOSHost.Write(bytesWritten, (uint)written);
     return(HResult.S_OK);
 }
Exemplo n.º 3
0
 private unsafe int ReadVirtual(
     IntPtr self,
     ulong address,
     IntPtr buffer,
     uint bytesRequested,
     uint *pbytesRead)
 {
     address &= _ignoreAddressBitsMask;
     if (!_memoryService.ReadMemory(address, buffer, unchecked ((int)bytesRequested), out int bytesRead))
     {
         Trace.TraceError("CorDebugDataTargetWrappter.ReadVirtual FAILED address {0:X16} size {1:X8}", address, bytesRequested);
         return(HResult.E_FAIL);
     }
     SOSHost.Write(pbytesRead, (uint)bytesRead);
     return(HResult.S_OK);
 }
Exemplo n.º 4
0
 private HResult ReadVirtual(
     IntPtr self,
     ulong address,
     IntPtr buffer,
     uint bytesRequested,
     uint *bytesRead)
 {
     Debug.Assert(address != MagicCallbackConstant);
     address &= _ignoreAddressBitsMask;
     if (!_memoryService.ReadMemory(address, buffer, unchecked ((int)bytesRequested), out int read))
     {
         Trace.TraceError("DataTargetWrapper.ReadVirtual FAILED address {0:X16} size {1:X8}", address, bytesRequested);
         SOSHost.Write(bytesRead);
         return(HResult.E_FAIL);
     }
     SOSHost.Write(bytesRead, (uint)read);
     return(HResult.S_OK);
 }
Exemplo n.º 5
0
 unsafe int GetModuleInfo(
     IntPtr self,
     uint index,
     ulong *moduleBase,
     ulong *moduleSize)
 {
     try
     {
         IModule module = _soshost.ModuleService.GetModuleFromIndex((int)index);
         SOSHost.Write(moduleBase, module.ImageBase);
         SOSHost.Write(moduleSize, module.ImageSize);
     }
     catch (DiagnosticsException)
     {
         return(HResult.E_FAIL);
     }
     return(HResult.S_OK);
 }
Exemplo n.º 6
0
 private HResult AllocVirtual(
     IntPtr self,
     ulong address,
     uint size,
     uint typeFlags,
     uint protectFlags,
     ulong *buffer)
 {
     if (_remoteMemoryService == null)
     {
         return(HResult.E_NOTIMPL);
     }
     if (!_remoteMemoryService.AllocateMemory(address, size, typeFlags, protectFlags, out ulong remoteAddress))
     {
         return(HResult.E_FAIL);
     }
     SOSHost.Write(buffer, remoteAddress);
     return(HResult.S_OK);
 }
Exemplo n.º 7
0
 unsafe int GetModuleInfo(
     IntPtr self,
     uint index,
     ulong *moduleBase,
     ulong *moduleSize,
     uint *timestamp,
     uint *checksum)
 {
     try
     {
         IModule module = _soshost.ModuleService.GetModuleFromIndex((int)index);
         SOSHost.Write(moduleBase, module.ImageBase);
         SOSHost.Write(moduleSize, module.ImageSize);
         SOSHost.Write(timestamp, module.IndexTimeStamp.GetValueOrDefault(SOSHost.InvalidTimeStamp));
         SOSHost.Write(checksum, SOSHost.InvalidChecksum);
     }
     catch (DiagnosticsException)
     {
         return(HResult.E_FAIL);
     }
     return(HResult.S_OK);
 }