为什么 erlang lib 更改没有合并到我的项目中?

发布于 2024-12-07 00:00:49 字数 1145 浏览 0 评论 0原文

我在一个相当大的项目上使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蔚蓝源自深海 2024-12-14 00:00:49

查看 code 模块的文档,其中解释了代码路径搜索。由于 eprof 位于 tools 应用程序中,因此应从任何其他库目录中获取它。

Look at the documentation for code module, which explains code path search. Since eprof is in the tools application, it should be picked up from any additional library directories.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文