Conversation
|
I wonder if something like this can be made available for redbean as well (or maybe it already is and just need to be exposed to the Lua layer)? @jart? |
|
@pkulchenko Absolutely. Lua doesn't require parens in function calls, and it lets you pass code to a function, so we could probably define the syntax as follows: ftrace {
some_code()
} |
jart
left a comment
There was a problem hiding this comment.
LGTM. Cool change! So excited to see people using the function call tracing.
@jart, we may need to tweak this a bit, as it will call If we're setting/removing a hook, then I've been also wondering if it's possible to keep the trace output internal and implement sort of a sliding window for it: |
Python likes to make a bunch of function calls for anything, so
ftrace-ing a Python script from start to end produces a TON of info.cosmo.ftrace()+cosmo.exit1()are nice, but I have to still structure my Python script to exit right after a particular line.As mentioned here, This commit adds a simple contextmanager wrapper to
cosmo.ftrace()so instead I can do things like this:the above snippet produces 32 lines of
ftracein stderr, which is much easier to examine: