Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: simon.marchi@ericsson.com (Simon Marchi)
Cc: palves@redhat.com (Pedro Alves), gdb-patches@sourceware.org
Subject: [commit] Fix build error (Re: [PATCH v2 2/3] Display names of remote threads)
Date: Tue, 01 Dec 2015 17:08:00 -0000	[thread overview]
Message-ID: <20151201170837.DC954F8BD@oc7340732750.ibm.com> (raw)
In-Reply-To: <56572AA0.9070904@ericsson.com> from "Simon Marchi" at Nov 26, 2015 10:52:00 AM

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


  parent reply	other threads:[~2015-12-01 17:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 21:49 [PATCH v2 0/3] Remote thread name support Simon Marchi
2015-11-25 21:49 ` [PATCH v2 3/3] Add test for thread names Simon Marchi
2015-11-26 11:45   ` Pedro Alves
2015-11-26 16:00     ` Simon Marchi
2015-11-26 16:57       ` Pedro Alves
2015-11-26 18:21         ` Simon Marchi
2015-11-25 21:49 ` [PATCH v2 1/3] Constify thread name return path Simon Marchi
2015-11-26 11:21   ` Pedro Alves
2015-11-26 15:46     ` Simon Marchi
2015-11-25 21:49 ` [PATCH v2 2/3] Display names of remote threads Simon Marchi
2015-11-26 11:32   ` Pedro Alves
2015-11-26 15:52     ` Simon Marchi
2015-11-26 16:30       ` Pedro Alves
2015-11-26 17:00         ` Simon Marchi
2015-11-27 14:37       ` Yao Qi
2015-11-27 15:16         ` Simon Marchi
2015-12-01 17:08       ` Ulrich Weigand [this message]
2015-12-01 17:54         ` [commit] Fix build error (Re: [PATCH v2 2/3] Display names of remote threads) Simon Marchi
2015-11-27 13:31 ` gdb fails to build (was: Re: [PATCH v2 0/3] Remote thread name support) Tobias Burnus
2015-11-27 15:49   ` gdb fails to build Simon Marchi
2015-11-27 19:05     ` Simon Marchi
2015-11-27 22:36       ` Tobias Burnus
2015-11-27 22:47         ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151201170837.DC954F8BD@oc7340732750.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=simon.marchi@ericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox