Delphi - FastMM事件日志方法名称

时间:2016-08-30 14:09:34

标签: delphi memory-leaks stack-trace fastmm

我正在寻找一些内存泄漏,我在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]

这对我来说不易阅读。我喜欢单位名称是方形的支持,但方法名称发生了什么?我知道方法的完全限定名称有它的参数类型。但注入其中的混乱是什么(如_ZN3,5,12,3,Ev)?

1 个答案:

答案 0 :(得分:2)

  

_ZN3,5,12,3,Ev
  这称为name mangling

因为可以使用相同的名称重载2个函数(如果使用不同的参数),编译器需要某种方式来区分它们。
这样做的方法是以供应商特定的方式对参数进行编码,并将这些代码添加到方法名称中。

在SO上查看此问题: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会为您取消名称。