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: GDB remote protocol and conditional breakpoints


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);
    }


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