1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 288962 - [debug view] Extend IExecutionDMData to retrieve details about state change reason

This commit is contained in:
Pawel Piech 2009-10-15 17:14:02 +00:00
parent 05512ba623
commit ee3801c51f
6 changed files with 52 additions and 2 deletions

View file

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

View file

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

View file

@ -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 <code>0</code> means it's not known. Value <code>1</code>, means it's known.
* @since 2.1
*/
public static final String PROP_STATE_CHANGE_DETAILS_KNOWN = "state_change_details_known"; //$NON-NLS-1$
/**
* Value <code>0</code> means it's not known. Value <code>1</code>, 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))
{

View file

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

View file

@ -50,7 +50,9 @@ AbstractContainerVMNode_No_columns__Error__label=<unavailable>
# {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=<unavailable>

View file

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