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

Bug 332605

Summary: MIBreakpointsManager convertToTargetBreakpoint didn't convert the breakpoint type attribute
Product: [Tools] CDT Reporter: Tien Hock Loh <thloh>
Component: cdt-debug-dsf-gdbAssignee: Marc Khouzam <marc.khouzam>
Status: RESOLVED FIXED QA Contact: Marc Khouzam <marc.khouzam>
Severity: normal    
Priority: P3 CC: cdtdoug, marc.khouzam, pawel.1.piech
Version: 8.0   
Target Milestone: 7.0.2   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch to MIBreakpointsManager::convertToTargetBreakpoints so that hardware/temporary breakpoints are set from CDIBreakpoints
none
Adds hardware/temporary breakpoint property when converting CDI breakpoint to DSF breakpoint
none
MIBreakpointsManager patch to include hardware and temporary breakpoints attributes marc.khouzam: iplog+

Description Tien Hock Loh CLA 2010-12-15 04:24:04 EST
Build Identifier: M20100211-1343

convertToTargetBreakpoint in MIBreakpointsManager doesn't convert the breakpoint type attribute and thus MIBreakpointDMData::IS_HARDWARE is not set when MIBreakpointsManager do a InstallBreakpoint. 

Reproducible: Always
Comment 1 Marc Khouzam CLA 2010-12-15 09:30:29 EST
From looking at the code it seems you are right.  The reason it was never noticed is that we never set Hardware breakpoints.  Same goes for temporary breakpoints.

So, MIBreakpointsManager#convertToTargetBreakpoint should convert both:

MIBreakpointDMData.IS_TEMPORARY
MIBreakpointDMData.IS_HARDWARE

for breakpoints, catchpoints and tracepoints, so maybe it is best to set them all the time in convertToTargetBreakpoint()

Thanks for reporting this.
Comment 2 Tien Hock Loh CLA 2010-12-15 19:36:17 EST
Yes I noticed that HW Breakpoints cannot be set using the UI of CDI, but we're actually trying to add the feature to Eclipse so that user can set the hardware breakpoint (currently prototyping, will be contributing to Eclipse if possible)
Is this considered a high priority bug? We can provide a patch if it helps.
Comment 3 Marc Khouzam CLA 2010-12-15 22:35:03 EST
(In reply to comment #2)
> Yes I noticed that HW Breakpoints cannot be set using the UI of CDI, but we're
> actually trying to add the feature to Eclipse so that user can set the hardware
> breakpoint (currently prototyping, will be contributing to Eclipse if possible)

Sounds great!

> Is this considered a high priority bug? We can provide a patch if it helps.

I wouldn't say high-priority, but it would be nice to fix.  As you know the fix is easy, so if you can provide a patch, I'll commit it.

Thanks
Comment 4 Tien Hock Loh CLA 2010-12-16 20:06:05 EST
Sure, I'll submit a patch when I've got it fixed.
Comment 5 Tien Hock Loh CLA 2010-12-17 01:49:13 EST
Created attachment 185400 [details]
Patch to MIBreakpointsManager::convertToTargetBreakpoints so that hardware/temporary breakpoints are set from CDIBreakpoints
Comment 6 Marc Khouzam CLA 2010-12-19 21:00:47 EST
This patch is against a old version.  Can you update to the latest please?
Comment 7 Tien Hock Loh CLA 2010-12-20 19:30:34 EST
Do I need to get the latest bleeding edge source code or just the latest released 3.6 version will do?
How do I get the bleeding edge source code if I need to patch against that?
Comment 8 Marc Khouzam CLA 2010-12-21 09:23:14 EST
(In reply to comment #7)
> Do I need to get the latest bleeding edge source code or just the latest
> released 3.6 version will do?
> How do I get the bleeding edge source code if I need to patch against that?

Yes you would need the latest code.
You can look at http://wiki.eclipse.org/CDT/contributing
You would also need the code under 
org.eclipse.cdt/dsf
and
org.eclipse.cdt/dsf-gdb

However, this patch is small enough that I can migrate your changes to the latest code and commit it.  But if you want to 'practice' for future contributions, I welcome you to do it.  Just let me know what you prefer.
Comment 9 Tien Hock Loh CLA 2010-12-21 19:08:56 EST
I'll do the patch. We'll likely be contributing to Eclipse features in near future. 
Thanks.
Comment 10 Tien Hock Loh CLA 2010-12-29 22:31:44 EST
Created attachment 185897 [details]
Adds hardware/temporary breakpoint property when converting CDI breakpoint to DSF breakpoint
Comment 11 Tien Hock Loh CLA 2011-01-12 22:25:34 EST
Hi Marc,
Do you have an ETA when you can get this integrated?
Thanks
Comment 12 Marc Khouzam CLA 2011-01-13 09:20:24 EST
(In reply to comment #10)
> Created attachment 185897 [details]
> Adds hardware/temporary breakpoint property when converting CDI breakpoint to
> DSF breakpoint

A hardware breakpoint and a hardware watchpoints are two different things, right?  I've never actually seen how GDB sets either one.  I'm asking because MIBreakpoint#parse sets both isHdw and isWpt together.  Is this right?  This was copied from the same class in CDI.
Comment 13 Marc Khouzam CLA 2011-01-13 09:44:23 EST
(In reply to comment #11)
> Hi Marc,
> Do you have an ETA when you can get this integrated?
> Thanks

 ((Integer) attributes.get(ICBreakpointType.TYPE) & ICBreakpointType.HARDWARE)

attributes.get could return null, which would lead to an NPE here.  Can you check for null?
Comment 14 Tien Hock Loh CLA 2011-01-13 19:21:50 EST
(In reply to comment #12)
> (In reply to comment #10)
> > Created attachment 185897 [details] [details]
> > Adds hardware/temporary breakpoint property when converting CDI breakpoint to
> > DSF breakpoint
> 
> A hardware breakpoint and a hardware watchpoints are two different things,
> right?  I've never actually seen how GDB sets either one.  I'm asking because
> MIBreakpoint#parse sets both isHdw and isWpt together.  Is this right?  This
> was copied from the same class in CDI.

Yes they should be. The thing is, I'm haven't been reading a lot of watch point's code, thus I'm not including hardware property when breakpoint is an instance of ICWatchPoint. 
There's currently no way to set the hardware breakpoint, but we're going to make a patch/plug-in to support it and hopefully integrate back to Eclipse. 

(In reply to comment #13)
> (In reply to comment #11)
> > Hi Marc,
> > Do you have an ETA when you can get this integrated?
> > Thanks
> 
>  ((Integer) attributes.get(ICBreakpointType.TYPE) & ICBreakpointType.HARDWARE)
> 
> attributes.get could return null, which would lead to an NPE here.  Can you
> check for null?

Looks like I've missed out an important detail here, will update the patch. Thanks.
Comment 15 Marc Khouzam CLA 2011-01-14 14:37:28 EST
(In reply to comment #14)

> Looks like I've missed out an important detail here, will update the patch.
> Thanks.

If you can have the patch before Monday, I can include it for the RC1 build.
Comment 16 Tien Hock Loh CLA 2011-01-16 20:35:30 EST
Created attachment 186891 [details]
MIBreakpointsManager patch to include hardware and temporary breakpoints attributes
Comment 17 Marc Khouzam CLA 2011-01-17 11:18:25 EST
Committed to both HEAD and the 7_0 branch.

Thanks for the patch.