diff mbox

[commit] Fix build error (Re: [PATCH v2 2/3] Display names of remote threads)

Message ID 20151201170837.DC954F8BD@oc7340732750.ibm.com
State New
Headers show

Commit Message

Ulrich Weigand Dec. 1, 2015, 5:08 p.m. UTC
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

Simon Marchi Dec. 1, 2015, 5:54 p.m. UTC | #1
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!
diff mbox

Patch

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);