diff options
6 files changed, 89 insertions, 7 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java index 5ff58c50c4b..b587cc519bd 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java @@ -685,7 +685,7 @@ public class BreakpointManager extends Manager { public void setLocationBreakpoint (LocationBreakpoint bkpt) throws CDIException { Target target = (Target)bkpt.getTarget(); MISession miSession = target.getMISession(); - MIBreakInsert[] breakInserts = createMIBreakInsert(bkpt); + MIBreakInsert[] breakInserts = createMIBreakInsert(bkpt, miSession.isBreakpointsWithFullName()); List pointList = new ArrayList(); boolean restart = false; try { @@ -918,8 +918,10 @@ public class BreakpointManager extends Manager { public AddressLocation createAddressLocation(BigInteger address) { return new AddressLocation(address); } - MIBreakInsert[] createMIBreakInsert(LocationBreakpoint bkpt) throws CDIException { + return createMIBreakInsert(bkpt, false); + } + MIBreakInsert[] createMIBreakInsert(LocationBreakpoint bkpt, boolean fullPath) throws CDIException { boolean hardware = bkpt.isHardware(); boolean temporary = bkpt.isTemporary(); String exprCond = null; @@ -938,7 +940,9 @@ public class BreakpointManager extends Manager { ICDILocator locator = bkpt.getLocator(); String file = locator.getFile(); if (file != null) { - file = new File(file).getName(); + if (fullPath==false) { + file = new File(file).getName(); + } } String function = locator.getFunction(); int no = locator.getLineNumber(); diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MISession.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MISession.java index 16bb6d6cb97..f76a1aaf49a 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MISession.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MISession.java @@ -66,6 +66,7 @@ public class MISession extends Observable { boolean terminated; boolean useInterpreterExecConsole; boolean verboseMode = false; + boolean breakpointsWithFullName = false; // hold the type of the session(post-mortem, attach etc ..) int sessionType; @@ -842,4 +843,21 @@ public class MISession extends Observable { public boolean isVerboseModeEnabled() { return verboseMode; } + + + /** + * getter for breakpointsWithFullName + * @return true when debugger should set breakpoints using full file name + */ + public final boolean isBreakpointsWithFullName() { + return breakpointsWithFullName; + } + + /** + * setter for breakpointsWithFullName + * set to true when debugger should set breakpoints using full file name, default is false + */ + public final void setBreakpointsWithFullName(boolean breakpointsWithFullName) { + this.breakpointsWithFullName = breakpointsWithFullName; + } } diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/AbstractGDBCDIDebugger.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/AbstractGDBCDIDebugger.java index d766fc05e9f..e799b9c5ca4 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/AbstractGDBCDIDebugger.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/AbstractGDBCDIDebugger.java @@ -63,6 +63,7 @@ abstract public class AbstractGDBCDIDebugger implements ICDIDebugger2 { throw new OperationCanceledException(); } boolean verboseMode = verboseMode( launch.getLaunchConfiguration() ); + boolean breakpointsFullPath = getBreakpointsWithFullNameAttribute(launch.getLaunchConfiguration() ); Session session = createGDBSession( launch, executable, monitor ); if ( session != null ) { try { @@ -73,8 +74,11 @@ abstract public class AbstractGDBCDIDebugger implements ICDIDebugger2 { IProcess debuggerProcess = createGDBProcess( (Target)targets[i], launch, debugger, renderDebuggerProcessLabel( launch ), null ); launch.addProcess( debuggerProcess ); } - ((Target)targets[i]).enableVerboseMode( verboseMode ); - ((Target)targets[i]).getMISession().start(); + Target target = (Target)targets[i]; + target.enableVerboseMode( verboseMode ); + target.getMISession().setBreakpointsWithFullName(breakpointsFullPath); + target.getMISession().start(); + } doStartSession( launch, session, monitor ); } @@ -214,4 +218,15 @@ abstract public class AbstractGDBCDIDebugger implements ICDIDebugger2 { } return result; } + + protected boolean getBreakpointsWithFullNameAttribute( ILaunchConfiguration config ) { + boolean result = IMILaunchConfigurationConstants.DEBUGGER_FULLPATH_BREAKPOINTS_DEFAULT; + try { + return config.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_FULLPATH_BREAKPOINTS, result ); + } + catch( CoreException e ) { + // use default + } + return result; + } } diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java index afe413d02dc..9ba7e4b8507 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java @@ -83,4 +83,13 @@ public interface IMILaunchConfigurationConstants { * Launch configuration attribute value. The key is ATTR_DEBUGGER_VERBOSE_MODE. */ public static final boolean DEBUGGER_VERBOSE_MODE_DEFAULT = false; + /** + * Launch configuration attribute key. The value is a boolean specifying is debugger should use full pathname to set breakpoints. + */ + public static final String ATTR_DEBUGGER_FULLPATH_BREAKPOINTS = MIPlugin.getUniqueIdentifier() + ".breakpointsFullPath"; //$NON-NLS-1$ + + /** + * Launch configuration default attribute value. The key is ATTR_DEBUGGER_FULLPATH_BREAKPOINTS. + */ + public static final boolean DEBUGGER_FULLPATH_BREAKPOINTS_DEFAULT = false; } diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIMessages.properties b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIMessages.properties index 33a935a0087..b8023908379 100644 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIMessages.properties +++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIMessages.properties @@ -37,6 +37,7 @@ StandardGDBDebuggerPage.10=Shared Libraries StandardGDBDebuggerPage.11=Protocol: StandardGDBDebuggerPage.12=GDB command set: StandardGDBDebuggerPage.13=Verbose console mode +StandardGDBDebuggerPage.14=Use full file path to set breakpoints GDBServerDebuggerPage.0=TCP GDBServerDebuggerPage.1=Serial GDBServerDebuggerPage.10=Connection diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/StandardGDBDebuggerPage.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/StandardGDBDebuggerPage.java index 65de76f7920..779edec50c9 100644 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/StandardGDBDebuggerPage.java +++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/StandardGDBDebuggerPage.java @@ -66,6 +66,7 @@ public class StandardGDBDebuggerPage extends AbstractCDebuggerPage implements Ob protected Combo fProtocolCombo; protected Button fVerboseModeButton; + protected Button fBreakpointsFullPath; private IMILaunchConfigurationComponent fSolibBlock; @@ -232,14 +233,23 @@ public class StandardGDBDebuggerPage extends AbstractCDebuggerPage implements Ob // use default } fVerboseModeButton.setSelection( verboseMode ); - + fBreakpointsFullPath.setSelection(getBreakpointsWithFullNameAttribute(configuration)); // We've populated combos, which affects their preferred size, and so must relayout things. Control changed[] = { fCommandFactoryCombo, fProtocolCombo }; ((Composite) getControl()).layout( changed ); setInitializing( false ); } - + protected boolean getBreakpointsWithFullNameAttribute( ILaunchConfiguration config ) { + boolean result = IMILaunchConfigurationConstants.DEBUGGER_FULLPATH_BREAKPOINTS_DEFAULT; + try { + return config.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_FULLPATH_BREAKPOINTS, result ); + } + catch( CoreException e ) { + // use default + } + return result; + } public void performApply( ILaunchConfigurationWorkingCopy configuration ) { String str = fGDBCommandText.getText(); str.trim(); @@ -256,6 +266,7 @@ public class StandardGDBDebuggerPage extends AbstractCDebuggerPage implements Ob if ( fSolibBlock != null ) fSolibBlock.performApply( configuration ); configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE, fVerboseModeButton.getSelection() ); + configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_FULLPATH_BREAKPOINTS, fBreakpointsFullPath.getSelection() ); } public String getName() { @@ -393,6 +404,14 @@ public class StandardGDBDebuggerPage extends AbstractCDebuggerPage implements Ob createCommandFactoryCombo( options ); createProtocolCombo( options ); createVerboseModeButton( subComp ); + createBreakpointFullPathName(subComp); + // fit options into 3-grid one per line + GridData gd1 = new GridData(); + gd1.horizontalSpan = 3; + fVerboseModeButton.setLayoutData(gd1); + GridData gd2 = new GridData(); + gd2.horizontalSpan = 3; + fBreakpointsFullPath.setLayoutData(gd2); } public void createSolibTab( TabFolder tabFolder ) { @@ -496,4 +515,20 @@ public class StandardGDBDebuggerPage extends AbstractCDebuggerPage implements Ob } } ); } + protected void createBreakpointFullPathName( Composite parent ) { + fBreakpointsFullPath = createCheckButton( parent, MIUIMessages.getString( "StandardGDBDebuggerPage.14" ) ); //$NON-NLS-1$ + + fBreakpointsFullPath.addSelectionListener( new SelectionListener() { + + public void widgetDefaultSelected( SelectionEvent e ) { + if ( !isInitializing() ) + updateLaunchConfigurationDialog(); + } + + public void widgetSelected( SelectionEvent e ) { + if ( !isInitializing() ) + updateLaunchConfigurationDialog(); + } + } ); + } } |