简体   繁体   English

即使我没有显示它的路径,windbg也会找到我的应用程序pdb文件

[英]windbg finds my application pdb file even when I haven't revealed its path

  1. I created a simple demo application (app.exe) in default projects folder under my documents. 我在文档下的默认项目文件夹中创建了一个简单的演示应用程序(app.exe)。
  2. I copied the app.exe to c:\\test\\app folder without copying the pdb file. 我将app.exe复制到c:\\ test \\ app文件夹,而没有复制pdb文件。

I run this executable with windbg (File menu > Open executable). 我使用windbg运行此可执行文件(“文件”菜单>“打开可执行文件”)。 I expect it NOT to find the symbol file but it does! 我希望它没有找到符号文件,但是可以!

I set sympath to .sympath srv*c:\\test\\Symbols*https://msdl.microsoft.com/download/symbols 我将sympath设置为.sympath srv*c:\\test\\Symbols*https://msdl.microsoft.com/download/symbols

The output for lm is lm的输出是

0:000> lm
start    end        module name
013b0000 013b8000   App      C (private pdb symbols)  c:\users\username\documents\visual studio 2013\Projects\App\Release\App.pdb
0f500000 0f571000   MSVCP120   (private pdb symbols)  c:\test\symbols\msvcp120.i386.pdb\0B631FCA474F4F6FBBE54C497C5821361\msvcp120.i386.pdb
0f740000 0f82e000   MSVCR120   (private pdb symbols)  c:\test\symbols\msvcr120.i386.pdb\16F5E2EF340A453ABC8B8F67DC6FD8082\msvcr120.i386.pdb
76860000 768a7000   KERNELBASE   (pdb symbols)          c:\test\symbols\wkernelbase.pdb\90BA6126FA6340F1ABFAE58DB8B7FB7D1\wkernelbase.pdb
769e0000 76af0000   kernel32   (pdb symbols)          c:\test\symbols\wkernel32.pdb\515F42F53681439D989AC0FC08F7F8F72\wkernel32.pdb
77210000 77390000   ntdll      (pdb symbols)          c:\test\symbols\wntdll.pdb\B5ACAC3B4A6C4515AF416D60366399652\wntdll.pdb

So the executable I am running is in c:\\test\\app\\app.exe , how does it finds its pdb file in my documents folder? 因此,我正在运行的可执行文件位于c:\\test\\app\\app.exe ,它如何在my documents文件夹中找到其pdb文件?

I verified, it is not cached. 我验证了,它没有被缓存。

Applications contain the path to the PDB file in the executable itself. 应用程序在可执行文件本身中包含PDB文件的路径。 You can make that visible in various ways: 您可以通过多种方式使其可见:

  1. You can verify that eg with Sysinternals Strings utility: 您可以使用Sysinternals Strings实用程序来验证:

     strings app.exe | findstr ".pdb" 

    will output the full path to the PDB. 将完整路径输出到PDB。

  2. Another tool (a bit more specific to debugging) to achieve a similar result is DebugDir : 获得类似结果的另一个工具(稍微更具体地用于调试)是DebugDir

     E:\\[...]\\DebugDir>DebugDir.exe "E:\\[...]\\Reporter.exe" File: E:\\[...]\\Reporter.exe Number of entries in debug directory: 1 Debug directory entry 1: Type: 2 ( CodeView ) TimeStamp: 5772e493 Characteristics: 0 MajorVer: 0 MinorVer: 0 Size: 120 RVA: 000ba482 FileOffset: 000b8682 CodeView format: RSDS Signature: {eac36e37-78c5-47c5-bc95-7c6e5896f694} Age: 1 PdbFile: E:\\[...]\\obj\\Debug\\Reporter.pdb 
  3. In WinDbg itself, use !lmi 在WinDbg本身中,使用!lmi

     0:009> !lmi Reporter [...] Debug Data Dirs: Type Size VA Pointer CODEVIEW 77, 82cf2, 80ef2 RSDS - GUID: {588CF7EE-FA7C-44F9-850C-382520749BE8} Age: 1, Pdb: E:\\[...]\\obj\\Debug\\Reporter.pdb Symbol Type: DEFERRED - No error - symbol load deferred Load Report: no symbols loaded 

    Alternatively, first find out the address of the module and then dump the headers (which is quite verbose). 或者,首先找出模块的地址,然后转储标题(非常冗长)。

     0:009> lm m Reporter start end module name 002c0000 00350000 Reporter (deferred) 0:009> !dh 002c0000 [...] Debug Directories(1) Type Size Address Pointer cv 77 82cf2 80ef2 Format: RSDS, guid, 1, E:\\[...]\\obj\\Debug\\Reporter.pdb 

If you don't want the path to be part of your executable, check if there's a compiler/linker setting that turns this feature off, eg /pdbpath:none for the Microsoft Visual C++ compiler. 如果您不希望该路径成为可执行文件的一部分,请检查是否有关闭此功能的编译器/链接器设置,例如Microsoft Visual C ++编译器的/pdbpath:none

If you don't want the debugger to find the PDB, move the PDB into a different folder instead of the executable. 如果您不希望调试器找到PDB,请将PDB移到其他文件夹而不是可执行文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 windbg和VS找不到我的pdb文件 - windbg and VS can't find my pdb file 无法使用 WinDBG、exe 及其关联的 pdb 进行符号化 - Can't symbolicate using WinDBG, the exe and its associated pdb 当我没有编码时,为什么我的班级会执行算术运算? - Why is my class performing arithmetic when I haven't coded any? 当我没有动态声明我的数组时,这个 display() 如何显示数组值 - How this display() displays the array values when I haven't declared my array dynamically __FILE__ 和 PDB 的相对路径 - Relative path for __FILE__ and PDB Qt:QSslCertificate :: fromPath找不到我的文件,但是QFileInfo找到了它 - Qt: QSslCertificate::fromPath doesn't find my file, but QFileInfo finds it 如果尚未建立树连接,应该在SMB标头中将TID设置为什么? - What should I set my TID to in an SMB header if I haven't established a tree connect? 无法通过windbg识别我的扩展名 - Can't get windbg to recognise my extension 即使我确定指定的路径是正确的,QTranslator 似乎也找不到 my.ls 文件 - QTranslator cannot seem to find my .ls file even though I am certain the specified path is correct 从文本文件中提取单个句子...我没有把它弄好 - Extracting individual sentences from a text file … I haven't got it right YET
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM