sim: trace: centralize the system tracing
authorMike Frysinger <vapier@gentoo.org>
Wed, 10 Jun 2015 10:02:52 +0000 (18:02 +0800)
committerMike Frysinger <vapier@gentoo.org>
Thu, 11 Jun 2015 14:39:43 +0000 (10:39 -0400)
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.

sim/common/ChangeLog
sim/common/sim-events.c
sim/common/sim-events.h
sim/common/sim-trace.c

index 35f08bb6d37c3d4e692f26a5c1be3122a8773271..a20f92d7ef4d644978af82501c52b34da2da682b 100644 (file)
@@ -1,3 +1,12 @@
+2015-06-11  Mike Frysinger  <vapier@gentoo.org>
+
+       * 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  <vapier@gentoo.org>
 
        * sim-trace.h (STRACE_ANY_P, STRACE_INSN_P, STRACE_DECODE_P,
index d7ca0df5d4b1acc5afbc10d90836ae2561a5c2bc..fc525753005c3bfb33f6e572dccf663d48e9687f 100644 (file)
@@ -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,
index 9c56cabcdbd85c31b0b0ffd287c21a7e7888112a..6faa5cc31d1096c799c86842ed28c79b0b98b375 100644 (file)
@@ -94,7 +94,6 @@ struct _sim_events {
   SIM_ELAPSED_TIME resume_wallclock;
   signed64 time_of_event;
   signed64 time_from_event;
-  int trace;
 };
 
 
index a706f1d89c6a4ccd2a45a5243a80d3f1810b5eef..915965d4636123d1ef541100ec7fe5f057b73ba1 100644 (file)
@@ -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++)
This page took 0.03356 seconds and 4 git commands to generate.