From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92373 invoked by alias); 21 Feb 2017 21:27:13 -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 92358 invoked by uid 89); 21 Feb 2017 21:27:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=confusion, Hx-languages-length:2685, Marks, los X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 Feb 2017 21:27:11 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 938F43A768B; Tue, 21 Feb 2017 21:27:11 +0000 (UTC) Received: from localhost (unused-10-15-17-193.yyz.redhat.com [10.15.17.193]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LLRA2v027059 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Feb 2017 16:27:11 -0500 From: Sergio Durigan Junior To: Pedro Alves Cc: GDB Patches , Luis Machado Subject: Re: [PATCH v3 4/6] Share parts of gdb/gdbthread.h with gdbserver References: <1482464361-4068-1-git-send-email-sergiodj@redhat.com> <20170208032257.15443-1-sergiodj@redhat.com> <20170208032257.15443-5-sergiodj@redhat.com> <5a437cf3-c980-bb70-35ac-533835ed9d01@redhat.com> X-URL: http://blog.sergiodj.net Date: Tue, 21 Feb 2017 21:27:00 -0000 In-Reply-To: <5a437cf3-c980-bb70-35ac-533835ed9d01@redhat.com> (Pedro Alves's message of "Wed, 15 Feb 2017 16:15:17 +0000") Message-ID: <87tw7nfd5e.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2017-02/txt/msg00573.txt.bz2 Thanks for the review. On Wednesday, February 15 2017, Pedro Alves wrote: > On 02/08/2017 03:22 AM, Sergio Durigan Junior wrote: > >> diff --git a/gdb/common/common-gdbthread.h b/gdb/common/common-gdbthread.h >> new file mode 100644 >> index 0000000..eb66de9 >> --- /dev/null >> +++ b/gdb/common/common-gdbthread.h >> @@ -0,0 +1,45 @@ >> +/* Common multi-process/thread control defs for GDB and gdbserver. >> + Copyright (C) 1987-2017 Free Software Foundation, Inc. >> + Contributed by Lynx Real-Time Systems, Inc. Los Gatos, CA. >> + >> + > > Spurious blank line. That "contributed by" line is meaningless > for this new file, please remove it. Fixed. >> + This file is part of GDB. > >> +#ifndef COMMON_THREAD_H >> +#define COMMON_THREAD_H > > This macro name does not patch the file name. Fixed. >> +/* See common/common-gdbthread.h. */ >> + >> +void >> +set_executing (ptid_t ptid ATTRIBUTE_UNUSED, int executing ATTRIBUTE_UNUSED) >> +{ >> + gdb_assert (current_thread != NULL); >> + current_thread->last_resume_kind = resume_stop; >> + current_thread->last_status = get_last_target_waitstatus (); >> +} >> + > > This is a bit too hacky to live IMO. :-/ The implementation > of the function is doing nothing related to its interface. > > Do we really need the set_executing call in the new shared file? AFAICS, > set_executing is only called at the very end of startup_inferior today. > Couldn't we leave that call out of the common code and add it on the > gdb side, after the common startup_inferior returns? Yes, that works and is better than the current solution, I agree. I'll implement it. >> >> -/* Marks thread PTID as executing, or not. If PTID is minus_one_ptid, >> - marks all threads. >> - >> - Note that this is different from the running state. See the >> - description of state and executing fields of struct >> - thread_info. */ >> -extern void set_executing (ptid_t ptid, int executing); >> - >> /* Reports if thread PTID is executing. */ >> extern int is_executing (ptid_t ptid); > > Having a setter in one place, and the getter somewhere > else is sure to generate confusion. In cases like these, > please leave a breadcrumb comment. (there may be more cases.) With set_executing being called after startup_inferior on GDB, this change will not be there anymore (i.e., set_executing will not be touched). But thanks for the heads up, I'll check other places where I moved functions from GDB to gdbserver and make sure everything is commented. Thanks, -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/