gpt4 book ai didi

debugging - valgrind 是否阻止了我想调试的段错误发生?

转载 作者:行者123 更新时间:2023-12-04 14:30:57 24 4
gpt4 key购买 nike

关闭。这个问题需要debugging details .它目前不接受答案。












想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。

2年前关闭。




Improve this question




我想确定是什么导致了段错误,我正在尝试使用 valgrind 来做到这一点。

https://gist.github.com/4349869是一个要点,当我在没有 valgrind 的情况下运行某些东西时我会遇到段错误,但是当我使用 valgrind 时我没有遇到段错误。 (我已经重复了几次,结果相同)

这是否意味着该错误是一个 heisenbug,当我使用 valgrind 时不会发生,因此 valgrind 在这里没有任何用处?

最佳答案

Does this mean that the bug is a heisenbug that won't occur when I usevalgrind, and therefore valgrind isn't any use here?


不,您仍然应该使用 Valgrind 并修复所有报告的错误。您描述的行为相当普遍,并记录在 Valgrind FAQ 中。 :

When a program runs under Valgrind, its environment is slightlydifferent to when it runs natively. For example, the memory layout isdifferent, and the way that threads are scheduled is different.

Most of the time this doesn't make any difference, but it can,particularly if your program is buggy. For example, if your programcrashes because it erroneously accesses memory that is unaddressable,it's possible that this memory will not be unaddressable when rununder Valgrind. Alternatively, if your program has data races, thesemay not manifest under Valgrind.

关于debugging - valgrind 是否阻止了我想调试的段错误发生?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13982847/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com