From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 124975 invoked by alias); 28 Mar 2017 14:08:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 124965 invoked by uid 89); 28 Mar 2017 14:08:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy= X-HELO: mail-wr0-f170.google.com Received: from mail-wr0-f170.google.com (HELO mail-wr0-f170.google.com) (209.85.128.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Mar 2017 14:08:22 +0000 Received: by mail-wr0-f170.google.com with SMTP id w43so92471911wrb.0 for ; Tue, 28 Mar 2017 07:08:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=6igpZisywE2UHOPkipkyxb185rUzOgRHAgHSdiwSiB4=; b=E6Ftai1xRZRexQS5S9MpPcWTr21VotASF1RpoWGZxtPlgK/2k8Q89BMEouEmb4gd7z ummS4/URx4mmbnBLUOSdkvusJ0jYMdq1wZRTVgHfXcpnyRxUkZPphkhMA0/7GQIDJn+g S0DSG/5mtKw1PXooHHdshJdA4FsTVf+fnZXHJKa8YeBcZLkJm+d4oQpcnIo7lgbKSnu1 eIWh6dSxtYQ6F0ARqddeULQ0ukJoZ91Ck5oQQ9hxhmSVlXPzOM9/YYlhDyPRz6CHcNJH 6DC0zQG3pw21WC0TU/qFTWIj47yf+m2A9C7siqKoyhHHtAYbNcUq+GHaC/ryuWjaFLzR iS8Q== X-Gm-Message-State: AFeK/H1fuAsQnvkkzehUg7ixD314szgDHRoIYJ/+/KQW7QLqNZHyLGaxCkrUrSoILPkYFg== X-Received: by 10.223.134.149 with SMTP id 21mr27390590wrx.1.1490710101229; Tue, 28 Mar 2017 07:08:21 -0700 (PDT) Received: from E107787-LIN ([194.214.185.158]) by smtp.gmail.com with ESMTPSA id e129sm3788458wma.13.2017.03.28.07.08.20 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 28 Mar 2017 07:08:20 -0700 (PDT) From: Yao Qi To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 1/2] Add constructor and destructor to thread_info References: <1490689483-16084-1-git-send-email-yao.qi@linaro.org> <1490689483-16084-2-git-send-email-yao.qi@linaro.org> <06385391-127e-87b7-d727-7d03a23f293c@redhat.com> Date: Tue, 28 Mar 2017 14:08:00 -0000 In-Reply-To: <06385391-127e-87b7-d727-7d03a23f293c@redhat.com> (Pedro Alves's message of "Tue, 28 Mar 2017 13:12:04 +0100") Message-ID: <86inmto5nx.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00482.txt.bz2 Pedro Alves writes: >> /* Non-zero means the thread is executing. Note: this is different >> from saying that there is an active target and we are stopped at >> a breakpoint, for instance. This is a real indicator whether the >> thread is off and running. */ >> - int executing; >> + int executing =3D 0; > > and do: > > bool executing =3D false; > > etc. (and tweak "Non-zero" references to say "True" instead.) > > (the patch's subject just becomes "C++-fy thread_info a bit" instead.) > Other thread_info fields can be changed to bool too. Once I change "executing" to bool, the 2nd argument of set_executing should be bool too. I'll change them in separate patches. >> @@ -220,7 +205,8 @@ init_thread_list (void) >> for (tp =3D thread_list; tp; tp =3D tpnext) >> { >> tpnext =3D tp->next; >> - free_thread (tp); >> + delete tp; >> + > > Spurious whitespace. > You mean spurious newline? > These could all be in-class initialized like you did to the other > fields, instead of using the explicit memset: > > - struct btrace_thread_info btrace; > + struct btrace_thread_info btrace {}; > > - struct target_waitstatus pending_follow; > + struct target_waitstatus pending_follow {TARGET_WAITKIND_SPURIOUS}; > This will only initialize the first member of union target_waitstatus.value to zero, so some bits of target_waitstatus.value.related_pid is not initialized. > (maybe drop the "struct" too while at it). --=20 Yao (=E9=BD=90=E5=B0=A7)