예제 #1
0
        protected override CLRTypeDebugInfo CreateDebugInfo(CorDebugStartDebuggingOptions options)
        {
            var    dncOptions = (DotNetCoreStartDebuggingOptions)options;
            string?hostFilename;

            if (!dncOptions.UseHost)
            {
                hostFilename = null;
            }
            else if (string.IsNullOrWhiteSpace(dncOptions.Host))
            {
                hostFilename = DotNetCoreHelpers.GetPathToDotNetExeHost(Bitness);
                if (!File.Exists(hostFilename))
                {
                    throw new Exception(string.Format(dnSpy_Debugger_DotNet_CorDebug_Resources.Error_CouldNotFindDotNetCoreHost, DotNetCoreHelpers.DotNetExeName));
                }
            }
            else
            {
                hostFilename = dncOptions.Host;
            }
            var hostCommandLine = dncOptions.HostArguments ?? string.Empty;

            return(new CoreCLRTypeDebugInfo(GetDbgShimAndVerify(), hostFilename, hostCommandLine));
        }
예제 #2
0
        string GetDbgShimAndVerify()
        {
            var dbgShimFilename = DotNetCoreHelpers.GetDebugShimFilename(Bitness);

            if (!File.Exists(dbgShimFilename))
            {
                throw new Exception("Couldn't find dbgshim.dll: " + dbgShimFilename);
            }
            return(dbgShimFilename);
        }
        IEnumerable <DotNetCoreAttachProgramOptions> TryGetCoreCLRInfos(Process process, string coreclrFilename)
        {
            // We can only debug processes with the same bitness
            int bitness         = IntPtr.Size * 8;
            var dbgShimFilename = DotNetCoreHelpers.GetDebugShimFilename(bitness);

            foreach (var ccInfo in CoreCLRHelper.GetCoreCLRInfos(process.Id, coreclrFilename, dbgShimFilename))
            {
                yield return(new DotNetCoreAttachProgramOptions(process.Id, ccInfo.CoreCLRTypeInfo.Version, ccInfo.CoreCLRTypeInfo.CoreCLRFilename));
            }
        }
        public override bool IsSupported(string filename, out ProcessStarterResult result)
        {
            result = ProcessStarterResult.None;

            if (!DotNetCoreHelpers.IsDotNetCoreExecutable(filename) || GetPathToDotNetExeHost() == null)
            {
                return(false);
            }

            var extension = Path.GetExtension(filename);

            if (!StringComparer.OrdinalIgnoreCase.Equals(extension, ".exe") && !StringComparer.OrdinalIgnoreCase.Equals(extension, ".dll"))
            {
                result |= ProcessStarterResult.WrongExtension;
            }
            return(true);
        }
 string GetPathToDotNetExeHost() => DotNetCoreHelpers.GetPathToDotNetExeHost(IntPtr.Size * 8);
예제 #6
0
 public override bool IsSupported(string filename) =>
 DotNetCoreHelpers.IsDotNetCoreExecutable(filename) &&
 GetPathToDotNetExeHost() != null;