This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: GDB remote protocol and conditional breakpoints
- From: Luis Machado <lgustavo at codesourcery dot com>
- To: David Taylor <dtaylor at emc dot com>, <gdb at sourceware dot org>
- Date: Thu, 10 Sep 2015 19:42:22 -0300
- Subject: Re: GDB remote protocol and conditional breakpoints
- Authentication-results: sourceware.org; auth=none
- References: <22850 dot 1441920145 at usendtaylorx2l dot lss dot emc dot com>
- Reply-to: Luis Machado <lgustavo at codesourcery dot com>
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:
/* Evaluate each condition in the breakpoint's list of conditions.
Return true if any of the conditions evaluates to TRUE.
If we failed to evaluate the expression, TRUE is returned. This
forces GDB to reevaluate the conditions. */
for (cl = bp->cond_list;
cl && !value && !err; cl = cl->next)
{
/* Evaluate the condition. */
err = gdb_eval_agent_expr (&ctx, cl->cond, &value);
}