From ee3801c51fd1c81c1dc5ded257d685b5d5be928c Mon Sep 17 00:00:00 2001 From: Pawel Piech Date: Thu, 15 Oct 2009 17:14:02 +0000 Subject: [PATCH] Bug 288962 - [debug view] Extend IExecutionDMData to retrieve details about state change reason --- .../viewmodel/launch/AbstractContainerVMNode.java | 8 ++++++++ .../ui/viewmodel/launch/AbstractThreadVMNode.java | 12 +++++++++++- .../viewmodel/launch/ExecutionContextLabelText.java | 13 +++++++++++++ .../ui/viewmodel/launch/ILaunchVMConstants.java | 5 +++++ .../debug/ui/viewmodel/launch/messages.properties | 4 +++- .../eclipse/cdt/dsf/debug/service/IRunControl.java | 12 ++++++++++++ 6 files changed, 52 insertions(+), 2 deletions(-) diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/AbstractContainerVMNode.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/AbstractContainerVMNode.java index 88dad087701..bd96eb4a754 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/AbstractContainerVMNode.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/AbstractContainerVMNode.java @@ -28,6 +28,7 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerResumedDMEvent; import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerSuspendedDMEvent; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMData; +import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMData2; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExitedDMEvent; import org.eclipse.cdt.dsf.debug.service.IRunControl.IStartedDMEvent; import org.eclipse.cdt.dsf.debug.service.IRunControl.StateChangeReason; @@ -177,6 +178,13 @@ public abstract class AbstractContainerVMNode extends AbstractDMVMNode if (reason != null) { update.setProperty(ILaunchVMConstants.PROP_STATE_CHANGE_REASON, data.getStateChangeReason().name()); } + + if (data instanceof IExecutionDMData2) { + String details = ((IExecutionDMData2)data).getDetails(); + if (details != null) { + update.setProperty(ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS, details); + } + } } @Override diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/AbstractThreadVMNode.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/AbstractThreadVMNode.java index 1be4a710286..67ee1ea6484 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/AbstractThreadVMNode.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/AbstractThreadVMNode.java @@ -29,6 +29,7 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerResumedDMEvent; import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerSuspendedDMEvent; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMData; +import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMData2; import org.eclipse.cdt.dsf.debug.service.IRunControl.IResumedDMEvent; import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent; import org.eclipse.cdt.dsf.debug.service.IRunControl.StateChangeReason; @@ -107,7 +108,9 @@ public abstract class AbstractThreadVMNode extends AbstractDMVMNode ILaunchVMConstants.PROP_ID, ILaunchVMConstants.PROP_IS_SUSPENDED, ExecutionContextLabelText.PROP_STATE_CHANGE_REASON_KNOWN, - ILaunchVMConstants.PROP_STATE_CHANGE_REASON }), + ILaunchVMConstants.PROP_STATE_CHANGE_REASON, + ExecutionContextLabelText.PROP_STATE_CHANGE_DETAILS_KNOWN, + ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS }), new LabelText(MessagesForLaunchVM.AbstractThreadVMNode_No_columns__Error__label, new String[0]), new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING)) { { setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED }); } @@ -208,6 +211,13 @@ public abstract class AbstractThreadVMNode extends AbstractDMVMNode if (reason != null) { update.setProperty(ILaunchVMConstants.PROP_STATE_CHANGE_REASON, data.getStateChangeReason().name()); } + + if (data instanceof IExecutionDMData2) { + String details = ((IExecutionDMData2)data).getDetails(); + if (details != null) { + update.setProperty(ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS, details); + } + } } @Override diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/ExecutionContextLabelText.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/ExecutionContextLabelText.java index 9cced262bd1..8750303b51e 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/ExecutionContextLabelText.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/ExecutionContextLabelText.java @@ -27,6 +27,12 @@ public class ExecutionContextLabelText extends LabelText { */ public static final String PROP_STATE_CHANGE_REASON_KNOWN = "state_change_reason_known"; //$NON-NLS-1$ + /** + * Value 0 means it's not known. Value 1, means it's known. + * @since 2.1 + */ + public static final String PROP_STATE_CHANGE_DETAILS_KNOWN = "state_change_details_known"; //$NON-NLS-1$ + /** * Value 0 means it's not known. Value 1, means it's known. */ @@ -68,12 +74,17 @@ public class ExecutionContextLabelText extends LabelText { reasonLabel = MessagesForLaunchVM.State_change_reason__Watchpoint__label; } return reasonLabel; + } else if ( ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS.equals(propertyName) ) { + return properties.get(propertyName); } else if ( ILaunchVMConstants.PROP_IS_SUSPENDED.equals(propertyName) ) { Boolean suspended = (Boolean)properties.get(propertyName); return suspended ? 1 : 0; } else if ( PROP_STATE_CHANGE_REASON_KNOWN.equals(propertyName) ) { String reason = (String)properties.get(ILaunchVMConstants.PROP_STATE_CHANGE_REASON); return (reason != null && !StateChangeReason.UNKNOWN.name().equals(reason)) ? 1 : 0; + } else if ( PROP_STATE_CHANGE_DETAILS_KNOWN.equals(propertyName) ) { + String details = (String)properties.get(ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS); + return (details != null) ? 1 : 0; } else if (PROP_NAME_KNOWN.equals(propertyName)) { return properties.get(IElementPropertiesProvider.PROP_NAME) != null ? 1 : 0; } else if (IElementPropertiesProvider.PROP_NAME.equals(propertyName)) { @@ -94,6 +105,8 @@ public class ExecutionContextLabelText extends LabelText { IElementPropertiesProvider.PROP_NAME.equals(propertyName) || PROP_STATE_CHANGE_REASON_KNOWN.equals(propertyName) || ILaunchVMConstants.PROP_STATE_CHANGE_REASON.equals(propertyName) || + PROP_STATE_CHANGE_DETAILS_KNOWN.equals(propertyName) || + ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS.equals(propertyName) || PROP_ID_KNOWN.equals(propertyName) || ILaunchVMConstants.PROP_ID.equals(propertyName)) { diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/ILaunchVMConstants.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/ILaunchVMConstants.java index 9b43a6346c2..7c4d664ab2f 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/ILaunchVMConstants.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/ILaunchVMConstants.java @@ -36,4 +36,9 @@ public interface ILaunchVMConstants { public static final String PROP_STATE_CHANGE_REASON = "state_change_reason"; //$NON-NLS-1$ + /** + * @since 2.1 + */ + public static final String PROP_STATE_CHANGE_DETAILS = "state_change_details"; //$NON-NLS-1$ + } diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/messages.properties b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/messages.properties index 93a276f3c35..7cef5597a9a 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/messages.properties +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/launch/messages.properties @@ -50,7 +50,9 @@ AbstractContainerVMNode_No_columns__Error__label= # {4} - 0=running/1=suspended # {5} - state change reason available, 0=not available/1=available # {6} - state change reason -AbstractThreadVMNode_No_columns__text_format={0,choice,0#Thread|1#{1}}{2,choice,0#|1# [{3}]} ({4,choice,0#Running|1#Suspended}{5,choice,0#|1# : {6}}) +# {7} - state change details available, 0=not available/1=available +# {8} - state change details +AbstractThreadVMNode_No_columns__text_format={0,choice,0#Thread|1#{1}}{2,choice,0#|1# [{3}]} ({4,choice,0#Running|1#Suspended}{5,choice,0#|1# : {6}}{7,choice,0#|1# - {8}}) AbstractThreadVMNode_No_columns__Error__label= diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IRunControl.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IRunControl.java index 64c5881ad20..5fa6ebaa8c5 100644 --- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IRunControl.java +++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IRunControl.java @@ -107,6 +107,18 @@ public interface IRunControl extends IDsfService StateChangeReason getStateChangeReason(); } + /** + * @since 2.1 + */ + public interface IExecutionDMData2 extends IExecutionDMData { + /** + * Optional method to return more detail about the suspended event, e.g. + * "Divide by zero exception" + * @return more detail about the suspended event, or null + */ + String getDetails(); + } + /** * Retrieves execution data for given context. * @param dmc Context to retrieve data for.