|
Lines 55-60
Link Here
|
| 55 |
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl; |
55 |
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl; |
| 56 |
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent; |
56 |
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent; |
| 57 |
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; |
57 |
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; |
|
|
58 |
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses; |
| 58 |
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.BreakpointAddedEvent; |
59 |
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.BreakpointAddedEvent; |
| 59 |
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.BreakpointRemovedEvent; |
60 |
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.BreakpointRemovedEvent; |
| 60 |
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.BreakpointUpdatedEvent; |
61 |
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.BreakpointUpdatedEvent; |
|
Lines 113-118
Link Here
|
| 113 |
IBreakpoints fBreakpoints; |
114 |
IBreakpoints fBreakpoints; |
| 114 |
IBreakpointManager fBreakpointManager; // Platform breakpoint manager (not this!) |
115 |
IBreakpointManager fBreakpointManager; // Platform breakpoint manager (not this!) |
| 115 |
BreakpointActionManager fBreakpointActionManager; |
116 |
BreakpointActionManager fBreakpointActionManager; |
|
|
117 |
IGDBProcesses fProcService; |
| 116 |
|
118 |
|
| 117 |
/////////////////////////////////////////////////////////////////////////// |
119 |
/////////////////////////////////////////////////////////////////////////// |
| 118 |
// Breakpoints tracking |
120 |
// Breakpoints tracking |
|
Lines 122-128
Link Here
|
| 122 |
|
124 |
|
| 123 |
// Holds the set of platform breakpoints with their corresponding back-end |
125 |
// Holds the set of platform breakpoints with their corresponding back-end |
| 124 |
// breakpoint attributes, per context (i.e. each platform breakpoint is |
126 |
// breakpoint attributes, per context (i.e. each platform breakpoint is |
| 125 |
// replicated for each execution context). |
127 |
// replicated import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMContext;for each execution context). |
| 126 |
// - Context entry added/removed on start/stopTrackingBreakpoints() |
128 |
// - Context entry added/removed on start/stopTrackingBreakpoints() |
| 127 |
// - Augmented on breakpointAdded() |
129 |
// - Augmented on breakpointAdded() |
| 128 |
// - Modified on breakpointChanged() |
130 |
// - Modified on breakpointChanged() |
|
Lines 244-249
Link Here
|
| 244 |
fBreakpoints = getServicesTracker().getService(IBreakpoints.class); |
246 |
fBreakpoints = getServicesTracker().getService(IBreakpoints.class); |
| 245 |
fBreakpointManager = DebugPlugin.getDefault().getBreakpointManager(); |
247 |
fBreakpointManager = DebugPlugin.getDefault().getBreakpointManager(); |
| 246 |
fBreakpointActionManager = CDebugCorePlugin.getDefault().getBreakpointActionManager(); |
248 |
fBreakpointActionManager = CDebugCorePlugin.getDefault().getBreakpointActionManager(); |
|
|
249 |
fProcService = getServicesTracker().getService(IGDBProcesses.class); |
| 247 |
|
250 |
|
| 248 |
// Register to the useful events |
251 |
// Register to the useful events |
| 249 |
getSession().addServiceEventListener(this, null); |
252 |
getSession().addServiceEventListener(this, null); |
|
Lines 547-552
Link Here
|
| 547 |
// breakpoint creation. However, it is conceivable that an enhanced Editor |
550 |
// breakpoint creation. However, it is conceivable that an enhanced Editor |
| 548 |
// would permit it. |
551 |
// would permit it. |
| 549 |
final Set<String> threads = getThreads(attributes); |
552 |
final Set<String> threads = getThreads(attributes); |
|
|
553 |
final Set<String> threadGroups = getThreadGroups(); |
| 550 |
|
554 |
|
| 551 |
// Update the breakpoint state when all back-end breakpoints have been installed |
555 |
// Update the breakpoint state when all back-end breakpoints have been installed |
| 552 |
final CountingRequestMonitor installRM = new CountingRequestMonitor(getExecutor(), rm) { |
556 |
final CountingRequestMonitor installRM = new CountingRequestMonitor(getExecutor(), rm) { |
|
Lines 561-629
Link Here
|
| 561 |
|
565 |
|
| 562 |
// Install the back-end breakpoint(s) |
566 |
// Install the back-end breakpoint(s) |
| 563 |
for (final String thread : threads) { |
567 |
for (final String thread : threads) { |
| 564 |
DataRequestMonitor<IBreakpointDMContext> drm = |
568 |
for (final String threadgroup : threadGroups) { |
| 565 |
new DataRequestMonitor<IBreakpointDMContext>(getExecutor(), installRM) { |
569 |
DataRequestMonitor<IBreakpointDMContext> drm = |
| 566 |
@Override |
570 |
new DataRequestMonitor<IBreakpointDMContext>(getExecutor(), installRM) { |
| 567 |
protected void handleSuccess() { |
571 |
@Override |
| 568 |
// Add the new back-end breakpoint to the map |
572 |
protected void handleSuccess() { |
| 569 |
Vector<IBreakpointDMContext> list = breakpointIDs.get(breakpoint); |
573 |
// Add the new back-end breakpoint to the map |
| 570 |
if (list == null) |
574 |
Vector<IBreakpointDMContext> list = breakpointIDs.get(breakpoint); |
| 571 |
list = new Vector<IBreakpointDMContext>(); |
575 |
if (list == null) |
| 572 |
IBreakpointDMContext targetBP = getData(); |
576 |
list = new Vector<IBreakpointDMContext>(); |
| 573 |
list.add(targetBP); |
577 |
IBreakpointDMContext targetBP = getData(); |
| 574 |
breakpointIDs.put(breakpoint, list); |
578 |
list.add(targetBP); |
| 575 |
|
579 |
breakpointIDs.put(breakpoint, list); |
| 576 |
// Add the reverse mapping |
580 |
|
| 577 |
targetBPs.put(targetBP, breakpoint); |
581 |
// Add the reverse mapping |
| 578 |
|
582 |
targetBPs.put(targetBP, breakpoint); |
| 579 |
// And update the corresponding thread list |
583 |
|
| 580 |
Set<String> thrds = threadsIDs.get(breakpoint); |
584 |
// And update the corresponding thread list |
| 581 |
if (thrds == null) |
585 |
Set<String> thrds = threadsIDs.get(breakpoint); |
| 582 |
thrds = new HashSet<String>(); |
586 |
if (thrds == null) |
| 583 |
thrds.add(thread); |
587 |
thrds = new HashSet<String>(); |
| 584 |
threadsIDs.put(breakpoint, thrds); |
588 |
thrds.add(thread); |
| 585 |
|
589 |
threadsIDs.put(breakpoint, thrds); |
| 586 |
// Reset the thread (is it necessary?) |
590 |
|
| 587 |
attributes.put(ATTR_THREAD_ID, NULL_STRING); |
591 |
// Reset the thread (is it necessary?) |
| 588 |
|
592 |
attributes.put(ATTR_THREAD_ID, NULL_STRING); |
| 589 |
// Remove breakpoint problem marker (if any) |
593 |
|
| 590 |
removeBreakpointProblemMarker(breakpoint); |
594 |
// Remove breakpoint problem marker (if any) |
| 591 |
|
595 |
removeBreakpointProblemMarker(breakpoint); |
| 592 |
// Check for a pending breakpoint before showing that it was properly installed |
596 |
|
| 593 |
fBreakpoints.getBreakpointDMData(targetBP, new DataRequestMonitor<IBreakpointDMData>(getExecutor(), null) { |
597 |
// Check for a pending breakpoint before showing that it was properly installed |
| 594 |
@Override |
598 |
fBreakpoints.getBreakpointDMData(targetBP, new DataRequestMonitor<IBreakpointDMData>(getExecutor(), null) { |
| 595 |
protected void handleCompleted() { |
599 |
@Override |
| 596 |
boolean pending = false; |
600 |
protected void handleCompleted() { |
| 597 |
if (isSuccess()) { |
601 |
boolean pending = false; |
| 598 |
IBreakpointDMData data = getData(); |
602 |
if (isSuccess()) { |
| 599 |
if (data instanceof MIBreakpointDMData) { |
603 |
IBreakpointDMData data = getData(); |
| 600 |
pending = ((MIBreakpointDMData)data).isPending(); |
604 |
if (data instanceof MIBreakpointDMData) { |
| 601 |
} |
605 |
pending = ((MIBreakpointDMData)data).isPending(); |
| 602 |
} |
606 |
} |
| 603 |
// Finally, update the platform breakpoint to show it was installed, unless we have a pending breakpoint |
607 |
} |
| 604 |
if (!pending) { |
608 |
// Finally, update the platform breakpoint to show it was installed, unless we have a pending breakpoint |
| 605 |
try { |
609 |
if (!pending) { |
| 606 |
breakpoint.incrementInstallCount(); |
610 |
try { |
| 607 |
} catch (CoreException e) { |
611 |
breakpoint.incrementInstallCount(); |
| 608 |
} |
612 |
} catch (CoreException e) { |
| 609 |
} |
613 |
} |
| 610 |
installRM.done(); |
614 |
} |
| 611 |
} |
615 |
installRM.done(); |
| 612 |
}); |
616 |
} |
| 613 |
} |
617 |
}); |
| 614 |
|
618 |
} |
| 615 |
@Override |
619 |
|
| 616 |
protected void handleError() { |
620 |
@Override |
| 617 |
String description = MessageFormat.format(Messages.Breakpoint_attribute_problem, new Object[] { Messages.Breakpoint_installation_failed }); |
621 |
protected void handleError() { |
| 618 |
addBreakpointProblemMarker(breakpoint, description, IMarker.SEVERITY_WARNING); |
622 |
String description = MessageFormat.format(Messages.Breakpoint_attribute_problem, new Object[] { Messages.Breakpoint_installation_failed }); |
| 619 |
installRM.done(); |
623 |
addBreakpointProblemMarker(breakpoint, description, IMarker.SEVERITY_WARNING); |
| 620 |
} |
624 |
installRM.done(); |
| 621 |
}; |
625 |
} |
| 622 |
|
626 |
}; |
| 623 |
// Convert the breakpoint attributes for the back-end |
627 |
|
| 624 |
attributes.put(ATTR_THREAD_ID, thread); |
628 |
// Convert the breakpoint attributes for the back-end |
| 625 |
Map<String,Object> targetAttributes = convertToTargetBreakpoint(breakpoint, attributes); |
629 |
attributes.put(ATTR_THREAD_ID, thread); |
| 626 |
fBreakpoints.insertBreakpoint(dmc, targetAttributes, drm); |
630 |
Map<String,Object> targetAttributes = convertToTargetBreakpoint(breakpoint, attributes); |
|
|
631 |
fBreakpoints.insertBreakpoint(dmc, targetAttributes, drm); |
| 632 |
} |
| 627 |
} |
633 |
} |
| 628 |
} |
634 |
} |
| 629 |
|
635 |
|
|
Lines 1647-1652
Link Here
|
| 1647 |
return threads; |
1653 |
return threads; |
| 1648 |
} |
1654 |
} |
| 1649 |
|
1655 |
|
|
|
1656 |
private Set<String> getThreadGroups() { |
| 1657 |
Set<String> groupIds = new HashSet<String>(); |
| 1658 |
IDMContext[] containerList = fProcService.getExecutionContexts(null); |
| 1659 |
for ( int i = 0 ; i < containerList.length ; i++ ){ |
| 1660 |
groupIds.add(((IMIContainerDMContext)containerList[i]).getGroupId()); |
| 1661 |
} |
| 1662 |
return groupIds; |
| 1663 |
} |
| 1664 |
|
| 1650 |
/** |
1665 |
/** |
| 1651 |
* Get the list of threads from the platform breakpoint attributes |
1666 |
* Get the list of threads from the platform breakpoint attributes |
| 1652 |
* |
1667 |
* |