Recent

Author Topic: How to apply GDB to find rootcause of issue based on FPC heaptrc-file contents  (Read 1503 times)

Wings2018

  • New Member
  • *
  • Posts: 29
After having re-structured my program (obviously not good enoguh) I get following heaptrc-output after having finished the program (program ends without any error message):

e:\projects\software\mergegpxfiles_v3_21_02.exe input-file=test2.gpx output-file=output.gpx
Heap dump by heaptrc unit
1167 memory blocks allocated : 371823/384032
1166 memory blocks freed     : 371807/384016
1 unfreed memory blocks : 16
True heap size : 294912 (176 used in System startup)
True free heap : 294640
Should be : 294656
Call trace for block $035BA050 size 16
  $00427E9C
  $00415704
  $00483562
  $004156F4
  $004155EE
  $004862BC
  $004155EE
  $BAADF00D

I'm able to run gdb in FPC 3.0.4, but what I miss is a clear way of tackling the issue. Although there're a lot of Youtube video's available on how to use gdb,
nothing can be found on specifically debugging the FPC heaptr-output as mentioned above.
How to find the block mentioned? How do find the relation between the 8 mentioned corrupt addresses and the real source code?

I'm using Windows 10, FPC v3.0.4, GDB 7.4, Win32 for i386.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12531
  • Debugger - SynEdit - and more
    • wiki
It looks that you do not have (enough) debug symbols. Otherwise there should be units and line numbers after each address.

Make sure that menu: Project > project options > Debugging, have "generate info for debugger" or at least "display line numbers in run time errors".

You may also have to apply this to each package used. Best done via "additions and overwrites" in project options.

In rare cases the dump may still not show them => view > view leaks and traces
- paste the addresses
- press resolve, and select the exe
In that case the exe should be compiled with "dwarf" / project options > Debugging


 

TinyPortal © 2005-2018