This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Fix build error (Re: [PATCH v2 2/3] Display names of remote threads)
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: simon dot marchi at ericsson dot com (Simon Marchi)
- Cc: palves at redhat dot com (Pedro Alves), gdb-patches at sourceware dot org
- Date: Tue, 1 Dec 2015 18:08:37 +0100 (CET)
- Subject: [commit] Fix build error (Re: [PATCH v2 2/3] Display names of remote threads)
- Authentication-results: sourceware.org; auth=none
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.
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);
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com