From patchwork Thu Jun 11 15:58:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 7124 X-Patchwork-Delegate: vapier@gentoo.org Received: (qmail 43028 invoked by alias); 11 Jun 2015 15:58:30 -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 42878 invoked by uid 89); 11 Jun 2015 15:58:30 -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; Thu, 11 Jun 2015 15:58:27 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id E0A3B340D42 for ; Thu, 11 Jun 2015 15:58:25 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH 4/4] sim: trace: centralize the system tracing Date: Thu, 11 Jun 2015 11:58:14 -0400 Message-Id: <1434038294-32159-4-git-send-email-vapier@gentoo.org> In-Reply-To: <1434038294-32159-1-git-send-email-vapier@gentoo.org> References: <1434038294-32159-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes First we convert the ETRACE_P to STRACE_EVENTS_P. This means we move from using the sim_events.trace storage to the common sim_state_base.trace_data array. With that deleted, the common trace init code can be simplified so the sim state works the same as the sim cpu. Committed. --- sim/common/ChangeLog | 9 +++++++++ sim/common/sim-events.c | 9 +++------ sim/common/sim-events.h | 1 - sim/common/sim-trace.c | 12 ++---------- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 35f08bb..a20f92d 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,14 @@ 2015-06-11 Mike Frysinger + * sim-events.c (ETRACE_P): Delete. + (ETRACE): Change ETRACE_P to STRACE_EVENTS_P(sd). + (update_time_from_event, sim_events_schedule_vtracef): Likewise. + * sim-events.h (struct _sim_events): Delete trace member. + * sim-trace.c (set_trace_option_mask): Delete trace_nr check and + always set STATE_TRACE_FLAGS(sd)[trace_nr] element. + +2015-06-11 Mike Frysinger + * sim-trace.h (STRACE_ANY_P, STRACE_INSN_P, STRACE_DECODE_P, STRACE_EXTRACT_P, STRACE_LINENUM_P, STRACE_MEMORY_P, STRACE_MODEL_P, STRACE_ALU_P, STRACE_CORE_P, STRACE_EVENTS_P, STRACE_FPU_P, diff --git a/sim/common/sim-events.c b/sim/common/sim-events.c index d7ca0df..fc52575 100644 --- a/sim/common/sim-events.c +++ b/sim/common/sim-events.c @@ -140,14 +140,11 @@ struct _sim_event { #define _ETRACE sd, NULL -#undef ETRACE_P -#define ETRACE_P (WITH_TRACE && STATE_EVENTS (sd)->trace) - #undef ETRACE #define ETRACE(ARGS) \ do \ { \ - if (ETRACE_P) \ + if (STRACE_EVENTS_P (sd)) \ { \ if (STRACE_DEBUG_P (sd)) \ { \ @@ -409,7 +406,7 @@ update_time_from_event (SIM_DESC sd) events->time_of_event = current_time - 1; events->time_from_event = -1; } - if (ETRACE_P) + if (STRACE_EVENTS_P (sd)) { sim_event *event; int i; @@ -521,7 +518,7 @@ sim_events_schedule_vtracef (SIM_DESC sd, new_event->data = data; new_event->handler = handler; new_event->watching = watch_timer; - if (fmt == NULL || !ETRACE_P || vasprintf (&new_event->trace, fmt, ap) < 0) + if (fmt == NULL || !STRACE_EVENTS_P (sd) || vasprintf (&new_event->trace, fmt, ap) < 0) new_event->trace = NULL; insert_sim_event (sd, new_event, delta_time); ETRACE ((_ETRACE, diff --git a/sim/common/sim-events.h b/sim/common/sim-events.h index 9c56cab..6faa5cc 100644 --- a/sim/common/sim-events.h +++ b/sim/common/sim-events.h @@ -94,7 +94,6 @@ struct _sim_events { SIM_ELAPSED_TIME resume_wallclock; signed64 time_of_event; signed64 time_from_event; - int trace; }; diff --git a/sim/common/sim-trace.c b/sim/common/sim-trace.c index a706f1d..915965d 100644 --- a/sim/common/sim-trace.c +++ b/sim/common/sim-trace.c @@ -173,22 +173,14 @@ set_trace_option_mask (SIM_DESC sd, const char *name, int mask, const char *arg) } } - /* update applicable trace bits */ + /* Update applicable trace bits. */ for (trace_nr = 0; trace_nr < MAX_TRACE_VALUES; ++trace_nr) { if ((mask & (1 << trace_nr)) == 0) continue; /* Set non-cpu specific values. */ - switch (trace_nr) - { - case TRACE_EVENTS_IDX: - STATE_EVENTS (sd)->trace = trace_val; - break; - case TRACE_DEBUG_IDX: - STATE_TRACE_FLAGS (sd)[trace_nr] = trace_val; - break; - } + STATE_TRACE_FLAGS (sd)[trace_nr] = trace_val; /* Set cpu values. */ for (cpu_nr = 0; cpu_nr < MAX_NR_PROCESSORS; cpu_nr++)