|
Lines 39-44
Link Here
|
| 39 |
import org.eclipse.cdt.dsf.debug.service.IBreakpointsExtension.IBreakpointHitDMEvent; |
39 |
import org.eclipse.cdt.dsf.debug.service.IBreakpointsExtension.IBreakpointHitDMEvent; |
| 40 |
import org.eclipse.cdt.dsf.debug.service.ICachingService; |
40 |
import org.eclipse.cdt.dsf.debug.service.ICachingService; |
| 41 |
import org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext; |
41 |
import org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext; |
|
|
42 |
import org.eclipse.cdt.dsf.debug.service.IMultiRunControl; |
| 42 |
import org.eclipse.cdt.dsf.debug.service.IProcesses; |
43 |
import org.eclipse.cdt.dsf.debug.service.IProcesses; |
| 43 |
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext; |
44 |
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext; |
| 44 |
import org.eclipse.cdt.dsf.debug.service.command.BufferedCommandControl; |
45 |
import org.eclipse.cdt.dsf.debug.service.command.BufferedCommandControl; |
|
Lines 93-99
Link Here
|
| 93 |
* state. |
94 |
* state. |
| 94 |
* @since 3.0 |
95 |
* @since 3.0 |
| 95 |
*/ |
96 |
*/ |
| 96 |
public class MIRunControl extends AbstractDsfService implements IMIRunControl, ICachingService |
97 |
public class MIRunControl extends AbstractDsfService implements IMIRunControl, IMultiRunControl, ICachingService |
| 97 |
{ |
98 |
{ |
| 98 |
private static class MIExecutionDMC extends AbstractDMContext implements IMIExecutionDMContext, IDisassemblyDMContext |
99 |
private static class MIExecutionDMC extends AbstractDMContext implements IMIExecutionDMContext, IDisassemblyDMContext |
| 99 |
{ |
100 |
{ |
|
Lines 1578-1581
Link Here
|
| 1578 |
// we know GDB is accepting commands |
1579 |
// we know GDB is accepting commands |
| 1579 |
return !fTerminated && fSuspended && !fResumePending; |
1580 |
return !fTerminated && fSuspended && !fResumePending; |
| 1580 |
} |
1581 |
} |
|
|
1582 |
|
| 1583 |
/////////////////////////////////////////////////////////////////////////// |
| 1584 |
// IMultiRunControl implementation |
| 1585 |
/////////////////////////////////////////////////////////////////////////// |
| 1586 |
|
| 1587 |
/////////////////////////////////////////////////////////////////////////// |
| 1588 |
// Multi-resume implementation: |
| 1589 |
// In all-stop mode, if one context can be resumed, then all can be resumed. |
| 1590 |
// There is no added value of supporting multi-select with all-stop but we do |
| 1591 |
// so to be more user-friendly. |
| 1592 |
// |
| 1593 |
// Note that if scheduler-locking is enabled in GDB (we don't officially |
| 1594 |
// support it in CDT yet), then which thread is resumed makes a difference |
| 1595 |
// in the behavior, as the other threads will stay stopped. In that case, |
| 1596 |
// a multi-selection makes no sense because there is no way of knowing |
| 1597 |
// which thread the user really wants to resume. |
| 1598 |
/////////////////////////////////////////////////////////////////////////// |
| 1599 |
|
| 1600 |
/** @since 4.1 */ |
| 1601 |
@Override |
| 1602 |
public void canResumeSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) { |
| 1603 |
assert contexts != null; |
| 1604 |
|
| 1605 |
if (contexts != null && contexts.length > 0) { |
| 1606 |
// In all-stop, if one context can resume, all of them can |
| 1607 |
canResume(contexts[0], rm); |
| 1608 |
} else { |
| 1609 |
rm.done(false); |
| 1610 |
} |
| 1611 |
} |
| 1612 |
|
| 1613 |
/** @since 4.1 */ |
| 1614 |
@Override |
| 1615 |
public void canResumeAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) { |
| 1616 |
// In all-stop, if one context can resume, all of them can, so re-use the canResumeSome case. |
| 1617 |
canResumeSome(contexts, rm); |
| 1618 |
} |
| 1619 |
|
| 1620 |
/** @since 4.1 */ |
| 1621 |
@Override |
| 1622 |
public void resume(IExecutionDMContext[] contexts, RequestMonitor rm) { |
| 1623 |
assert contexts != null; |
| 1624 |
|
| 1625 |
if (contexts != null && contexts.length > 0) { |
| 1626 |
// In all-stop, resuming one context will resume all of them |
| 1627 |
resume(contexts[0], rm); |
| 1628 |
} else { |
| 1629 |
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid contexts", null)); //$NON-NLS-1$ |
| 1630 |
} |
| 1631 |
} |
| 1632 |
|
| 1633 |
/////////////////////////////////////////////////////////////////////////// |
| 1634 |
// Multi-suspend implementation: |
| 1635 |
// In all-stop mode, if one context can be suspended, then all can be suspended. |
| 1636 |
// There is no added value of supporting multi-select with all-stop but we do |
| 1637 |
// so to be more user-friendly |
| 1638 |
/////////////////////////////////////////////////////////////////////////// |
| 1639 |
|
| 1640 |
/** @since 4.1 */ |
| 1641 |
@Override |
| 1642 |
public void canSuspendSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) { |
| 1643 |
assert contexts != null; |
| 1644 |
|
| 1645 |
// In all-stop, if one context can suspend, all of them can |
| 1646 |
if (contexts != null && contexts.length > 0) { |
| 1647 |
canSuspend(contexts[0], rm); |
| 1648 |
} else { |
| 1649 |
rm.done(false); |
| 1650 |
} |
| 1651 |
} |
| 1652 |
|
| 1653 |
/** @since 4.1 */ |
| 1654 |
@Override |
| 1655 |
public void canSuspendAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) { |
| 1656 |
// In all-stop, if one context can suspend, all of them can, so re-use canSuspendSome |
| 1657 |
canSuspendSome(contexts, rm); |
| 1658 |
} |
| 1659 |
|
| 1660 |
/** @since 4.1 */ |
| 1661 |
@Override |
| 1662 |
public void isSuspendedSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) { |
| 1663 |
assert contexts != null; |
| 1664 |
|
| 1665 |
// In all-stop, if one context is suspended, all of them are |
| 1666 |
if (contexts != null && contexts.length > 0) { |
| 1667 |
rm.done(isSuspended(contexts[0])); |
| 1668 |
} else { |
| 1669 |
rm.done(false); |
| 1670 |
} |
| 1671 |
|
| 1672 |
} |
| 1673 |
|
| 1674 |
/** @since 4.1 */ |
| 1675 |
@Override |
| 1676 |
public void isSuspendedAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) { |
| 1677 |
// In all-stop, if one context is suspended, all of them are, so re-use isSuspendedSome |
| 1678 |
isSuspendedSome(contexts, rm); |
| 1679 |
} |
| 1680 |
|
| 1681 |
/** @since 4.1 */ |
| 1682 |
@Override |
| 1683 |
public void suspend(IExecutionDMContext[] contexts, RequestMonitor rm) { |
| 1684 |
assert contexts != null; |
| 1685 |
|
| 1686 |
if (contexts != null && contexts.length > 0) { |
| 1687 |
// In all-stop, suspending one context will suspend all of them |
| 1688 |
suspend(contexts[0], rm); |
| 1689 |
} else { |
| 1690 |
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Invalid contexts", null)); //$NON-NLS-1$ |
| 1691 |
} |
| 1692 |
} |
| 1693 |
|
| 1694 |
/////////////////////////////////////////////////////////////////////////// |
| 1695 |
// Multi-step implementation. Not implemented yet. See bug 330974. |
| 1696 |
/////////////////////////////////////////////////////////////////////////// |
| 1697 |
|
| 1698 |
/** @since 4.1 */ |
| 1699 |
@Override |
| 1700 |
public void canStepSome(IExecutionDMContext[] contexts, StepType stepType, DataRequestMonitor<Boolean> rm) { |
| 1701 |
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", null)); //$NON-NLS-1$ |
| 1702 |
} |
| 1703 |
|
| 1704 |
/** @since 4.1 */ |
| 1705 |
@Override |
| 1706 |
public void canStepAll(IExecutionDMContext[] contexts, StepType stepType, DataRequestMonitor<Boolean> rm) { |
| 1707 |
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", null)); //$NON-NLS-1$ |
| 1708 |
} |
| 1709 |
|
| 1710 |
/** @since 4.1 */ |
| 1711 |
@Override |
| 1712 |
public void isSteppingSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) { |
| 1713 |
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", null)); //$NON-NLS-1$ |
| 1714 |
} |
| 1715 |
|
| 1716 |
/** @since 4.1 */ |
| 1717 |
@Override |
| 1718 |
public void isSteppingAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) { |
| 1719 |
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", null)); //$NON-NLS-1$ |
| 1720 |
} |
| 1721 |
|
| 1722 |
/** @since 4.1 */ |
| 1723 |
@Override |
| 1724 |
public void step(IExecutionDMContext[] contexts, StepType stepType, RequestMonitor rm) { |
| 1725 |
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", null)); //$NON-NLS-1$ |
| 1726 |
} |
| 1581 |
} |
1727 |
} |