1

I would like to have my stack trace contain unit names / methods / lines. Anything that can help really to make it more readable. I know this has worked in the past, but it has stopped working...

I have enabled

  {$DEFINE FullDebugMode}
  {$DEFINE RawStackTraces}
  {$DEFINE CheckHeapForCorruption}
  {$DEFINE EnableMemoryLeakReporting}
  {$DEFINE ClearLogFileOnStartup}
  {$DEFINE UseOutputDebugString}

I have 32+64bit dll in executable compiled directory.

I have enabled all debug options in project options (symbol references set to reference info) for both 32bit/64bit.

I am using the latest version.

I am listing FastMM as first unit in uses clause in project dpr file.

I use Delphi XE4.

I 100% checked the correct group of defines get compiled in by typing in gibberish to provoke compiletime error (i.e. so I am not doing something wrong with release/debug builds)

What more can I try?

enter image description here

....

@fpiette suggested I posted a test project. I will include that here...

Project1.dpr

program Project1;
uses
  FastMM4,
  Vcl.Forms,
  testmem in 'testmem.pas' {Form1};
{$R *.res}
begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

testmem.pas

unit testmem;
interface
uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Buttons, Vcl.ExtCtrls, Vcl.StdCtrls;
type
  TForm1 = class(TForm)
    BitBtn1: TBitBtn;
    Panel1: TPanel;
    BitBtn2: TBitBtn;
    SpeedButton1: TSpeedButton;
    procedure FormCreate(Sender: TObject);
  private
  public
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
b: TButton;
begin
b := TButton.Create(nil);
b.Parent := Self;
b.Free;
b.Free;
end;

And this worked after I moved the precompiled dlls into the directory... Not sure why it would not work for my own project because I do the exact same... Just checked debug settings same in project options and that I in Delphi "target" same kind of build.

Solution Enabling debug info / detailed map file in project options - linking options.

Tom
  • 3,587
  • 9
  • 69
  • 124
  • Just to be sure: you are building the debug build? – fpiette May 05 '21 at 12:35
  • Yes. Debugging inside IDE otherwise works fine. – Tom May 05 '21 at 13:24
  • What happens if you create a totally new and simple project? – fpiette May 05 '21 at 15:11
  • That seems to work... Oddly... Same project settings, target etc. – Tom May 06 '21 at 19:14
  • I have uploaded picture of my project configuration and added more descriptions of what I have tried to do (i.e. made 100% sure same FastMM get compiled in with correct defines etc.) – Tom May 06 '21 at 19:30
  • Could it be somehosw it loads wrong dll? I have put the dlls into the same directory as the executable (same folder as log is generated in.... but well... I am out of ideas. Probably something simple, but I think I have covered most bases.) – Tom May 06 '21 at 19:35
  • If it works with a new project, somehow your current project is corrupted. Why not recreate a new project with all the units of your current project? Should not be very time consuming. – fpiette May 07 '21 at 06:21
  • If you suspect the incorrect DLL is loaded, you may use ProcessMonitor or ProcessExplorer to see exactly which DLL are loaded and from where. – fpiette May 07 '21 at 06:22
  • @fpiette I will try delete all files except .dpr .pas .dfm files in my project directory and see if that helps. I will also check the .dll loading just to make sure. (I have no concrete suspicions - just trying to eliminate possible reasons) – Tom May 07 '21 at 09:02
  • Unfortunately this did not help. I wiped everything. And I tried removing the DLL files which caused error message. readding them removed error message. – Tom May 07 '21 at 10:30
  • Is FastMM depending on executable being in same directory as project files? Or does it have some kind of limitation if the program pulls in *a lot* of source files from different packages and similar? Is there maybe some place I can inspect/debug/breakpoint FastMM source and see what goes wrong? – Tom May 07 '21 at 10:51
  • Did you had a look at https://stackoverflow.com/questions/1130454/how-to-get-a-stack-trace-from-fastmm ? – fpiette May 07 '21 at 12:03
  • I can't say what my linking options *were* but seems they were mostly off with my my project after removing all non pas/dpr/dfm files. But it works now... Just confused why a new demo project worked and not removing all non pas/dpr/dfm files did. But thank you for your help. I must have made a blunder. – Tom May 07 '21 at 13:42
  • 1
    Happy to have helped you. I summarized in an answer so that you can accept it :-) – fpiette May 07 '21 at 14:20

1 Answers1

2

Somehow your project is corrupted.

Recreate the project from scratch (dpr and dproj, add all pas files and code you manually added to your dpr) and make sure the options are as described in How to get a stack trace from FastMM

fpiette
  • 11,983
  • 1
  • 24
  • 46