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

Vladimir Prus
2006-02-17T14:14:16Z

Daniel Jacobowitz wrote:

> On Fri, Feb 17, 2006 at 03:37:21PM +0300, Vladimir Prus wrote:
>>
>> Hello!
>>
>> The output of -break-insert and -break-watch currently looks like this:
>>
>> ^done,bkpt={number="1",......
>>
>> and
>>
>> ^done,wpt={number="2",.......
>>
>> What is exactly the point of using different field names: "bkpt" and
>> "wpt"? This makes it impossible to get the number of set breakpoint in a
>> uniform fashion -- I need to have some conditional on the type of
>> breakpoint, or add logic that checks if "bkpt" or "wpt" is present in
>> reply.
>
> 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'?

- Volodya