[fpc-pascal] The 'correct' way to debug applications
Graeme Geldenhuys
graemeg.lists at gmail.com
Wed Apr 23 14:53:48 CEST 2008
Hi,
I'm busy implementing and correcting Application.CreateForm() in fpGUI.
Everything looked and worked fine until I enabled 'heaptrc' to see if I
have memory leaks.
Normally I just look at the output, randomly picking a method listed by
heaptrc output and go through the code slowly. 9 out of 10 times I spot
the problem and fix it.
Today I've been sitting for 4 hours trying to find the problem and I'm
still not the wiser! Is there a 'correct' process to follow and debug
Free Pascal applications. Something like a system or steps to follow, to
get to the problem area. Is there a website or book that covers
debugging Object Pascal (or just Pascal) applications?
Any help, references or links would be greatly appreciated at this time.
BTW: When I run my test application via GDB I get only 3 lines of output
which simply reference the Destroy() method, nothing more. :-(
-------------------------
Heap dump by heaptrc unit
1190 memory blocks allocated : 116862/118456
1181 memory blocks freed : 115895/117472
9 unfreed memory blocks : 967
True heap size : 327680
True free heap : 326080
Should be : 326192
Call trace for block $B7BCC678 size 12
$08056AD2
$0807FCC0 TFPGAPPLICATION__GETFONT, line 846 of
/home/graemeg/programming/fpGUI/src/corelib/fpgfx.pas
$0807F6BD FPGGETFONT, line 754 of
/home/graemeg/programming/fpGUI/src/corelib/fpgfx.pas
$080C5477 TFPGBUTTON__SETFONTDESC, line 201 of gui_button.pas
$080F1807 TTESTFORM__AFTERCREATE, line 68 of frm_test.pas
$080AEDBE TFPGFORM__CREATE, line 226 of gui_form.pas
$080F1654 TTESTFORM__CREATE, line 50 of frm_test.pas
$080A2CC0 TFPGAPPLICATIONBASE__CREATEFORM, line 1899 of
/home/graemeg/programming/fpGUI/src/corelib/gfxbase.pas
Call trace for block $B7A9A648 size 120
$08056AD2
$08082B6B TFPGWINDOW__CREATE, line 1370 of
/home/graemeg/programming/fpGUI/src/corelib/fpgfx.pas
$080ACF26 TFPGWIDGET__CREATE, line 261 of
/home/graemeg/programming/fpGUI/src/corelib/gfx_widget.pas
$080C54EF TFPGBUTTON__CREATE, line 207 of gui_button.pas
$080F17AB TTESTFORM__AFTERCREATE, line 62 of frm_test.pas
$080AEDBE TFPGFORM__CREATE, line 226 of gui_form.pas
$080F1654 TTESTFORM__CREATE, line 50 of frm_test.pas
$080A2CC0 TFPGAPPLICATIONBASE__CREATEFORM, line 1899 of
/home/graemeg/programming/fpGUI/src/corelib/gfxbase.pas
Call trace for block $B7BCC628 size 16
$0805B96B
$0806A4F7
$080717A5
$080A06DA TFPGWINDOWBASE__CREATE, line 953 of
/home/graemeg/programming/fpGUI/src/corelib/gfxbase.pas
$080A6D3A TFPGWINDOWIMPL__CREATE, line 1594 of gfx_x11.pas
$08082AE1 TFPGWINDOW__CREATE, line 1353 of
/home/graemeg/programming/fpGUI/src/corelib/fpgfx.pas
$080ACF26 TFPGWIDGET__CREATE, line 261 of
/home/graemeg/programming/fpGUI/src/corelib/gfx_widget.pas
$080C54EF TFPGBUTTON__CREATE, line 207 of gui_button.pas
Call trace for block $B7BCC5D8 size 16
$08056AD2
$0806B477
$08070FF3
$080717A5
$080A06DA TFPGWINDOWBASE__CREATE, line 953 of
/home/graemeg/programming/fpGUI/src/corelib/gfxbase.pas
$080A6D3A TFPGWINDOWIMPL__CREATE, line 1594 of gfx_x11.pas
$08082AE1 TFPGWINDOW__CREATE, line 1353 of
/home/graemeg/programming/fpGUI/src/corelib/fpgfx.pas
$080ACF26 TFPGWIDGET__CREATE, line 261 of
/home/graemeg/programming/fpGUI/src/corelib/gfx_widget.pas
Call trace for block $B7BCC588 size 8
$08056AD2
$08070FF3
$080717A5
$080A06DA TFPGWINDOWBASE__CREATE, line 953 of
/home/graemeg/programming/fpGUI/src/corelib/gfxbase.pas
$080A6D3A TFPGWINDOWIMPL__CREATE, line 1594 of gfx_x11.pas
$08082AE1 TFPGWINDOW__CREATE, line 1353 of
/home/graemeg/programming/fpGUI/src/corelib/fpgfx.pas
$080ACF26 TFPGWIDGET__CREATE, line 261 of
/home/graemeg/programming/fpGUI/src/corelib/gfx_widget.pas
$080C54EF TFPGBUTTON__CREATE, line 207 of gui_button.pas
Call trace for block $B7A8A348 size 308
$08056AD2
$080F17AB TTESTFORM__AFTERCREATE, line 62 of frm_test.pas
$080AEDBE TFPGFORM__CREATE, line 226 of gui_form.pas
$080F1654 TTESTFORM__CREATE, line 50 of frm_test.pas
$080A2CC0 TFPGAPPLICATIONBASE__CREATEFORM, line 1899 of
/home/graemeg/programming/fpGUI/src/corelib/gfxbase.pas
$080842D7 TMAINFORM__NEWFORMCLICK, line 49 of frm_main.pas
$080C5FEB TFPGBUTTON__CLICK, line 466 of gui_button.pas
$080C5DA0 TFPGBUTTON__DORELEASE, line 385 of gui_button.pas
Call trace for block $B7F5F308 size 19
$08051C2F
$080AEDBE TFPGFORM__CREATE, line 226 of gui_form.pas
$080F1654 TTESTFORM__CREATE, line 50 of frm_test.pas
$080A2CC0 TFPGAPPLICATIONBASE__CREATEFORM, line 1899 of
/home/graemeg/programming/fpGUI/src/corelib/gfxbase.pas
$080842D7 TMAINFORM__NEWFORMCLICK, line 49 of frm_main.pas
$080C5FEB TFPGBUTTON__CLICK, line 466 of gui_button.pas
$080C5DA0 TFPGBUTTON__DORELEASE, line 385 of gui_button.pas
$080C5F07 TFPGBUTTON__HANDLELMOUSEUP, line 431 of gui_button.pas
Call trace for block $B7A9A588 size 120
$08056AD2
$08082B6B TFPGWINDOW__CREATE, line 1370 of
/home/graemeg/programming/fpGUI/src/corelib/fpgfx.pas
$080ACF26 TFPGWIDGET__CREATE, line 261 of
/home/graemeg/programming/fpGUI/src/corelib/gfx_widget.pas
$080AED2F TFPGFORM__CREATE, line 214 of gui_form.pas
$080F1654 TTESTFORM__CREATE, line 50 of frm_test.pas
$080A2CC0 TFPGAPPLICATIONBASE__CREATEFORM, line 1899 of
/home/graemeg/programming/fpGUI/src/corelib/gfxbase.pas
$080842D7 TMAINFORM__NEWFORMCLICK, line 49 of frm_main.pas
$080C5FEB TFPGBUTTON__CLICK, line 466 of gui_button.pas
Call trace for block $B7A921E8 size 348
$08056AD2
$080A2CC0 TFPGAPPLICATIONBASE__CREATEFORM, line 1899 of
/home/graemeg/programming/fpGUI/src/corelib/gfxbase.pas
$080842D7 TMAINFORM__NEWFORMCLICK, line 49 of frm_main.pas
$080C5FEB TFPGBUTTON__CLICK, line 466 of gui_button.pas
$080C5DA0 TFPGBUTTON__DORELEASE, line 385 of gui_button.pas
$080C5F07 TFPGBUTTON__HANDLELMOUSEUP, line 431 of gui_button.pas
$080AD58B TFPGWIDGET__MSGMOUSEUP, line 445 of
/home/graemeg/programming/fpGUI/src/corelib/gfx_widget.pas
$08056E79
-------------------------
Regards,
- Graeme -
_______________________________________________________
fpGUI - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/
More information about the fpc-pascal
mailing list