Hi, I think I got the problem. I was missing the statement return bufPtr in method: event message_t* Receive.receive(message_t* bufPtr, void* payload, uint8_t len) Adding the above return statement at the end of method removed the segmentation fault.
Regards, Harshal > Hi, > I tried running the code in gdb. I got the following: > ---------- > > Program received signal SIGSEGV, Segmentation fault. > 0xb75a6bca in memcpy () from /lib/tls/i686/cmov/libc.so.6 > (gdb) backtrace > #0 0xb75a6bca in memcpy () from /lib/tls/i686/cmov/libc.so.6 > #1 0x0804f882 in TossimActiveMessageC$Model$receive (msg=0x80b15e0) at > /opt/tinyos-2.1.1/tos/lib/tossim/TossimActiveMessageC.nc:105 > #2 0x08052a30 in TossimPacketModelC$Packet$receive (msg=0x80b15e0) at > /opt/tinyos-2.1.1/tos/lib/tossim/TossimPacketModel.nc:77 > #3 0x08052a19 in TossimPacketModelC$GainRadioModel$receive > (msg=0x80b15e0) at > /opt/tinyos-2.1.1/tos/lib/tossim/TossimPacketModelC.nc:282 > #4 0x080529d4 in CpmModelC$Model$receive (msg=0x80b15e0) at > /opt/tinyos-2.1.1/tos/lib/tossim/GainRadioModel.nc:52 > #5 0x08052738 in CpmModelC$sim_gain_receive_handle (evt=0x8bc3e50) at > /opt/tinyos-2.1.1/tos/lib/tossim/CpmModelC.nc:322 > #6 0x0804cd41 in sim_run_next_event () at > /opt/tinyos-2.1.1/tos/lib/tossim/sim_tossim.c:135 > #7 0x0804a5e7 in Tossim::runNextEvent (this=0x89d0008) at > /opt/tinyos-2.1.1/tos/lib/tossim/tossim.c:278 > #8 0x0804a466 in main (argc=2, argv=0xbf806054) at Driver.c:85 > > ---------------- > The prog seg-faults after a few exchange of messages between nodes. > Apparently there is some problem is receiving messages (look at #1 above). > Please help me locate the problem. > > -- > Harshal > > >> On Jun 29, 2010, at 7:25 AM, [email protected] wrote: >> >>> Hi, >>> I have been trying to run a clustering protocol in tinyos2. I have >>> written >>> some code for some part of the protocol. But whenever I run the code on >>> TOSSIM, it runs for a few events and then a Segmentation fault is >>> flagged >>> and simulation stops abruptly. >>> >>> I tried removing the noise model part(i.e. commenting out the following >>> in >>> python script): >>> ------code begins------ >>> for i in range(0,numNodes): >>> print "Creating noise model for ",i; >>> t.getNode(i).createNoiseModel() >>> ------code ends-------- >>> then the code runs and terminates smoothly but it is of not much use as >>> none of the sent messages are received. >>> >>> I really need to simulate the protocol. Any suggestions would be >>> greatly >>> appreciated. >> >> I'd suggest running it in gdb to find out what's causing the segfault. >> Chances are you are not initializing the noise model correctly. Take a >> look through the archives: similar problems come up occasionally. >> >> Phil >> >> >> > > _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
