This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2] Add support for GNAT Ravenscar run-time library.


> 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
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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]