Skip to content

The combination of -gh and -gl does not give line number information

Original Reporter info from Mantis: karl-michael.schindler@web.de @KaMiSchi
  • Reporter name: Karl-Michael Schindler

Description:

I tried with 3.0.4 and trunk on macOS, with 3.0.0 on WindowsXP and 3.0.2 on linux, but i never got the line number information as stated in chapter 19.3 HeapTrc Usage of the rtl docs as well as chapter 10.7 of the user docs. I tried the example from the rtl docs, but only got this (on macOS):

michael% ./heaptr
Marked memory at $000000010FDEC660 invalid
Wrong size : 128 allocated 64 freed
Call trace for block $000000010FDEC660 size 128
Heap dump by heaptrc unit of./heaptr
12 memory blocks allocated : 1412/1416
6 memory blocks freed : 708/712
6 unfreed memory blocks : 704
True heap size : 360448 (32 used in System startup)
True free heap : 358688
Should be : 358944
Call trace for block $000000010FDEC660 size 128
Call trace for block $000000010FDEC540 size 128
Call trace for block $000000010FDEC420 size 128
Call trace for block $000000010FDEC300 size 128
Call trace for block $000000010FDEC1E0 size 128
Call trace for block $000000010FDEC0C0 size 128
michael%

Does anyone have a working example or is anyone aware of another trick, how to enable this?

MiSchi

Steps to reproduce:

fpc -gl -gh heaptr.pp
./heaptr

Additional information:

heaptr.pp:

program heapex;

var
  p1: ^longint;
  p2: pointer;
  i : longint ;
begin
  new(p1);
  dispose(p1);
  for i := 1 to 10 do
  begin
    GetMem(p2, 128);
    if (i mod 2) = 0 then
      FreeMem(p2, 128);
  end;
  GetMem(p2, 128);
  FreeMem(p2, 64);
end.

Mantis conversion info:

  • Mantis ID: 32775
  • OS: Mac OS X
  • OS Build: 10.5, 10.6
  • Platform: darwin
  • Version: 3.0.2
  • Monitored by: » @KaMiSchi (Karl-Michael Schindler), » @neurolabusc1 (Chris Rorden), » helbig (Wolfgang Helbig), » @martin_frb (Martin Friebe), » @trevoz (Trevor Roydhouse), » @davidbannon (David)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information