Re: MI: reporting of multiple breakpoints

Vladimir Prus
2006-02-17T15:48:56Z

Daniel Jacobowitz wrote:

> On Fri, Feb 17, 2006 at 06:01:13PM +0300, Vladimir Prus wrote:
>>
>> Hello!
>> It seems that for stop on multiple breakpoints, MI reports only one:
>>
>> (gdb)
>> -break-insert main
>> ^done,bkpt={number="1",type="breakpoint".....
>> (gdb)
>> -break-insert main
>> ^done,bkpt={number="2",type="breakpoint"......
>> (gdb)
>> -exec-run
>> ^running
>> (gdb)
>> *stopped,reason="breakpoint-hit",bkptno="1",thread-id="1",frame={...}
>>
>> Is this a bug, or by design?
>
> The CLI does the same thing; so does the core of GDB, unsurprisingly.

For ordinary breakpoints, yes. For watchpoints, not quite:

(gdb) watch p1
Hardware watchpoint 3: p1
(gdb) watch p1
Hardware watchpoint 4: p1
(gdb) c
Continuing.
Hardware watchpoint 3: p1

Old value = (int *) 0x0
New value = (int *) 0x8049994
Hardware watchpoint 4: p1

Old value = (int *) 0x0
New value = (int *) 0x8049994
main () at print_pointers.cpp:27
27 B* p2 = (B*)0x12345678;

while in MI we get:

-break-watch p1
^done,wpt={number="2",exp="p1"}
(gdb)
-break-watch p2
^done,wpt={number="3",exp="p2"}
(gdb)
-exec-continue
^running
(gdb)
*stopped,reason="watchpoint-trigger",
wpt={number="2",exp="p1"},
value={old="(int *) 0x0",new="(int *) 0x8049994"},
thread-id="1",frame={...}

CLI reports two watchpoints, and MI reports just one. I did not test more
complex combinations, like mix of watchpoints and breakpoints that trigger
on the same line.

> It's not entirely obvious what ought to happen.

Well, all breakpoints which stop conditions are satisfied should be
reported, I guess.

- Volodya