From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16715 invoked by alias); 15 Feb 2017 16:15:43 -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 13276 invoked by uid 89); 15 Feb 2017 16:15:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=AFAICS, afaics, thread_info, Systems 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; Wed, 15 Feb 2017 16:15:20 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (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 9A4AC13D13; Wed, 15 Feb 2017 16:15:20 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1FGFJbu012910; Wed, 15 Feb 2017 11:15:19 -0500 Subject: Re: [PATCH v3 4/6] Share parts of gdb/gdbthread.h with gdbserver To: Sergio Durigan Junior , GDB Patches References: <1482464361-4068-1-git-send-email-sergiodj@redhat.com> <20170208032257.15443-1-sergiodj@redhat.com> <20170208032257.15443-5-sergiodj@redhat.com> Cc: Luis Machado From: Pedro Alves Message-ID: <5a437cf3-c980-bb70-35ac-533835ed9d01@redhat.com> Date: Wed, 15 Feb 2017 16:15:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20170208032257.15443-5-sergiodj@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-02/txt/msg00419.txt.bz2 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. > + This file is part of GDB. > +#ifndef COMMON_THREAD_H > +#define COMMON_THREAD_H This macro name does not patch the file name. > +/* 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? > > -/* 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.) Thanks, Pedro Alves