Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/160.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将PDB中的符号信息与PE内容关联? 我一直在试图更好地理解我的C++源代码以PE格式结束的方式以及如何在PE中找到源代码中的特定点。例如,我使用/Od和/ZI标志编译了一个_C++_Windows_Linker_Symbols_Virtual Address Space - Fatal编程技术网

如何将PDB中的符号信息与PE内容关联? 我一直在试图更好地理解我的C++源代码以PE格式结束的方式以及如何在PE中找到源代码中的特定点。例如,我使用/Od和/ZI标志编译了一个

如何将PDB中的符号信息与PE内容关联? 我一直在试图更好地理解我的C++源代码以PE格式结束的方式以及如何在PE中找到源代码中的特定点。例如,我使用/Od和/ZI标志编译了一个,c++,windows,linker,symbols,virtual-address-space,C++,Windows,Linker,Symbols,Virtual Address Space,有一个源文件具有以下功能:main,PrintVector,AddOneToEach 当我在十六进制编辑器中打开main.exe时,我可以将PE图像中的地址和值与dumpbin./main.exe/headers中的某些值关联起来作为参考。例如: FILE HEADER VALUES 14C machine (x86) 7 number of sections 5E48E9D4 time date stamp Sat Feb

有一个源文件具有以下功能:
main
PrintVector
AddOneToEach

当我在十六进制编辑器中打开
main.exe
时,我可以将PE图像中的地址和值与
dumpbin./main.exe/headers
中的某些值关联起来作为参考。例如:

FILE HEADER VALUES
             14C machine (x86)
               7 number of sections
        5E48E9D4 time date stamp Sat Feb 15 23:05:56 2020
               0 file pointer to symbol table
               0 number of symbols
              E0 size of optional header
             102 characteristics
                   Executable
                   32 bit word machine

OPTIONAL HEADER VALUES
             10B magic # (PE32)
           14.16 linker version
           9DA00 size of code
           25400 size of initialized data
               0 size of uninitialized data
           4BD1C entry point (0044BD1C) @ILT+19735(_mainCRTStartup)
我知道在地址0x3c处,我应该找到一个4字节长的字段,其中包含PE头的起始地址。我在little-endian格式中找到了转换为
0x0000100
0x0001000000
。在地址
0x00000100
中,我找到了每个

检查关联的PDB文件时,我通过powershell
和$dbh./main.PDB n PrintVector
查找符号
PrintVector
,其中
$dbh=C:\Program Files(x86)\Windows Kits\10\Debuggers\x64\dbh.exe
。输出为:

   name : PrintVector
   addr :  1059090
   size : 86
  flags : 0
   type : 2
modbase :  1000000
  value :        0
    reg : 0
  scope : SymTagExe (1)
    tag : SymTagFunction (5)
  index : 1

给定地址值
0x01059090
,我希望能够在main.exe的地址
0x01059090
中找到函数
PrintVector
的开头。但是,地址范围main.exe以
0x000cf15f0
结尾,这说明我对虚拟寻址和PE格式的理解有问题。我的期望是,我应该能够在main.exe中的某个地方找到函数
PrintVector
的入口点,该入口点基于使用PDB文件上的DBH通过Dumpbin提取的地址。我的理解到哪里去了?

1059090-1000000==59090
。所以
PrintVector
的rva是
59090
。将此rva添加到实际的基址,在该基址处,exe文件在运行时映射,您得到了
PrintVector
的地址。我看到
0x00059090
在main.exe的地址空间内,但是,当我检查该地址时,我看到的只是前84个字节的值
0xcccc
,然后是小端,
0x8bff
用于dbh报告的总大小为86字节的最后2个字节。但是,当在符号
AddOneToEach
上运行dbh时,它指向
0x01059092-0x01000000==0x00059092
,我在那里看到了一些合理的字节值。另外,当使用dbh时,我看到
name addonetoeach
的addr是
0x01059020
,它的大小是
54
,我假设它是以字节为单位的。
next addonetoeach
显示
PrintVector
是下一个符号,但它的地址与
addonetoeach
的地址相差>54字节,我不确定原因。