Example #1
0
        private static void LoadDump(string absoluteDumpFile)
        {
            try {
                target = DataTarget.LoadCrashDump(absoluteDumpFile, CrashDumpReader.ClrMD);

                // attention: CLRMD needs symbol path to be ";" separated. srv*url1*url2*url3 won't work.

                Console.WriteLine(SYMBOL_PATH);
                if (!string.IsNullOrEmpty(SYMBOL_PATH))
                {
                    target.SymbolLocator.SymbolPath = SYMBOL_PATH;
                }

                context.DumpFile                 = absoluteDumpFile;
                context.DumpDirectory            = Path.GetDirectoryName(absoluteDumpFile);
                context.SymbolLocator            = target.SymbolLocator;
                context.SymbolLocator.SymbolPath = target.SymbolLocator.SymbolPath + ";" + context.DumpDirectory;
                context.SymbolPath               = target.SymbolLocator.SymbolPath + ";" + context.DumpDirectory;
                context.Target = target;
            } catch (InvalidOperationException ex) {
                context.WriteError("wrong architecture");
                context.WriteLine(ex.Message);
                throw;
            } catch (Exception ex) {
                context.WriteError("An exception occured while loading crash dump.");
                context.WriteError(ex.Message);
                context.WriteLine(ex.StackTrace);
                throw;
            }
        }
Example #2
0
        private static void SetupCLRRuntime(DumpContext context)
        {
            // for .NET specific
            try {
                string dac = null;
                context.DacLocation = dac;
                context.Runtime     = context.Target.CreateRuntime(ref dac);
                context.WriteInfo("created runtime with version " + context.Runtime.ClrInfo.Version);
                context.Heap = context.Runtime.Heap;
            } catch (FileNotFoundException ex) {
                context.WriteError("The right dac file could not be found.");
                context.WriteLine(ex.Message);
                context.WriteLine(ex.StackTrace);

                context.Runtime = null;
                //context.Dispose();
                //throw ex;
            } catch (Exception ex) {
                context.WriteError("Exception creating CLR Runtime");
                context.WriteError(ex.Message);
                context.WriteLine(ex.StackTrace);
            }
        }
Example #3
0
        public int Output(DEBUG_OUTPUT mask, string text)
        {
            switch (mask)
            {
            case DEBUG_OUTPUT.ERROR:
                context.WriteError(text.TrimEnd('\n', '\r'));
                break;

            case DEBUG_OUTPUT.EXTENSION_WARNING:
            case DEBUG_OUTPUT.WARNING:
                context.WriteWarning(text.TrimEnd('\n', '\r'));
                break;

            case DEBUG_OUTPUT.SYMBOLS:
                context.WriteInfo(text.TrimEnd('\n', '\r'));
                break;

            default:
                context.WriteLine(text);
                break;
            }

            return(0);
        }