This is the mail archive of the gdb-patches@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: [PATCH 2/8] Check LWP_SIGNAL_CAN_BE_DELIVERED for enqueue/dequeue pending signals


On 03/17/2016 08:40 AM, Yao Qi wrote:

>
> Here is the version to change it to function and also update comments as
> Luis suggested.

Thanks.


+/* The signal can be delivered to the inferior if we are not trying to
+   reinsert a breakpoint and not trying to finish a fast tracepoint
+   collect.  */
+
+static int
+lwp_signal_can_be_delivered (struct lwp_info *lwp)
+{
+  return !(lwp->bp_reinsert != 0 || lwp->collecting_fast_tracepoint);

The comment is written in terms of "and", but the implementation is in
terms of "or", negated.

If you write it like:

  return (lwp->bp_reinsert == 0 && !lwp->collecting_fast_tracepoint);

then it matches exactly what the comment says, making it easier to
reason about.

Otherwise LGTM.

Thanks,
Pedro Alves


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