From 04266b0a8611682ec74beaadf15befaf879fcf0f Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Mon, 9 Dec 2002 00:55:42 +0000 Subject: [PATCH] Display the error message with details when program is suspended because of ICDIErrorInfo. --- debug/org.eclipse.cdt.debug.core/ChangeLog | 4 +++ .../internal/core/model/CDebugTarget.java | 29 ++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 2e4c73d2e31..3be2e7559c9 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,7 @@ +2002-12-08 Mikhail Khodjaiants + Display the error message with details when program is suspended because of ICDIErrorInfo. + * CDebugTarget.java + 2002-12-05 Alain Magloire Some debuggers like gdb/mi can provide detail information, for example diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java index f600e40fadc..5c346498669 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java @@ -24,6 +24,7 @@ import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager; import org.eclipse.cdt.debug.core.cdi.ICDICondition; import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration; import org.eclipse.cdt.debug.core.cdi.ICDIEndSteppingRange; +import org.eclipse.cdt.debug.core.cdi.ICDIErrorInfo; import org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager; import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.ICDIRegisterObject; @@ -62,7 +63,9 @@ import org.eclipse.cdt.debug.core.model.IState; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator; import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode; +import org.eclipse.cdt.debug.internal.core.CDebugUtils; import org.eclipse.cdt.debug.internal.core.CMemoryManager; +import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; import org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint; import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLocator; import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager; @@ -73,6 +76,9 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; @@ -1264,6 +1270,10 @@ public class CDebugTarget extends CDebugElement { handleWatchpointScope( (ICDIWatchpointScope)reason ); } + else if ( reason instanceof ICDIErrorInfo ) + { + handleErrorInfo( (ICDIErrorInfo)reason ); + } } private void handleResumedEvent( ICDIResumedEvent event ) @@ -1327,6 +1337,23 @@ public class CDebugTarget extends CDebugElement fireSuspendEvent( DebugEvent.UNSPECIFIED ); } + private void handleErrorInfo( ICDIErrorInfo info ) + { + if ( info != null ) + { + MultiStatus status = new MultiStatus( CDebugCorePlugin.getUniqueIdentifier(), + ICDebugInternalConstants.STATUS_CODE_ERROR, + "The execution of program is suspended because of error.", + null ); + status.add( new Status( IStatus.ERROR, + status.getPlugin(), + ICDebugInternalConstants.STATUS_CODE_ERROR, + info.getDetailMessage(), + null ) ); + CDebugUtils.error( status, this ); + } + } + private void handleExitedEvent( ICDIExitedEvent event ) { removeAllThreads(); @@ -1339,7 +1366,7 @@ public class CDebugTarget extends CDebugElement } catch( DebugException e ) { - CDebugCorePlugin.log( e.getStatus() ); + CDebugCorePlugin.log( e.getStatus() ); } }