为什么 erlang lib 更改没有合并到我的项目中?
我在一个相当大的项目上使用 eclipse 3.6.2 和 erlang 5.8.1.1,我们还没有准备好迁移到该语言的更现代版本,所以我遇到了 eprof 中的一个错误:
string_bp_mfa([{Mfa, {Count, Time}}|Mfas], Tus, {MfaW, CountW, PercW, TimeW, TpCW}, Strings) ->
Smfa = s(Mfa),
Scount = s(Count),
Stime = s(Time),
Sperc = s("~.2f", [100*(Time/Tus)]),
Stpc = s("~.2f", [Time/Count]),
string_bp_mfa(Mfas, Tus, {
erlang:max(MfaW, length(Smfa)),
erlang:max(CountW,length(Scount)),
erlang:max(PercW, length(Sperc)),
erlang:max(TimeW, length(Stime)),
erlang:max(TpCW, length(Stpc))
}, [[Smfa, Scount, Sperc, Stime, Stpc] | Strings]).
这对我来说崩溃了一直以来,因为无论谁写这个都没有防范被零除。我已经进行了更改:
SafeTus = case Tus of 0 -> 1; _ -> Tus end,
SafeCount = case Count of 0 -> 1; _ -> Count end,
Sperc = s("~.2f", [100*(Time/SafeTus)]),
Stpc = s("~.2f", [Time/SafeCount]),
...但它从未由我的项目执行。我已经手动重新编译了.erl并将.beam放在ebin目录中,但是在我的项目完全关闭、关闭eclipse、打开eclipse、刷新、清理和重新启动之后,新版本的方法没有被执行。我尝试将“foo + 1”之类的表达式粘贴到方法中,看看是否得到了与现在让我失望的 badarith 不同的异常,但没有效果。
我只能猜测 .beams 正在被合并或缓存在我将不得不删除或重建的地方?
I'm using eclipse 3.6.2 with erlang 5.8.1.1 on a fairly large project that we're not ready to move to a more modern version of the language, so I'm stuck with a bug in eprof:
string_bp_mfa([{Mfa, {Count, Time}}|Mfas], Tus, {MfaW, CountW, PercW, TimeW, TpCW}, Strings) ->
Smfa = s(Mfa),
Scount = s(Count),
Stime = s(Time),
Sperc = s("~.2f", [100*(Time/Tus)]),
Stpc = s("~.2f", [Time/Count]),
string_bp_mfa(Mfas, Tus, {
erlang:max(MfaW, length(Smfa)),
erlang:max(CountW,length(Scount)),
erlang:max(PercW, length(Sperc)),
erlang:max(TimeW, length(Stime)),
erlang:max(TpCW, length(Stpc))
}, [[Smfa, Scount, Sperc, Stime, Stpc] | Strings]).
Which crashes for me all the time because whoever wrote this didn't guard against dividebyzero. I've hacked in a change:
SafeTus = case Tus of 0 -> 1; _ -> Tus end,
SafeCount = case Count of 0 -> 1; _ -> Count end,
Sperc = s("~.2f", [100*(Time/SafeTus)]),
Stpc = s("~.2f", [Time/SafeCount]),
...but it is never executed by my project. I've manually recompiled the .erl and placed the .beam in the ebin directory, but after a total shutdown of my project, closing eclipse, opening eclipse, refreshing, cleaning, and restarting, the new version of the method is not executed. I've tried sticking expressions like "foo + 1" into the method to see if I get a different exception than the badarith that is taking me down now, but to no effect.
I can only guess that the .beams are being consolidated or cached somewhere that I'm going to have to nuke or rebuild?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看
code
模块的文档,其中解释了代码路径搜索。由于eprof
位于tools
应用程序中,因此应从任何其他库目录中获取它。Look at the documentation for
code
module, which explains code path search. Sinceeprof
is in thetools
application, it should be picked up from any additional library directories.