From 31fea520eaaab347f7338858bef11907be7bf2f3 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Sun, 25 Mar 2007 17:16:57 +0000 Subject: [PATCH] Debug output --- core/sys/autostart.c | 12 +++++++++++- core/sys/process.c | 19 ++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/core/sys/autostart.c b/core/sys/autostart.c index 1fe80f59b..1514b0fe3 100644 --- a/core/sys/autostart.c +++ b/core/sys/autostart.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: autostart.c,v 1.1 2006/06/17 22:41:19 adamdunkels Exp $ + * $Id: autostart.c,v 1.2 2007/03/25 17:16:57 adamdunkels Exp $ */ /** @@ -40,6 +40,14 @@ #include "sys/autostart.h" +#define DEBUG 0 +#if DEBUG +#include +#define PRINTF(...) printf(__VA_ARGS__) +#else +#define PRINTF(...) +#endif + /*---------------------------------------------------------------------------*/ void autostart_start(struct process *processes[]) @@ -48,6 +56,7 @@ autostart_start(struct process *processes[]) for(i = 0; processes[i] != NULL; ++i) { process_start(processes[i], NULL); + PRINTF("autostart_start: starting process '%s'\n", processes[i]->name); } } /*---------------------------------------------------------------------------*/ @@ -58,6 +67,7 @@ autostart_exit(struct process *processes[]) for(i = 0; processes[i] != NULL; ++i) { process_exit(processes[i]); + PRINTF("autostart_exit: stopping process '%s'\n", processes[i]->name); } } /*---------------------------------------------------------------------------*/ diff --git a/core/sys/process.c b/core/sys/process.c index 87f8f903e..a54163f93 100644 --- a/core/sys/process.c +++ b/core/sys/process.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: process.c,v 1.3 2007/01/24 16:07:20 bg- Exp $ + * @(#)$Id: process.c,v 1.4 2007/03/25 17:18:37 adamdunkels Exp $ */ /** @@ -83,6 +83,13 @@ static volatile unsigned char poll_requested; static void call_process(struct process *p, process_event_t ev, process_data_t data); +#define DEBUG 0 +#if DEBUG +#include +#define PRINTF(...) printf(__VA_ARGS__) +#else +#define PRINTF(...) +#endif /*---------------------------------------------------------------------------*/ process_event_t @@ -112,7 +119,7 @@ process_start(struct process *p, char *arg) PT_INIT(&p->pt); - /* Post an asynchronous event to the process. */ + /* Post a synchronous event to the process. */ process_post(p, PROCESS_EVENT_INIT, (process_data_t)arg); } /*---------------------------------------------------------------------------*/ @@ -367,7 +374,13 @@ process_post(struct process *p, process_event_t ev, process_data_t data) static unsigned char snum; if(nevents == PROCESS_CONF_NUMEVENTS) { - printf("soft panic: event queue is full\n"); +#if DEBUG + if(p == PROCESS_BROADCAST) { + printf("soft panic: event queue is full when broadcast event %d was posted from %s\n", ev, process_current->name); + } else { + printf("soft panic: event queue is full when event %d was posted to %s frpm %s\n", ev, p->name, process_current->name); + } +#endif /* DEBUG */ return PROCESS_ERR_FULL; }