如何跟踪 Erlang 模块中除一个函数之外的所有函数?
我想使用 dbg:tpl 跟踪 erlang 模块中的所有函数,但其中一个内部函数占用了跟踪文件的 95%。然后我只想排除那个单一的功能,发现它并不像我想象的那么容易。
我知道跟踪时参数有很大的模式匹配可能性。
对函数应用模式匹配是否有类似的可能性?
例如:{'=/=', '$2', function_name}
我也欢迎开箱即用的解决方案!
谢谢你!
I wanted to trace for all functions in an erlang module, with dbg:tpl
, but one of the internal functions took up 95% of the trace file. I then wanted to exclude only that single function and found that it was not as easy as I thought it would be.
I know there are great pattern matching possibilities for arguments when tracing.
Is there a similar possibility to apply pattern matching for functions?
eg.: {'=/=', '$2', function_name}
I am open for outside-the-box solutions as well!
Thank You!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它可以通过列表理解来实现:
其中
Mod
是您要跟踪的模块,DontTrace
是不应跟踪的函数名称列表在。It can be achieved as one statement with a list comprehension:
Where
Mod
is the module you want to trace on, andDontTrace
is a list of functions names that should not be traced on.还没有测试过这个,但这不应该起作用吗?不知道一种方法可以在一行中完成它。
Haven't tested this but shouldn't this do the trick? Don't know of a way to do it in one line.