On Jun 12, 2007, at 8:57 AM, Philip Levis wrote:
On Jun 12, 2007, at 5:42 AM, Marek Jawurek wrote:
Well I tried turning the nodes off and on again but I get a
segmentation
fault. So I tried the example c++ Driver from Tutorial 11 to be
able to
use gdb on it.
I appended the Driver sourcecode with my modifications.
I compile it with:
g++ -g -c -o ctest.o ctest.cpp\
-I/data/hiwi/tinyos/tinyos-2.x/tos/lib/tossim
g++ -g -o ctest ctest.o build/micaz/tossim.o build/micaz/sim.o\
build/micaz/c-support.o
"gdb ctest" produces:
(gdb) run
Starting program: /data/hiwi/tinyos/tinyos-2.x/apps/ProbFlooding/
ctest
Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x0804bd70 in sim_run_next_event ()
at /data/hiwi/tinyos/tinyos-2.x/tos/lib/tossim/sim_tossim.c:118
#2 0x0804ae67 in Tossim::runNextEvent (this=0x80d3008)
at /data/hiwi/tinyos/tinyos-2.x/tos/lib/tossim/tossim.c:278
#3 0x08049980 in main () at ctevst.cpp:21
As I receive dbg output from my program's channel and Tossim dbg
here is
the complete output of ctest (without gdb) http://jawurek.net/
ProbCDUMP
At the end it appears if the sim_ticks var has overrun ?
Is this now a problem in my program for the nodes or some internal
TOSSIM error ?
Any help greatly appreciated.
It could be either, but it's more likely TOSSIM. I've never tested
trying to reset a simulation. I'll try to reproduce the bug and
hopefully the fix(es) will make their way into 2.0.2.
The bug is the following:
TossimPacketModelC statically allocates a TOSSIM event within its
frame for MAC backoff (this seemed easier than dynamically
allocating). The problem that occurs is when you reboot a mote, its
memory is wiped clean to the state it should be at boot: all memory
is initialized to zero, except variables that have initializers. So
the event structure is being zeroed out when a node reboots.
The bug occurs when the node is in the midst of MAC backoff. It has a
MAC backoff event pending in the queue and is rebooted. The event is
zeroed out, and the function pointers to handle() and cleanup()
become null (as does the time). When TOSSIM executes the event, it
hits seg fault.
The easy fix for you is to, rather than turnOff/turnOn, turnOff and
schedule a bootAtTime in the near future (50ms should be fine). The
TOSSIM fix for 2.0.2 (which I'm about to check in) is to check that
the function pointers are non NULL before using them.
Phil
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help