diff --git a/rse/examples/org.eclipse.rse.remotecdt/META-INF/MANIFEST.MF b/rse/examples/org.eclipse.rse.remotecdt/META-INF/MANIFEST.MF index 965719c0914..8d6b275a366 100644 --- a/rse/examples/org.eclipse.rse.remotecdt/META-INF/MANIFEST.MF +++ b/rse/examples/org.eclipse.rse.remotecdt/META-INF/MANIFEST.MF @@ -18,7 +18,9 @@ Require-Bundle: org.eclipse.rse.ui, org.eclipse.ui, org.eclipse.debug.core, org.eclipse.core.resources, - org.eclipse.core.runtime + org.eclipse.core.runtime, + org.eclipse.cdt.debug.mi.ui, + org.eclipse.cdt.debug.ui Eclipse-LazyStart: true Bundle-Vendor: %providerName Bundle-RequiredExecutionEnvironment: J2SE-1.4 diff --git a/rse/examples/org.eclipse.rse.remotecdt/plugin.xml b/rse/examples/org.eclipse.rse.remotecdt/plugin.xml index 756405b8f2a..4e7673e7cc0 100644 --- a/rse/examples/org.eclipse.rse.remotecdt/plugin.xml +++ b/rse/examples/org.eclipse.rse.remotecdt/plugin.xml @@ -41,6 +41,25 @@ Martin Oberhuber (Wind River) - fix 158529: Migrate docs to HTML / TOC format type="org.eclipse.rse.remotecdt.RemoteApplicationLaunch"> + + + + + + + + diff --git a/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/IRemoteConnectionConfigurationConstants.java b/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/IRemoteConnectionConfigurationConstants.java index 1597a0e88b4..d293815a243 100644 --- a/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/IRemoteConnectionConfigurationConstants.java +++ b/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/IRemoteConnectionConfigurationConstants.java @@ -22,9 +22,13 @@ public interface IRemoteConnectionConfigurationConstants extends DebugPlugin.getUniqueIdentifier() + ".REMOTE_TCP"; //$NON-NLS-1$ - public static final String ATTR_DEFAULT_PORT = "2345"; //$NON-NLS-1$ + public static final String ATTR_GDBSERVER_PORT = + DebugPlugin.getUniqueIdentifier() + ".ATTR_GDBSERVER_PORT"; //$NON-NLS-1$ + public static final String ATTR_GDBSERVER_COMMAND = + DebugPlugin.getUniqueIdentifier() + ".ATTR_GDBSERVER_COMMAND"; //$NON-NLS-1$ - public static final String ATTR_REMOTE_DEBUGGER_COMMAND = "gdbserver"; //$NON-NLS-1$ + public static final String ATTR_GDBSERVER_PORT_DEFAULT = "2345"; //$NON-NLS-1$ + public static final String ATTR_GDBSERVER_COMMAND_DEFAULT = "gdbserver"; //$NON-NLS-1$ /* * Generic Remote Path and Download options diff --git a/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/Messages.java b/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/Messages.java index 505287768e6..8b1fbb4a049 100644 --- a/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/Messages.java +++ b/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/Messages.java @@ -15,6 +15,14 @@ import org.eclipse.osgi.util.NLS; public class Messages extends NLS { private static final String BUNDLE_NAME = "org.eclipse.rse.remotecdt.messages"; //$NON-NLS-1$ + public static String Gdbserver_name_textfield_label; + + public static String Gdbserver_Settings_Tab_Name; + + public static String Port_number_textfield_label; + + public static String Remote_GDB_Debugger_Options; + public static String RemoteCMainTab_Program; public static String RemoteCMainTab_SkipDownload; public static String RemoteCMainTab_ErrorNoProgram; diff --git a/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/RemoteCDebuggerTab.java b/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/RemoteCDebuggerTab.java index 696488f9dd0..af34e9a4a20 100644 --- a/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/RemoteCDebuggerTab.java +++ b/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/RemoteCDebuggerTab.java @@ -29,12 +29,7 @@ public class RemoteCDebuggerTab extends CDebuggerTab { "org.eclipse.rse.remotecdt.launchgroup"); //$NON-NLS-1$ } - public String getName() { - // TODO Auto-generated method stub - return null; - } - - static final private String GDBSERVER_DEBUGGER_NAME = "gdb/mi"; //$NON-NLS-1$ + static final private String REMOTE_GDB_DEBUGGER_NAME = "remote gdb/mi"; //$NON-NLS-1$ public RemoteCDebuggerTab(boolean attachMode) { super(attachMode); @@ -46,7 +41,7 @@ public class RemoteCDebuggerTab extends CDebuggerTab { List list = new ArrayList(); for(int i = 0; i < debugConfigs.length; i++) { ICDebugConfiguration configuration = debugConfigs[i]; - if(configuration.getName().equals(GDBSERVER_DEBUGGER_NAME)) { + if(configuration.getName().equals(REMOTE_GDB_DEBUGGER_NAME)) { list.add(configuration); // Select as default selection defaultSelection = configuration.getID(); diff --git a/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/RemoteGDBDebuggerPage.java b/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/RemoteGDBDebuggerPage.java new file mode 100644 index 00000000000..119b9b5e1c0 --- /dev/null +++ b/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/RemoteGDBDebuggerPage.java @@ -0,0 +1,141 @@ +/******************************************************************************* + * Copyright (c) 2006 PalmSource, Inc. + * 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: + * Ewa Matejska (PalmSource) + * + * Referenced GDBDebuggerPage code to write this. + *******************************************************************************/ + +package org.eclipse.rse.remotecdt; + +import org.eclipse.cdt.debug.mi.internal.ui.GDBDebuggerPage; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; +import org.eclipse.swt.widgets.Text; + +/** + * The dynamic debugger tab for remote launches using gdb server. + * The gdbserver settings are used to start a gdbserver session on the + * remote and then to connect to it from the host. The DSDP-TM project is + * used to accomplish this. + */ +public class RemoteGDBDebuggerPage extends GDBDebuggerPage { + + protected Text fGDBServerCommandText; + + protected Text fGDBServerPortNumberText; + + public String getName() { + return Messages.Remote_GDB_Debugger_Options; + } + + public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) { + super.setDefaults(configuration); + configuration.setAttribute( IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND, + IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND_DEFAULT ); + configuration.setAttribute( IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT, + IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT ); + } + + public void initializeFrom( ILaunchConfiguration configuration ) { + super.initializeFrom(configuration); + String gdbserverCommand = null; + String gdbserverPortNumber = null; + try { + gdbserverCommand = configuration.getAttribute( IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND, + IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND_DEFAULT); + } + catch( CoreException e ) { + } + try { + gdbserverPortNumber = configuration.getAttribute( IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT, + IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT ); + } + catch( CoreException e ) { + } + fGDBServerCommandText.setText( gdbserverCommand ); + fGDBServerPortNumberText.setText( gdbserverPortNumber ); + } + + public void performApply( ILaunchConfigurationWorkingCopy configuration ) { + super.performApply(configuration); + String str = fGDBServerCommandText.getText(); + str.trim(); + configuration.setAttribute( IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND, str ); + str = fGDBServerPortNumberText.getText(); + str.trim(); + configuration.setAttribute( IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT, str ); + } + + protected void createGdbserverSettingsTab( TabFolder tabFolder ) { + TabItem tabItem = new TabItem( tabFolder, SWT.NONE ); + tabItem.setText( Messages.Gdbserver_Settings_Tab_Name ); + + Composite comp = new Composite(tabFolder, SWT.NULL); + comp.setLayout(new GridLayout(1, true)); + comp.setLayoutData(new GridData(GridData.FILL_BOTH)); + ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false; + comp.setFont( tabFolder.getFont() ); + tabItem.setControl( comp ); + + Composite subComp = new Composite(comp, SWT.NULL); + subComp.setLayout(new GridLayout(2, true)); + subComp.setLayoutData(new GridData(GridData.FILL_BOTH)); + ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false; + subComp.setFont( tabFolder.getFont() ); + + Label label = new Label(subComp, SWT.LEFT); + label.setText(Messages.Gdbserver_name_textfield_label); + GridData gd = new GridData(); + label.setLayoutData( gd ); + + + fGDBServerCommandText = new Text(subComp, SWT.SINGLE | SWT.BORDER); + GridData data = new GridData(); + fGDBServerCommandText.setLayoutData(data); + fGDBServerCommandText.addModifyListener( new ModifyListener() { + + public void modifyText( ModifyEvent evt ) { + updateLaunchConfigurationDialog(); + } + } ); + label = new Label(subComp, SWT.LEFT); + label.setText(Messages.Port_number_textfield_label); + gd = new GridData(); + label.setLayoutData( gd ); + + fGDBServerPortNumberText = new Text(subComp, SWT.SINGLE | SWT.BORDER); + data = new GridData(); + fGDBServerPortNumberText.setLayoutData(data); + fGDBServerPortNumberText.addModifyListener( new ModifyListener() { + + public void modifyText( ModifyEvent evt ) { + updateLaunchConfigurationDialog(); + } + } ); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.mi.internal.ui.GDBDebuggerPage#createTabs(org.eclipse.swt.widgets.TabFolder) + */ + public void createTabs( TabFolder tabFolder ) { + super.createTabs( tabFolder ); + createGdbserverSettingsTab( tabFolder ); + } +} + diff --git a/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/RemoteRunLaunchDelegate.java b/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/RemoteRunLaunchDelegate.java index 365f779ba21..31063691a47 100644 --- a/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/RemoteRunLaunchDelegate.java +++ b/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/RemoteRunLaunchDelegate.java @@ -89,11 +89,15 @@ public class RemoteRunLaunchDelegate extends AbstractCLaunchDelegate { // Automatically start up the gdbserver. In the future this should be expanded to launch // an arbitrary remote damon. - String command_arguments = ":" + IRemoteConnectionConfigurationConstants.ATTR_DEFAULT_PORT + " " //$NON-NLS-1$ //$NON-NLS-2$ + String gdbserver_port_number = config.getAttribute(IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT, + IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT); + String gdbserver_command = config.getAttribute(IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND, + IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND_DEFAULT); + String command_arguments = ":" + gdbserver_port_number + " " //$NON-NLS-1$ //$NON-NLS-2$ + spaceEscapify(remoteExePath); if(arguments != null && !arguments.equals("")) //$NON-NLS-1$ command_arguments += " " + arguments; //$NON-NLS-1$ - remoteShellProcess = remoteShellExec(config, IRemoteConnectionConfigurationConstants.ATTR_REMOTE_DEBUGGER_COMMAND, + remoteShellProcess = remoteShellExec(config, gdbserver_command, command_arguments); DebugPlugin.newProcess(launch, remoteShellProcess, Messages.RemoteRunLaunchDelegate_RemoteShell); @@ -104,7 +108,7 @@ public class RemoteRunLaunchDelegate extends AbstractCLaunchDelegate { wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, true); wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, getRemoteHostname(config)); wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, - IRemoteConnectionConfigurationConstants.ATTR_DEFAULT_PORT); + gdbserver_port_number); wc.doSave(); // Default to using the GDBServerCDIDebugger. @@ -272,7 +276,8 @@ public class RemoteRunLaunchDelegate extends AbstractCLaunchDelegate { IShellService shellService = (IShellService) getConnectedRemoteService(config, SHELL_SERVICE); // This is necessary because runCommand does not actually run the command right now. - IHostShell hostShell = shellService.launchShell(new NullProgressMonitor(), "",null); //$NON-NLS-1$ + String env[] = new String[0]; + IHostShell hostShell = shellService.launchShell(new NullProgressMonitor(), "",env); //$NON-NLS-1$ hostShell.writeToShell(remote_command); Process p = null; diff --git a/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/messages.properties b/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/messages.properties index 22520c08b84..e122c11b9e7 100644 --- a/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/messages.properties +++ b/rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/messages.properties @@ -17,7 +17,11 @@ RemoteRunLaunchDelegate_6=Error during file upload. RemoteRunLaunchDelegate_7=Could not create the hostShellProcess.\n RemoteCMainTab_Program=Remote Path for C/C++ Application: RemoteCMainTab_SkipDownload=Skip download to target path. +Remote_GDB_Debugger_Options=Remote GDB Debugger Options RemoteCMainTab_ErrorNoProgram=Remote executable path is not specified. RemoteCMainTab_ErrorNoConnection=Remote Connection must be selected. RemoteCMainTab_Connection=Connection: RemoteCMainTab_New=New +Gdbserver_Settings_Tab_Name=Gdbserver Settings +Gdbserver_name_textfield_label=Gdbserver name: +Port_number_textfield_label=Port number: