This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MI: output of -break-insert and -break-watch


Daniel Jacobowitz wrote:

> On Fri, Feb 17, 2006 at 05:13:52PM +0300, Vladimir Prus wrote:
>> > I don't get it.  Why is this a problem?  It sounds to me like the only
>> > reason this would be awkward would be limitations of your front end.
>> > If you've done -break-insert you should expect a bkpt response, if
>> > you've done -break-watch you should expect a wpt response.
>> 
>> Here's the code I use now to extract breakpoint id from response:
>> 
>>             int id = -1;
>> 
>>             if (r.hasField("bkpt"))
>>                 id = r["bkpt"]["number"].literal().toInt();
>>             else if (r.hasField("wpt"))
>>                 id = r["wpt"]["number"].literal().toInt();
>>             else if (r.hasField("hw-rwpt"))
>>                 id = r["hw-rwpt"]["number"].literal().toInt();
>> 
>> And there's also "hw-awpt", and in future there might be "catchpoint" and
>> "fork" and what not.
>> 
>> If I only want to extract the *id* of breakpoint, why do I need to write
>> such boilerplate? Or should I write a function that will iterate over all
>> fields of 'r', and check if that field has nested field called 'number'?
> 
> This still sounds to me like it has more to do with the architecture of
> your front-end than it does with meaningful layout of MI.  

Well, I'm not sure it's specific to KDevelop:

1. All frontends will want to know the id of the set breakpoint, as that's
the only information that allows to modify the breakpoint later.

2. The above "bkpt" and so on are MI-specific names which must be hardcoded
in frontend somewhere.

> This is only 
> about the response to -break-insert and -break-watch as far as I
> understand.  So if you want to avoid the conditional, you can record
> which type to expect when you issue the command.  

And if I have to remember the type of breakpoint command I've sent, then
what's the use of the different naming of field in reply -- it clearly not
need to recover the type of breakpoint, as I've already remembered it.

> Or leave the conditional; it's not that bad, is it?

Well, it just got another "if" clause for "hw-awpt", and I'd expect this to
grow by a couple over time. No, it's no a big architectural thing, but
still an annoyance.

- Volodya



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]