protected AbstractSession(SDBDeviceInfo device, TSessionConfiguration sessionConfiguration) { _selectedDevice = device; var cap = new SDBCapability(_selectedDevice); _tizenVersion = cap.GetValueByKey("platform_version"); if (!ProfilerPlugin.IsTizenVersionSupported(_tizenVersion, false)) { throw new Exception($"Target platform version {_tizenVersion} is not supported"); } _sdkToolPath = cap.GetValueByKey("sdk_toolpath"); _isSecureProtocol = cap.GetAvailabilityByKey("secure_protocol"); _sessionConfiguration = sessionConfiguration; ProjectDirectory = _sessionConfiguration.ProjectHostPath; DeviceName = _selectedDevice.Name; _asyncErrorTask = Task.Run(() => { try { _asyncErrorEvent.WaitOne(); } catch (Exception ex) { Debug.WriteLine(ex.Message); } DisposeHelper.SafeDispose(ref _asyncErrorEvent); }); }
private string GetVersionFileMask() { string toolPath = sdbCapability.GetValueByKey("sdk_toolpath"); return((pkgName == LLDBPACKAGE) ? $"{toolPath}/lldb/bin/lldb-server-*" : $"{toolPath}/{pkgName}/version-*"); }
private string GetTargetArch() { SDBCapability cap = new SDBCapability(); string arch = cap.GetValueByKey("cpu_arch"); return(arch); }
protected virtual string GetLldbDestPath() { SDBCapability cap = new SDBCapability(); string lldbPath = cap.GetValueByKey("sdk_toolpath") + @"/on-demand/" + GetLldbPkgName(); return(lldbPath); }
protected override string GetLldbDestPath() { SDBCapability cap = new SDBCapability(); string lldbPath = cap.GetValueByKey("sdk_toolpath") + @"/on-demand/lldb.tar.gz"; return(lldbPath); }
protected override Parameters GetDebugEngineLaunchParameters() { string launchPadArguments = string.Empty; var cap = new SDBCapability(_device); string pluginVersion = cap.GetValueByKey("sdbd_plugin_version"); string[] version = pluginVersion.Split('.'); if (version.Length == 3) { int major = Int32.Parse(version[0]); int minor = Int32.Parse(version[1]); if ((major < 3) || (major == 3 && minor <= 5)) { launchPadArguments = " __DLP_DEBUG_ARG__ --server=4711,-- "; } else { launchPadArguments = "0"; } } return(new Parameters( pipePath: Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), "NetCat.exe"), pipeArguments: String.Format("127.0.0.1 4712"), miMode: "clrdbg", additionalOptions: "<CustomLaunchSetupCommands/>" + // empty because we pass launch command through arguments "<LaunchCompleteCommand>exec-run</LaunchCompleteCommand>", launchCommand: "0 vs_sdklaunch NETCOREDBG", launchpadArgs: launchPadArguments )); }
private bool TargetHasTizenDotNET(SDBDeviceInfo device, out string lastErrorMessage) { bool isDotnetSupported = false; try { var cap = new SDBCapability(device); isDotnetSupported = DeployHelper.IsTizenVersionSupported(cap.GetValueByKey("platform_version")); } catch { } lastErrorMessage = isDotnetSupported ? string.Empty : "Failed to identify the .NET support on current platform version. Tizen .NET is supported on Tizen 4.0 or higher."; return(isDotnetSupported); }
// Older emulator images do not support __AUL_SDK__ LLDB-MI: //protected virtual string GetLldbArguments() => " -s " + DeviceManager.SelectedDevice.Serial + " shell sh -c '" + DebugLaunchDataStore.LldbMi + "'"; private string GetTargetArch() { var cap = new SDBCapability(_device); string arch = cap.GetValueByKey("cpu_arch"); switch (arch) { case "x86": return("X86"); case "x86_64": return("X64"); default: return("arm"); } }
/// <summary> /// Install packages on the target. /// </summary> /// <param name="packageNames">E.g. "profctl", "heaptrack", "coreprofiler".</param> /// <returns>True iff installed successfully</returns> public bool Install(params string[] packageNames) { if ((packageNames == null) || (packageNames.Length == 0)) { throw new ArgumentException(nameof(packageNames)); } ErrorMessage = ""; var cap = new SDBCapability(_device); string tizenVersion = cap.GetValueByKey("platform_version"); if (!DeployHelper.IsTizenVersionSupported(tizenVersion)) { ErrorMessage = $"The target system platform version {tizenVersion} is not supported"; return(false); } _sdkOnDemandFolder = ToolsPathInfo.GetOnDemandFolderPath(tizenVersion); if (string.IsNullOrEmpty(_sdkOnDemandFolder)) { ErrorMessage = $"Can not find the folder with target packages for version \"{tizenVersion}\""; return(false); } if (!Directory.Exists(_sdkOnDemandFolder)) { ErrorMessage = $"Folder \"{_sdkOnDemandFolder}\" not found"; return(false); } _isSecureProtocol = cap.GetAvailabilityByKey("secure_protocol"); if (_isSecureProtocol) { if (!_supportTarGz) { ErrorMessage = "The target uses secure protocol. Only tar.gz packages are supported for secure targets"; } _supportRpms = false; } _sdkToolPath = cap.GetValueByKey("sdk_toolpath"); _cpuArch = DeployHelper.GetPackageSuffix(cap.GetValueByKey("cpu_arch")); var unavailablePackages = new List <string>(); CheckAvailable(packageNames, unavailablePackages); bool result = true; try { if (unavailablePackages != null) { foreach (string packageName in unavailablePackages) { Version installedVersion = GetInstalledPackageVersion(packageName); if (installedVersion == null) { ErrorMessage = $"Package \"{packageName}\" not found both in \"{_sdkOnDemandFolder}\" and on the target system"; return(false); } } } CheckInstalled(); if (_packages.Any(p => p.Value.NeedToInstall)) { result = InstallPackages(_sdkToolPath + "/on-demand"); } } finally { // } _packages.Clear(); return(result); }
private string GetArch() { SDBCapability cap = new SDBCapability(); return(cap.GetValueByKey("cpu_arch")); }
private string GetRpmsPath() { SDBCapability cap = new SDBCapability(); return(cap.GetValueByKey("sdk_toolpath") + @"/on-demand"); }
public override async Task LaunchAsync(DebugLaunchOptions launchOptions) { if (ProfilerPlugin.Instance.ProfileLauncher.SessionActive || ProfilerPlugin.Instance.HeaptrackLauncher.SessionActive) { ProfilerPlugin.Instance.ShowError("Cannot start debugging: a profiling session is active"); return; } SDBDeviceInfo device = DeviceManager.SelectedDevice; if (device == null) { new EmulatorManagerLauncher().Launch(); return; } var cap = new SDBCapability(device); string tizenVersion = cap.GetValueByKey("platform_version"); if (!ProfilerPlugin.IsTizenVersionSupported(tizenVersion, true)) { return; } bool isSecureProtocol = cap.GetAvailabilityByKey("secure_protocol"); bool useNetCoreDbg = cap.GetAvailabilityByKey("netcoredbg_support"); bool isDebugMode = !launchOptions.Equals(DebugLaunchOptions.NoDebug); bool useLiveProfiler = isDebugMode && useNetCoreDbg && DebuggerInfo.UseLiveProfiler; // check the root mode is off if (!ProfilerPlugin.EnsureRootOff(device, isDebugMode ? (useLiveProfiler ? ProfilerPlugin.RunMode.LiveProfiler : ProfilerPlugin.RunMode.Debug) : ProfilerPlugin.RunMode.NoDebug)) { return; } Project debuggeeProj = VsHierarchy.GetDTEProject(); tDebugLaunchOptions = isSecureProtocol ? (useNetCoreDbg ? new SecuredTizenNetCoreDbgLaunchOptions(device, isDebugMode, debuggeeProj, _tizenLaunchSettingsProvider.TizenLaunchSetting.ExtraArguments) : new SecuredTizenDebugLaunchOptions(device, isDebugMode, debuggeeProj, _tizenLaunchSettingsProvider.TizenLaunchSetting.ExtraArguments)) : (useNetCoreDbg ? new TizenNetCoreDbgLaunchOptions(device, isDebugMode, debuggeeProj, _tizenLaunchSettingsProvider.TizenLaunchSetting.ExtraArguments) : new TizenDebugLaunchOptions(device, isDebugMode, debuggeeProj, _tizenLaunchSettingsProvider.TizenLaunchSetting.ExtraArguments)); string msg = $"Start {(isDebugMode ? "" : "without ")}debugging \"{tDebugLaunchOptions.AppId}\""; if (isSecureProtocol) { msg += " (secure protocol)"; } OutputDebugLaunchMessage($"<<< {msg} >>>"); bool isDebugNeeded = InstallTizenPackage(device, tDebugLaunchOptions); if (isDebugNeeded) { if (isDebugMode) { /* * OnDemandDebuggerInstaller debuggerInstaller = isSecureProtocol ? * (useNetCoreDbg ? * new OnDemandDebuggerInstallerSecure("netcoredbg", "1.0.0") : * new OnDemandDebuggerInstallerSecure("lldb-tv", "3.8.1")) : * (useNetCoreDbg ? * new OnDemandDebuggerInstaller("netcoredbg", "1.0.0") : * new OnDemandDebuggerInstaller("lldb", "3.8.1")); * * isDebugNeeded = debuggerInstaller.InstallPackage(tizenVersion, VsPackage.outputPaneTizen, VsPackage.dialogFactory); */ // TODO!! remove OnDemandDebuggerInstaller.cs after checking OnDemandInstaller var installer = new OnDemandInstaller(device, supportRpms: false, supportTarGz: true, onMessage: (s) => ProfilerPlugin.Instance.WriteToOutput(s)); isDebugNeeded = installer.Install(useNetCoreDbg ? "netcoredbg" : (isSecureProtocol ? "lldb-tv" : "lldb")); if (!isDebugNeeded) { ProfilerPlugin.Instance.ShowError(StringHelper.CombineMessages( "Cannot check/install the debugger package.\n", installer.ErrorMessage)); } } if (isDebugNeeded) { isDebugNeeded = LaunchApplication(device, tDebugLaunchOptions) && isDebugMode; if (isDebugNeeded) { await base.LaunchAsync(launchOptions); } } } }