[Bro] Debugging Policies and Print Statement

Siwek, Jonathan Luke jsiwek at illinois.edu
Tue May 29 10:48:57 PDT 2012

> I'm using bro version 2.0-372 with a new git checkout from master as of 2012-05-27 on Centos6.   I'm having an issue where the print statement in the policy debugger displays nothing.

It seems that parameters of functions/events take on the module scoping in which they're declared.  So in your case, breaking in the "http_entity_data" in file-hash.bro is inside the "HTTP" module (there's the "module HTTP;" statement near the top of that script).  So qualifying local variables or event parameters with the module name in the script debugger should work:

print HTTP::is_orig
print HTTP::c
print HTTP::c$id

> Breakpoints and stack tracks seem to work correctly

I also noticed that the context string for stack traces is using a static buffer size, so it's getting truncated sometimes and the filename:line won't be there.  I can fix that and also give some better error messages for when the 'print' command fails to parse the given args and put that on the fastpath branch, but I'm not sure how bad it will be to try to change local identifiers to not inherit module scoping, or even if that would be "right".


More information about the Bro mailing list