1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

*org.eclipse.cdt.debug.mi.core/{AbstractGDBCDIDebugger,IMILaunchConfigurationConstants}.java

*org.eclipse.cdt.debug.mi.core/MISession.java
* org.eclipse.cdt.debug.mi.core.cdi/BreakpointManager.ajva
*org.eclipse.cdt.debug.mi.internal/iu/{StandardGDBDebuggerPage.java,MIUIMEssages.properties}

220045  Debuger is stopping on non-existing breakpoints for files with same name

Patch from Elena
This commit is contained in:
Alain Magloire 2008-03-28 15:42:17 +00:00
parent dd9db085d7
commit 802af6b09c
6 changed files with 89 additions and 7 deletions

View file

@ -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();

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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;
}

View file

@ -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

View file

@ -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 ) {
@ -490,6 +509,22 @@ public class StandardGDBDebuggerPage extends AbstractCDebuggerPage implements Ob
updateLaunchConfigurationDialog();
}
public void widgetSelected( SelectionEvent e ) {
if ( !isInitializing() )
updateLaunchConfigurationDialog();
}
} );
}
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();