[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-patch] CDT Head patch: Shared Library path editor.
|
Alain, Mikhail, thanks for your earlier feedback on this patch.
Please find attached a revised version of the Shared Library
path editor for GDBServerDebugger. The implementation and
the UI now look very similar to the GDBDebugger.
I've also propagated the stop-on-solib-events change to
GDBServerDebugger
Bug 47230 has been created to track this request.
Regards,
Ashish.
Mikhail Khodjaiants wrote:
If you put the current options of the GDB Server page on the main tab, you
can just copy the 'Shared Libraries' tab from 'GDBDebuggerPage'.
----- Original Message -----
From: "Ashish Karkare" <ashish.karkare@xxxxxxxxxxx>
To: <cdt-patch@xxxxxxxxxxx>
Sent: Friday, November 14, 2003 2:17 PM
Subject: Re: [cdt-patch] CDT Head patch: Shared Library path editor.
Mikhail Khodjaiants wrote:
Why didn't you use the existing GDBSolibBlock or SolibSearchPathBlock
classes?
I think it would be better to make the GDB Server page look like all
other
pages.
Thanks for pointing it out. The original fix was implemented when
GDBSolib* and SolibSearch* weren't available.
I will revisit the fix.
Ashish.
_______________________________________________
cdt-patch mailing list
cdt-patch@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/cdt-patch
_______________________________________________
cdt-patch mailing list
cdt-patch@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/cdt-patch
Index: GDBServerDebuggerPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBServerDebuggerPage.java,v
retrieving revision 1.3
diff -u -r1.3 GDBServerDebuggerPage.java
--- GDBServerDebuggerPage.java 6 Nov 2003 21:06:45 -0000 1.3
+++ GDBServerDebuggerPage.java 21 Nov 2003 14:41:37 -0000
@@ -7,12 +7,16 @@
*
* Contributors:
* Monta Vista - initial API and implementation
+ * TimeSys - serial line speed support and other fixes.
*******************************************************************************/
package org.eclipse.cdt.debug.mi.internal.ui;
+import java.util.Observable;
+import java.util.Observer;
+
import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
-import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
+import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
@@ -28,9 +32,12 @@
import org.eclipse.swt.widgets.Combo;
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;
-public class GDBServerDebuggerPage extends AbstractLaunchConfigurationTab {
+public class GDBServerDebuggerPage extends AbstractLaunchConfigurationTab implements Observer
+{
protected Text fDebuggerCommandText;
protected Button fTCPButton;
@@ -39,166 +46,24 @@
protected Text fHostPort;
protected Text fAsyncDev;
protected Combo fAsyncDevSpeedCombo;
- private Button fAutoSoLibButton;
+ private GDBSolibBlock fSolibBlock;
+ private TabFolder fTabFolder;
public void createControl(Composite parent) {
+
Composite comp = new Composite(parent, SWT.NONE);
- GridLayout topLayout = new GridLayout();
- topLayout.numColumns = 2;
- comp.setLayout(topLayout);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ comp.setLayout(new GridLayout());
+ GridData gd = new GridData(GridData.FILL_BOTH);
comp.setLayoutData(gd);
- setControl(comp);
-
- createVerticalSpacer(comp, 2);
-
- Label debugCommandLabel= new Label(comp, SWT.NONE);
- debugCommandLabel.setText("GDBServer gdb executable:");
-
- fDebuggerCommandText= new Text(comp, SWT.SINGLE | SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- fDebuggerCommandText.setLayoutData(gd);
- fDebuggerCommandText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent evt) {
- updateLaunchConfigurationDialog();
- }
- });
-
- Composite radioComp = new Composite(comp, SWT.NONE);
- GridLayout radioLayout = new GridLayout(2, true);
- radioLayout.marginHeight = 0;
- radioLayout.marginWidth = 0;
- radioComp.setLayout(radioLayout);
- gd = new GridData();
- gd.horizontalSpan = 2;
- radioComp.setLayoutData(gd);
- fTCPButton = createRadioButton(radioComp, "Connect using TCP");
- fTCPButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- boolean isTcp = fTCPButton.getSelection();
- fHostPort.setEnabled(isTcp);
- fHostText.setEnabled(isTcp);
- updateLaunchConfigurationDialog();
- }
- });
- fAsyncButton = createRadioButton(radioComp, "Connect using a serial port");
- fAsyncButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- fAsyncDev.setEnabled(fAsyncButton.getSelection());
- fAsyncDevSpeedCombo.setEnabled(fAsyncButton.getSelection());
- updateLaunchConfigurationDialog();
- }
- });
-
-
- Label hostTextLabel= new Label(comp, SWT.NONE);
- hostTextLabel.setText("GDBServer TCP host:");
-
- fHostText= new Text(comp, SWT.SINGLE | SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- fHostText.setLayoutData(gd);
- fHostText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent evt) {
- updateLaunchConfigurationDialog();
- }
- });
-
- Label hostPortLabel= new Label(comp, SWT.NONE);
- hostPortLabel.setText("GDBServer TCP port:");
-
- fHostPort= new Text(comp, SWT.SINGLE | SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- fHostPort.setLayoutData(gd);
- fHostPort.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent evt) {
- updateLaunchConfigurationDialog();
- }
- });
+ fTabFolder = new TabFolder( comp, SWT.NONE );
+ fTabFolder.setLayoutData( new GridData( GridData.FILL_BOTH | GridData.GRAB_VERTICAL ) );
-
-
- Label asyncDevLabel= new Label(comp, SWT.NONE);
- asyncDevLabel.setText("Serial device:");
-
- fAsyncDev= new Text(comp, SWT.SINGLE | SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- fAsyncDev.setLayoutData(gd);
- fAsyncDev.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent evt) {
- updateLaunchConfigurationDialog();
- }
- });
+ createTabs( fTabFolder );
- Label asyncDevSpeedLabel= new Label(comp, SWT.NONE);
- asyncDevSpeedLabel.setText("Serial speed:");
-
-
- fAsyncDevSpeedCombo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY);
- String choices [] = {"9600", "19200","38400", "57600", "115200"};
- fAsyncDevSpeedCombo.setItems(choices);
- fAsyncDevSpeedCombo.select(choices.length-1);
-
- gd = new GridData(GridData.FILL_HORIZONTAL);
- fAsyncDevSpeedCombo.setLayoutData(gd);
- fAsyncDevSpeedCombo.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent arg0) {
-
- updateLaunchConfigurationDialog();
-
- }
- });
-
- fTCPButton.setSelection(true);
- fAsyncButton.setSelection(false);
- fHostText.setEnabled(true);
- fHostPort.setEnabled(true);
- fAsyncDev.setEnabled(false);
- fHostPort.setEnabled(true);
- fHostText.setEnabled(true);
- fAsyncDevSpeedCombo.setEnabled(false);
-
- createVerticalSpacer(comp, 2);
-
- fAutoSoLibButton = new Button(comp, SWT.CHECK ) ;
- fAutoSoLibButton.setText("Load shared library symbols automatically");
- gd = new GridData();
- gd.horizontalSpan = 2;
- fAutoSoLibButton.setLayoutData(gd);
-/*
- ListEditor listEditor = new ListEditor("1", "Shared library search paths:", comp) {
- protected String createList(String[] items) {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < items.length; i++) {
- buf.append(items[i]);
- buf.append(';');
- }
- return buf.toString();
- }
- protected String getNewInputObject() {
-// StringInputDialog dialog= new StringInputDialog(comp.getShell(), "Library Path", null, "Enter a library path", "", null);
-// if (dialog.open() == dialog.OK) {
-// return dialog.getValue();
-// } else {
-// return null;
-// }
- return null;
- }
-
- protected String[] parseString(String list) {
- StringTokenizer st = new StringTokenizer(list, ";");
- ArrayList v = new ArrayList();
- while (st.hasMoreElements()) {
- v.add(st.nextElement());
- }
- return (String[]) v.toArray(new String[v.size()]);
- }
-
- };
-*/
-
+ fTabFolder.setSelection( 0 );
+ setControl( parent );
}
-
+
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
String attr;
@@ -245,6 +110,8 @@
if (attr == null) {
configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, "115200");
}
+ if ( fSolibBlock != null )
+ fSolibBlock.setDefaults( configuration );
}
/**
@@ -287,10 +154,8 @@
String hostPort = "";
String asyncDev = "/dev/ttyS0";
String asyncDevSpeed = "115200";
- boolean autosolib = false;
try {
debuggerCommand = configuration.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
- autosolib = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, false);
} catch (CoreException e) {
}
try {
@@ -312,7 +177,8 @@
fHostPort.setEnabled(isTcp);
fAsyncDev.setEnabled(!isTcp);
fAsyncDevSpeedCombo.setEnabled(!isTcp);
- fAutoSoLibButton.setSelection(autosolib);
+ if ( fSolibBlock != null )
+ fSolibBlock.initializeFrom( configuration );
}
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
@@ -326,12 +192,13 @@
hostPort.trim();
asyncDev.trim();
configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEBUG_NAME, debuggerCommand);
- configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, fAutoSoLibButton.getSelection());
configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, fTCPButton.getSelection());
configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, hostText);
configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, hostPort);
configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV, asyncDev);
configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, asyncDevSpeed);
+ if ( fSolibBlock != null )
+ fSolibBlock.performApply( configuration );
}
public String getName() {
@@ -343,5 +210,173 @@
*/
protected void updateLaunchConfigurationDialog() {
super.updateLaunchConfigurationDialog();
+ }
+
+/* (non-Javadoc)
+ * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
+ */
+ public void update( Observable o, Object arg )
+ {
+ updateLaunchConfigurationDialog();
+ }
+ public GDBSolibBlock createSolibBlock( Composite parent )
+ {
+ GDBSolibBlock block = new GDBSolibBlock();
+ block.createBlock( parent, true, true, true );
+ return block;
+ }
+
+ public void createTabs( TabFolder tabFolder )
+ {
+ createMainTab( tabFolder );
+ createSolibTab( tabFolder );
+ }
+
+ public void createMainTab( TabFolder tabFolder )
+ {
+ GridData gd;
+ TabItem tabItem = new TabItem( tabFolder, SWT.NONE );
+ tabItem.setText( "Main" );
+
+ Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH );
+ ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
+ tabItem.setControl( comp );
+
+ Composite subComp = ControlFactory.createCompositeEx( comp, 2, GridData.FILL_HORIZONTAL );
+ ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
+
+ Label debugCommandLabel= new Label(subComp, SWT.NONE);
+ debugCommandLabel.setText("GDBServer gdb executable:");
+
+ fDebuggerCommandText= new Text(subComp, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ fDebuggerCommandText.setLayoutData(gd);
+ fDebuggerCommandText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ Composite radioComp = new Composite(subComp, SWT.NONE);
+ GridLayout radioLayout = new GridLayout(2, true);
+
+ radioLayout.marginHeight = 0;
+ radioLayout.marginWidth = 0;
+ radioComp.setLayout(radioLayout);
+ gd = new GridData();
+ gd.horizontalSpan = 2;
+ radioComp.setLayoutData(gd);
+ fTCPButton = createRadioButton(radioComp, "Connect using TCP");
+ fTCPButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ boolean isTcp = fTCPButton.getSelection();
+ fHostPort.setEnabled(isTcp);
+ fHostText.setEnabled(isTcp);
+ updateLaunchConfigurationDialog();
+ }
+ });
+ fAsyncButton = createRadioButton(radioComp, "Connect using a serial port");
+ fAsyncButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ fAsyncDev.setEnabled(fAsyncButton.getSelection());
+ fAsyncDevSpeedCombo.setEnabled(fAsyncButton.getSelection());
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+
+ Label hostTextLabel= new Label(subComp, SWT.NONE);
+ hostTextLabel.setText("GDBServer TCP host:");
+
+ fHostText= new Text(subComp, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fHostText.setLayoutData(gd);
+ fHostText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ Label hostPortLabel= new Label(subComp, SWT.NONE);
+ hostPortLabel.setText("GDBServer TCP port:");
+
+ fHostPort= new Text(subComp, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fHostPort.setLayoutData(gd);
+ fHostPort.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+
+
+ Label asyncDevLabel= new Label(subComp, SWT.NONE);
+ asyncDevLabel.setText("Serial device:");
+
+ fAsyncDev= new Text(subComp, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fAsyncDev.setLayoutData(gd);
+ fAsyncDev.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ Label asyncDevSpeedLabel= new Label(subComp, SWT.NONE);
+ asyncDevSpeedLabel.setText("Serial speed:");
+
+
+ fAsyncDevSpeedCombo = new Combo(subComp, SWT.DROP_DOWN | SWT.READ_ONLY);
+ String choices [] = {"9600", "19200","38400", "57600", "115200"};
+ fAsyncDevSpeedCombo.setItems(choices);
+ fAsyncDevSpeedCombo.select(choices.length-1);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fAsyncDevSpeedCombo.setLayoutData(gd);
+ fAsyncDevSpeedCombo.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent arg0) {
+
+ updateLaunchConfigurationDialog();
+
+ }
+ });
+
+ fTCPButton.setSelection(true);
+ fAsyncButton.setSelection(false);
+ fHostText.setEnabled(true);
+ fHostPort.setEnabled(true);
+ fAsyncDev.setEnabled(false);
+ fHostPort.setEnabled(true);
+ fHostText.setEnabled(true);
+ fAsyncDevSpeedCombo.setEnabled(false);
+
+ }
+
+public void createSolibTab( TabFolder tabFolder )
+ {
+ TabItem tabItem = new TabItem( tabFolder, SWT.NONE );
+ tabItem.setText( "Shared Libraries" );
+
+ Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH );
+ tabItem.setControl( comp );
+
+ fSolibBlock = createSolibBlock( comp );
+ fSolibBlock.addObserver( this );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
+ */
+ public void dispose()
+ {
+ if ( fSolibBlock != null )
+ {
+ fSolibBlock.deleteObserver( this );
+ fSolibBlock.dispose();
+ }
+ super.dispose();
}
}
Index: GDBServerDebugger.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java,v
retrieving revision 1.5
diff -u -r1.5 GDBServerDebugger.java
--- GDBServerDebugger.java 6 Nov 2003 20:56:17 -0000 1.5
+++ GDBServerDebugger.java 21 Nov 2003 14:39:11 -0000
@@ -7,6 +7,7 @@
*
* Contributors:
* Monta Vista - initial API and implementation
+ * TimeSys - fixes
*******************************************************************************/
package org.eclipse.cdt.debug.mi.core;
@@ -36,11 +37,24 @@
void initializeLibraries(ILaunchConfiguration config, Session session) throws CDIException {
try {
- ICDISharedLibraryManager mgr = session.getSharedLibraryManager();
- if (mgr instanceof SharedLibraryManager) {
+ ICDISharedLibraryManager manager = session.getSharedLibraryManager();
+ if (manager instanceof SharedLibraryManager) {
+ SharedLibraryManager mgr = (SharedLibraryManager)manager;
boolean autolib = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, false);
+ boolean stopOnSolibEvents = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, false);
try {
((SharedLibraryManager)mgr).setAutoLoadSymbols(autolib);
+ mgr.setStopOnSolibEvents(stopOnSolibEvents);
+ // The idea is that if the user set autolib, by default
+ // we provide with the capability of deferred breakpoints
+ // And we set setStopOnSolib events for them(but they should not see those things.
+ //
+ // If the user explicitly set stopOnSolibEvents well it probably
+ // means that they wanted to see those events so do no do deferred breakpoints.
+ if (autolib && !stopOnSolibEvents) {
+ mgr.setDeferredBreakpoint(true);
+ mgr.setStopOnSolibEvents(true);
+ }
} catch (CDIException e) {
// ignore this one, cause problems for many gdb.
}
@@ -48,7 +62,7 @@
List p = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, new ArrayList(1));
if (p.size() > 0) {
String[] paths = (String[])p.toArray(new String[0]);
- mgr.setSharedLibraryPaths(paths);
+ manager.setSharedLibraryPaths(paths);
}
} catch (CoreException e) {
throw new CDIException("Error initializing: " + e.getMessage());