符号未定义问题:https://blog.csdn.net/buknow/article/details/96130049
首页 | 归档 | 分类 | 标签 | 关于 |
|
jemalloc 资源
1 | jemalloc 原理:https://wanghenshui.github.io/2019/05/01/jemalloc.html |
编译一个 gcc 的交叉编译工具链:https://www.cnblogs.com/zhouronghua/p/15236755.html
1 | git clone https://github.com/openssl/openssl.git |
1 | https://curl.se/download/ |
非正规的做法
https://zhuanlan.zhihu.com/p/71564723
官方文档:https://github.com/google/sanitizers/wiki/AddressSanitizer
源码剖析-INTERCEPTION:https://zhuanlan.zhihu.com/p/372460482
firasan:
1 | https://zhuanlan.zhihu.com/p/452363685 |
对 symbol 使用包装函数,任何对 symbol 未定义的引用会被解析成 __wrap_symbol
。而任何对 __real_symbol
未定义的引用会被解析成 symbol。即当一个名为 symbol 符号使用 wrap 功能时,工程中任何用到 symbol 符号的地方实际使用的是 __wrap_symbol
符号,任何用到 __real_symbol
的地方实际使用的是真正的 symbol。
注意:当 __wrap_symbol
是使用 C++ 实现时,一定要加上 extern "C"
1 | # wrap_symbol.h |
测试代码
1 | int main() { |
CpuProfile 原理:start 和 stop 的区间,用于检测 cpu 以及函数的调用。生成一个 二进制+文本(smaps) 的文件,交给 pprof 来解析
CpuProfiler 中 start 调用 EnableHandler 用于注册回调(prof_handler)。回调函数中生成具体行为,插入到 hash 中,在整体 stop 或者 flush 的时候进行计算。
触发方式:以 settimer 为基础注册调度事件,以一定方式(定期)发送某个信号;然后 sigactiion 重置对此信号的处理,以达到调用我们注册的回调函数的目的。
在 start 和 end 之间,dump 一份内存视图,进行对比两个视图。以发现是否有内存泄漏