Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: jan.kratochvil@redhat.com, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] Add support for GNAT Ravenscar run-time library.
Date: Mon, 27 Sep 2010 18:59:00 -0000	[thread overview]
Message-ID: <20100927173414.GH3007@adacore.com> (raw)
In-Reply-To: <201009232308.50387.pedro@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 394 bytes --]

> 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

[-- Attachment #2: ravenscar-adjustment-1.diff --]
[-- Type: text/x-diff, Size: 1430 bytes --]

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

  reply	other threads:[~2010-09-27 17:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-23 19:01 Joel Brobecker
2010-09-23 19:44 ` [PATCH 1/2] [Ada] Add ada-tasks.c:iterate_over_live_ada_tasks Joel Brobecker
2010-09-29  3:25   ` Joel Brobecker
2010-09-23 19:49 ` [PATCH 2/2] Add support for GNAT Ravenscar run-time library Joel Brobecker
2010-09-23 21:56   ` Joel Brobecker
2010-09-23 21:58   ` Jan Kratochvil
2010-09-23 22:09   ` Pedro Alves
2010-09-23 23:39     ` Joel Brobecker
2010-09-24  1:39       ` Pedro Alves
2010-09-27 18:59         ` Joel Brobecker [this message]
2010-09-27 19:01           ` Pedro Alves
2010-09-28 14:55             ` Joel Brobecker
2010-09-29  9:52               ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100927173414.GH3007@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=pedro@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox