This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 10/18] Remote thread create/exit events
- From: Pedro Alves <palves at redhat dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 01 Dec 2015 16:06:31 +0000
- Subject: Re: [PATCH 10/18] Remote thread create/exit events
- Authentication-results: sourceware.org; auth=none
- References: <20151201151227 dot 7FB35F8BD at oc7340732750 dot ibm dot com>
On 12/01/2015 03:12 PM, Ulrich Weigand wrote:
> Pedro Alves wrote:
>
>> + case 'w': /* Thread exited. */
>> + {
>> + char *p;
>> + ULONGEST value;
>> +
>> + event->ws.kind = TARGET_WAITKIND_THREAD_EXITED;
>> + p = unpack_varlen_hex (&buf[1], &value);
>> + event->ws.value.integer = value;
>> + if (*p != ';')
>> + error (_("stop reply packet badly formatted: %s"), buf);
>> + event->ptid = read_ptid (++p, &p);
>
> This causes a build error on my RHEL 5 daily build system (using
> the GCC 4.1.2 host compiler) due to:
>
> gdb/remote.c: In function 'remote_parse_stop_reply':
> gdb/remote.c:6549: warning: operation on 'p' may be undefined
>
> I'm not 100% convinced this is really undefined, since the
> value of &p doesn't change whether or not ++p is evaluated
> before or after it.
I agree.
>
> But in any case, since p isn't used afterwards, any reason why
> this couldn't instead just be:
>
> event->ptid = read_ptid (++p, NULL);
Indeed, that should work.
Thanks,
Pedro Alves