From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32584 invoked by alias); 14 Dec 2012 15:02:56 -0000 Received: (qmail 32567 invoked by uid 22791); 14 Dec 2012 15:02:55 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO,RP_MATCHES_RCVD,TW_EG 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; Fri, 14 Dec 2012 15:02:51 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 666D62E340; Fri, 14 Dec 2012 10:02:50 -0500 (EST) 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 q1bfn-b+dlwq; Fri, 14 Dec 2012 10:02:50 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id E312B2E09B; Fri, 14 Dec 2012 10:02:49 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 1768CC14D6; Fri, 14 Dec 2012 19:02:40 +0400 (RET) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Joel Brobecker Subject: [RFA/commit 1/3] minor ravenscar-thread cleanup Date: Fri, 14 Dec 2012 15:02:00 -0000 Message-Id: <1355497356-13922-1-git-send-email-brobecker@adacore.com> 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: 2012-12/txt/msg00500.txt.bz2 Hello, Before attacking the gdbarch-ification of ravenscar-thread proper, I noticed that ravenscar-thread uses a number of global variables, which annoyed me quite a bit. There was one that seems like an easy target, so I dealt with it now. For the remaining ones, I will take care of them after the patch series is in, and I have reconciled the FSF tree and AdaCore's tree. The use of the ravenscar_open static global is unnecessary. This patch removes it. It also removes some routines that were created in association with the management of this global. gdb/ChangeLog: * ravenscar-thread.c (ravenscar_is_open): Delete. (ravenscar_initialize): Move most of the code from here... (ravenscar_inferior_created): ... to there. Invert logic. (ravenscar_close): Delete. (init_ravenscar_thread_ops): Remove setting of ravenscar_ops.to_close. Tested on x86_64-linux. Also tested on sparc-elf with AdaCore's testsuite. --- gdb/ravenscar-thread.c | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 0f9380b..ddbaea6 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -34,10 +34,6 @@ /* 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; @@ -70,7 +66,6 @@ static void ravenscar_fetch_registers (struct target_ops *ops, static void ravenscar_store_registers (struct target_ops *ops, struct regcache *regcache, int regnum); static void ravenscar_prepare_to_store (struct regcache *regcache); -static void ravenscar_initialize (char *name, int from_tty); static void ravenscar_resume (struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal siggnal); static void ravenscar_mourn_inferior (struct target_ops *ops); @@ -180,12 +175,6 @@ get_running_thread_id (void) } static void -ravenscar_close (int quitting) -{ - ravenscar_is_open = 0; -} - -static void ravenscar_resume (struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal siggnal) { @@ -332,9 +321,12 @@ ravenscar_mourn_inferior (struct target_ops *ops) static void ravenscar_inferior_created (struct target_ops *target, int from_tty) { - if (ravenscar_task_support - && has_ravenscar_runtime ()) - ravenscar_initialize (NULL, 0); + if (!ravenscar_task_support || !has_ravenscar_runtime ()) + return; + + base_magic_null_ptid = inferior_ptid; + ravenscar_update_inferior_ptid (); + push_target (&ravenscar_ops); } void @@ -348,20 +340,6 @@ ravenscar_register_arch_ops (struct ravenscar_arch_ops *ops) current_arch_ops = ops; } -/* Initialize Ravenscar support. */ - -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 ravenscar_get_ada_task_ptid (long lwp, long thread) { @@ -374,7 +352,6 @@ init_ravenscar_thread_ops (void) ravenscar_ops.to_shortname = "ravenscar"; ravenscar_ops.to_longname = "Ravenscar tasks."; ravenscar_ops.to_doc = "Ravenscar tasks support."; - ravenscar_ops.to_close = ravenscar_close; ravenscar_ops.to_resume = ravenscar_resume; ravenscar_ops.to_wait = ravenscar_wait; ravenscar_ops.to_fetch_registers = ravenscar_fetch_registers; -- 1.7.10.4