简体   繁体   English

什么是这个CopyPDBs函数(来自clr.dll)呢?

[英]What is this CopyPDBs function (from clr.dll) doing?

When using Process Explorer to analyze an ASP.NET MVC application in a production environment running IIS, I've noticed a lot of calls to this CopyPDBs function from C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\clr.dll : 当使用Process Explorer分析运行IIS的生产环境中的ASP.NET MVC应用程序时,我注意到从C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\clr.dll调用了这个CopyPDBs函数:

Process Explorer CopyPDB

All of them are having the exact same stack trace: 所有这些都具有完全相同的堆栈跟踪:

ntdll.dll!ZwWaitForSingleObject+0xa
KERNELBASE.dll!WaitForSingleObjectEx+0x98
clr.dll!GetMetaDataInternalInterface+0x3064a
clr.dll!GetMetaDataInternalInterface+0x30732
clr.dll!GetMetaDataInternalInterface+0x306e5
clr.dll!CopyPDBs+0x44a2
KERNEL32.DLL!BaseThreadInitThunk+0x22
ntdll.dll!RtlUserThreadStart+0x34

My question is: What is this CopyPDBs function from the clr.dll exactly doing? 我的问题是: 这是什么CopyPDBs从功能clr.dll究竟在做什么?

I've searched a lot but still can't find any exaplanation and/or documentation of this function. 我搜索了很多但仍然找不到任何这个功能的摘要和/或文档。

Note: This question is somehow related to a previous question of mine, asked in ServerFault: https://serverfault.com/questions/684554/high-cpu-usage-of-iis-process-w3wp-exe-because-of-many-slow-clr-dllcopypdbs 注意:这个问题与我之前的一个问题有关,在ServerFault中询问: https ://serverfault.com/questions/684554/high-cpu-usage-of-iis-process-w3wp-exe-because-of- 许多慢-CLR-dllcopypdbs

It is not doing anything. 它没有做任何事情。 Process Explorer does not have access to the PDB file for clr.dll so it doesn't know enough about the code. Process Explorer无权访问clr.dll的PDB文件,因此它对代码知之甚少。 Always very evident when you look at the instruction offset from the known symbol, +0x44a2 is long, long past the CopyPDBs() function. 当您查看已知符号的指令偏移量时,始终非常明显, +0x44a2很长,超过CopyPDBs()函数。 All of the symbols you see from clr.dll are junk. 你从clr.dll看到的所有符号都是垃圾。 The symbols from ntdll.dll are good, note the small offsets. 来自ntdll.dll的符号很好,请注意小偏移量。

Without a PDB file that provides symbols for internal functions in a DLL, a debugger can only rely on exported functions. 如果没有为DLL中的内部函数提供符号的PDB文件,则调试器只能依赖导出的函数。 Clr.dll does not have many of them. Clr.dll没有很多。

Helping Process Explorer show better stack traces is the subject of this blog post . 帮助Process Explorer显示更好的堆栈跟踪是本博客文章的主题。

Windbg isn't the only way, you can also do it with Visual Studio: Windbg不是唯一的方法,你也可以使用Visual Studio:

  1. Tools > Options > Debugging > Symbols. 工具>选项>调试>符号。 Tick the "Microsoft Symbol Servers" checkbox and select a cache directory. 勾选“Microsoft Symbol Servers”复选框并选择一个缓存目录。
  2. Project > Properties > Debug > tick the "Enable native code debugging" option. “项目”>“属性”>“调试”>勾选“启用本机代码调试”选项。
  3. Press F5, you'll see the debugger downloading the symbols. 按F5,您将看到下载符号的调试器。 Takes a while, it happens just once. 需要一段时间,它只发生一次。
  4. Tell Process Explorer about the cache directory you picked with Options > Configure Symbols. 通过“选项”>“配置符号”告诉Process Explorer您选择的缓存目录。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM