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
    
  • 相关阅读:
    js中for..of..和迭代器
    Python与其他语言的区别
    数据结构和算法部分总结
    MVC设计模式及SSH框架的介绍
    块级元素和行内元素以及display中block、inline和inline-block的区别
    线程安全和非线程安全
    Spring MVC拦截器入门
    Java反射的理解
    mybatis
    重定向和转发
  • 原文地址:https://www.cnblogs.com/migoo/p/8931595.html
Copyright © 2011-2022 走看看