From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20319 invoked by alias); 27 Sep 2010 17:34:26 -0000 Received: (qmail 20167 invoked by uid 22791); 27 Sep 2010 17:34:25 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Sep 2010 17:34:20 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 48A152BAC1D; Mon, 27 Sep 2010 13:34:18 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id gvWaLiHjQopS; Mon, 27 Sep 2010 13:34:18 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 04ECA2BABFF; Mon, 27 Sep 2010 13:34:17 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 982D4F591F; Mon, 27 Sep 2010 10:34:14 -0700 (PDT) Date: Mon, 27 Sep 2010 18:59:00 -0000 From: Joel Brobecker To: Pedro Alves Cc: jan.kratochvil@redhat.com, gdb-patches@sourceware.org Subject: Re: [PATCH 2/2] Add support for GNAT Ravenscar run-time library. Message-ID: <20100927173414.GH3007@adacore.com> References: <1285267380-8329-1-git-send-email-brobecker@adacore.com> <201009232049.37585.pedro@codesourcery.com> <20100923213927.GD3007@adacore.com> <201009232308.50387.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Qrgsu6vtpU/OV/zm" Content-Disposition: inline In-Reply-To: <201009232308.50387.pedro@codesourcery.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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 X-SW-Source: 2010-09/txt/msg00453.txt.bz2 --Qrgsu6vtpU/OV/zm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 394 > Please no current/topmost target name comparisons. Add a > ravenscar_is_open global if you don't have any other global you > can use to check whether target revenscar is open. I tried to find something I could use, but I don't see any. So I added a new static global, as you suggested. Attached is the change I made to the latest version being posted. Does it look OK? Thanks, -- Joel --Qrgsu6vtpU/OV/zm Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ravenscar-adjustment-1.diff" Content-length: 1430 diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 4d3fe8d..03cde89 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -34,6 +34,10 @@ /* If non-null, ravenscar task support is enabled. */ static int ravenscar_task_support = 1; +/* Non-null if the ravenscar thread layer has been pushed on the target + stack. */ +static int ravenscar_is_open = 0; + /* This module's target-specific operations. */ static struct target_ops ravenscar_ops; @@ -282,6 +286,7 @@ ravenscar_mourn_inferior (struct target_ops *ops) base_ptid = null_ptid; beneath->to_mourn_inferior (beneath); unpush_target (&ravenscar_ops); + ravenscar_is_open = 0; } /* Observer on inferior_created: push ravenscar thread stratum if needed. */ @@ -290,8 +295,7 @@ static void ravenscar_inferior_created (struct target_ops *target, int from_tty) { if (ravenscar_task_support - && has_ravenscar_runtime () - && strcmp (target_shortname, ravenscar_ops.to_shortname) != 0) + && has_ravenscar_runtime ()) ravenscar_initialize (NULL, 0); } @@ -311,9 +315,13 @@ ravenscar_register_arch_ops (struct ravenscar_arch_ops *ops) static void ravenscar_initialize (char *name, int from_tty) { + if (ravenscar_is_open) + return; + base_magic_null_ptid = inferior_ptid; ravenscar_update_inferior_ptid (); push_target (&ravenscar_ops); + ravenscar_is_open = 1; } static ptid_t --Qrgsu6vtpU/OV/zm--