Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 170392 Details for
Bug 314628
Unresolved breakpoint freezes application
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix for all-stop mode
zpatch.txt (text/plain), 8.12 KB, created by
Marc Khouzam
on 2010-05-28 13:50:32 EDT
(
hide
)
Description:
Fix for all-stop mode
Filename:
MIME Type:
Creator:
Marc Khouzam
Created:
2010-05-28 13:50:32 EDT
Size:
8.12 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.dsf.gdb >Index: src/org/eclipse/cdt/dsf/mi/service/IMIRunControl.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIRunControl.java,v >retrieving revision 1.5 >diff -u -r1.5 IMIRunControl.java >--- src/org/eclipse/cdt/dsf/mi/service/IMIRunControl.java 2 Mar 2010 13:29:03 -0000 1.5 >+++ src/org/eclipse/cdt/dsf/mi/service/IMIRunControl.java 28 May 2010 17:47:50 -0000 >@@ -28,7 +28,7 @@ > * to receive commands. Once the specified steps are executed, the target should be > * returned to its original availability. > * >- * This can is of value for breakpoints commands; e.g., breakpoints need to be inserted >+ * This is of value for breakpoints commands; e.g., breakpoints need to be inserted > * even when the target is running, so this call would suspend the target, insert the > * breakpoint, and resume the target again. > * >Index: src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java,v >retrieving revision 1.26 >diff -u -r1.26 MIRunControl.java >--- src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java 28 Apr 2010 23:50:49 -0000 1.26 >+++ src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java 28 May 2010 17:47:50 -0000 >@@ -908,17 +908,27 @@ > /** > * @since 3.0 > */ >- public void executeWithTargetAvailable(IDMContext ctx, Sequence.Step[] steps, RequestMonitor rm) { >+ public void executeWithTargetAvailable(IDMContext ctx, Sequence.Step[] steps, final RequestMonitor rm) { > Vector<Step> totalStepsVector = new Vector<Step>(); > totalStepsVector.add(new IsTargetAvailableStep(ctx)); > totalStepsVector.add(new MakeTargetAvailableStep()); > for (Step step : steps) { > totalStepsVector.add(step); > } >- totalStepsVector.add(new RestoreTargetStateStep()); >+ >+ // This RM makes sure that even if the sequence fails, we restore >+ // the target if necessary (bug 314628) >+ RequestMonitor cleanupRm = new RequestMonitor(getExecutor(), rm) { >+ @Override >+ protected void handleCompleted() { >+ // Pass the status from the sequence the actual rm >+ rm.setStatus(getStatus()); >+ restoreTargetState(new RequestMonitor(getExecutor(), rm)); >+ } >+ }; > > final Step[] totalSteps = totalStepsVector.toArray(new Step[totalStepsVector.size()]); >- getExecutor().execute(new Sequence(getExecutor(), rm) { >+ getExecutor().execute(new Sequence(getExecutor(), cleanupRm) { > @Override public Step[] getSteps() { return totalSteps; } > }); > } >@@ -934,8 +944,9 @@ > * and https://bugs.eclipse.org/bugs/show_bug.cgi?id=282273 > * > * ******************************************************************************/ >- private IContainerDMContext fContainerDmc = null; >- private boolean fTargetAvailable = false; >+ private IContainerDMContext fContainerDmc; >+ private boolean fTargetAvailable; >+ private boolean fMustResumeTarget; > > /** > * Returns whether the target is available to perform operations >@@ -1002,25 +1013,33 @@ > suspend(getContextToSuspend(), > new RequestMonitor(getExecutor(), rm) { > @Override >+ protected void handleSuccess() { >+ fMustResumeTarget = true; >+ super.handleSuccess(); >+ } >+ @Override > protected void handleFailure() { > // We weren't able to suspend, so abort the operation > fDisableNextSignalEvent = false; >+ fMustResumeTarget = false; > super.handleFailure(); > }; > }); > } else { >+ fMustResumeTarget = false; > rm.done(); > } > } > }; > > /** >+ * This method is called outside of the sequence to make sure >+ * we properly restore the target state. >+ * > * @since 3.0 > */ >- protected class RestoreTargetStateStep extends Sequence.Step { >- @Override >- public void execute(final RequestMonitor rm) { >- if (!isTargetAvailable()) { >+ protected void restoreTargetState(RequestMonitor rm) { >+ if (fMustResumeTarget) { > assert fDisableNextRunningEvent == false; > fDisableNextRunningEvent = true; > >@@ -1031,6 +1050,7 @@ > new DataRequestMonitor<MIInfo>(getExecutor(), rm) { > @Override > protected void handleSuccess() { >+ fMustResumeTarget = false; > fSilencedSignalEvent = null; > super.handleSuccess(); > } >@@ -1039,7 +1059,8 @@ > protected void handleFailure() { > // Darn, we're unable to restart the target. Must cleanup! > fDisableNextRunningEvent = false; >- >+ fMustResumeTarget = false; >+ > // We must also sent the Stopped event that we had kept silent > if (fSilencedSignalEvent != null) { > eventDispatched(fSilencedSignalEvent); >@@ -1058,7 +1079,6 @@ > rm.done(); > } > } >- }; > > /** > * {@inheritDoc} >#P org.eclipse.cdt.tests.dsf.gdb >Index: src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java,v >retrieving revision 1.11 >diff -u -r1.11 MIBreakpointsTest.java >--- src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java 27 May 2010 22:56:38 -0000 1.11 >+++ src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java 28 May 2010 17:47:50 -0000 >@@ -1238,6 +1238,54 @@ > ((MIBreakpointHitEvent)event).getNumber() == ref.getReference()); > } > >+ // ------------------------------------------------------------------------ >+ // insertInvalidBreakpoint_WhileTargetRunning >+ // Set an invalid breakpoint while the target is running, then set a valid >+ // breakpoint and make sure the second breakpoints eventually gets hit. >+ // >+ // We had a problem where an invalid breakpoint set when the target was running >+ // would leave us in a bad state (Bug 314628) >+ // ------------------------------------------------------------------------ >+ @Test >+ public void insertInvalidBreakpoint_WhileTargetRunning() throws Throwable { >+ >+ // Create a line breakpoint >+ Map<String, Object> breakpoint = new HashMap<String, Object>(); >+ breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); >+ breakpoint.put(FILE_NAME_TAG, "Bad file name"); >+ breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_5); >+ >+ // Run the program. It will make a two second sleep() call, during which time... >+ SyncUtil.resume(); >+ >+ // ...we install the bad breakpoint and check that it failed >+ insertBreakpoint(fBreakpointsDmc, breakpoint); >+ assertTrue(fWait.getMessage(), !fWait.isOK()); >+ >+ // Now install a proper breakpoint an see that it hits without having to resume >+ // the target. This will show that the target was still properly running. >+ breakpoint.put(FILE_NAME_TAG, SOURCE_FILE); >+ MIBreakpointDMContext ref = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint); >+ >+ // Wait for breakpoint to hit. >+ MIStoppedEvent event = waitForBreakpointEventsAfterBreakpointOperationWhileTargetRunning(true, 2); >+ >+ // Ensure the correct BreakpointEvent was received >+ MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); >+ assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 2); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " >+ + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); >+ assertTrue("BreakpointService problem: breakpoint mismatch", >+ fBreakpointRef == breakpoint1.getNumber()); >+ clearEventCounters(); >+ >+ assertTrue("Did not stop because of breakpoint, but stopped because of: " + >+ event.getClass().getCanonicalName(), event instanceof MIBreakpointHitEvent); >+ assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, >+ ((MIBreakpointHitEvent)event).getNumber() == ref.getReference()); >+ } >+ > /////////////////////////////////////////////////////////////////////////// > // Add Watchpoint tests > ///////////////////////////////////////////////////////////////////////////
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
marc.khouzam
:
iplog-
Actions:
View
|
Diff
Attachments on
bug 314628
:
170255
|
170325
|
170392
|
170399
|
170410