Exemple #1
0
 internal MinidumpLoadedImage(Minidump minidump, MinidumpModule module)
 {
     Minidump    = minidump;
     _module     = module;
     _peFile     = new Lazy <PEFile>(CreatePEFile);
     _moduleName = new Lazy <string>(GetModuleName);
 }
Exemple #2
0
        private static void CheckLoadedModulesInternal(Stream stream)
        {
            Minidump minidump = GetMinidumpFromStream(stream);

            var modules = minidump.LoadedImages;

            Assert.True(modules.Count > 0);
        }
Exemple #3
0
 private void CheckNestedPEImagesInternal(Minidump minidump)
 {
     foreach (var loadedImage in minidump.LoadedImages)
     {
         Assert.True(loadedImage.Image.HasValidDosSignature.Check());
         Assert.True(loadedImage.Image.HasValidPESignature.Check());
     }
 }
Exemple #4
0
        private void CheckModuleNamesInternal(Minidump minidump)
        {
            Assert.Single(minidump.LoadedImages.Where(i => i.ModuleName.EndsWith(@"\clr.dll")));

            foreach (var module in minidump.LoadedImages)
            {
                Assert.NotNull(module.ModuleName);
            }
        }
Exemple #5
0
        private void CheckPdbInfoInternal(Minidump minidump, Guid guid)
        {
            PEFile image = minidump.LoadedImages.Where(i => i.ModuleName.EndsWith(@"\clr.dll")).Single().Image;

            foreach (PEPdbRecord pdb in image.Pdbs)
            {
                Assert.NotNull(pdb);
                Assert.Equal(ClrPdb, pdb.Path);
                Assert.Equal(ClrAge, pdb.Age);
                Assert.Equal(guid, pdb.Signature);
            }
        }
Exemple #6
0
        private static void CheckStartupMemoryReadInternal(Stream stream)
        {
            IAddressSpace       sas        = new StreamAddressSpace(stream);
            MaxStreamReadHelper readHelper = new MaxStreamReadHelper(sas);

            Minidump minidump = new Minidump(readHelper);

            // We should have read the header of a minidump, so we cannot have read nothing.
            Assert.True(readHelper.Max > 0);

            // We should only read the header and not too far into the dump file, 1k should be plenty.
            Assert.True(readHelper.Max <= 1024);
        }
Exemple #7
0
        private void CheckMemoryRangesInternal(Minidump minidump)
        {
            ReadOnlyCollection <MinidumpLoadedImage> images = minidump.LoadedImages;
            ReadOnlyCollection <MinidumpSegment>     memory = minidump.Segments;

            // Ensure that all of our images actually correspond to memory in the crash dump.  Note that our minidumps used
            // for this test are all full dumps with all memory (including images) in them.
            foreach (var image in images)
            {
                int count = memory.Where(m => m.VirtualAddress <= image.BaseAddress && image.BaseAddress < m.VirtualAddress + m.Size).Count();
                Assert.Equal(1, count);

                // Check the start of each image for the PE header 'MZ'
                byte[] header = minidump.VirtualAddressReader.Read(image.BaseAddress, 2);
                Assert.Equal((byte)'M', header[0]);
                Assert.Equal((byte)'Z', header[1]);
            }
        }
Exemple #8
0
        public void CheckIsMinidump()
        {
            using (Stream stream = TestUtilities.OpenCompressedFile(x86Dump))
            {
                Assert.True(Minidump.IsValid(new StreamAddressSpace(stream)));
                Assert.False(Minidump.IsValid(new StreamAddressSpace(stream), 1));
            }

            using (Stream stream = TestUtilities.OpenCompressedFile(x64Dump))
            {
                Assert.True(Minidump.IsValid(new StreamAddressSpace(stream)));
                Assert.False(Minidump.IsValid(new StreamAddressSpace(stream), 1));
            }

            // These are GZiped files, they should not be minidumps.
            using (FileStream stream = File.OpenRead(x86Dump))
                Assert.False(Minidump.IsValid(new StreamAddressSpace(stream)));

            using (FileStream stream = File.OpenRead(x64Dump))
                Assert.False(Minidump.IsValid(new StreamAddressSpace(stream)));
        }