Advertisement
RandomClear

FastMM4 FullDebugMode Integration

May 18th, 2015
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 2.60 KB | None | 0 0
  1. // Open FastMM_FullDebugMode.dpr
  2. ____________________________________________________________
  3.  
  4. // -== Find ==-
  5.  
  6. {$define JCLDebug}
  7. {.$define madExcept}
  8. {.$define EurekaLog}
  9.  
  10. // -== Replace with ==-
  11.  
  12. {.$define JCLDebug}
  13. {.$define madExcept}
  14. {.$define EurekaLog}       // EurekaLog 5/EurekaLog 6
  15. {.$define EurekaLog_Ver7}  // EurekaLog 7+
  16. ____________________________________________________________
  17.  
  18. // -== Find ==-
  19.  
  20. uses
  21.   {$ifdef JCLDebug}JCLDebug{$endif}
  22.   {$ifdef madExcept}madStackTrace{$endif}
  23.   {$ifdef EurekaLog}ExceptionLog{$endif},
  24.   SysUtils, Windows;
  25.  
  26. // -== Replace with ==-
  27.  
  28. {$ifdef EurekaLog_Ver7}
  29.   {$define EurekaLog_NEW}
  30.   {$undef EurekaLog_OLD}
  31. {$else}  
  32.   {$ifdef EurekaLog}
  33.     {$undef EurekaLog_NEW}
  34.     {$define EurekaLog_OLD}
  35.   {$endif}
  36. {$endif}
  37.  
  38. uses
  39.   {$ifdef JCLDebug}JCLDebug{$endif}
  40.   {$ifdef madExcept}madStackTrace{$endif}
  41.   {$ifdef EurekaLog_NEW}EFastMM4Support{$endif}
  42.   {$ifdef EurekaLog_OLD}ExceptionLog{$endif}
  43.   , SysUtils, Windows;
  44. ____________________________________________________________
  45.  
  46. // -== Find ==-
  47.  
  48. {$ifdef EurekaLog}
  49.  
  50. // -== Replace with ==-
  51.  
  52. {$ifdef EurekaLog_OLD}
  53. ____________________________________________________________
  54.  
  55. // -== Find ==-
  56.  
  57. {$endif}
  58.  
  59. {-----------------------------Exported Functions----------------------------}
  60.  
  61. exports
  62.   GetFrameBasedStackTrace,
  63.   GetRawStackTrace,
  64.   LogStackTrace;
  65.  
  66. // -== Replace with ==-
  67.  
  68. {$endif}
  69.  
  70. {$ifdef EurekaLog_NEW}
  71. function LogStackTrace(AReturnAddresses: PNativeUInt; AMaxDepth: Cardinal; ABuffer: PAnsiChar): PAnsiChar;
  72. begin
  73.   {Needs EurekaLog 7.0.7.15 or a newer build}
  74.   Result := Pointer(EFastMM4Support.FastMM_LogStackTrace(Pointer(AReturnAddresses), AMaxDepth, Pointer(ABuffer), MaxInt { TODO: buffer limitation? },
  75.     [ddModule, ddUnit, ddProcedure, ddSourceCode], // which entries to show
  76.     True,  // show module names
  77.     True,  // show offset from Address to LineNumber symbol location (in bytes)
  78.     True,  // show offset from Address to ProcedureName symbol location (in lines)
  79.     True,  // show offset from module's start = Address - Module (bytes)
  80.     True,  // show RAW pointer
  81.     True   // show line number
  82.     ));
  83. end;
  84.  
  85. {$endif}
  86.  
  87. function FM4AllocMem(const ASize: Integer): Pointer;
  88. begin
  89.   Result := AllocMem(ASize);
  90. end;
  91.  
  92. procedure FM4FreeMem(const AMem: Pointer);
  93. begin
  94.   FreeMem(AMem);
  95. end;
  96.  
  97. {-----------------------------Exported Functions----------------------------}
  98.  
  99. exports
  100.   GetFrameBasedStackTrace,
  101.   GetRawStackTrace,
  102.   LogStackTrace,
  103.  
  104.   FM4AllocMem,
  105.   FM4FreeMem;
  106. ____________________________________________________________
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement