From patchwork Tue Mar 24 05:24:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 5784 Received: (qmail 73797 invoked by alias); 24 Mar 2015 05:24:34 -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 73678 invoked by uid 89); 24 Mar 2015 05:24:33 -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_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: smtp.gentoo.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 24 Mar 2015 05:24:31 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 18E683406BD for ; Tue, 24 Mar 2015 05:24:29 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: profile: disconnect from watchpoint core Date: Tue, 24 Mar 2015 01:24:27 -0400 Message-Id: <1427174667-23285-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes The profile code was using STATE_WATCHPOINTS to get access to the PC, but we already have a standard method for getting the pc, so switch to that. This assumes that sizeof_pc is the same size as sim_cia, but we already assume this in places by way of sim_pc_{get,set}, and this is how it's documented in the sim-base.h API. Committed. --- sim/common/ChangeLog | 7 +++++++ sim/common/sim-profile.c | 16 ++++------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 85cf559..e41203c 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,12 @@ 2015-03-24 Mike Frysinger + * sim-profile.c (profile_pc_event): Get pc via sim_pc_get. Delete + usage of STATE_WATCHPOINTS. + (profile_pc_init): Delete STATE_WATCHPOINTS (sd)->pc check. Change + STATE_WATCHPOINTS (sd)->sizeof_pc to sizeof (sim_cia). + +2015-03-24 Mike Frysinger + * tconfig.h: Note SIM_HAVE_PROFILE is deprecated. 2015-03-24 Mike Frysinger diff --git a/sim/common/sim-profile.c b/sim/common/sim-profile.c index dbe64de..d473eef 100644 --- a/sim/common/sim-profile.c +++ b/sim/common/sim-profile.c @@ -520,15 +520,8 @@ profile_pc_event (SIM_DESC sd, { sim_cpu *cpu = (sim_cpu*) data; PROFILE_DATA *profile = CPU_PROFILE_DATA (cpu); - address_word pc; + address_word pc = sim_pc_get (cpu); unsigned i; - switch (STATE_WATCHPOINTS (sd)->sizeof_pc) - { - case 2: pc = *(unsigned_2*)(STATE_WATCHPOINTS (sd)->pc) ; break; - case 4: pc = *(unsigned_4*)(STATE_WATCHPOINTS (sd)->pc) ; break; - case 8: pc = *(unsigned_8*)(STATE_WATCHPOINTS (sd)->pc) ; break; - default: pc = 0; - } i = (pc - PROFILE_PC_START (profile)) >> PROFILE_PC_SHIFT (profile); if (i < PROFILE_PC_NR_BUCKETS (profile)) PROFILE_PC_COUNT (profile) [i] += 1; /* Overflow? */ @@ -547,8 +540,7 @@ profile_pc_init (SIM_DESC sd) { sim_cpu *cpu = STATE_CPU (sd, n); PROFILE_DATA *data = CPU_PROFILE_DATA (cpu); - if (CPU_PROFILE_FLAGS (STATE_CPU (sd, n))[PROFILE_PC_IDX] - && STATE_WATCHPOINTS (sd)->pc != NULL) + if (CPU_PROFILE_FLAGS (STATE_CPU (sd, n))[PROFILE_PC_IDX]) { int bucket_size; /* fill in the frequency if not specified */ @@ -571,7 +563,7 @@ profile_pc_init (SIM_DESC sd) { /* nr_buckets = (full-address-range / 2) / (bucket_size / 2) */ PROFILE_PC_NR_BUCKETS (data) = - ((1 << (STATE_WATCHPOINTS (sd)->sizeof_pc) * (8 - 1)) + ((1 << sizeof (sim_cia) * (8 - 1)) / (PROFILE_PC_BUCKET_SIZE (data) / 2)); } else @@ -590,7 +582,7 @@ profile_pc_init (SIM_DESC sd) { if (PROFILE_PC_END (data) == 0) /* bucket_size = (full-address-range / 2) / (nr_buckets / 2) */ - bucket_size = ((1 << ((STATE_WATCHPOINTS (sd)->sizeof_pc * 8) - 1)) + bucket_size = ((1 << ((sizeof (sim_cia) * 8) - 1)) / (PROFILE_PC_NR_BUCKETS (data) / 2)); else bucket_size = ((PROFILE_PC_END (data)