mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-14 11:45:38 +02:00
Implementation of error handling.
This commit is contained in:
parent
3766b7446a
commit
eb7350b546
7 changed files with 199 additions and 4 deletions
|
@ -9,9 +9,11 @@ package org.eclipse.cdt.debug.core;
|
|||
import java.util.HashMap;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||
import org.eclipse.cdt.debug.internal.core.CDebugUtils;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CWatchpoint;
|
||||
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
|
||||
|
@ -113,14 +115,28 @@ public class CDebugModel
|
|||
catch( CoreException e )
|
||||
{
|
||||
CDebugCorePlugin.log( e );
|
||||
// throw DebugException
|
||||
}
|
||||
|
||||
if ( stopInMain )
|
||||
ICDIConfiguration config = cdiTarget.getSession().getConfiguration();
|
||||
|
||||
if ( config.supportsBreakpoints() && stopInMain )
|
||||
{
|
||||
ICDILocation location = cdiTarget.getSession().getBreakpointManager().createLocation( "", "main", 0 );
|
||||
try
|
||||
{
|
||||
((CDebugTarget)target[0]).setInternalTemporaryBreakpoint( location );
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
CDebugUtils.confirm( e.getStatus(), e );
|
||||
}
|
||||
}
|
||||
|
||||
if ( config.supportsResume() )
|
||||
{
|
||||
target[0].resume();
|
||||
}
|
||||
|
||||
return target[0];
|
||||
}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.internal.core;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.IStatusHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since Sep 25, 2002
|
||||
*/
|
||||
public class CDebugUtils
|
||||
{
|
||||
public static boolean confirm( IStatus status, Object source )
|
||||
{
|
||||
Boolean result = new Boolean( false );
|
||||
IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler( status );
|
||||
if ( handler != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
result = (Boolean)handler.handleStatus( status, source );
|
||||
}
|
||||
catch( CoreException e )
|
||||
{
|
||||
}
|
||||
}
|
||||
return result.booleanValue();
|
||||
}
|
||||
|
||||
public static void info( IStatus status, Object source )
|
||||
{
|
||||
IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler( status );
|
||||
if ( handler != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
handler.handleStatus( status, source );
|
||||
}
|
||||
catch( CoreException e )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void error( IStatus status, Object source )
|
||||
{
|
||||
IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler( status );
|
||||
if ( handler != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
handler.handleStatus( status, source );
|
||||
}
|
||||
catch( CoreException e )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -333,5 +333,26 @@
|
|||
id="org.eclipse.cdt.debug.ui.cSourceLocator">
|
||||
</sourceLocator>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.debug.core.statusHandlers">
|
||||
<statusHandler
|
||||
code="10000"
|
||||
plugin="org.eclipse.cdt.debug.core"
|
||||
class="org.eclipse.cdt.debug.internal.ui.ConfirmStatusHandler"
|
||||
id="org.eclipse.cdt.debug.internal.ui.ConfirmStatusHandler">
|
||||
</statusHandler>
|
||||
<statusHandler
|
||||
code="10001"
|
||||
plugin="org.eclipse.cdt.debug.core"
|
||||
class="org.eclipse.cdt.debug.internal.ui.InfoStatusHandler"
|
||||
id="org.eclipse.cdt.debug.internal.ui.InfoStatusHandler">
|
||||
</statusHandler>
|
||||
<statusHandler
|
||||
code="10002"
|
||||
plugin="org.eclipse.cdt.debug.core"
|
||||
class="org.eclipse.cdt.debug.internal.ui.ErrorStatusHandler"
|
||||
id="org.eclipse.cdt.debug.internal.ui.ErrorStatusHandler">
|
||||
</statusHandler>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.internal.ui;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.debug.core.IStatusHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since Sep 25, 2002
|
||||
*/
|
||||
public class ConfirmStatusHandler implements IStatusHandler
|
||||
{
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.core.IStatusHandler#handleStatus(IStatus, Object)
|
||||
*/
|
||||
public Object handleStatus( IStatus status, Object source ) throws CoreException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.internal.ui;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.debug.core.IStatusHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since Sep 25, 2002
|
||||
*/
|
||||
public class ErrorStatusHandler implements IStatusHandler
|
||||
{
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.core.IStatusHandler#handleStatus(IStatus, Object)
|
||||
*/
|
||||
public Object handleStatus( IStatus status, Object source ) throws CoreException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -14,6 +14,13 @@ package org.eclipse.cdt.debug.internal.ui;
|
|||
*/
|
||||
public interface ICDebugUIInternalConstants
|
||||
{
|
||||
/*
|
||||
* Status handler codes.
|
||||
*/
|
||||
public static final int STATUS_CODE_CONFIRM = 10000;
|
||||
public static final int STATUS_CODE_INFO = 10001;
|
||||
public static final int STATUS_CODE_ERROR = 10002;
|
||||
|
||||
/*
|
||||
* Memory view constants.
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.internal.ui;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.debug.core.IStatusHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since Sep 25, 2002
|
||||
*/
|
||||
public class InfoStatusHandler implements IStatusHandler
|
||||
{
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.core.IStatusHandler#handleStatus(IStatus, Object)
|
||||
*/
|
||||
public Object handleStatus( IStatus status, Object source ) throws CoreException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue