我正在寻找一些内存泄漏,并在 FullDebugMode 中使用 FastMM 来获取事件日志。这工作得很好,但是堆栈跟踪......一点也不太好。
一个简短的例子:
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]
这对我来说不容易阅读。我喜欢单位名称位于方括号中,但是方法名称发生了什么?我知道该方法有完全限定的名称及其参数类型。但是注入(inject)其中的困惑内容(如 _ZN3, 5, 12, 3, Ev)是什么?
最佳答案
_ZN3, 5, 12, 3, Ev
This is called name mangling.
因为有可能重载两个同名的函数(如果使用不同的参数),编译器需要某种方法来区分它们。
完成此操作的方法是以供应商特定的方式对参数进行编码并将这些代码添加到方法名称中。
请参阅以下问题:Delphi - unmangle names in BPL's
Delphi 附带了一个名为 tdump.exe
and tdump64.exe
的实用程序它可以为您解码损坏的名称。
有人甚至写了一个ruby gem为了它。
tdump -e <name_of_exe>
会成功并显示所有未损坏的名称。
这里有更多阅读内容:http://www.int0x80.gr/papers/name_mangling.pdf
如果你愿意投资那就MadExcept为你解开名字。
关于Delphi - FastMM 事件日志方法名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39229813/