[commit] Fix build error (Re: [PATCH v2 2/3] Display names of remote threads)
Commit Message
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â:
gdb/remote.c:2855: error: âitem.nameâ may be used uninitialized in this function
gdb/remote.c:3079: note: âitem.nameâ 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.
Comments
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!
@@ -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);