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

User can now specify a memory address for the stop on start point (173201)

This commit is contained in:
John Cortell 2007-02-07 18:07:34 +00:00
parent 09a6509ebf
commit e1ca2d84ef

View file

@ -282,8 +282,16 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
ICDITargetConfiguration config = getConfiguration();
if ( config.supportsBreakpoints() ) {
getBreakpointManager().setInitialBreakpoints();
if ( stopSymbol != null && stopSymbol.length() != 0 ) {
stopAtSymbol( stopSymbol );
// See if the expression is a numeric address
try {
IAddress address = getAddressFactory().createAddress(stopSymbol);
stopAtAddress(address);
} catch (NumberFormatException nfexc) {
// OK, expression is not a simple, absolute numeric value; keep trucking and try to resolve as expression
stopAtSymbol( stopSymbol );
}
}
}
if ( config.supportsResume() && resume ) {
@ -1733,20 +1741,24 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
getBreakpointManager().skipBreakpoints( enabled );
}
protected void stopAtSymbol( String stopSymbol ) throws DebugException {
/**
* 'stopExpression' is used solely for the error message if the request
* fails. Where to stop is dictated entirely by 'location'
* @param symbol
*/
private void stopAtLocation(ICDILocation location, String stopExpression ) throws DebugException {
try {
ICDILocation location = getCDITarget().createFunctionLocation( "", stopSymbol ); //$NON-NLS-1$
setInternalTemporaryBreakpoint( location );
}
catch( CoreException e ) {
boolean isTerminated = getCDITarget().isTerminated();
if ( isTerminated ) {
String message = MessageFormat.format( CoreModelMessages.getString( "CDebugTarget.0" ), new String[]{ stopSymbol } ); //$NON-NLS-1$
String message = MessageFormat.format( CoreModelMessages.getString( "CDebugTarget.0" ), new String[]{ stopExpression } ); //$NON-NLS-1$
MultiStatus status = new MultiStatus( CDebugCorePlugin.getUniqueIdentifier(), IStatus.OK, message, null );
status.add( e.getStatus() );
throw new DebugException( status );
}
String message = MessageFormat.format( CoreModelMessages.getString( "CDebugTarget.2" ), new String[]{ stopSymbol, e.getStatus().getMessage() } ); //$NON-NLS-1$
String message = MessageFormat.format( CoreModelMessages.getString( "CDebugTarget.2" ), new String[]{ stopExpression, e.getStatus().getMessage() } ); //$NON-NLS-1$
IStatus newStatus = new Status( IStatus.WARNING, e.getStatus().getPlugin(), ICDebugInternalConstants.STATUS_CODE_QUESTION, message, null );
if ( !CDebugUtils.question( newStatus, this ) ) {
throw new DebugException( new Status( IStatus.OK, e.getStatus().getPlugin(), e.getStatus().getCode(), e.getStatus().getMessage(), null ) );
@ -1754,6 +1766,16 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
}
}
protected void stopAtSymbol( String stopSymbol ) throws DebugException {
ICDILocation location = getCDITarget().createFunctionLocation( "", stopSymbol ); //$NON-NLS-1$
stopAtLocation(location, stopSymbol);
}
protected void stopAtAddress( IAddress address ) throws DebugException {
ICDIAddressLocation location = getCDITarget().createAddressLocation(address.getValue());
stopAtLocation(location, address.toHexAddressString());
}
protected void stopInMain() throws DebugException {
String mainSymbol = new String( ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
try {