On Sep 17, 2007, at 1:35 PM, Islam Hegazy wrote:

I am developing an application that sends and receives messages using mica2. I want to use TOSSIM to simulate the operations of sending and receiving to be able to debug my code. TOSSIM simulates the sending operation correctly but it can't simulate the receiving operation. Here is my code for the receiving:

event TOS_MsgPtr ReceiveCtrlMsg.receive(TOS_MsgPtr m)

{

    CtrlMsg *ctrlMessage = (CtrlMsg *)m->data;

    struct CtrlMsg *msg;
This is a bug. You have allocated a CtrlMsg*, not a CtrlMsg. Since the pointer is on the stack and you have not initialized it, who knows what it points to.... This is a basic C bug and has nothing to do with nesC/TOSSIM.

Phil
_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to