1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 01:06:01 +02:00

Bug 108636: mi level selection option should be moved to the gdb page.

This commit is contained in:
Mikhail Khodjaiants 2005-09-06 19:11:57 +00:00
parent d743e195a3
commit db189e5935
12 changed files with 116 additions and 64 deletions

View file

@ -1,3 +1,7 @@
2005-09-01 Mikhail Khodjaiants
Bug 108636: mi level selection option should be moved to the gdb page.
* ICDTLaunchConfigurationConstants.java
2005-09-01 Mikhail Khodjaiants
Bug 108424: Debugger stops on removed breakpoints.
* CBreakpointManager.java

View file

@ -151,6 +151,7 @@ public interface ICDTLaunchConfigurationConstants {
/**
* launch configuration attribute key. The value is a string specifying the protocol to
* use. For now only "mi", "mi1", "m2", "mi3" are supported.
* @deprecated
*/
public static final String ATTR_DEBUGGER_PROTOCOL = CDT_LAUNCH_ID + ".protocol"; //$NON-NLS-1$

View file

@ -1,3 +1,10 @@
2005-09-01 Mikhail Khodjaiants
Bug 108636: mi level selection option should be moved to the gdb page.
* src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger.java
* src/org/eclipse/cdt/debug/mi/core/GDBServerCDIDebugger.java
* src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java
* src/org/eclipse/cdt/debug/mi/core/MIPlugin.java
2005-09-01 Mikhail Khodjaiants
Bug 108424: Debugger stops on removed breakpoints.
* cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java

View file

@ -94,7 +94,7 @@ public class GDBCDIDebugger implements ICDIDebugger {
boolean failed = false;
try {
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
String miVersion = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi"); //$NON-NLS-1$
String miVersion = getMIVersion(config);
boolean usePty = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, true);
File cwd = getProjectPath(config).toFile();
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
@ -130,7 +130,7 @@ public class GDBCDIDebugger implements ICDIDebugger {
boolean failed = false;
try {
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
String miVersion = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi"); //$NON-NLS-1$
String miVersion = getMIVersion(config);
int pid = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_ATTACH_PROCESS_ID, -1);
File cwd = getProjectPath(config).toFile();
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
@ -163,7 +163,7 @@ public class GDBCDIDebugger implements ICDIDebugger {
boolean failed = false;
try {
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
String miVersion = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi"); //$NON-NLS-1$
String miVersion = getMIVersion(config);
File cwd = getProjectPath(config).toFile();
IPath coreFile = new Path(config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, (String)null));
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
@ -293,4 +293,7 @@ public class GDBCDIDebugger implements ICDIDebugger {
return new CoreException(status);
}
protected String getMIVersion( ILaunchConfiguration config ) {
return MIPlugin.getMIVersion( config );
}
}

View file

@ -12,9 +12,7 @@
package org.eclipse.cdt.debug.mi.core;
import java.io.File;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
@ -44,7 +42,7 @@ public class GDBServerCDIDebugger extends GDBCDIDebugger {
boolean failed = false;
try {
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
String miVersion = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi"); //$NON-NLS-1$
String miVersion = getMIVersion(config);
File cwd = getProjectPath(config).toFile();
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
if (config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, false)) {

View file

@ -49,4 +49,10 @@ public interface IMILaunchConfigurationConstants {
* Launch configuration attribute value. The key is ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS.
*/
public static boolean DEBUGGER_STOP_ON_SOLIB_EVENTS_DEFAULT = false;
/**
* launch configuration attribute key. The value is a string specifying the protocol to
* use. For now only "mi", "mi1", "m2", "mi3" are supported.
*/
public static final String ATTR_DEBUGGER_PROTOCOL = MIPlugin.getUniqueIdentifier() + ".protocol"; //$NON-NLS-1$
}

View file

@ -18,6 +18,7 @@ import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.command.CLITargetAttach;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
@ -25,10 +26,12 @@ import org.eclipse.cdt.debug.mi.core.command.MIStackListFrames;
import org.eclipse.cdt.debug.mi.core.command.MITargetSelect;
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.utils.pty.PTY;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.osgi.framework.BundleContext;
/**
@ -413,4 +416,21 @@ public class MIPlugin extends Plugin {
super.stop(context);
}
public static String getMIVersion( ILaunchConfiguration config ) {
String miVersion = ""; //$NON-NLS-1$
try {
miVersion = config.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "" ); //$NON-NLS-1$
}
catch( CoreException e ) {
}
if ( miVersion.length() == 0 ) {
try {
miVersion = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi" ); //$NON-NLS-1$
}
catch( CoreException e ) {
miVersion = "mi"; //$NON-NLS-1$
}
}
return miVersion;
}
}

View file

@ -1,3 +1,8 @@
2005-09-01 Mikhail Khodjaiants
Bug 108636: mi level selection option should be moved to the gdb page.
* MIUIMessages.properties
* GDBDebuggerPage.java
2005-09-02 Mikhail Khodjaiants
Bug 108723: Create a separate tab for gdb server's conection options.
* GDBDebuggerPage.java

View file

@ -13,8 +13,8 @@ package org.eclipse.cdt.debug.mi.internal.ui;
import java.io.File;
import java.util.Observable;
import java.util.Observer;
import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.core.MIPlugin;
import org.eclipse.cdt.debug.mi.ui.IMILaunchConfigurationComponent;
import org.eclipse.cdt.debug.mi.ui.MIUIUtils;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
@ -27,9 +27,11 @@ 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.SelectionListener;
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.Label;
@ -43,12 +45,17 @@ import org.eclipse.swt.widgets.Text;
*/
public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements Observer {
final private static String DEFAULT_MI_PROTOCOL = MIUIMessages.getString( "GDBDebuggerPage.12" ); //$NON-NLS-1$
final protected String[] protocolItems = new String[] { DEFAULT_MI_PROTOCOL, "mi1", "mi2", "mi3" }; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
protected TabFolder fTabFolder;
protected Text fGDBCommandText;
protected Text fGDBInitText;
protected Combo fProtocolCombo;
private IMILaunchConfigurationComponent fSolibBlock;
private boolean fIsInitializing = false;
@ -67,6 +74,7 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) {
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" ); //$NON-NLS-1$
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, "" ); //$NON-NLS-1$
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi" ); //$NON-NLS-1$
if ( fSolibBlock != null )
fSolibBlock.setDefaults( configuration );
}
@ -90,24 +98,47 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
String gdbInit = ""; //$NON-NLS-1$
try {
gdbCommand = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" ); //$NON-NLS-1$
}
catch( CoreException e ) {
}
try {
gdbInit = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, "" ); //$NON-NLS-1$
}
catch( CoreException e ) {
}
String miVersion = MIPlugin.getMIVersion( configuration );
if ( miVersion.compareTo( "mi" ) == 0 ) { //$NON-NLS-1$
miVersion = DEFAULT_MI_PROTOCOL;
}
if ( fSolibBlock != null )
fSolibBlock.initializeFrom( configuration );
fGDBCommandText.setText( gdbCommand );
fGDBInitText.setText( gdbInit );
int index = 0;
if ( miVersion.length() > 0 ) {
for( int i = 0; i < protocolItems.length; ++i ) {
if ( protocolItems[i].equals( miVersion ) ) {
index = i;
break;
}
}
}
fProtocolCombo.select( index );
setInitializing( false );
}
public void performApply( ILaunchConfigurationWorkingCopy configuration ) {
String gdbStr = fGDBCommandText.getText();
gdbStr.trim();
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbStr );
gdbStr = fGDBInitText.getText();
gdbStr.trim();
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, gdbStr );
String str = fGDBCommandText.getText();
str.trim();
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, str );
str = fGDBInitText.getText();
str.trim();
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, str );
str = fProtocolCombo.getText();
if ( str.compareTo( DEFAULT_MI_PROTOCOL ) == 0 ) {
str = "mi"; //$NON-NLS-1$
}
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, str );
if ( fSolibBlock != null )
fSolibBlock.performApply( configuration );
}
@ -233,12 +264,13 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
fGDBInitText.setText( res );
}
} );
label = ControlFactory.createLabel( comp, MIUIMessages.getString( "GDBDebuggerPage.9" ), //$NON-NLS-1$
label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "GDBDebuggerPage.9" ), //$NON-NLS-1$
200, SWT.DEFAULT, SWT.WRAP );
gd = new GridData( GridData.FILL_HORIZONTAL );
gd.horizontalSpan = 1;
gd.horizontalSpan = 3;
gd.widthHint = 200;
label.setLayoutData( gd );
createProtocolCombo( subComp );
}
public void createSolibTab( TabFolder tabFolder ) {
@ -280,4 +312,23 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
private void setInitializing( boolean isInitializing ) {
fIsInitializing = isInitializing;
}
protected void createProtocolCombo( Composite parent ) {
Label label = new Label( parent, SWT.NONE );
label.setText( MIUIMessages.getString( "GDBDebuggerPage.11" ) ); //$NON-NLS-1$
fProtocolCombo = new Combo( parent, SWT.READ_ONLY | SWT.DROP_DOWN );
fProtocolCombo.setItems( protocolItems );
fProtocolCombo.addSelectionListener( new SelectionListener() {
public void widgetDefaultSelected( SelectionEvent e ) {
if ( !isInitializing() )
updateLaunchConfigurationDialog();
}
public void widgetSelected( SelectionEvent e ) {
if ( !isInitializing() )
updateLaunchConfigurationDialog();
}
} );
}
}

