Re: GDB remote protocol and conditional breakpoints
Pedro Alves <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
On 09/10/2015 11:42 PM, Luis Machado wrote: > On 09/10/2015 06:22 PM, David Taylor wrote: >> In GDB's remote protocol, there is a Z0 command for setting breakpoints. >> The summary of the Z0 command is: >> >> Z0,addr,kind[;cond_list...][;cmds:persist,cmd_list...] >> >> I have a question about the cond_list part. The description in the >> manual says, in part: >> >> cond_list is an optional list of conditional expressions in bytecode >> form that should be evaluated on the target's side. These are >> conditions that should be taken into consideration when deciding if >> the breakpoint trigger should be reported back to GDBN. >> >> The cond_list parameter is comprised of a series of expressions, >> concatenated without separators. >> >> If there is only one expression, no problem. But, if there are multiple >> expressions, should the stub treat them as having an implicit || between >> them? Or an implicit && ? Or something else? >> >> That is, is the breakpoint reported to GDB and the commands run if *ANY* >> of the conditions are true? If *ALL* of the conditions are true? Or >> something else? >> >> What is the intent when there are multiple conditions? > > I remember implementing this first as an implicit &&, but then we ended > up changing it to ||, as evidenced by the comment in the code in > mem-break.c:gdb_condition_true_at_breakpoint_z_type: Yeah, that's because each of the conditions comes from separate breakpoint on the GDB side. E.g, if you have: (gdb) break foo if global == 1 (gdb) break foo if global == 2 When the breakpoint at foo hits, the stop should be reported to the user if global == 1 OR global == 2. Thanks, Pedro Alves