有Valgrind Memcheck像工具的Windows调试使用后的免费错误? [英] Is there Valgrind Memcheck like tool for windows to debug use after free errors?

查看:308
本文介绍了有Valgrind Memcheck像工具的Windows调试使用后的免费错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Durring我的工作我regulary面临相当普遍的编程错误 - 使用一些已经被释放的对象。这在C ++中调用UB。在 linux ,这种问题通常通过使用Valgrind工具Memcheck来解决。从 Memcheck手动

Durring my work I regulary face rather common programming error - using some object which has already been freed. This invokes UB in C++. On linux, this kind of problems are usually resolved by using Valgrind tool Memcheck. From Memcheck manual:


Memcheck尝试确定非法地址可能与什么相关,
,因为它通常很有用。因此,如果它指向已经释放的内存块
,则会通知这一点,并且
被释放。

Memcheck tries to establish what the illegal address might relate to, since that's often useful. So, if it points into a block of memory which has already been freed, you'll be informed of this, and also where the block was freed.

Memcheck提供了我调用堆栈,对象被释放,我可以继续和调试问题。是否有类似工具 Windows 具有相同的功能,最好是免费的?

Memcheck provides me call stack, where the object was deallocated and I can go on and debug the problem. Is there similar tool for windows with the same functionality, preferably free?

推荐答案

内存文档,有具有完全相同的Valgrind功能的 -delay_frees_stack 选项。从选项参考

According to Dr. Memory documentation, there is -delay_frees_stack option with exactly the same Valgrind functionality. From Option Reference:

-delay_frees_stack 
default: false 
Record callstacks on free to use when reporting use-after-free or other errors that overlap with freed objects. There is a slight performance hit incurred by this feature for malloc-intensive applications.

此处还有一个示例错误由Memory记忆

Here is another example, using the -delay_frees_stack option to obtain the callstack of the freed memory:

Error #8: UNADDRESSABLE ACCESS: reading 0x001338a8-0x001338ac 4 byte(s)
# 0 unaddr_test1                    [e:\derek\drmemory\git\src\tests\suppress.c:110]
# 1 test                            [e:\derek\drmemory\git\src\tests\suppress.c:269]
# 2 main                            [e:\derek\drmemory\git\src\tests\suppress.c:297]
Note: @0:00:02.141 in thread 3024
Note: next higher malloc: 0x001338e8-0x00133938
Note: prev lower malloc:  0x001337e8-0x00133820
Note: 0x001338a8-0x001338ac overlaps memory 0x001338a8-0x001338c4 that was freed here:
Note: # 0 test                            [e:\derek\drmemory\git\src\tests\suppress.c:269]
Note: # 1 main                            [e:\derek\drmemory\git\src\tests\suppress.c:297]
Note: instruction: mov    (%eax) -> %eax

这篇关于有Valgrind Memcheck像工具的Windows调试使用后的免费错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