[fpc-pascal] ansistrings, exceptions, pascal call stack and access violations
David Emerson
dle3ab at angelbase.com
Thu Nov 4 00:04:42 CET 2004
Compiling sysutils with -gl gave the call stack seen below... insightful, I suppose, but not necessarily useful ;)
It definitely points to what Peter said about the ansistring finalize writing to the same place in the stack. Examining the stack, it seems that dump_stack calls get_caller_addr, and then I assume the access violation is about the address being unfindable since it's been overwritten.
1.9.5 (today's w32 binary) didn't work any better
re: Peter's last comment: so I guess the finalization of that temp ansistring is done at the end of play_with_strings, rather than being done within play_with_strings just after completion of the call to do_nothing_with_an_ansistring ... but it still irks me that the temp ansistring is created even if the function requiring it is not called. Oh well.
Has this been filed as a bug? (Is it considered a bug? I should hope so) ... for now, I guess I'm condemned to always be recompiling with a directive to either handle exceptions or see a call stack. I can live with that (as if I have a choice!)
Thanks, guys... keep up the good work, I'm sure this problem will be solved eventually :-)
~David.
Here's the stack with the debug version of sysutils (1.9.4):
An unhandled exception occurred at 0x004275D8 :
EDivByZero : Division by zero
$004275D8 TEST_DIVISION_BY_ZERO, line 13 of t.pas
$702E7420 line 1 of windows.pp
An unhandled exception occurred at 0x00415B8F :
EAccessViolation : Access violation
$00415B8F GET_CALLER_ADDR, line 1207 of e:/c/194/src/rtl/i386/i386.inc
$00420B58 DUMP_STACK, line 779 of e:/c/194/src/rtl/inc/system.inc
$0066FDA0 line 1 of windows.pp
$702E7420 line 1 of windows.pp
An unhandled exception occurred at 0x00415B8F :
EAccessViolation : Access violation
$00415B8F GET_CALLER_ADDR, line 1207 of e:/c/194/src/rtl/i386/i386.inc
$00420B58 DUMP_STACK, line 779 of e:/c/194/src/rtl/inc/system.inc
$0066FB2C line 1 of windows.pp
$00420B58 DUMP_STACK, line 779 of e:/c/194/src/rtl/inc/system.inc
$0066FDA0 line 1 of windows.pp
$702E7420 line 1 of windows.pp
An unhandled exception occurred at 0x00415B8F :
EAccessViolation : Access violation
$00415B8F GET_CALLER_ADDR, line 1207 of e:/c/194/src/rtl/i386/i386.inc
$00420B58 DUMP_STACK, line 779 of e:/c/194/src/rtl/inc/system.inc
$0066F8B8 line 1 of windows.pp
$00420B58 DUMP_STACK, line 779 of e:/c/194/src/rtl/inc/system.inc
$0066FB2C line 1 of windows.pp
$00420B58 DUMP_STACK, line 779 of e:/c/194/src/rtl/inc/system.inc
$0066FDA0 line 1 of windows.pp
$702E7420 line 1 of windows.pp
An unhandled exception occurred at 0x00415B8F :
EAccessViolation : Access violation
$00415B8F GET_CALLER_ADDR, line 1207 of e:/c/194/src/rtl/i386/i386.inc
$00420B58 DUMP_STACK, line 779 of e:/c/194/src/rtl/inc/system.inc
$0066F644 line 1 of windows.pp
$00420B58 DUMP_STACK, line 779 of e:/c/194/src/rtl/inc/system.inc
$0066F8B8 line 1 of windows.pp
$00420B58 DUMP_STACK, line 779 of e:/c/194/src/rtl/inc/system.inc
$0066FB2C line 1 of windows.pp
$00420B58 DUMP_STACK, line 779 of e:/c/194/src/rtl/inc/system.inc
$0066FDA0 line 1 of windows.pp
$702E7420 line 1 of windows.pp
More information about the fpc-pascal
mailing list