This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Support for enabling/disabling tracepoints while a trace experiment is running
- From: Kwok Cheung Yeung <kcy at codesourcery dot com>
- To: Pedro Alves <pedro at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 05 May 2011 19:29:34 +0100
- Subject: Re: [PATCH] Support for enabling/disabling tracepoints while a trace experiment is running
- References: <4DC2DDEF.10600@codesourcery.com> <201105051848.15560.pedro@codesourcery.com>
On 05/05/2011 18:48, Pedro Alves wrote:
>> + if ((enable && tp->enabled) || (!enable && !tp->enabled))
>
> but isn't this just:
>
> if (enable != tp->enabled)
>
> ?
>
In this case it is, since enable and tp->enabled can only take the values 0 and
1. However, 'true' in C is 'non-zero' - 1 and ~0 are both non-zero and therefore
'true', but they aren't equal. The first version would get the boolean
comparison correct if there were multiple values of 'true' being used, whereas
the second would not.
Kwok