private bool InstallTizenPackage(SDBDeviceInfo device, TizenDebugLaunchOptions tDebugLaunchOptions) { SDBLauncher.Create(VsPackage.outputPaneTizen).TerminateApplication(device, tDebugLaunchOptions.AppId); InstallResult installResult = Launcher.Create().InstallTizenPackage(device, tDebugLaunchOptions.TpkPath, null, VsPackage.dialogFactory, false, out lastErrorMessage); bool isInstallSucceeded = (installResult == InstallResult.OK); if (!isInstallSucceeded) { OutputDebugLaunchMessage(lastErrorMessage); ShowInstallError(installResult); TizenPackageTracer.CleanTpiFiles(); } return(isInstallSucceeded); }
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); } } } }
private bool LaunchDebugModeApplication(SDBDeviceInfo device, TizenDebugLaunchOptions tDebugLaunchOptions) { #region W/A launch due to not-implemented parameter(for debug) of runapp protocol switch (tDebugLaunchOptions.AppType) { case "watch-application": case "widget-application": SDBLauncher.Create(VsPackage.outputPaneTizen).LaunchApplication(device, DebugLaunchDataStore.WidgetViewerSdkAppId); break; } var cap = new SDBCapability(device); bool startLiveProfiler = tDebugLaunchOptions.IsDebugMode && cap.GetAvailabilityByKey("netcoredbg_support") && DebuggerInfo.UseLiveProfiler; if (startLiveProfiler) { switch (tDebugLaunchOptions.AppType) { case "ui-application": case "service-application": if (tDebugLaunchOptions is SecuredTizenDebugLaunchOptions) { startLiveProfiler = false; } break; default: startLiveProfiler = false; break; } } bool ok = true; if (startLiveProfiler) { var proc = StartSdbProcess("-s " + device.Serial + " forward --remove tcp:4712", "Removing port forward...", false); WaitProcessExit(proc, 5000); proc = StartSdbProcess("-s " + device.Serial + " forward tcp:4712 tcp:4711", "Forwarding port..."); WaitProcessExit(proc, 5000); ok = ProfilerPlugin.Instance.StartProfiler(true); // StartProfiler checks whether the root mode is off } else { if (ProfilerPlugin.EnsureRootOff(device, ProfilerPlugin.RunMode.Debug)) // check the root mode is off { foreach (var arg in tDebugLaunchOptions.LaunchSequence) { var proc = StartSdbProcess(arg.Args, arg.Message); if (arg.Timeout != 0) { if (!WaitProcessExit(proc, arg.Timeout)) { // TODO!! show diagnostics ok = false; break; } } } } } return(ok); #endregion }
private bool LaunchApplication(SDBDeviceInfo device, TizenDebugLaunchOptions tDebugLaunchOptions) { return(tDebugLaunchOptions.IsDebugMode ? LaunchDebugModeApplication(device, tDebugLaunchOptions) : SDBLauncher.Create(VsPackage.outputPaneTizen).LaunchApplication(device, tDebugLaunchOptions.AppId)); }