Bug 489683 - [breakpoints] change the breakpoint "number" from an int to a String
Summary: [breakpoints] change the breakpoint "number" from an int to a String
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: Next   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-15 15:07 EDT by Marc Dumais CLA
Modified: 2020-09-04 15:20 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Dumais CLA 2016-03-15 15:07:00 EDT
This is an API-breaking change, necessary because the breakpoint "number" provided by gdb has evolved so that it numbers breakpoints independently for each process being debugged. 

For example,  bkp1 for process1 would be number "1.1". Bkp2 would be "1.2". Process2 would have its own bkp1: "2.1".
Comment 1 Eclipse Genie CLA 2016-03-16 07:17:45 EDT
New Gerrit change created: https://git.eclipse.org/r/68524
Comment 2 Nobody - feel free to take it CLA 2016-03-16 12:54:04 EDT
(In reply to Marc Dumais from comment #0)
> This is an API-breaking change, necessary because the breakpoint "number"
> provided by gdb has evolved so that it numbers breakpoints independently for
> each process being debugged. 
> 
> For example,  bkp1 for process1 would be number "1.1". Bkp2 would be "1.2".
> Process2 would have its own bkp1: "2.1".

Do you know where the process number comes from? Is it the inferior's id?
Comment 3 Marc Dumais CLA 2016-03-16 13:11:01 EDT
(In reply to Mikhail Khodjaiants from comment #2)
> Do you know where the process number comes from? Is it the inferior's id?

yes, I believe it is the inferior id, as internally known to gdb.
Comment 4 Marc Khouzam CLA 2016-03-16 13:17:11 EDT
(gdb) info inferior
  Num  Description       Executable        
  3    <null>            /home/lmckhou/testing/loopsecond 
  2    <null>            /home/lmckhou/testing/loopfirst 
* 1    process 24685     /home/lmckhou/testing/loopfirst

(gdb) info break
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   <MULTIPLE>         
1.1                         y     0x000000000040055c in main() at loopfirst.cc:9 inf 2
1.2                         y     0x000000000040055c in main() at loopfirst.cc:9 inf 1
3       breakpoint     keep y   <MULTIPLE>         
3.1                         y     0x000000000040054c in main() at loopfirst.cc:7 inf 1
3.2                         y     0x000000000040054c in main() at loopfirst.cc:7 inf 2
3.3                         y     0x000000000040054c in main() at loopsecond.cc:8 inf 3
Comment 5 Marc Dumais CLA 2016-03-17 13:20:31 EDT
Mikhail,

I wanted to discuss the comment you added on the review (same comment in two places): 

"I think we should also add methods that return the process number and the breakpoint number in the process. It will encapsulate the parsing of the breakpoint's identifier string. Otherwise the clients of this class that parse the identifier would be affected by any change in the identifier format."

The goal for this week was to quickly do the API-breaking changes, before API freeze. What you suggest makes sense, but can be added as new APIs later. Is that ok with you?
Comment 6 Nobody - feel free to take it CLA 2016-03-17 13:46:06 EDT
(In reply to Marc Dumais from comment #5)
> Mikhail,
> 
> I wanted to discuss the comment you added on the review (same comment in two
> places): 
> 
> "I think we should also add methods that return the process number and the
> breakpoint number in the process. It will encapsulate the parsing of the
> breakpoint's identifier string. Otherwise the clients of this class that
> parse the identifier would be affected by any change in the identifier
> format."
> 
> The goal for this week was to quickly do the API-breaking changes, before
> API freeze. What you suggest makes sense, but can be added as new APIs
> later. Is that ok with you?

Sure, I thought about it too. The only problem is that we can add new methods only in 9.1, right?
Comment 7 Marc Dumais CLA 2016-03-17 13:57:33 EDT
(In reply to Mikhail Khodjaiants from comment #6)
> Sure, I thought about it too. The only problem is that we can add new
> methods only in 9.1, right?

yes, that's correct. More work will also be required to actually parse and use the new breakpoint number format, but at least we will be able to proceed for 9.1 instead of waiting for CDT 10.
Comment 8 Nobody - feel free to take it CLA 2016-03-17 14:22:05 EDT
(In reply to Marc Dumais from comment #7)
> (In reply to Mikhail Khodjaiants from comment #6)
> > Sure, I thought about it too. The only problem is that we can add new
> > methods only in 9.1, right?
> 
> yes, that's correct. More work will also be required to actually parse and
> use the new breakpoint number format, but at least we will be able to
> proceed for 9.1 instead of waiting for CDT 10.

Not sure I understand the difficulties. Assuming that breakpoint's number format is 'x.y' I suggested adding two new methods to MIBreakpoint class, something like the following:

int getInferiorNumber(), which would return the first part of a complex breakpoint number, or 0 when the breakpoint number is a single integer.

int getBreakpointNumber(), which would return the breakpoint's number in the inferior, i.e. the second part of the complex breakpoint number.

The implementation of both methods seem to be very easy unless I missing something here.

Since MIBreakpointDMData is a wrapper around MIBreakpoint the same methods should be added to it too.
Comment 9 Marc Dumais CLA 2016-03-18 08:38:56 EDT
(In reply to Mikhail Khodjaiants from comment #8)
> Not sure I understand the difficulties. Assuming that breakpoint's number
> format is 'x.y' I suggested adding two new methods to MIBreakpoint class,
> something like the following:
> 
> int getInferiorNumber(), which would return the first part of a complex
> breakpoint number, or 0 when the breakpoint number is a single integer.
> 
> int getBreakpointNumber(), which would return the breakpoint's number in the
> inferior, i.e. the second part of the complex breakpoint number.
> 
> The implementation of both methods seem to be very easy unless I missing
> something here.
> 
> Since MIBreakpointDMData is a wrapper around MIBreakpoint the same methods
> should be added to it too.

At this point, we have not thought about the way forward enough to commit to adding these APIs. They do seem to make sense, but we want to think about it some more. 

BTW, I had a talk with Marc K., and we are permitted to add APIs until M7, so for about another month.
Comment 10 Eclipse Genie CLA 2016-03-18 13:50:56 EDT
New Gerrit change created: https://git.eclipse.org/r/68796
Comment 12 Eclipse Genie CLA 2016-03-19 13:05:22 EDT
New Gerrit change created: https://git.eclipse.org/r/68841