From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YHp9EdAIjl+ERwAAWB0awg (envelope-from ) for ; Mon, 19 Oct 2020 17:44:48 -0400 Received: by simark.ca (Postfix, from userid 112) id 37D111EFC7; Mon, 19 Oct 2020 17:44:48 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 7DB591E58E for ; Mon, 19 Oct 2020 17:44:45 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6D31E3850409; Mon, 19 Oct 2020 21:44:41 +0000 (GMT) Received: from gateway34.websitewelcome.com (gateway34.websitewelcome.com [192.185.148.140]) by sourceware.org (Postfix) with ESMTPS id BFD80388EC05 for ; Mon, 19 Oct 2020 21:44:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BFD80388EC05 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 619A984E23 for ; Mon, 19 Oct 2020 16:44:35 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id UcxHktv6PLFNkUcxHkqHJC; Mon, 19 Oct 2020 16:44:35 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=W0kiKnY+1Knxt/ZkQuzz4vqunCZ+3BlQ9KDo5Sl9MTs=; b=D/i05aKaSUX9aoYjWl4uN0pqrD cWNLbAmB2fbTTrYd22gRt+6oXV/eCD3ZFbVogGB7eWezhWLtB5BOyjAWvXSdBd3u4Opeg+YLXgMty N041oHpICY3S/HmXdod8BH0NM; Received: from 75-166-102-113.hlrn.qwest.net ([75.166.102.113]:45712 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kUcxH-004Oci-5P; Mon, 19 Oct 2020 15:44:35 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH v2 11/16] Change program_space_empty_p to method on program_space Date: Mon, 19 Oct 2020 15:44:24 -0600 Message-Id: <20201019214429.13815-12-tom@tromey.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20201019214429.13815-1-tom@tromey.com> References: <20201019214429.13815-1-tom@tromey.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.102.113 X-Source-L: No X-Exim-ID: 1kUcxH-004Oci-5P X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-102-113.hlrn.qwest.net (bapiya.Home) [75.166.102.113]:45712 X-Source-Auth: tom+tromey.com X-Email-Count: 12 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tom Tromey Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" This changes program_space_empty_p to be a method on program_space. It also changes it to return bool. I removed the "_p" suffix because "empty" is a "well-known" C++ method name. gdb/ChangeLog 2020-10-19 Tom Tromey * inferior.c (delete_inferior): Update. * progspace.c (program_space::empty): Rename from program_space_empty_p. Return bool. * progspace.h (struct program_space) : New method. (program_space_empty_p): Don't declare. --- gdb/ChangeLog | 8 ++++++++ gdb/inferior.c | 2 +- gdb/progspace.c | 9 +++------ gdb/progspace.h | 7 ++++--- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/gdb/inferior.c b/gdb/inferior.c index 5c63dfa0bf1..6ca0c28d7f0 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -175,7 +175,7 @@ delete_inferior (struct inferior *todel) gdb::observers::inferior_removed.notify (inf); /* If this program space is rendered useless, remove it. */ - if (program_space_empty_p (inf->pspace)) + if (inf->pspace->empty ()) delete inf->pspace; delete inf; diff --git a/gdb/progspace.c b/gdb/progspace.c index 84baaeab292..70c0f7ec2a2 100644 --- a/gdb/progspace.c +++ b/gdb/progspace.c @@ -280,13 +280,10 @@ set_current_program_space (struct program_space *pspace) /* Returns true iff there's no inferior bound to PSPACE. */ -int -program_space_empty_p (struct program_space *pspace) +bool +program_space::empty () { - if (find_inferior_for_program_space (pspace) != NULL) - return 0; - - return 1; + return find_inferior_for_program_space (this) == nullptr; } /* Prints the list of program spaces and their details on UIOUT. If diff --git a/gdb/progspace.h b/gdb/progspace.h index 22805d74f37..fa5247f8ac2 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -293,6 +293,10 @@ struct program_space later be printed. */ void clear_solib_cache (); + /* Returns true iff there's no inferior bound to this program + space. */ + bool empty (); + /* Unique ID number. */ int num = 0; @@ -383,9 +387,6 @@ extern std::vectorprogram_spaces; /* The current program space. This is always non-null. */ extern struct program_space *current_program_space; -/* Returns true iff there's no inferior bound to PSPACE. */ -extern int program_space_empty_p (struct program_space *pspace); - /* Copies program space SRC to DEST. Copies the main executable file, and the main symbol file. Returns DEST. */ extern struct program_space *clone_program_space (struct program_space *dest, -- 2.17.2