简体   繁体   English

Delphi-FastMM事件日志方法名称

[英]Delphi - FastMM event log methods names

I'm hunting some memoryleaks and I use FastMM in FullDebugMode to get event logs. 我正在寻找一些内存泄漏,并且在FullDebugMode中使用FastMM来获取事件日志。 This works pretty fine, but the stacktrace is...not very nice at all. 这工作得很好,但是stacktrace是...一点也不好。

A short example: 一个简短的例子:

This block was allocated by thread 0x25F8, and the stack trace (return addresses) at the time was:
4081E8 [FastMM4.pas][FastMM4][_ZN7Fastmm411DebugGetMemEx][8737]
4086A5 [FastMM4.pas][FastMM4][_ZN7Fastmm413DebugAllocMemEx][9019]
F0D820 [_ZN6System8AllocMemEx]
F18A0D [_ZN6System8TMonitor6CreateEv]
F18EEB [_ZN6System8TMonitor10GetMonitorEPNS_7TObjectE]
10AE265 [_ZN6System7Classes16CheckSynchronizeEi]
54CAC7 [Vcl.Forms.pas][Vcl.Forms][_ZN3Vcl5Forms12TApplication4IdleERK6tagMSG][11044]
54B598 [Vcl.Forms.pas][Vcl.Forms][_ZN3Vcl5Forms12TApplication13HandleMessageEv][10473]
54BA24 [Vcl.Forms.pas][Vcl.Forms][_ZN3Vcl5Forms12TApplication3RunEv][10611]
566719 [ServerRunner.pas][ServerRunner][_ZN12Serverrunner9RunServerEv][113]

This is not easy readable for me. 这对我来说不容易理解。 I like that unit name is in square backets, but what did happen to methods names? 我喜欢单位名称在方格里,但是方法名称发生了什么? I understand there is fully qualified name of the method with it's arguments types. 我知道该方法的参数类型具有完全限定的名称。 But what is the mess (like _ZN3, 5, 12, 3, Ev) injected into it? 但是注入其中的混乱是什么(例如_ZN3、5、12、3,Ev)?

_ZN3, 5, 12, 3, Ev _ZN3、5、12、3,Ev
This is called name mangling . 这称为名称修改

Because it is possible to overload 2 functions with the same name (if using different parameters) the compiler needs some way to tell them apart. 因为可以重载两个具有相同名称的函数(如果使用不同的参数),则编译器需要某种方法来区分它们。
The way this is done is by encoding the parameters in a vendor specific way and adding these codes to the method name. 完成此操作的方式是通过使用供应商特定的方式对参数进行编码,然后将这些代码添加到方法名称中。

See this question on SO: Delphi - unmangle names in BPL's 在SO上看到以下问题: Delphi-在BPL中解开名称

Delphi comes with a utility called tdump.exe and tdump64.exe that can decode the mangled names for you. Delphi带有一个名为tdump.exetdump64.exe的实用程序,可以为您解码错误的名称。
Someone even wrote a ruby gem for it. 甚至有人为此写了一颗红宝石

tdump -e <name_of_exe>   

Will do the trick and display all unmangled names. 将完成所有操作,并显示所有未更改的名称。

Here's some more reading: http://www.int0x80.gr/papers/name_mangling.pdf 这是更多阅读内容: http : //www.int0x80.gr/papers/name_mangling.pdf

If you're willing to invest then MadExcept unmangles the names for you. 如果您愿意投资,则MadExcept会为您取消命名。

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

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