View file

@ -21,6 +21,8 @@ GDBDebuggerPage.7=B&rowse...
GDBDebuggerPage.8=GDB Command File
GDBDebuggerPage.9=(Warning: Some commands in this file may interfere with the startup operation of the debugger, for example "run".)
GDBDebuggerPage.10=Shared Libraries
GDBDebuggerPage.11=MI Protocol:
GDBDebuggerPage.12=Default
GDBServerDebuggerPage.0=TCP
GDBServerDebuggerPage.1=Serial
GDBServerDebuggerPage.10=Connection

View file

@ -1,3 +1,7 @@
2005-09-01 Mikhail Khodjaiants
Bug 108636: mi level selection option should be moved to the gdb page.
* CDebuggerTab.java
2005-08-31 Alain Magloire
Fix Pr 107571: Part of this fix is to add the
inferior process in the session

View file

@ -18,7 +18,6 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IBinaryParser;
import org.eclipse.cdt.core.ICExtensionReference;
@ -45,7 +44,6 @@ import org.eclipse.swt.events.SelectionEvent;
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.Control;
import org.eclipse.swt.widgets.Group;
@ -59,9 +57,6 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
private Button fRegBookKeeping;
final String[] protocolItems = new String[] { "mi", "mi1", "mi2", "mi3" }; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
private Combo fPCombo;
/**
* Constructor for AdvancedDebuggerOptionsDialog.
*/
@ -85,25 +80,10 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
fVarBookKeeping.setText(LaunchMessages.getString("CDebuggerTab.Variables")); //$NON-NLS-1$
fRegBookKeeping = new Button(group, SWT.CHECK);
fRegBookKeeping.setText(LaunchMessages.getString("CDebuggerTab.Registers")); //$NON-NLS-1$
createProtocolCombo(composite, 2);
initialize();
return composite;
}
protected void createProtocolCombo(Composite parent, int colspan) {
Group comboComp = new Group(parent, SWT.NONE);
comboComp.setText("Protocol");
GridLayout layout = new GridLayout(2, false);
comboComp.setLayout(layout);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = colspan;
comboComp.setLayoutData(gd);
fPCombo = new Combo(comboComp, SWT.READ_ONLY | SWT.DROP_DOWN);
fPCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fPCombo.setItems(protocolItems);
}
protected void okPressed() {
saveValues();
super.okPressed();
@ -115,19 +95,6 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
fVarBookKeeping.setSelection( (varBookkeeping instanceof Boolean) ? ! ((Boolean)varBookkeeping).booleanValue() : true);
Object regBookkeeping = attr.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING);
fRegBookKeeping.setSelection( (regBookkeeping instanceof Boolean) ? ! ((Boolean)regBookkeeping).booleanValue() : true);
Object protocol = attr.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL);
int index = 0;
if (protocol instanceof String) {
String p = (String)protocol;
if (p != null && p.length() > 0) {
for (int i = 0; i < protocolItems.length; ++i) {
if (protocolItems[i].equals(p)) {
index = i;
}
}
}
}
fPCombo.select(index);
}
private void saveValues() {
@ -136,10 +103,6 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
attr.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, varBookkeeping);
Boolean regBookkeeping = (fRegBookKeeping.getSelection()) ? Boolean.FALSE : Boolean.TRUE;
attr.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING, regBookkeeping);
String protocol = fPCombo.getText();
if (protocol != null && protocol.length() > 0) {
attr.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, protocol);
}
updateLaunchConfigurationDialog();
}
@ -422,11 +385,6 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
attr.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING, regBookkeeping);
} catch (CoreException e) {
}
try {
String protocol = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi"); //$NON-NLS-1$
attr.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, protocol);
} catch (CoreException e) {
}
}
private void applyAdvancedAttributes(ILaunchConfigurationWorkingCopy config) {
@ -439,13 +397,6 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
if (regBookkeeping instanceof Boolean)
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING,
((Boolean)regBookkeeping).booleanValue());
Object protocol = attr.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL);
if (protocol instanceof String) {
String p = (String)protocol;
if (p != null && p.length() > 0) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, p);
}
}
}
protected Shell getShell() {