On Fri, 2006-04-14 at 19:24, Omprakash Gnawali wrote:
> I did not receive a response to the following email so if someone
> could send me a tarball of tos/lib/tossim that "works", I can try to
> find out if it is tossim or something else that is causing the problem
> of not seeing debug outputs.

Om,

A student at Stanford encountered the same problem; it only happens with
dbg() statements when running in the Python interpreter, right? 

I looked into it and found the cause, a bug in TOSSIM. I've checked in a
fix. I don't know what the status of anonymous CVS is (how often the
updates are, they've been lagging a bit recently), but if you check out
with your sf login, you should get it. Let the list know if it solves
your problem?

For reference, the problem was due to the call

addChannel(char* channel, FILE* output)

When called directly from Python, the char* was a Python string that was
being copied into a C format. The C code assumed that this string was
persistent, but it wasn't; Python would reuse the memory. The hashtable
was using the string as its key. So suddenly the hashtable, instead of
having

"BlinkC", stdout

as a tuple, would have something like

"global", stdout

as a tuple, no dbg() calls would match, and it wouldn't work. The bug
was due to my not completely understanding how SWIG was managing memory
between Python and C. The fix is to copy the key string when adding a
new channel.

Phil

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

Reply via email to