当您使用 /GL 进行编译或链接时间代码生成编译器在 vc 2010 之后会发出一个包含 vcfeature 的额外调试目录时,这些会存储一些 pre-vc 110 /GS 计数 /sdl 计数和 guardN 计数的计数
dumpbin /headers 将显示此功能的详细信息 0xc
:\>dir /b
printf.cpp
:\>cat printf.cpp
#include <stdio.h>
void main (void) {
printf("%x\n%d\n%u\n%f\n%g\n%s\n%c\n",256,100,-1,2.2,45.87,"hi",97);
}
:\>cl /Zi /W4 /GL /Ox /analyze /nologo printf.cpp
printf.cpp
Generating code
Finished generating code
:\>dumpbin /headers printf.exe | grep -A 10 "Debug Directories"
Debug Directories
Time Type Size RVA Pointer
-------- ------- -------- -------- --------
5A7F2A78 cv 3C 0004529C 43E9C Format: RSDS, xxx59}, 1, printf.pdb
5A7F2A78 feat 14 000452D8 43ED8 Counts: Pre-VC++ 11.00=0, C/C++=194, /GS=194, /sd
l=0, guardN=193 <<<<<<<<<<<<<
5A7F2A78 coffgrp 28C 000452EC 43EEC 4C544347 (LTCG)
对于初学者来说,这些都是在 windows 头文件中定义的
13 id == coffgrp 已显示由 lint 时间代码生成创建
如果您进行增量链接,则会创建 14 个 /LINK /LTCG:INCREMENTAL
这是一个虚拟调试目录
Debug Directories(4)
Type Size Address Pointer
cv 53 463cc 457cc
( 12) 14 46420 45820
( 13) 29c 46434 45834
( 14) 0 0 0
dumpbin /headers pogo_vcfeature.exe | grep -A 8 "调试目录"
Debug Directories
Time Type Size RVA Pointer
-------- ------- -------- -------- --------
5AD58258 cv 53 000463CC 457CC
5AD58258 feat 14 00046420 45820
Counts: Pre-VC++ 11.00=0, C/C++=202, /GS=202, /sdl=0, guardN=201
5AD58258 coffgrp 29C 00046434 45834
4C544347 (LTCG)
5AD58258 iltcg 0 00000000 0
窗口标题
:\>echo %cd%
C:\Program Files\Windows Kits\10\Include\10.0.16299.0
:\>grep -ir -B 12 -A 4 IMAGE_DEBUG_TYPE_VC_FEATURE *
xxxxxxxxxxxxxx
km/ntimage.h:#define IMAGE_DEBUG_TYPE_VC_FEATURE 12
km/ntimage.h-#define IMAGE_DEBUG_TYPE_POGO 13
km/ntimage.h-#define IMAGE_DEBUG_TYPE_ILTCG 14
km/ntimage.h-#define IMAGE_DEBUG_TYPE_MPX 15
km/ntimage.h-#define IMAGE_DEBUG_TYPE_REPRO 16
--
xxxxxxxxxxxxxxxxx
um/winnt.h:#define IMAGE_DEBUG_TYPE_VC_FEATURE 12
um/winnt.h-#define IMAGE_DEBUG_TYPE_POGO 13
um/winnt.h-#define IMAGE_DEBUG_TYPE_ILTCG 14
um/winnt.h-#define IMAGE_DEBUG_TYPE_MPX 15
um/winnt.h-#define IMAGE_DEBUG_TYPE_REPRO 16
:\>