diff options
Diffstat (limited to 'jtag')
11 files changed, 2 insertions, 1180 deletions
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF b/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF index eb386f2d677..c248949c71b 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF @@ -9,7 +9,6 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.debug.core, org.eclipse.cdt.launch, org.eclipse.cdt.debug.core, - org.eclipse.cdt.debug.mi.core, org.eclipse.cdt.core, org.eclipse.core.variables, org.eclipse.cdt.dsf.gdb, diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml b/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml index c0a4f6d83dd..457da8191e5 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml @@ -13,16 +13,6 @@ <extension point="org.eclipse.debug.core.launchDelegates"> <launchDelegate - delegate="org.eclipse.cdt.debug.gdbjtag.core.GDBJtagLaunchConfigurationDelegate" - delegateDescription="%launchDelegate.jtag.description" - id="org.eclipse.cdt.debug.gdbjtag.core.cdiLaunchDelegate" - modes="debug" - name="%launchDelegate.jtag.name" - sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator" - sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer" - type="org.eclipse.cdt.debug.gdbjtag.launchConfigurationType"> - </launchDelegate> - <launchDelegate delegate="org.eclipse.cdt.debug.gdbjtag.core.GDBJtagDSFLaunchConfigurationDelegate" delegateDescription="%launchDelegate.jtagDsf.description" id="org.eclipse.cdt.debug.gdbjtag.core.dsfLaunchDelegate" diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagCommandFactory.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagCommandFactory.java deleted file mode 100644 index ff68b705570..00000000000 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagCommandFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/********************************************************************** - * Copyright (c) 2007 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - **********************************************************************/ - -package org.eclipse.cdt.debug.gdbjtag.core; - -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; - -/** - * @author Doug Schaefer - * - */ -public class GDBJtagCommandFactory extends CommandFactory { - - /** - * - */ - public GDBJtagCommandFactory() { - // TODO Auto-generated constructor stub - } - - /** - * @param miVersion - */ - public GDBJtagCommandFactory(String miVersion) { - super(miVersion); - // TODO Auto-generated constructor stub - } - -} diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java deleted file mode 100644 index fb8c7e0b608..00000000000 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java +++ /dev/null @@ -1,405 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 - 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Doug Schaefer, Adrian Petrescu - QNX Software Systems - Initial API and implementation - * Andy Jin - Hardware debugging UI improvements, bug 229946 - * Peter Vidler - Monitor support (progress and cancellation) bug 242699 - * Bruce Griffith, Sage Electronic Engineering, LLC - bug 305943 - * - API generalization to become transport-independent (allow - * connections via serial ports and pipes). - *******************************************************************************/ - -package org.eclipse.cdt.debug.gdbjtag.core; - -import java.io.File; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.CDebugUtils; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.cdi.ICDISession; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContribution; -import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContributionFactory; -import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice; -import org.eclipse.cdt.debug.mi.core.AbstractGDBCDIDebugger; -import org.eclipse.cdt.debug.mi.core.MIException; -import org.eclipse.cdt.debug.mi.core.MIPlugin; -import org.eclipse.cdt.debug.mi.core.MISession; -import org.eclipse.cdt.debug.mi.core.cdi.Session; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; -import org.eclipse.cdt.debug.mi.core.command.CLICommand; -import org.eclipse.cdt.debug.mi.core.command.MICommand; -import org.eclipse.cdt.debug.mi.core.command.Command; -import org.eclipse.cdt.debug.mi.core.command.CommandFactory; -import org.eclipse.cdt.debug.mi.core.command.MIGDBSetNewConsole; -import org.eclipse.cdt.debug.mi.core.output.MIInfo; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.core.variables.VariablesPlugin; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; - -/** - * Debugger class for Jtag debugging (using gdb server) - */ -public class GDBJtagDebugger extends AbstractGDBCDIDebugger { - - private String miVersion; - - @Override - public ICDISession createSession(ILaunch launch, File executable, - IProgressMonitor monitor) throws CoreException { - return super.createSession(launch, executable, monitor); - } - - @Override - public ICDISession createDebuggerSession(ILaunch launch, IBinaryObject exe, - IProgressMonitor monitor) throws CoreException { - return super.createDebuggerSession(launch, exe, monitor); - } - - @Override - protected CommandFactory getCommandFactory(ILaunchConfiguration config) - throws CoreException { - miVersion = MIPlugin.getMIVersion(config); - return new GDBJtagCommandFactory(miVersion); - } - - @Override - @SuppressWarnings("deprecation") - protected void doStartSession(ILaunch launch, Session session, IProgressMonitor monitor) throws CoreException { - SubMonitor submonitor = SubMonitor.convert(monitor, 100); - - try { - submonitor.subTask(Messages.getString("GDBJtagDebugger.0")); //$NON-NLS-1$ - ILaunchConfiguration config = launch.getLaunchConfiguration(); - ICDITarget[] targets = session.getTargets(); - if (targets.length == 0 || !(targets[0] instanceof Target)) { - Activator.log(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), - DebugPlugin.INTERNAL_ERROR, Messages.getString("GDBJtagDebugger.1"), null)); //$NON-NLS-1$ - return; - } - MISession miSession = ((Target)targets[0]).getMISession(); - CommandFactory factory = miSession.getCommandFactory(); - if (submonitor.isCanceled()) { - throw new OperationCanceledException(); - } - try { - MIGDBSetNewConsole newConsole = factory.createMIGDBSetNewConsole(); - miSession.postCommand(newConsole); - MIInfo info = newConsole.getMIInfo(); - if (info == null) { - throw new MIException(MIPlugin.getResourceString("src.common.No_answer")); //$NON-NLS-1$ - } - } - catch( MIException e ) { - // We ignore this exception, for example - // on GNU/Linux the new-console is an error. - } - - submonitor.worked(10); - if (submonitor.isCanceled()) { - throw new OperationCanceledException(); - } - IGDBJtagDevice gdbJtagDevice; - try { - gdbJtagDevice = getGDBJtagDevice(config); - } catch (NullPointerException e) { - return; - } - - List<String> commands = new ArrayList<String>(); - - if (submonitor.isCanceled()) { - throw new OperationCanceledException(); - } - // execute symbol load - boolean doLoadSymbols = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS); - if (doLoadSymbols) { - String symbolsFileName = null; - // New setting in Helios. Default is true. Check for existence - // in order to support older launch configs - if (config.hasAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS) && - config.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_SYMBOLS)) { - IPath programFile = CDebugUtils.verifyProgramPath(config); - if (programFile != null) { - symbolsFileName = programFile.toOSString(); - } - } - else { - symbolsFileName = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, IGDBJtagConstants.DEFAULT_SYMBOLS_FILE_NAME); - if (symbolsFileName.length() > 0) { - symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName); - } - } - if (symbolsFileName == null) { - // The launch config GUI should prevent this from happening, but just in case - throw new CoreException(new Status( IStatus.ERROR, - Activator.getUniqueIdentifier(), - -1, Messages.getString("GDBJtagDebugger.err_no_sym_file"), null)); - } - - // Escape windows path separator characters TWICE, once for Java and once for GDB. - symbolsFileName = symbolsFileName.replace("\\", "\\\\"); - - String symbolsOffset = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, IGDBJtagConstants.DEFAULT_SYMBOLS_OFFSET); - if (symbolsOffset.length() > 0) { - symbolsOffset = "0x" + symbolsOffset; - } - commands.clear(); - gdbJtagDevice.doLoadSymbol(symbolsFileName, symbolsOffset, commands); - monitor.beginTask(Messages.getString("GDBJtagDebugger.loading_symbols"), 1); //$NON-NLS-1$ - executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15)); - } - - if (submonitor.isCanceled()) { - throw new OperationCanceledException(); - } - - // hook up to remote target - boolean useRemote = config.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET); - if (useRemote) { - submonitor.subTask(Messages.getString("GDBJtagDebugger.2")); //$NON-NLS-1$ - try { - commands.clear(); - if (gdbJtagDevice instanceof IGDBJtagConnection) { - URI connection = new URI(config.getAttribute(IGDBJtagConstants.ATTR_CONNECTION, IGDBJtagConstants.DEFAULT_CONNECTION)); - IGDBJtagConnection device = (IGDBJtagConnection)gdbJtagDevice; - device.doRemote(connection.getSchemeSpecificPart(), commands); - } else { - // use deprecated methods tied to TCP/IP - String ipAddress = config.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ""); //$NON-NLS-1$ - int portNumber = config.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, 0); - gdbJtagDevice.doRemote(ipAddress, portNumber, commands); - } - } catch (URISyntaxException e) { - throw new OperationCanceledException(); - } - executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(10)); - if (submonitor.isCanceled()) { - throw new OperationCanceledException(); - } - } - - // execute init script - submonitor.subTask(Messages.getString("GDBJtagDebugger.3")); //$NON-NLS-1$ - submonitor.setWorkRemaining(80); // compensate for optional work above - - // Run device-specific code to reset the board - if (config.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET)) { - commands.clear(); - gdbJtagDevice.doReset(commands); - int defaultDelay = gdbJtagDevice.getDefaultDelay(); - gdbJtagDevice.doDelay(config.getAttribute(IGDBJtagConstants.ATTR_DELAY, defaultDelay), commands); - executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15)); - } - submonitor.setWorkRemaining(65); // compensate for optional work above - - // Run device-specific code to halt the board - if (config.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, IGDBJtagConstants.DEFAULT_DO_HALT)) { - commands.clear(); - gdbJtagDevice.doHalt(commands); - executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15)); - } - submonitor.setWorkRemaining(50); // compensate for optional work above - // execute any user defined init command - executeGDBScript(config, IGDBJtagConstants.ATTR_INIT_COMMANDS, miSession, - submonitor.newChild(15)); - - // execute load - boolean doLoad = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE); - if (doLoad) { - String imageFileName = null; - - // New setting in Helios. Default is true. Check for existence - // in order to support older launch configs - if (config.hasAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE) && - config.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_IMAGE)) { - IPath programFile = CDebugUtils.verifyProgramPath(config); - if (programFile != null) { - imageFileName = programFile.toOSString(); - } - } - else { - imageFileName = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, IGDBJtagConstants.DEFAULT_IMAGE_FILE_NAME); - if (imageFileName.length() > 0) { - imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName); - } - } - if (imageFileName == null) { - // The launch config GUI should prevent this from happening, but just in case - throw new CoreException(new Status( IStatus.ERROR, - Activator.getUniqueIdentifier(), - -1, Messages.getString("GDBJtagDebugger.err_no_img_file"), null)); - } - imageFileName = imageFileName.replace("\\", "\\\\"); - - String imageOffset = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET); - if (imageOffset.length() > 0) { - imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET); - } - - commands.clear(); - gdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands); - monitor.beginTask(Messages.getString("GDBJtagDebugger.loading_image"), 1); //$NON-NLS-1$ - executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20)); - - - } - submonitor.setWorkRemaining(15); // compensate for optional work above - } catch (OperationCanceledException e) { - if (launch != null && launch.canTerminate()) { - launch.terminate(); - } - } - } - - public void doRunSession(ILaunch launch, ICDISession session, IProgressMonitor monitor) throws CoreException { - SubMonitor submonitor = SubMonitor.convert(monitor, 100); - - try { - ILaunchConfiguration config = launch.getLaunchConfiguration(); - ICDITarget[] targets = session.getTargets(); - if ( targets.length == 0 || !(targets[0] instanceof Target) ) - return; - MISession miSession = ((Target)targets[0]).getMISession(); - - IGDBJtagDevice gdbJtagDevice; - try { - gdbJtagDevice = getGDBJtagDevice(config); - } catch (NullPointerException e) { - return; - } - - if (submonitor.isCanceled()) { - throw new OperationCanceledException(); - } - submonitor.worked(20); - List<String> commands = new ArrayList<String>(); - // Set program counter - boolean setPc = config.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER); - if (setPc) { - String pcRegister = config.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_PC_REGISTER)); - gdbJtagDevice.doSetPC(pcRegister, commands); - executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20)); - } - submonitor.setWorkRemaining(60); // compensate for optional work above - - // execute run script - monitor.beginTask(Messages.getString("GDBJtagDebugger.18"), 1); //$NON-NLS-1$ - boolean setStopAt = config.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT); - if (setStopAt) { - String stopAt = config.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, IGDBJtagConstants.DEFAULT_STOP_AT); - commands.clear(); - gdbJtagDevice.doStopAt(stopAt, commands); - executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20)); - } - submonitor.setWorkRemaining(40); // compensate for optional work above - - boolean setResume = config.getAttribute(IGDBJtagConstants.ATTR_SET_RESUME, IGDBJtagConstants.DEFAULT_SET_RESUME); - if (setResume) { - commands.clear(); - gdbJtagDevice.doContinue(commands); - executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20)); - } - submonitor.setWorkRemaining(20); // compensate for optional work above - // Run any user defined command - executeGDBScript(config, IGDBJtagConstants.ATTR_RUN_COMMANDS, miSession, - submonitor.newChild(20)); - } catch (OperationCanceledException e) { - if (launch != null && launch.canTerminate()) { - launch.terminate(); - } - } - } - - private void executeGDBScript(String script, MISession miSession, - IProgressMonitor monitor) throws CoreException { - // Try to execute any extra command - if (script == null || script.length() == 0) - return; - script = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(script); - String[] commands = script.split("\\r?\\n"); - SubMonitor submonitor = SubMonitor.convert(monitor, commands.length); - for (int j = 0; j < commands.length; ++j) { - try { - submonitor.subTask(Messages.getString("GDBJtagDebugger.21") + commands[j]); //$NON-NLS-1$ - Command cmd = null; - if (commands[j].startsWith("-")) { - cmd = new MICommand(miVersion, commands[j]); - } else { - cmd = new CLICommand(commands[j]); - } - miSession.postCommand(cmd, MISession.FOREVER); - submonitor.worked(1); - if (submonitor.isCanceled()) { - throw new OperationCanceledException(); - } - MIInfo info = cmd.getMIInfo(); - if (info == null) { - throw new MIException("Timeout"); //$NON-NLS-1$ - } - } catch (MIException e) { - MultiStatus status = new MultiStatus( - Activator.PLUGIN_ID, - ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR, - Messages.getString("GDBJtagDebugger.22"), e); //$NON-NLS-1$ - status - .add(new Status( - IStatus.ERROR, - Activator.PLUGIN_ID, - ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR, - e == null ? "" : e.getLocalizedMessage(), //$NON-NLS-1$ - e)); - CDebugCorePlugin.log(status); - } - } - } - - private void executeGDBScript(ILaunchConfiguration configuration, String attribute, - MISession miSession, IProgressMonitor monitor) throws CoreException { - executeGDBScript(configuration.getAttribute(attribute, ""), miSession, monitor); //$NON-NLS-1$ - } - - private IGDBJtagDevice getGDBJtagDevice (ILaunchConfiguration config) - throws CoreException, NullPointerException { - IGDBJtagDevice gdbJtagDevice = null; - String jtagDeviceName = config.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, IGDBJtagConstants.DEFAULT_JTAG_DEVICE); - GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory. - getInstance().getGDBJtagDeviceContribution(); - for (int i = 0; i < availableDevices.length; i++) { - if (jtagDeviceName.equals(availableDevices[i].getDeviceName())) { - gdbJtagDevice = availableDevices[i].getDevice(); - break; - } - } - return gdbJtagDevice; - } - - private String getGDBScript(List<String> commands) { - if (commands.isEmpty()) - return null; - StringBuffer sb = new StringBuffer(); - for (String cmd : commands) { - sb.append(cmd); - } - return sb.toString(); - } -} diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagLaunchConfigurationDelegate.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagLaunchConfigurationDelegate.java deleted file mode 100644 index 7d689482e5a..00000000000 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagLaunchConfigurationDelegate.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 - 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.gdbjtag.core; - -import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.CDebugUtils; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDISession; -import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; -import org.eclipse.cdt.launch.AbstractCLaunchDelegate; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.core.model.IProcess; - -/** - * @author Doug Schaefer - * - */ -public class GDBJtagLaunchConfigurationDelegate extends AbstractCLaunchDelegate { - - @Override - protected String getPluginID() { - return Activator.PLUGIN_ID; - }; - - @Override - public void launch(ILaunchConfiguration configuration, String mode, - ILaunch launch, IProgressMonitor monitor) throws CoreException { - SubMonitor submonitor = SubMonitor.convert(monitor, 2); - // set the default source locator if required - setDefaultSourceLocator(launch, configuration); - - if (mode.equals(ILaunchManager.DEBUG_MODE)) { - GDBJtagDebugger debugger = new GDBJtagDebugger(); - ICProject project = CDebugUtils.verifyCProject(configuration); - IPath exePath = CDebugUtils.verifyProgramPath(configuration); - ICDISession session = debugger.createSession(launch, null, submonitor.newChild(1)); - IBinaryObject exeBinary = null; - if ( exePath != null ) { - exeBinary = verifyBinary(project, exePath); - } - - try { - // create the Launch targets/processes for eclipse. - ICDITarget[] targets = session.getTargets(); - for( int i = 0; i < targets.length; i++ ) { - Process process = targets[i].getProcess(); - IProcess iprocess = null; - if ( process != null ) { - iprocess = DebugPlugin.newProcess(launch, process, renderProcessLabel(exePath != null ? exePath.toOSString() : "???"), - getDefaultProcessMap() ); - } - CDIDebugModel.newDebugTarget(launch, project.getProject(), targets[i], - renderProcessLabel("GDB Hardware Debugger"), iprocess, exeBinary, true, false, false); - } - - debugger.doRunSession(launch, session, submonitor.newChild(1)); - } catch (CoreException e) { - try { - session.terminate(); - } catch (CDIException e1) { - // ignore - } - throw e; - } - } else { - cancel("TargetConfiguration not supported", - ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); - } - } - -} diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java index 2d515bcf64a..3f632816737 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java @@ -18,8 +18,6 @@ package org.eclipse.cdt.debug.gdbjtag.core; */ public interface IGDBJtagConstants { - public static final String DEBUGGER_ID = "org.eclipse.cdt.debug.mi.core.CDebuggerNew"; //$NON-NLS-1$ - // Debugger public static final String ATTR_USE_REMOTE_TARGET = Activator.PLUGIN_ID + ".useRemoteTarget"; //$NON-NLS-1$ public static final String ATTR_IP_ADDRESS = Activator.PLUGIN_ID + ".ipAddress"; //$NON-NLS-1$ diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF index 1571883d11a..62f08e16688 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF @@ -2,14 +2,13 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.cdt.debug.gdbjtag.ui;singleton:=true -Bundle-Version: 7.1.0.qualifier +Bundle-Version: 8.0.0.qualifier Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.ui.Activator Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.debug.ui, org.eclipse.cdt.launch, - org.eclipse.cdt.debug.mi.core, org.eclipse.cdt.debug.gdbjtag.core, org.eclipse.core.variables, org.eclipse.ui.ide, diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.xml b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.xml index 12cf41987cd..ea63b485515 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.xml +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.xml @@ -60,63 +60,6 @@ </extension> <extension point="org.eclipse.debug.ui.launchConfigurationTabs"> - <tab - class="org.eclipse.cdt.debug.gdbjtag.ui.GDBJtagCDICMainTab" - group="org.eclipse.cdt.debug.gdbjtag.launchConfigurationTabGroup" - id="org.eclipse.cdt.debug.gdbjtag.ui.cmaintab.cdi" - name="%launchtab.cmaintab.name"> - <associatedDelegate - delegate="org.eclipse.cdt.debug.gdbjtag.core.cdiLaunchDelegate"> - </associatedDelegate> - </tab> - <tab - class="org.eclipse.cdt.debug.gdbjtag.ui.GDBJtagDebuggerTab" - group="org.eclipse.cdt.debug.gdbjtag.launchConfigurationTabGroup" - id="org.eclipse.cdt.debug.gdbjtag.ui.debuggertab.cdi" - name="%launchtab.debuggertab.name"> - <associatedDelegate - delegate="org.eclipse.cdt.debug.gdbjtag.core.cdiLaunchDelegate"> - </associatedDelegate> - <placement - after="org.eclipse.cdt.cdi.launch.mainTab"> - </placement> - </tab> - <tab - class="org.eclipse.cdt.debug.gdbjtag.ui.GDBJtagStartupTab" - group="org.eclipse.cdt.debug.gdbjtag.launchConfigurationTabGroup" - id="org.eclipse.cdt.debug.gdbjtag.ui.startuptab.cdi" - name="%launchtab.startuptab.name"> - <associatedDelegate - delegate="org.eclipse.cdt.debug.gdbjtag.core.cdiLaunchDelegate"> - </associatedDelegate> - <placement - after="org.eclipse.cdt.debug.gdbjtag.ui.debuggertab.cdi"> - </placement> - </tab> - <tab - class="org.eclipse.debug.ui.sourcelookup.SourceLookupTab" - group="org.eclipse.cdt.debug.gdbjtag.launchConfigurationTabGroup" - id="org.eclipse.cdt.debug.gdbjtag.ui.sourcelookuptab.cdi" - name="%launchTab.sourceLookup.name"> - <associatedDelegate - delegate="org.eclipse.cdt.debug.gdbjtag.core.cdiLaunchDelegate"> - </associatedDelegate> - <placement - after="org.eclipse.cdt.debug.gdbjtag.ui.startuptab"> - </placement> - </tab> - <tab - class="org.eclipse.debug.ui.CommonTab" - group="org.eclipse.cdt.debug.gdbjtag.launchConfigurationTabGroup" - id="org.eclipse.cdt.debug.gdbjtag.ui.commontab.cdi" - name="%launchTab.common.name"> - <associatedDelegate - delegate="org.eclipse.cdt.debug.gdbjtag.core.cdiLaunchDelegate"> - </associatedDelegate> - <placement - after="org.eclipse.debug.ui.sourceLookupTab"> - </placement> - </tab> <tab class="org.eclipse.cdt.debug.gdbjtag.internal.ui.GDBJtagDSFCMainTab" group="org.eclipse.cdt.debug.gdbjtag.launchConfigurationTabGroup" diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/pom.xml b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/pom.xml index 65b4ffa9ab7..cbef980761d 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/pom.xml +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/pom.xml @@ -11,7 +11,7 @@ <relativePath>../../pom.xml</relativePath> </parent> - <version>7.1.0-SNAPSHOT</version> + <version>8.0.0-SNAPSHOT</version> <artifactId>org.eclipse.cdt.debug.gdbjtag.ui</artifactId> <packaging>eclipse-plugin</packaging> </project> diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java index 089c2a90c4d..016fda1f7c6 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java @@ -29,10 +29,6 @@ import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConstants; import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContribution; import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContributionFactory; import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice; -import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; -import org.eclipse.cdt.debug.mi.core.MIPlugin; -import org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoryDescriptor; -import org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoryManager; import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; @@ -442,7 +438,6 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { @Override public void performApply(ILaunchConfigurationWorkingCopy configuration) { - configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbCommand.getText().trim()); configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbCommand.getText().trim()); // DSF savedJtagDevice = jtagDevice.getText(); configuration.setAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, savedJtagDevice); @@ -476,12 +471,6 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND, "", null); //$NON-NLS-1$ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, defaultGdbCommand); - CommandFactoryManager cfManager = MIPlugin.getDefault().getCommandFactoryManager(); - CommandFactoryDescriptor defDesc = cfManager.getDefaultDescriptor(IGDBJtagConstants.DEBUGGER_ID); - configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, defDesc.getName()); - configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, defDesc.getMIVersions()[0]); - configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE, - IMILaunchConfigurationConstants.DEBUGGER_VERBOSE_MODE_DEFAULT); configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET); configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND, diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDebuggerTab.java b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDebuggerTab.java deleted file mode 100644 index cc439468a48..00000000000 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDebuggerTab.java +++ /dev/null @@ -1,565 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - * Andy Jin - Hardware debugging UI improvements, bug 229946 - * Anna Dushistova (MontaVista) - bug 241279 - * - Hardware Debugging: Host name or ip address not saving in - * the debug configuration - * Andy Jin (QNX) - Added DSF debugging, bug 248593 - * Bruce Griffith, Sage Electronic Engineering, LLC - bug 305943 - * - API generalization to become transport-independent (e.g. to - * allow connections via serial ports and pipes). -*******************************************************************************/ - -package org.eclipse.cdt.debug.gdbjtag.ui; - -import java.io.File; -import java.net.URI; -import java.net.URISyntaxException; - -import org.eclipse.cdt.debug.gdbjtag.core.Activator; -import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConnection; -import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConstants; -import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContribution; -import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContributionFactory; -import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice; -import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; -import org.eclipse.cdt.debug.mi.core.MIPlugin; -import org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoryDescriptor; -import org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoryManager; -import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -import org.eclipse.debug.ui.StringVariableSelectionDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.VerifyEvent; -import org.eclipse.swt.events.VerifyListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -/** - * @author Doug Schaefer, Adrian Petrescu - * - */ -public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab { - - private static final String TAB_NAME = "Debugger"; - private static final String TAB_ID = "org.eclipse.cdt.debug.gdbjtag.ui.debuggertab.cdi"; - - private CommandFactoryDescriptor[] cfDescs; - - private Text gdbCommand; - private Combo commandFactory; - private Combo miProtocol; - private Button verboseMode; - private Button useRemote; - private Combo jtagDevice; - private Composite remoteConnectionParameters; - private StackLayout remoteConnectParmsLayout; - private Composite remoteTcpipBox; - private Text ipAddress; - private Text portNumber; - private Composite remoteConnectionBox; - private Text connection; - private String savedJtagDevice; - - - @Override - public String getName() { - return TAB_NAME; - } - - @Override - public Image getImage() { - return GDBJtagImages.getDebuggerTabImage(); - } - - @Override - public void createControl(Composite parent) { - ScrolledComposite sc = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL); - sc.setExpandHorizontal(true); - sc.setExpandVertical(true); - setControl(sc); - - Composite comp = new Composite(sc, SWT.NONE); - sc.setContent(comp); - GridLayout layout = new GridLayout(); - comp.setLayout(layout); - - Group group = new Group(comp, SWT.NONE); - layout = new GridLayout(); - group.setLayout(layout); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - group.setLayoutData(gd); - group.setText(Messages.getString("GDBJtagDebuggerTab.gdbSetupGroup_Text")); - - createCommandControl(group); - createCommandFactoryControl(group); - createProtocolControl(group); - createVerboseModeControl(group); - - createRemoteControl(comp); - } - - private void browseButtonSelected(String title, Text text) { - FileDialog dialog = new FileDialog(getShell(), SWT.NONE); - dialog.setText(title); - String str = text.getText().trim(); - int lastSeparatorIndex = str.lastIndexOf(File.separator); - if (lastSeparatorIndex != -1) - dialog.setFilterPath(str.substring(0, lastSeparatorIndex)); - str = dialog.open(); - if (str != null) - text.setText(str); - } - - private void variablesButtonSelected(Text text) { - StringVariableSelectionDialog dialog = new StringVariableSelectionDialog( - getShell()); - if (dialog.open() == StringVariableSelectionDialog.OK) { - text.insert(dialog.getVariableExpression()); - } - } - - private void createCommandControl(Composite parent) { - Composite comp = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - comp.setLayout(layout); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 1; - comp.setLayoutData(gd); - - Label label = new Label(comp, SWT.NONE); - label.setText(Messages.getString("GDBJtagDebuggerTab.gdbCommandLabel")); - gd = new GridData(); - gd.horizontalSpan = 3; - label.setLayoutData(gd); - - gdbCommand = new Text(comp, SWT.SINGLE | SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gdbCommand.setLayoutData(gd); - gdbCommand.addModifyListener(new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - scheduleUpdateJob(); // provides much better performance for Text listeners - } - }); - - Button button = new Button(comp, SWT.NONE); - button.setText(Messages.getString("GDBJtagDebuggerTab.gdbCommandBrowse")); - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - browseButtonSelected(Messages.getString("GDBJtagDebuggerTab.gdbCommandBrowse_Title"), gdbCommand); - } - }); - - button = new Button(comp, SWT.NONE); - button.setText(Messages.getString("GDBJtagDebuggerTab.gdbCommandVariable")); - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - variablesButtonSelected(gdbCommand); - } - }); - } - - private void createCommandFactoryControl(Composite parent) { - Composite comp = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(2, false); - comp.setLayout(layout); - Label label = new Label(comp, SWT.NONE); - label.setText(Messages.getString("GDBJtagDebuggerTab.commandFactoryLabel")); - - commandFactory = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN); - - // Get the command sets - CommandFactoryManager cfManager = MIPlugin.getDefault().getCommandFactoryManager(); - cfDescs = cfManager.getDescriptors(IGDBJtagConstants.DEBUGGER_ID); - for (int i = 0; i < cfDescs.length; ++i) { - commandFactory.add(cfDescs[i].getName()); - } - - commandFactory.addModifyListener(new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - commandFactoryChanged(); - scheduleUpdateJob(); // provides much better performance for Text listeners - } - }); - } - - private void createProtocolControl(Composite parent) { - Composite comp = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(2, false); - comp.setLayout(layout); - Label label = new Label(comp, SWT.NONE); - label.setText(Messages.getString("GDBJtagDebuggerTab.miProtocolLabel")); - - miProtocol = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN); - miProtocol.addModifyListener(new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - scheduleUpdateJob(); // provides much better performance for Text listeners - } - }); - } - - private void commandFactoryChanged() { - int currsel = miProtocol.getSelectionIndex(); - String currProt = null; - if (currsel >= 0) - currProt = miProtocol.getItem(currsel); - miProtocol.removeAll(); - int cfsel = commandFactory.getSelectionIndex(); - if (cfsel >= 0) { - String[] protocols = cfDescs[cfsel].getMIVersions(); - for (int i = 0; i < protocols.length; ++i) { - miProtocol.add(protocols[i]); - if (currProt != null && protocols[i].equals(currProt)) - miProtocol.select(i); - } - } - if (miProtocol.getSelectionIndex() < 0 && miProtocol.getItemCount() > 0) - miProtocol.select(0); - } - - private void createVerboseModeControl(Composite parent) { - verboseMode = new Button(parent, SWT.CHECK); - verboseMode.setText(Messages.getString("GDBJtagDebuggerTab.verboseModeLabel")); - verboseMode.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - updateLaunchConfigurationDialog(); - } - }); - } - - private void createRemoteControl(Composite parent) { - Group group = new Group(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - group.setLayout(layout); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - group.setLayoutData(gd); - group.setText(Messages.getString("GDBJtagDebuggerTab.remoteGroup_Text")); - - useRemote = new Button(group, SWT.CHECK); - useRemote.setText(Messages.getString("GDBJtagDebuggerTab.useRemote_Text")); - useRemote.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - useRemoteChanged(); - updateLaunchConfigurationDialog(); - } - }); - - Composite comp = new Composite(group, SWT.NONE); - layout = new GridLayout(); - layout.numColumns = 2; - comp.setLayout(layout); - - Label label = new Label(comp, SWT.NONE); - label.setText(Messages.getString("GDBJtagDebuggerTab.jtagDeviceLabel")); - - jtagDevice = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN); - - GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory. - getInstance().getGDBJtagDeviceContribution(); - for (int i = 0; i < availableDevices.length; i++) { - jtagDevice.add(availableDevices[i].getDeviceName()); - } - - jtagDevice.addModifyListener(new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - updateDeviceIpPort(jtagDevice.getText()); - scheduleUpdateJob(); // provides much better performance for Text listeners - } - }); - - remoteConnectionParameters = new Composite(group, SWT.NO_TRIM | SWT.NO_FOCUS); - remoteConnectParmsLayout = new StackLayout(); - remoteConnectionParameters.setLayout(remoteConnectParmsLayout); - - // - // Create entry fields for TCP/IP connections - // - - { - remoteTcpipBox = new Composite(remoteConnectionParameters, SWT.NO_TRIM | SWT.NO_FOCUS); - layout = new GridLayout(); - layout.numColumns = 2; - remoteTcpipBox.setLayout(layout); - remoteTcpipBox.setBackground(remoteConnectionParameters.getParent().getBackground()); - - label = new Label(remoteTcpipBox, SWT.NONE); - label.setText(Messages.getString("GDBJtagDebuggerTab.ipAddressLabel")); //$NON-NLS-1$ - ipAddress = new Text(remoteTcpipBox, SWT.BORDER); - gd = new GridData(); - gd.widthHint = 125; - ipAddress.setLayoutData(gd); - - label = new Label(remoteTcpipBox, SWT.NONE); - label.setText(Messages.getString("GDBJtagDebuggerTab.portNumberLabel")); //$NON-NLS-1$ - portNumber = new Text(remoteTcpipBox, SWT.BORDER); - gd = new GridData(); - gd.widthHint = 125; - portNumber.setLayoutData(gd); - } - - // - // Create entry fields for other types of connections - // - - { - remoteConnectionBox = new Composite(remoteConnectionParameters, SWT.NO_TRIM | SWT.NO_FOCUS); - layout = new GridLayout(); - layout.numColumns = 2; - remoteConnectionBox.setLayout(layout); - remoteConnectionBox.setBackground(remoteConnectionParameters.getParent().getBackground()); - - label = new Label(remoteConnectionBox, SWT.NONE); - label.setText(Messages.getString("GDBJtagDebuggerTab.connectionLabel")); //$NON-NLS-1$ - connection = new Text(remoteConnectionBox, SWT.BORDER); - gd = new GridData(); - gd.widthHint = 125; - connection.setLayoutData(gd); - } - - // - // Add watchers for user data entry - // - - ipAddress.addModifyListener(new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - scheduleUpdateJob(); // provides much better performance for Text listeners - } - }); - portNumber.addVerifyListener(new VerifyListener() { - @Override - public void verifyText(VerifyEvent e) { - e.doit = Character.isDigit(e.character) || Character.isISOControl(e.character); - } - }); - portNumber.addModifyListener(new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - scheduleUpdateJob(); // provides much better performance for Text listeners - } - }); - - connection.addModifyListener(new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - scheduleUpdateJob(); // provides much better performance for Text listeners - } - }); - } - - /** - * @param text - */ - @SuppressWarnings("deprecation") - protected void updateDeviceIpPort(String selectedDeviceName) { - if (selectedDeviceName.equals(savedJtagDevice)) { - return; - } - GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance() - .getGDBJtagDeviceContribution(); - IGDBJtagDevice selectedDevice = null; - for (int i = 0; i < availableDevices.length; i++) { - String name = availableDevices[i].getDeviceName(); - if (name.equals(selectedDeviceName)) { - selectedDevice = availableDevices[i].getDevice(); - if (selectedDevice != null) { - if (selectedDevice instanceof IGDBJtagConnection) { - IGDBJtagConnection connectionDevice = (IGDBJtagConnection)selectedDevice; - connection.setText(connectionDevice.getDefaultDeviceConnection()); - } else { - // legacy way - ipAddress.setText(selectedDevice.getDefaultIpAddress()); - portNumber.setText(selectedDevice.getDefaultPortNumber()); - } - useRemoteChanged(); - updateLaunchConfigurationDialog(); - break; - } - } - } - } - - private void useRemoteChanged() { - boolean enabled = useRemote.getSelection(); - jtagDevice.setEnabled(enabled); - ipAddress.setEnabled(enabled); - portNumber.setEnabled(enabled); - connection.setEnabled(enabled); - GDBJtagDeviceContribution selectedDeviceEntry = findJtagDeviceByName(jtagDevice.getText()); - if ((selectedDeviceEntry == null) || (selectedDeviceEntry.getDevice() == null)) { - remoteConnectParmsLayout.topControl = null; - remoteConnectionParameters.layout(); - } else { - IGDBJtagDevice device = selectedDeviceEntry.getDevice(); - if (device instanceof IGDBJtagConnection) { - remoteConnectParmsLayout.topControl = remoteConnectionBox; - remoteConnectionBox.getParent().layout(); - } else { - remoteConnectParmsLayout.topControl = remoteTcpipBox; - remoteTcpipBox.getParent().layout(); - } - } - } - - private GDBJtagDeviceContribution findJtagDeviceByName(String name) { - GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance().getGDBJtagDeviceContribution(); - for (GDBJtagDeviceContribution device : availableDevices) { - if (device.getDeviceName().equals(name)) { - return device; - } - } - return null; - } - - @Override - public void initializeFrom(ILaunchConfiguration configuration) { - try { - String gdbCommandAttr = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT); - gdbCommand.setText(gdbCommandAttr); - - CommandFactoryManager cfManager = MIPlugin.getDefault().getCommandFactoryManager(); - CommandFactoryDescriptor defDesc = cfManager.getDefaultDescriptor(IGDBJtagConstants.DEBUGGER_ID); - String commandFactoryAttr = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, defDesc.getName()); - int cfid = 0; - for (int i = 0; i < cfDescs.length; ++i) - if (cfDescs[i].getName().equals(commandFactoryAttr)) { - cfid = i; - break; - } - commandFactory.select(cfid); // populates protocol list too - - String miProtocolAttr = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, defDesc.getMIVersions()[0]); - int n = miProtocol.getItemCount(); - for (int i = 0; i < n; ++i) { - if (miProtocol.getItem(i).equals(miProtocolAttr)) { - miProtocol.select(i); - } - } - - boolean verboseModeAttr = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE, IMILaunchConfigurationConstants.DEBUGGER_VERBOSE_MODE_DEFAULT); - verboseMode.setSelection(verboseModeAttr); - - boolean useRemoteAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET); - useRemote.setSelection(useRemoteAttr); - useRemoteChanged(); - - savedJtagDevice = configuration.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, ""); //$NON-NLS-1$ - if (savedJtagDevice.length() == 0) { - jtagDevice.select(0); - } else { - String storedAddress = ""; //$NON-NLS-1$ - int storedPort = 0; - String storedConnection = ""; //$NON-NLS-1$ - - for (int i = 0; i < jtagDevice.getItemCount(); i++) { - if (jtagDevice.getItem(i).equals(savedJtagDevice)) { - storedAddress = configuration.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, IGDBJtagConstants.DEFAULT_IP_ADDRESS); - storedPort = configuration.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER); - storedConnection = configuration.getAttribute(IGDBJtagConstants.ATTR_CONNECTION, IGDBJtagConstants.DEFAULT_CONNECTION); - jtagDevice.select(i); - break; - } - } - - // New generic connection settings - try { - connection.setText(new URI(storedConnection).getSchemeSpecificPart()); - } catch (URISyntaxException e) { - Activator.log(e); - } - - // Legacy TCP/IP based settings - ipAddress.setText(storedAddress); - String portString = (0<storedPort)&&(storedPort<=65535) ? Integer.valueOf(storedPort).toString() : ""; //$NON-NLS-1$ - portNumber.setText(portString); - } - } catch (CoreException e) { - Activator.getDefault().getLog().log(e.getStatus()); - } - - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getId() - */ - @Override - public String getId() { - return TAB_ID; - } - - @Override - public void performApply(ILaunchConfigurationWorkingCopy configuration) { - configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbCommand.getText().trim()); - configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbCommand.getText().trim()); // DSF - configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, commandFactory.getText()); - configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, miProtocol.getText()); - configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE, verboseMode.getSelection()); - savedJtagDevice = jtagDevice.getText(); - configuration.setAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, savedJtagDevice); - configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, useRemote.getSelection()); - if (savedJtagDevice.length() > 0) { - try { - IGDBJtagDevice device = findJtagDeviceByName(jtagDevice.getText()).getDevice(); - if (device instanceof IGDBJtagConnection) { - String conn = connection.getText().trim(); - URI uri = new URI("gdb", conn, ""); //$NON-NLS-1$ //$NON-NLS-2$ - configuration.setAttribute(IGDBJtagConstants.ATTR_CONNECTION, uri.toString()); - } else { - String ip = ipAddress.getText().trim(); - configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ip); - int port = Integer.valueOf(portNumber.getText().trim()).intValue(); - configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, port); - } - } catch (URISyntaxException e) { - Activator.log(e); - } catch (NumberFormatException e) { - Activator.log(e); - } - } - } - - @Override - public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { - configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT); - CommandFactoryManager cfManager = MIPlugin.getDefault().getCommandFactoryManager(); - CommandFactoryDescriptor defDesc = cfManager.getDefaultDescriptor(IGDBJtagConstants.DEBUGGER_ID); - configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, defDesc.getName()); - configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, defDesc.getMIVersions()[0]); - configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE, IMILaunchConfigurationConstants.DEBUGGER_VERBOSE_MODE_DEFAULT); - configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET); - } - -} |