From patchwork Tue Sep 27 21:48:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Durigan Junior X-Patchwork-Id: 16095 Received: (qmail 82118 invoked by alias); 27 Sep 2016 21:48:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 82106 invoked by uid 89); 27 Sep 2016 21:48:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=2986, Hx-spam-relays-external:sk:unused-, H*r:sk:unused-, 904 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, 27 Sep 2016 21:48:48 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 8C0E23D941 for ; Tue, 27 Sep 2016 21:48:47 +0000 (UTC) Received: from psique.yyz.redhat.com (unused-10-15-17-193.yyz.redhat.com [10.15.17.193]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8RLml2P008645; Tue, 27 Sep 2016 17:48:47 -0400 From: Sergio Durigan Junior To: GDB Patches Cc: Sergio Durigan Junior Subject: [RFA] Consolidate API of target_supports_multi_process Date: Tue, 27 Sep 2016 17:48:41 -0400 Message-Id: <1475012921-21928-1-git-send-email-sergiodj@redhat.com> X-IsSubscribed: yes This simple commit consolidates the API of target_supports_multi_process. Since both GDB and gdbserver use the same function prototype, all that was needed was to move create this prototype on gdb/target/target.h and turn the macros declared on gdb/{,gdbserver/}target.h into actual functions. Regtested (clean pass) on the BuildBot. gdb/ChangeLog: 2016-09-27 Sergio Durigan Junior * target.c (target_supports_multi_process): New function, moved from... * target.h (target_supports_multi_process): ... here. Remove macro. * target/target.h (target_supports_multi_process): New prototype. gdb/gdbserver/ChangeLog: 2016-09-27 Sergio Durigan Junior * target.c (target_supports_multi_process): New function, moved from... * target.h (target_supports_multi_process): ... here. Remove macro. --- gdb/gdbserver/target.c | 9 +++++++++ gdb/gdbserver/target.h | 4 ---- gdb/target.c | 8 ++++++++ gdb/target.h | 6 ------ gdb/target/target.h | 5 +++++ 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c index cf3da47..e39334f 100644 --- a/gdb/gdbserver/target.c +++ b/gdb/gdbserver/target.c @@ -298,6 +298,15 @@ target_continue (ptid_t ptid, enum gdb_signal signal) (*the_target->resume) (&resume_info, 1); } +/* See target/target.h. */ + +int +target_supports_multi_process (void) +{ + return (the_target->supports_multi_process != NULL ? + (*the_target->supports_multi_process) () : 0); +} + int start_non_stop (int nonstop) { diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h index 26f7422..d098a92 100644 --- a/gdb/gdbserver/target.h +++ b/gdb/gdbserver/target.h @@ -535,10 +535,6 @@ int kill_inferior (int); #define target_async(enable) \ (the_target->async ? (*the_target->async) (enable) : 0) -#define target_supports_multi_process() \ - (the_target->supports_multi_process ? \ - (*the_target->supports_multi_process) () : 0) - #define target_process_qsupported(features, count) \ do \ { \ diff --git a/gdb/target.c b/gdb/target.c index b6a7e64..cb89e75 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2727,6 +2727,14 @@ target_supports_disable_randomization (void) return 0; } +/* See target/target.h. */ + +int +target_supports_multi_process (void) +{ + return (*current_target.to_supports_multi_process) (¤t_target); +} + char * target_get_osdata (const char *type) { diff --git a/gdb/target.h b/gdb/target.h index b458970..176f332 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1380,12 +1380,6 @@ struct address_space *target_thread_address_space (ptid_t); int target_info_proc (const char *, enum info_proc_what); -/* Returns true if this target can debug multiple processes - simultaneously. */ - -#define target_supports_multi_process() \ - (*current_target.to_supports_multi_process) (¤t_target) - /* Returns true if this target can disable address space randomization. */ int target_supports_disable_randomization (void); diff --git a/gdb/target/target.h b/gdb/target/target.h index be41fa7..2f4c716 100644 --- a/gdb/target/target.h +++ b/gdb/target/target.h @@ -90,4 +90,9 @@ extern ptid_t target_wait (ptid_t ptid, struct target_waitstatus *status, extern void target_mourn_inferior (ptid_t ptid); +/* Return 1 if this target can debug multiple processes + simultaneously, zero otherwise. */ + +extern int target_supports_multi_process (void); + #endif /* TARGET_COMMON_H */