zoukankan      html  css  js  c++  java
  • 执行Valgrind后打桩失败问题解决方法

    valgrind是什么

    Valgrind是一款用于内存调试、内存泄漏检测以及性能分析的软件开发工具。C\C++程序员们比较头疼的问题就是内存管理,常常出现内存申请后不释放,最终导致内存耗尽程序崩溃。这种内存泄露问题如果光靠代码检视,是难以发现的,然而使用Valgrind进行检测,能够很快发现内存泄露。当然Valgrind的功能不仅仅是查内存泄露,可以参见网络上其他博客与Valgrind官网

    问题

    我们使用Valgrind来检查使用了mockcpp打桩的工程,发现只要运行了valgrind就会出现打桩失败,不运行valgrind时打桩功能一切正常

    解决方法

    最终查阅Valgrind官网手册发现

    --smc-check=<none|stack|all|all-non-file> [default: all-non-file for x86/amd64/s390x, stack for other archs]
    
    This option controls Valgrind's detection of self-modifying code. If no checking is done, 
    when a program executes some code, then overwrites it with new code, and executes the new code, 
    Valgrind will continue to execute the translations it made for the old code. 
    This will likely lead to incorrect behaviour and/or crashes.
    

    出于性能考虑Valgrind的默认选项会导致函数重写失效,这也就是运行Valgrind之后,mockcpp打桩失败的原因。解决办法就是设置

    --smc-check=all
    
  • 相关阅读:
    支付宝及时到帐接口使用详解
    Linux 天翼3G上网
    VBS常用函数及功能
    mencoder和ffmpeg参数详解
    C# 将数据导出到Excel汇总
    C# WinForm开发系列 Excel
    C#中的String.Format方法
    Google Maps API 代码
    ffmpeg的使用
    C# WinForm开发系列 Crystal Report
  • 原文地址:https://www.cnblogs.com/migoo/p/8931595.html
Copyright © 2011-2022 走看看