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

Bug 397460

Summary: [breakpoints] Duplicate GDB breakpoints do not get associated to the platform bp properly
Product: [Tools] CDT Reporter: Marc Khouzam <marc.khouzam>
Component: cdt-debug-dsf-gdbAssignee: Marc Khouzam <marc.khouzam>
Status: RESOLVED FIXED QA Contact: Marc Khouzam <marc.khouzam>
Severity: normal    
Priority: P3 CC: cdtdoug, nobody, pawel.1.piech
Version: Next   
Target Milestone: 8.2   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Marc Khouzam CLA 2013-01-04 11:15:25 EST
From the review of bug 392512 the following comment came up:

Marc's comment:
In MIBreakpointsSynchronizer#targetBreakpointCreated(),
I believe bm.breakpointAdded() will do much more than increment the install count. It will behave as if a new platformBp was created, instead of re-using the existing platform bp. In fact testing that case gives me: 
!ENTRY org.eclipse.cdt.dsf
!MESSAGE Breakpoint already installed 
!SUBENTRY 1 org.eclipse.cdt.dsf.gdb
!MESSAGE Breakpoint already installed

Mikhail's answer:
Using "breakpointAdded()" is the right approach if a platform breakpoint already exists, but is not installed in the session. This happens when a breakpoint is deleted from the console and then set again. I believe you get "Breakpoint already installed" when you try to set a duplicate breakpoint from the console. In this case the problem is in MIBreakpointsManager. It doesn't allow duplicate breakpoints. I think it is wrong, a platform breakpoint can be associated with multiple target breakpoints. Removing "Minimal validation" code from MIBreakpointsManager.installBreakpoint() seems to work fine.
Comment 1 Marc Khouzam CLA 2013-01-04 11:19:32 EST
To reproduce simply:
- launch a debug session
- create a platform bp on that session
- from the gdb console create a bp at the same line
=> if the platform bp is disabled or deleted, the bp created from the gdb console is not disabled or deleted in GDB and will still cause execution to stop

Intead, we want any action on the platform bp to affect all target breakpoints at that line.

Mikhail's suggestion of "Removing 'Minimal validation' code from  IBreakpointsManager.installBreakpoint()" does seem to work fine.  I will look into it a little further before posting a patch.
Comment 2 Marc Khouzam CLA 2013-01-04 11:55:14 EST
(In reply to comment #1)

> Mikhail's suggestion of "Removing 'Minimal validation' code from 
> IBreakpointsManager.installBreakpoint()" does seem to work fine.  I will
> look into it a little further before posting a patch.

That looks right to me.  It also works when creating a breakpoint from the console for a specific thread.

I've pushed that to Gerrit:
https://git.eclipse.org/r/9460
Comment 3 Marc Khouzam CLA 2013-01-04 13:02:31 EST
(In reply to comment #2)

> I've pushed that to Gerrit:
> https://git.eclipse.org/r/9460

Committed to master.