Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339216 - Add support for foreign breakpoints
Summary: Add support for foreign breakpoints
Status: RESOLVED FIXED
Alias: None
Product: TCF
Classification: Tools
Component: Debug (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 0.4.0   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-08 08:10 EST by Anton Leherbauer CLA
Modified: 2013-06-05 05:54 EDT (History)
1 user (show)

See Also:


Attachments
Proposed patch (17.37 KB, patch)
2011-03-08 08:10 EST, Anton Leherbauer CLA
mober.at+eclipse: iplog+
Details | Diff
Follow up fix (15.31 KB, patch)
2011-03-10 10:30 EST, Anton Leherbauer CLA
mober.at+eclipse: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Leherbauer CLA 2011-03-08 08:10:51 EST
Created attachment 190654 [details]
Proposed patch

Breakpoints created outside Eclipse by another client are currently not displayed in Eclipse.  This patch creates transient non-persisted breakpoint markers on the fly for such breakpoints (if possible).
Comment 1 Eugene Tarassov CLA 2011-03-08 21:23:05 EST
The code in TCFBreakpointStatusListener patch is prone to racing conditions. It causes the list of transient breakpoints to get out of sync if events are coming in too fast. I can reproduce the problem by pressing and holding Ctrl+Shift+B in second instance of Eclipse.

I am going to work on a fix for the racing before committing the code.

Thanks!
Comment 2 Eugene Tarassov CLA 2011-03-09 14:36:20 EST
I'v made changes to solve synchronization problems and committed the code.

There are still some issues that we need to consider before closing the bug:

1. Enabling/disabling/modifying breakpoints is not properly propagated to second client GUI.

2. User can modify foreign breakpoints, but it has not effect on a target. I would prefer foreign breakpoints to be read-only.

3. Watchpoints are shown as line breakpoints in second client.

4. Deleting of foreign breakpoints causes a lot of exceptions in CDT code:
org.eclipse.debug.core.DebugException: Breakpoint does not have an associated marker.
It looks like CDT does not do proper locking of workspace data when updating Breakpoints view. It might be related to #5:

5. ResourcesPlugin.getWorkspace().getRuleFactory().markerRule(resource) always returns null. This causes fatal racing. I have changed the code to use modifyRule() to avoid the racing, but I'm not sure what is the right way to schedule breakpoint updates in Eclipse.
Comment 3 Anton Leherbauer CLA 2011-03-10 10:30:34 EST
Created attachment 190869 [details]
Follow up fix

(In reply to comment #2)
> I'v made changes to solve synchronization problems and committed the code.

Thanks!

> There are still some issues that we need to consider before closing the bug:
> 
> 1. Enabling/disabling/modifying breakpoints is not properly propagated to
> second client GUI.

This is fixed with this patch.

> 2. User can modify foreign breakpoints, but it has not effect on a target. I
> would prefer foreign breakpoints to be read-only.

Unfortunately I don't know of a way to make breakpoints read-only.  This patch allows at least keeps the breakpoint states in sync.

> 3. Watchpoints are shown as line breakpoints in second client.

I've fixed that.

> 4. Deleting of foreign breakpoints causes a lot of exceptions in CDT code:
> org.eclipse.debug.core.DebugException: Breakpoint does not have an associated
> marker.
> It looks like CDT does not do proper locking of workspace data when updating
> Breakpoints view. It might be related to #5:

I see this only when breakpoints are created/deleted rapidly.  Under "normal" conditions this did not occur.  A fix for this would probably need to go into the platform to protect from marker changes/removal while updating the breakpoint labels.

> 5. ResourcesPlugin.getWorkspace().getRuleFactory().markerRule(resource) always
> returns null. This causes fatal racing. I have changed the code to use
> modifyRule() to avoid the racing, but I'm not sure what is the right way to
> schedule breakpoint updates in Eclipse.

I think the reason for the null rule is that it should always be allowed to create markers so that you can e.g. set a breakpoint while the workspace is built or problem markers for compiler errors can be created.
It does open the door for race conditions, though.
Comment 4 Eugene Tarassov CLA 2011-03-10 21:21:41 EST
OK. It looks great.
Committed.
Thanks!
Comment 5 Martin Oberhuber CLA 2013-05-23 19:49:26 EDT
Comment on attachment 190869 [details]
Follow up fix

Anton was elected TCF committer on 24-Mar-2011:
http://dev.eclipse.org/mhonarc/lists/tcf-dev/msg00028.html

Thus any contributions before that time must be marked iplog+