chiark / gitweb /
eventcounter for help with debugging
authorian <ian>
Mon, 9 Jun 2008 00:26:55 +0000 (00:26 +0000)
committerian <ian>
Mon, 9 Jun 2008 00:26:55 +0000 (00:26 +0000)
hostside/commands.c
hostside/realtime.c
hostside/realtime.h
hostside/safety.c

index 02daa7ac3b4dc2dd5a5ebca904f10ab3eeb90e5d..12d904c753a483b25aa57e0631eb8eaf4531526d 100644 (file)
@@ -357,6 +357,8 @@ void command_doline(ParseState *ps, CommandInput *cmdi_arg) {
   simlog_flush();
   current_cmd= 0;
 
+  debug_count_event("command");
+
   cmdline= ps->remain;
   if (!cmdline[0]) return;
   r= ps_word(ps);  assert(!r);
index ee6c29e57117cad8ee02d87c83567bccaed1465b..9a73731f49ca34211d69292f39a33b79c4d78bfd 100644 (file)
@@ -326,6 +326,13 @@ void serial_transmit(const PicInsn *pi) {
 
 /*---------- debugging ----------*/
 
+unsigned long eventcounter;
+
+void debug_count_event(const char *what) {
+  DPRINTF(misc,event, "0x%lx %s\n",eventcounter,what);
+  eventcounter++;
+}
+
 #define DEFDFLAGS_safety ~(DBIT_safety_predictplan|DBIT_safety_predictseg)
 #define DEFDFLAGS_movpos ~(DBIT_movpos_eval|DBIT_movpos_changeneeded)
 #define DEFDFLAGS_speed ~(DBIT_speed_query)
index 7dfc7566f5915bf4fc146d7e56fbf2569ac81f65..bd67a7a92b43c6d3ac4ccc26c79c3586295ceeed 100644 (file)
@@ -230,6 +230,8 @@ void ouprintf(const char *fmt, ...);
 void ouvprintf_only(const char *fmt, va_list al);
 void ouprintf_only(const char *fmt, ...);
 
+void debug_count_event(const char *what);
+
 #define DEBUGP(a,k) (dflags_##a & DBIT_##a##_##k)
 
 #define COND_DPRINTF(cond, a,k, fmt, ...) \
index 689c9868843e612cf241aca47c267431b9e137dd..198971d72ab06dbb1d8e3474b0dc98e1f75c269f 100644 (file)
@@ -1066,6 +1066,8 @@ void safety_notify_detection(Segment *seg) {
 
   if (seg->det_ignore) return;
 
+  debug_count_event("detection");
+
   if (!seg->det_expected) {
     interferer= segment_interferes(0,seg);
     if (!interferer) safety_panic(0,seg, "unexpected detection");