This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [commit] Fix build error (Re: [PATCH v2 2/3] Display names of remote threads)
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: Pedro Alves <palves at redhat dot com>, <gdb-patches at sourceware dot org>
- Date: Tue, 1 Dec 2015 12:54:26 -0500
- Subject: Re: [commit] Fix build error (Re: [PATCH v2 2/3] Display names of remote threads)
- Authentication-results: sourceware.org; auth=none
- References: <20151201170837 dot DC954F8BD at oc7340732750 dot ibm dot com>
On 15-12-01 12:08 PM, Ulrich Weigand wrote:
> Simon Marchi wrote:
>
>> (thread_item_t) <name>: New field.
>
> This causes build errors for me when using a GCC 4.4.7 host compiler:
>
> gdb/remote.c: In function â?~remote_update_thread_listâ?T:
> gdb/remote.c:2855: error: â?~item.nameâ?T may be used uninitialized in this function
> gdb/remote.c:3079: note: â?~item.nameâ?T was declared here
>
> There were in fact two places where a struct thread_item with an uninitialized
> name field was added to a vector.
>
> I've checked in the following patch to fix the build error.
>
> Bye,
> Ulrich
>
> ChangeLog:
>
> * remote.c (remote_newthread_step): Initialize item.name.
> (remote_get_threads_with_qthreadinfo): Likewise.
>
> diff --git a/gdb/remote.c b/gdb/remote.c
> index 9d44ce1..c60f173 100644
> --- a/gdb/remote.c
> +++ b/gdb/remote.c
> @@ -2914,6 +2914,7 @@ remote_newthread_step (threadref *ref, void *data)
>
> item.ptid = ptid_build (pid, threadref_to_int (ref), 0);
> item.core = -1;
> + item.name = NULL;
> item.extra = NULL;
>
> VEC_safe_push (thread_item_t, context->items, &item);
> @@ -3079,6 +3080,7 @@ remote_get_threads_with_qthreadinfo (struct target_ops *ops,
>
> item.ptid = read_ptid (bufp, &bufp);
> item.core = -1;
> + item.name = NULL;
> item.extra = NULL;
>
> VEC_safe_push (thread_item_t, context->items, &item);
>
Thanks!