From patchwork Fri Jun 12 10:22:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 7137 Received: (qmail 36226 invoked by alias); 12 Jun 2015 10:23:04 -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 36209 invoked by uid 89); 12 Jun 2015 10:23:03 -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; Fri, 12 Jun 2015 10:23:02 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 28F6C3409BC for ; Fri, 12 Jun 2015 10:23:00 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: trace: add WITH_TRACE_ANY_P helper Date: Fri, 12 Jun 2015 06:22:58 -0400 Message-Id: <1434104578-12196-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes We have STRACE_ANY_P and TRACE_ANY_P, so add WITH_TRACE_ANY_P to fill out the API. This lets us wrap the internal configure symbol. Committed. --- sim/common/ChangeLog | 8 ++++++++ sim/common/sim-module.c | 2 +- sim/common/sim-trace.c | 8 ++++---- sim/common/sim-trace.h | 9 ++++++--- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 1557449..403ba0f 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,13 @@ 2015-06-12 Mike Frysinger + * sim-module.c (modules): Change WITH_TRACE to WITH_TRACE_ANY_P. + * sim-trace.c (trace_option_handler): Likewise. + * sim-trace.h (WITH_TRACE_ANY_P): Define. + (STRACE_ANY_P): Use WITH_TRACE_ANY_P. + (TRACE_ANY_P): Likewise. + +2015-06-12 Mike Frysinger + * cgen-run.c (sim_resume): Rename TRACE_INSN_FINI to CGEN_TRACE_INSN_FINI. * cgen-trace.c: Rename trace_insn to cgen_trace_insn, diff --git a/sim/common/sim-module.c b/sim/common/sim-module.c index fd9b587..2d8e7dc 100644 --- a/sim/common/sim-module.c +++ b/sim/common/sim-module.c @@ -46,7 +46,7 @@ static MODULE_INSTALL_FN * const modules[] = { #if WITH_ENGINE sim_engine_install, #endif -#if WITH_TRACE +#if WITH_TRACE_ANY_P trace_install, #endif #if WITH_PROFILE diff --git a/sim/common/sim-trace.c b/sim/common/sim-trace.c index 915965d..f00fe9b 100644 --- a/sim/common/sim-trace.c +++ b/sim/common/sim-trace.c @@ -232,7 +232,7 @@ trace_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, switch (opt) { case 't' : - if (! WITH_TRACE) + if (!WITH_TRACE_ANY_P) sim_io_eprintf (sd, "Tracing not compiled in, `-t' ignored\n"); else return set_trace_option_mask (sd, "trace", TRACE_USEFUL_MASK, arg); @@ -352,7 +352,7 @@ trace_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, #ifdef SIM_HAVE_ADDR_RANGE case OPTION_TRACE_RANGE : - if (WITH_TRACE) + if (WITH_TRACE_ANY_P) { int cpu_nr; char *chp = arg; @@ -378,7 +378,7 @@ trace_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, break; case OPTION_TRACE_FUNCTION : - if (WITH_TRACE) + if (WITH_TRACE_ANY_P) { /*wip: need to compute function range given name*/ } @@ -395,7 +395,7 @@ trace_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, break; case OPTION_TRACE_FILE : - if (! WITH_TRACE) + if (!WITH_TRACE_ANY_P) sim_io_eprintf (sd, "Tracing not compiled in, `--trace-file' ignored\n"); else { diff --git a/sim/common/sim-trace.h b/sim/common/sim-trace.h index 5d6919a..822940b 100644 --- a/sim/common/sim-trace.h +++ b/sim/common/sim-trace.h @@ -107,8 +107,11 @@ enum { #define TRACE_syscall (1 << TRACE_SYSCALL_IDX) #define TRACE_debug (1 << TRACE_DEBUG_IDX) -/* Preprocessor macros to simplify tests of WITH_TRACE. */ +/* Return non-zero if tracing of idx is enabled (compiled in). */ #define WITH_TRACE_P(idx) (WITH_TRACE & (1 << idx)) + +/* Preprocessor macros to simplify tests of WITH_TRACE. */ +#define WITH_TRACE_ANY_P (WITH_TRACE) #define WITH_TRACE_INSN_P WITH_TRACE_P (TRACE_INSN_IDX) #define WITH_TRACE_DECODE_P WITH_TRACE_P (TRACE_DECODE_IDX) #define WITH_TRACE_EXTRACT_P WITH_TRACE_P (TRACE_EXTRACT_IDX) @@ -193,7 +196,7 @@ typedef struct _trace_data { (WITH_TRACE_P (idx) && STATE_TRACE_FLAGS (sd)[idx] != 0) /* Non-zero if --trace- was specified for SD. */ -#define STRACE_ANY_P(sd) ((WITH_TRACE) && (STATE_TRACE_DATA (sd)->trace_any_p)) +#define STRACE_ANY_P(sd) (WITH_TRACE_ANY_P && (STATE_TRACE_DATA (sd)->trace_any_p)) #define STRACE_INSN_P(sd) STRACE_P (sd, TRACE_INSN_IDX) #define STRACE_DECODE_P(sd) STRACE_P (sd, TRACE_DECODE_IDX) #define STRACE_EXTRACT_P(sd) STRACE_P (sd, TRACE_EXTRACT_IDX) @@ -218,7 +221,7 @@ typedef struct _trace_data { (WITH_TRACE_P (idx) && CPU_TRACE_FLAGS (cpu)[idx] != 0) /* Non-zero if --trace- was specified for CPU. */ -#define TRACE_ANY_P(cpu) ((WITH_TRACE) && (CPU_TRACE_DATA (cpu)->trace_any_p)) +#define TRACE_ANY_P(cpu) (WITH_TRACE_ANY_P && (CPU_TRACE_DATA (cpu)->trace_any_p)) #define TRACE_INSN_P(cpu) TRACE_P (cpu, TRACE_INSN_IDX) #define TRACE_DECODE_P(cpu) TRACE_P (cpu, TRACE_DECODE_IDX) #define TRACE_EXTRACT_P(cpu) TRACE_P (cpu, TRACE_EXTRACT_IDX)