コード例 #1
0
        private ImportedModule ImportModule(DkmClrModuleInstance debuggerModule)
        {
            IntPtr metadataBlock;
            uint   blockSize;

            try
            {
                metadataBlock = debuggerModule.GetMetaDataBytesPtr(out blockSize);
                return(Session.Importer.ImportModule(metadataBlock, blockSize));
            }
            catch (DkmException)
            {
                // This can fail when dump debugging if the full heap is not available
                return(null);
            }
        }
コード例 #2
0
 /// <summary>
 /// Attempt to construct a <see cref="MetadataReader"/> instance for this module.
 /// </summary>
 /// <returns>Returns 'false' for modules with "bad" or missing metadata.</returns>
 private unsafe static bool TryGetMetadataReader(this DkmClrModuleInstance module, out IntPtr ptr, out int size, out MetadataReader reader)
 {
     try
     {
         uint uSize;
         ptr    = module.GetMetaDataBytesPtr(out uSize);
         size   = (int)uSize;
         reader = new MetadataReader((byte *)ptr, size);
         return(true);
     }
     catch (Exception e) when(MetadataUtilities.IsBadOrMissingMetadataException(e, module.FullName))
     {
         ptr    = IntPtr.Zero;
         size   = 0;
         reader = null;
         return(false);
     }
 }