Example #1
0
        private void CreateClient(IDebugClient client)
        {
            DebuggerInterface = client;

            _spaces    = (IDebugDataSpaces)DebuggerInterface;
            _spacesPtr = (IDebugDataSpacesPtr)DebuggerInterface;
            _symbols   = (IDebugSymbols)DebuggerInterface;
            _control   = (IDebugControl2)DebuggerInterface;

            // These interfaces may not be present in older DbgEng dlls.
            _spaces2        = DebuggerInterface as IDebugDataSpaces2;
            _symbols3       = DebuggerInterface as IDebugSymbols3;
            _advanced       = DebuggerInterface as IDebugAdvanced;
            _systemObjects  = DebuggerInterface as IDebugSystemObjects;
            _systemObjects3 = DebuggerInterface as IDebugSystemObjects3;

            Interlocked.Increment(ref s_totalInstanceCount);

            if (_systemObjects3 == null && s_totalInstanceCount > 1)
            {
                throw new ClrDiagnosticsException("This version of DbgEng is too old to create multiple instances of DataTarget.", ClrDiagnosticsExceptionKind.DebuggerError);
            }

            if (_systemObjects3 != null)
            {
                _systemObjects3.GetCurrentSystemId(out _instance);
            }
        }
Example #2
0
        private void CreateClient(IDebugClient client)
        {
            _client = client;

            _spaces = (IDebugDataSpaces)_client;
            _spacesPtr = (IDebugDataSpacesPtr)_client;
            _symbols = (IDebugSymbols)_client;
            _control = (IDebugControl2)_client;

            // These interfaces may not be present in older DbgEng dlls.
            _spaces2 = _client as IDebugDataSpaces2;
            _symbols3 = _client as IDebugSymbols3;
            _advanced = _client as IDebugAdvanced;
            _systemObjects = _client as IDebugSystemObjects;
            _systemObjects3 = _client as IDebugSystemObjects3;

            Interlocked.Increment(ref s_totalInstanceCount);

            if (_systemObjects3 == null && s_totalInstanceCount > 1)
                throw new ClrDiagnosticsException("This version of DbgEng is too old to create multiple instances of DataTarget.", ClrDiagnosticsException.HR.DebuggerError);

            if (_systemObjects3 != null)
                _systemObjects3.GetCurrentSystemId(out _instance);
        }
Example #3
0
        public override bool Generate(CommandExecutionContext context)
        {
            _title = Path.GetFileName(context.DumpFile);
            switch (context.TargetType)
            {
            case TargetType.DumpFile:
                DumpType = "Full memory dump with heap";
                break;

            case TargetType.DumpFileNoHeap:
                DumpType = "Mini dump with no heap";
                break;

            default:
                DumpType = "Unsupported dump file type";
                break;
            }
            var target = context.NativeDbgEngTarget;
            IDebugSystemObjects2 sysObjects = (IDebugSystemObjects2)target.DebuggerInterface;
            IDebugControl2       control    = (IDebugControl2)target.DebuggerInterface;

            uint          dummy;
            StringBuilder exeName = new StringBuilder(2048);

            if (HR.Succeeded(sysObjects.GetCurrentProcessExecutableName(exeName, exeName.Capacity, out dummy)))
            {
                ExecutableName = exeName.ToString();
            }

            uint uptime;

            if (HR.Succeeded(sysObjects.GetCurrentProcessUpTime(out uptime)))
            {
                ProcessUpTimeInSeconds = uptime;
            }

            if (HR.Succeeded(control.GetCurrentSystemUpTime(out uptime)))
            {
                SystemUpTimeInSeconds = uptime;
            }

            uint time;

            if (HR.Succeeded(control.GetCurrentTimeDate(out time)))
            {
                SessionTime = DateTimeOffset.FromUnixTimeSeconds(time);
            }

            uint num;

            if (HR.Succeeded(control.GetNumberProcessors(out num)))
            {
                NumberOfProcessors = num;
            }

            uint          platformId, major, minor, servicePackNumber;
            StringBuilder servicePack = new StringBuilder(1048);
            StringBuilder build       = new StringBuilder(1048);

            if (HR.Succeeded(control.GetSystemVersion(out platformId, out major, out minor, servicePack, servicePack.Capacity, out dummy, out servicePackNumber, build, build.Capacity, out dummy)))
            {
                WindowsBuildNumber       = minor;
                WindowsServicePack       = servicePack.ToString();
                WindowsServicePackNumber = servicePackNumber;
                WindowsBuild             = build.ToString();
            }

            ClrVersions.AddRange(context.Runtime.DataTarget.ClrVersions.Select(v => v.Version.ToString()));

            if (context.Runtime.DataTarget.ClrVersions.Any(v => v.Version.Minor == 2))
            {
                Recommendations.Add(new CLRV2Detected());
            }

            return(true);
        }