Attached is another patch containing fixes for both the build issue and
the segfault issue I was having in TOSSIM-CC2420/HPLCC2420M.nc.  The
segfault was because the transmittingFrame was NULL in
handleFrameSentEvent().

Perhaps the patch could be applied to the CVS tree?

Thanks,
tony

Tony Mancill wrote:
> Hello tinyos-help:
> 
> Attached is a very minor patch for TOSSIM-CC2420/HPLCC2420M.nc.  Without
> it, I was unable to compile due to an invalid lvalue error.
> 
> Also, I wanted to ask the list if anyone else has experienced segfaults
> using TOSSIM to simulate telos.
> 
> Sometimes it doesn't happen right away, but invariably my simulations
> will end with:
> 
>   7: HPLCC2420 (0:0:5.09596975): enter handleFrameSentEvent()
>   7: HPLCC2420 (0:0:5.09596975): enter createFrameReceivedEvent()
>   ...
> 
>   7: HPLCC2420 (0:0:5.09596975): setState( from STATE_RX_CALIBRATE to
> STATE_RX_CALIBRATE )
>   7: HPLCC2420 (0:0:5.09596975): enter createRxCalibratedEvent()
>   7: HPLCC2420 (0:0:5.09596975): SFD set low, already low
>   Segmentation fault
> 
> From what I can tell, this is coming from one of the calls to free() on
> lines 1989 and 1990 in HPLCC2420M.nc, but in looking at the code, it
> only seems that either handleFrameSentEvent() is being called twice or
> that an alloc() is failing.  (Perhaps more likely the latter.  I've
> already tried updating the code to check for NULLs before freeing.)
> 
> Any ideas?
> 
> Thank you,
> tony
> 

Index: HPLCC2420M.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/TOSSIM-CC2420/HPLCC2420M.nc,v
retrieving revision 1.4
diff -r1.4 HPLCC2420M.nc
1508c1508
<             (int8_t) frame[length - 2] = getEncodedRssi(receivingFrame->rssi);
---
>             frame[length - 2] = (uint8_t) getEncodedRssi(receivingFrame->rssi);
1989,1990c1989,1993
<     free(transmittingFrame->frame);
<     free(transmittingFrame);
---
> 		if (transmittingFrame != NULL) {
> 			free(transmittingFrame->frame);
> 			free(transmittingFrame);
> 		} 
> 
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to