Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 224477

Summary: resume, suspend and step not enabled/disabled during stepping
Product: [Eclipse Project] Platform Reporter: Mike Thyer <MikeThyer>
Component: DebugAssignee: Pawel Piech <pawel.1.piech>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: darin.eclipse, john.cortell, pawel.1.piech
Version: 3.3.1   
Target Milestone: 3.4 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch none

Description Mike Thyer CLA 2008-03-27 17:28:42 EDT
Build ID: M20071023-1652

Steps To Reproduce:
1. write a progam with an empty infinite loop
2. step into the loop
3. look at the state of the Debug toolbar icons and Run menu items


More information:
This problems occurs both when debugging Java and C.

Clicking on any of the stack entries in the Debug view causes the debug commands (resume,suspend,step) to be enabled/disabled correctly.

The bug seems to be in the handling of suspend timeouts, an insufficiently thorough refresh of the Debug view is being performed.

Adding the following override function to DebugTargetEventHandler fixes the problem:

protected void handleSuspendTimeout(DebugEvent event) {
	fireDelta((IDebugTarget) event.getSource(), IModelDelta.CONTENT | IModelDelta.STATE | IModelDelta.SELECT);
}
Comment 1 Darin Wright CLA 2008-03-29 13:08:51 EDT
*** Bug 224771 has been marked as a duplicate of this bug. ***
Comment 2 Darin Wright CLA 2008-03-29 13:11:08 EDT
Will investigate for M7. We want to avoid updating actions uneccessarily (i.e. when a step completes immediately). Updating on the timeout seems fair - but we also need to be careful not to re-retrieve stack frames (as they likely are not available while a thread is stepping). We used to collapse the frames on a timeout, but I prefer to have the stack frames remain expanded/visible.
Comment 3 Pawel Piech CLA 2008-03-31 11:36:15 EDT
(In reply to comment #0)
> protected void handleSuspendTimeout(DebugEvent event) {
>         fireDelta((IDebugTarget) event.getSource(), IModelDelta.CONTENT |
> IModelDelta.STATE | IModelDelta.SELECT);
> }

This change will indeed refresh the stack frame, but won't it also cause the debug target to be selected?  Unfortunately, if the SELECT flag is not set, I don't think the actions will be notified.  I filed bug 162595 in 3.3 cycle about this problem but my proposed solution was deemed risky.  Still, in our product we patched for this bug and haven't seen any adverse effects.
Comment 4 Darin Wright CLA 2008-03-31 11:55:02 EDT
I agree - we should look for a good solution that does not have adverse side effects (not neccessarily the fix shown here).
Comment 5 John Cortell CLA 2008-03-31 12:32:37 EDT
The IModelDelta.SELECT is overkill. The reason it fixes the problem is that a selection event results in the view's actions being updated. Seems to me all we have to do is ensure the platform updates the actions in addition to causing a refresh of the viewer in the  suspend timeout logic. Perhaps I'm overlooking something.
Comment 6 Darin Wright CLA 2008-04-24 12:14:31 EDT
Created attachment 97484 [details]
patch

This patch updates the active debug context's state when a parent element changes state. I think this will also fix bug 162595.
Comment 7 Darin Wright CLA 2008-04-24 12:15:53 EDT
Note - this does not change existing the model proxy's - it just changes the debug view processing of the delta.
Comment 8 Darin Wright CLA 2008-04-24 12:27:11 EDT
Released fix to HEAD.
Comment 9 Darin Wright CLA 2008-04-24 12:28:18 EDT
Please verify, Pawel.
Comment 10 Darin Wright CLA 2008-04-24 12:31:12 EDT
*** Bug 162595 has been marked as a duplicate of this bug. ***
Comment 11 Pawel Piech CLA 2008-04-24 12:58:27 EDT
Verified :-)