mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-04 23:55:26 +02:00
[158784] Apply patch for specifying gdbserver name, port and debugger options.
This commit is contained in:
parent
9dae46223a
commit
65622aa27e
8 changed files with 192 additions and 14 deletions
|
@ -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
|
||||
|
|
|
@ -41,6 +41,25 @@ Martin Oberhuber (Wind River) - fix 158529: Migrate docs to HTML / TOC format
|
|||
type="org.eclipse.rse.remotecdt.RemoteApplicationLaunch">
|
||||
</launchConfigurationTabGroup>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.debug.core.CDebugger">
|
||||
<debugger
|
||||
class="org.eclipse.cdt.debug.mi.core.GDBServerCDIDebugger2"
|
||||
cpu="*"
|
||||
id="org.eclipse.rse.remotecdt.RemoteGDBDebugger"
|
||||
modes="run"
|
||||
name="remote gdb/mi"
|
||||
platform="*">
|
||||
</debugger>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.debug.ui.CDebuggerPage">
|
||||
<debuggerPage
|
||||
class="org.eclipse.rse.remotecdt.RemoteGDBDebuggerPage"
|
||||
debuggerID="org.eclipse.rse.remotecdt.RemoteGDBDebugger"
|
||||
id="org.eclipse.rse.remotecdt.RemoteGDBDebuggerPage">
|
||||
</debuggerPage>
|
||||
</extension>
|
||||
|
||||
<!-- ============================================ -->
|
||||
<!-- Define Help Context -->
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue