# HG changeset patch # User tzelaw # Date 1239739399 18000 # Node ID d74b720418db9d2675154c05544129e4117e0318 # Parent cfa799aaafa1fb5c7a6516391928e6961d6b9e80 Test framework support: Ask debugger to remember DebugTarget so test framework can use it to setup test framework related utility. With this we can use the DebugUI way of launching while keeping test framework functionality diff -r cfa799aaafa1 -r d74b720418db debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ATFLaunchSupport.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ATFLaunchSupport.java Tue Apr 14 15:03:19 2009 -0500 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +package com.nokia.cdt.internal.debug.launch; + +import org.eclipse.debug.core.model.IDebugTarget; + +public class ATFLaunchSupport { + // Pass to IDebugTarget the outside world (e.g. test framework), it is dropped by Eclipse core debugger + private static IDebugTarget debugTargetFromLaunchDelegate = null; + + /** + * Pass debug target from LaunchDelegate to outside world (e.g. test framework) + * We read and clear to save us the hassle of clearing before each usage. + */ + public static IDebugTarget getAndClearDebugTargetFromLaunchDelegate() { + IDebugTarget result = debugTargetFromLaunchDelegate; + debugTargetFromLaunchDelegate = null; + return result; + } + + /** + * Saves debug target from LaunchDelegate to outside world (e.g. test framework) + */ + public static void saveDebugTargetFromLaunchDelegate(IDebugTarget debugTarget) { + debugTargetFromLaunchDelegate = debugTarget; + } + +} diff -r cfa799aaafa1 -r d74b720418db debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/EmulationLaunchDelegate.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/EmulationLaunchDelegate.java Tue Apr 14 10:42:34 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/EmulationLaunchDelegate.java Tue Apr 14 15:03:19 2009 -0500 @@ -57,6 +57,7 @@ import com.freescale.cdt.debug.cw.DebuggerLog; import com.freescale.cdt.debug.cw.core.cdi.ISessionListener; import com.freescale.cdt.debug.cw.core.cdi.Session; +import com.freescale.cdt.debug.cw.core.cdi.model.Target; import com.freescale.cdt.debug.cw.core.settings.DebuggerCommonData; import com.freescale.cdt.debug.cw.core.ui.console.LoggingConsole; import com.nokia.cdt.debug.cw.symbian.SettingsData; @@ -158,7 +159,8 @@ File wd = getWorkingDirectory(config); long t = System.currentTimeMillis(); - cwDebugSession.launchExecutable(launch, config, exeFile, otherExecutables, arguments, wd, getEnvironmentAsProperty(config), monitor, project, renderTargetLabel(debugConfig), true); + Target target = cwDebugSession.launchExecutable(launch, config, exeFile, otherExecutables, arguments, wd, getEnvironmentAsProperty(config), monitor, project, renderTargetLabel(debugConfig), true); + ATFLaunchSupport.saveDebugTargetFromLaunchDelegate(target.getCoreModelTarget()); t = System.currentTimeMillis() - t; // System.out.println("launchExecutable returns in : " + t); DebuggerLog.log("launchExecutable returns in : " + t); diff -r cfa799aaafa1 -r d74b720418db debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/SophiaSTILaunchDelegate.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/SophiaSTILaunchDelegate.java Tue Apr 14 10:42:34 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/SophiaSTILaunchDelegate.java Tue Apr 14 15:03:19 2009 -0500 @@ -38,6 +38,7 @@ import com.freescale.cdt.debug.cw.CWException; import com.freescale.cdt.debug.cw.core.cdi.Session; +import com.freescale.cdt.debug.cw.core.cdi.model.Target; import com.nokia.cdt.debug.cw.symbian.SettingsData; import com.nokia.cdt.debug.cw.symbian.SymbianPlugin; @@ -107,7 +108,8 @@ config = synchronizeWithProjectAccessPaths(project, config); File wd = getWorkingDirectory(config); - cwDebugSession.launchExecutable(launch, config, exeFile, otherExecutables, arguments, wd, getEnvironmentAsProperty(config), monitor, project, getTargetLabel(exeFile.getName()), true); + Target target = cwDebugSession.launchExecutable(launch, config, exeFile, otherExecutables, arguments, wd, getEnvironmentAsProperty(config), monitor, project, getTargetLabel(exeFile.getName()), true); + ATFLaunchSupport.saveDebugTargetFromLaunchDelegate(target.getCoreModelTarget()); } catch (CoreException e) { Session session = (Session)dsession; diff -r cfa799aaafa1 -r d74b720418db debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/TRKLaunchDelegate.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/TRKLaunchDelegate.java Tue Apr 14 10:42:34 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/TRKLaunchDelegate.java Tue Apr 14 15:03:19 2009 -0500 @@ -32,6 +32,7 @@ import com.freescale.cdt.debug.cw.CWException; import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper; import com.freescale.cdt.debug.cw.core.cdi.Session; +import com.freescale.cdt.debug.cw.core.cdi.model.Target; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; @@ -159,8 +160,9 @@ config = synchronizeWithProjectAccessPaths(project, config); File wd = getWorkingDirectory(config); - cwDebugSession.launchExecutable(launch, config, exeFile, otherExecutables, arguments, wd, getEnvironmentAsProperty(config), monitor, project, getTargetLabel(exeFile.getName()), true); - + Target target = cwDebugSession.launchExecutable(launch, config, exeFile, otherExecutables, arguments, wd, getEnvironmentAsProperty(config), monitor, project, getTargetLabel(exeFile.getName()), true); + ATFLaunchSupport.saveDebugTargetFromLaunchDelegate(target.getCoreModelTarget()); + } catch (CoreException e) { Session session = (Session)dsession; session.cleanupAfterLaunchFailure(); diff -r cfa799aaafa1 -r d74b720418db debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/Trace32LaunchDelegate.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/Trace32LaunchDelegate.java Tue Apr 14 10:42:34 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/Trace32LaunchDelegate.java Tue Apr 14 15:03:19 2009 -0500 @@ -38,6 +38,7 @@ import com.freescale.cdt.debug.cw.CWException; import com.freescale.cdt.debug.cw.core.cdi.Session; +import com.freescale.cdt.debug.cw.core.cdi.model.Target; import com.nokia.cdt.debug.cw.symbian.SettingsData; import com.nokia.cdt.debug.cw.symbian.SymbianPlugin; @@ -110,7 +111,8 @@ config = synchronizeWithProjectAccessPaths(project, config); File wd = getWorkingDirectory(config); - cwDebugSession.launchExecutable(launch, config, exeFile, otherExecutables, arguments, wd, getEnvironmentAsProperty(config), monitor, project, getTargetLabel(exeFile.getName()), true); + Target target = cwDebugSession.launchExecutable(launch, config, exeFile, otherExecutables, arguments, wd, getEnvironmentAsProperty(config), monitor, project, getTargetLabel(exeFile.getName()), true); + ATFLaunchSupport.saveDebugTargetFromLaunchDelegate(target.getCoreModelTarget()); } catch (CoreException e) { Session session = (Session)dsession;