From patchwork Mon Mar 17 15:23:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 118 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (caibbdcaaahb.dreamhost.com [208.113.200.71]) by wilcox.dreamhost.com (Postfix) with ESMTP id E2DEA3600C9 for ; Mon, 17 Mar 2014 08:23:46 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14314964) id 98757C7882D; Mon, 17 Mar 2014 08:23:46 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx21.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id BF82F1F57C4A for ; Mon, 17 Mar 2014 08:23:45 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=O2mZx13vMX+dQQSOnnAJ9gDS3gkNmWt U8I9SBF9HmMjC0SuMvbjcxjdzF9owSPVu86j8U+6D4QuxaazY4crbylF8gaKuHY7 0uI0F49DX6b9hJVas4PJwBXbOTD7s92nWanIZOZbJhe7M8LcQFRUT91CEV521Bdr D0MOcfnlGKlo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=K070Q4pOLMNGIx9vXNLA48Xoo1k=; b=STejG ypfU50egTe/Ze70HWGMpNi4W/iC+gV/dhI9/TOVLPriIN3QcN8INhUNVrkVbRI/U Tl1yEgG0UrUnj3kWeekem9og3NPp9boK2aVHQojXSPeKQfJ35y9mhOB9Q55ds3g0 y88SrVLrJ4YW+m5WikXEzq89EXmuWruWEpVcF0= Received: (qmail 5418 invoked by alias); 17 Mar 2014 15:23:16 -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 5317 invoked by uid 89); 17 Mar 2014 15:23:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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; Mon, 17 Mar 2014 15:23:14 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2HFNCi0007882 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 17 Mar 2014 11:23:13 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s2HFN5A2009032 for ; Mon, 17 Mar 2014 11:23:12 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 5/8] nto-procfs.c: Add "target native". Date: Mon, 17 Mar 2014 15:23:01 +0000 Message-Id: <1395069784-7406-6-git-send-email-palves@redhat.com> In-Reply-To: <1395069784-7406-1-git-send-email-palves@redhat.com> References: <1395069784-7406-1-git-send-email-palves@redhat.com> X-DH-Original-To: gdb@patchwork.siddhesh.in This makes QNX/NTO end up with two targets. It preserves "target procfs ", and adds a "native" target to be like other native ports. Not tested. gdb/ 2014-03-17 Pedro Alves * nto-procfs.c (procfs_can_run): New function. (nto_procfs_ops): New global. (init_procfs_targets): New, based on procfs_target. Install "target native" in addition to "target procfs". (_initialize_procfs): Call init_procfs_targets instead of adding the target here. --- gdb/nto-procfs.c | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index c552a8e..b328dfa 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -1370,18 +1370,31 @@ procfs_pid_to_str (struct target_ops *ops, ptid_t ptid) return buf; } -/* Create a nto-procfs target. */ +/* to_can_run implementation for "target procfs". Note this really + means "can this target be the default run target", which there can + be only one, and we make it be "target native" like other ports. + "target procfs " wouldn't make sense as default run target, as + it needs . */ -static struct target_ops * -procfs_target (void) +static int +procfs_can_run (struct target_ops *self) +{ + return 0; +} + +/* "target procfs". */ +static struct target_ops nto_procfs_ops; + +/* Create the "native" and "procfs" targets. */ + +static void +init_procfs_targets (void) { struct target_ops *t = inf_child_target (); - t->to_shortname = "procfs"; - t->to_longname = "QNX Neutrino procfs child process"; - t->to_doc - = "QNX Neutrino procfs child process (started by the \"run\" command).\n\ - target procfs "; + /* Leave to_shortname as "native". */ + t->to_longname = "QNX Neutrino local process"; + t->to_doc = "QNX Neutrino local process (started by the \"run\" command)."; t->to_open = procfs_open; t->to_attach = procfs_attach; t->to_post_attach = procfs_post_attach; @@ -1411,7 +1424,16 @@ procfs_target (void) t->to_have_continuable_watchpoint = 1; t->to_extra_thread_info = nto_extra_thread_info; - return t; + /* Register "target native". This is the default run target. */ + add_target (t); + + /* Register "target procfs ". */ + nto_procfs_ops = *t; + nto_procfs_ops.to_shortname = "procfs"; + nto_procfs_ops.to_can_run = procfs_can_run; + t->to_longname = "QNX Neutrino local or remote process"; + t->to_doc = "QNX Neutrino process. target procfs "; + add_target (&nto_procfs_ops); } #define OSTYPE_NTO 1 @@ -1420,10 +1442,8 @@ void _initialize_procfs (void) { sigset_t set; - struct target_ops *t; - t = procfs_target (); - add_target (t); + init_procfs_targets (); /* We use SIGUSR1 to gain control after we block waiting for a process. We use sigwaitevent to wait. */