说明
使用 VLD 内存泄漏检测工具辅助开发时整理的学习笔记。本篇对 VLD 源码包中的各文件用途做个概述。同系列文章目录可见 《内存泄漏检测工具》目录
目录
- 说明
- 1. 整体概览
- 2. 文件夹 .teamcity
- 3 文件夹 lib
- 4 文件夹 mfc_detect(vld 辅助工程)
- 5 文件夹 setup
- 6 文件夹 src
- 6.1 外部 34 个文件(vld 核心工程)
- 6.2 文件夹 tests
- 6.3 文件夹 tests\basics(测试工程)
- 6.4 文件夹 tests\console(示例工程)
- 6.5 文件夹 tests\corruption(测试工程)
- 6.6 文件夹 tests\dynamic_app(测试工程)
- 6.7 文件夹 tests\dynamic_dll(测试辅助工程)
- 6.8 文件夹 tests\mfc(示例工程)
- 6.9 文件夹 tests\mfc_dll(测试辅助工程)
- 6.10 文件夹 tests\suite(测试工程)
- 6.11 文件夹 tests\vld_ComTest(测试辅助工程)
- 6.12 文件夹 tests\vld_dll1(测试辅助工程)
- 6.13 文件夹 tests\vld_dll2(测试辅助工程)
- 6.14 文件夹 tests\vld_main(示例工程)
- 6.15 文件夹 tests\vld_main_test(测试工程)
- 6.16 文件夹 tests\vld_unload(测试工程)
- 7 其余 12 个文件
1. 整体概览
以 vld2.5.1
版本为例,下载源码 后,根目录下一共 5
个文件夹:.teamcity
、lib
、mfc_detect
、setup
、src
。还有 12
个文件:.editorconfig
、.gitignore
、.mailmap
、appveyor.yml
、AUTHORS.txt
、change_toolset.ps1
、CHANGES.txt
、COPYING.txt
、README.md
、vld.ini
、vld_vs14.sln
、vld_vs14_wo_mfc.sln
。
2. 文件夹 .teamcity
该文件夹的目录结构如下:
vld-master\.teamcity
└─Vld
│ project-config.xml
│
├─buildTypes
│ Vld_CompileAll.xml
│ Vld_DebugCrtDllWin32.xml
│
├─pluginData
│ plugin-settings.xml
│
└─vcsRoots
Vld_HttpsGithubComKindDragonVldGitRefsHeadsMaster.xml
里面全是 xml
文件,是 teamcity
持续集成工具的配置文件,用于 VLD
项目源码的集成管理,关于该工具的介绍,可访问其官网:Jetbrains-teamcity。
3 文件夹 lib
该文件夹下有三个子文件夹:cppformat
、dbghelp
、gtest
。
3.1 文件夹 cppformat(生成 libformat)
该文件夹的目录结构如下:
vld-master\lib\cppformat
ChangeLog.rst
format.cc
format.h
format.vcxproj
format.vcxproj.filters
LICENSE.rst
posix.cc
posix.h
cppformat
是一个开源的 C++ 格式化库,仓库地址为 Github-fmtlib,在 VLD
中被用来格式化输出堆栈信息,详见 源码 callstack.cpp 第 224~275 行。
3.2 文件夹 dbghelp
该文件夹的目录结构如下:
vld-master\lib\dbghelp
├─include
│ DbgHelp.h
│
└─lib
├─Win32
│ DbgHelp.Lib
│
└─x64
DbgHelp.Lib
dbghelp
是 Windows
系统下的调试跟踪库,相关信息可见 关于 DbgHelp,在 VLD
中被用来获取堆栈信息,详见源码中 callstack.cpp、vld.cpp、vld_hooks.cpp 等文件。
3.3 文件夹 gtest(生成 libgtest)
该文件夹的目录结构如下:
vld-master\lib\gtest
│ CHANGES
│ CMakeLists.txt
│ configure
│ configure.ac
│ CONTRIBUTORS
│ LICENSE
│ Makefile.am
│ Makefile.in
│ README
│
├─include
│ └─gtest
│ │ gtest-death-test.h
│ │ gtest-message.h
│ │ gtest-param-test.h
│ │ gtest-param-test.h.pump
│ │ gtest-printers.h
│ │ gtest-spi.h
│ │ gtest-test-part.h
│ │ gtest-typed-test.h
│ │ gtest.h
│ │ gtest_pred_impl.h
│ │ gtest_prod.h
│ │
│ └─internal
│ gtest-death-test-internal.h
│ gtest-filepath.h
│ gtest-internal.h
│ gtest-linked_ptr.h
│ gtest-param-util-generated.h
│ gtest-param-util-generated.h.pump
│ gtest-param-util.h
│ gtest-port.h
│ gtest-string.h
│ gtest-tuple.h
│ gtest-tuple.h.pump
│ gtest-type-util.h
│ gtest-type-util.h.pump
│
├─msvc
│ gtest-md.sln
│ gtest.sln
│ gtest.vcxproj
│ gtest.vcxproj.filters
│ gtest_main.vcxproj
│ gtest_main.vcxproj.filters
│ gtest_prod_test.vcxproj
│ gtest_prod_test.vcxproj.filters
│ gtest_unittes