View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0032775 | FPC | RTL | public | 2017-12-05 16:15 | 2020-10-11 15:08 |
Reporter | Karl-Michael Schindler | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Platform | darwin | OS | Mac OS X | ||
Product Version | 3.0.2 | ||||
Summary | 0032775: The combination of -gh and -gl does not give line number information | ||||
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. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | |||||
FPCOldBugId | |||||
FPCTarget | |||||
Attached Files |
|
has duplicate | 0037910 | resolved | Jonas Maebe | -gl option does not work: 10.6 Line numbers in run-time error backtraces |
|
-gl is only supported for Stabs on Darwin right now, which is only supported on 32 bit platforms and only the default on PowerPC. A Dwarf reader for Darwin needs to be created to have backtrace symbolication on the other platforms. |
|
Thanks for your extremely clarifying note. I am still confused, as I tried ppc386 -gs -gl -gh heaptr.pp on VirtualBox 32 bit Ubuntu with fpc 3.0.2+dfsg-2 and still do not get symbolication. |
|
On linux, both stabs and dwarf should work (bar bugs). |
|
It does not seem to work on linux, but a third party confirmation would be nice to exclude errors in my setup. |
|
The sample code has two problems, firstly, drop the -gs and secondly apparently heaptrc cannot report fully on leaks in the main procedure. Here is a very simple demonstration of the problem. Compile with fpc -glh MyTest.pas It will report line numbers on Linux but not the Mac (carbon or cocoa). program MyTest; {$mode objfpc}{$H+} procedure BadProcedure(); var Ptr : ^longint; begin new(Ptr); end; begin BadProcedure(); end. Here is a modified version or origional, compile with fpc -glh heaptr2.pp. Again, reports line numbers under Linux, not under Max OSX program heaptr2; {$mode objfpc}{$H+} procedure Leak(); 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; begin Leak(); end. |
|
Can this be related to my recent report about -Xs always (independent of release or debug) being turned on in a bog standard fpc.cfg? 0032831 If you strip code, lineinfo is gone of course...... I provided a patch some days ago. |
|
"...related to my recent report about -Xs..." No Thaddy, my MacOSX test platform is the one built with much help from yourself and others so that it does not strip. |
|
I checked with verbose logging 3.0.4 on macOS 10.13.2 and to the best of my knowledge no stripping is done. No line numbers. |
|
I just tried with trunk, and that seems to work: Call trace for block $00007FE31779A540 size 128 $000000000041E93E GETMEM, line 284 of ../inc/heap.inc $0000000000400277 main, line 12 of atest.pp $000000000042BCF0 SYSENTRY, line 129 of system.pp Call trace for block $00007FE31779A420 size 128 $000000000041E93E GETMEM, line 284 of ../inc/heap.inc $0000000000400277 main, line 12 of atest.pp $000000000042BCF0 SYSENTRY, line 129 of system.pp |
|
So, I have done something wrong on linux, but the dwarf reader for Darwin remains. |
Date Modified | Username | Field | Change |
---|---|---|---|
2017-12-05 16:15 | Karl-Michael Schindler | New Issue | |
2017-12-05 21:02 | Jonas Maebe | Note Added: 0104477 | |
2017-12-05 22:23 | Karl-Michael Schindler | Note Added: 0104485 | |
2017-12-05 22:28 | Jonas Maebe | Note Added: 0104486 | |
2017-12-05 23:19 | Karl-Michael Schindler | Note Added: 0104489 | |
2017-12-28 08:19 | David | Note Added: 0105063 | |
2017-12-28 16:22 | Thaddy de Koning | Note Added: 0105070 | |
2017-12-28 16:22 | Thaddy de Koning | Note Edited: 0105070 | View Revisions |
2017-12-28 16:23 | Thaddy de Koning | Note Edited: 0105070 | View Revisions |
2017-12-28 23:08 | David | Note Added: 0105078 | |
2017-12-28 23:22 | Karl-Michael Schindler | Note Added: 0105079 | |
2018-02-24 22:12 | Marco van de Voort | Note Added: 0106597 | |
2018-02-25 15:21 | Karl-Michael Schindler | Note Added: 0106615 | |
2020-10-11 15:08 | Jonas Maebe | Relationship added | has duplicate 0037910 |