TFPList exception with no excpetion stack printed
Original Reporter info from Mantis: ericisko
-
Reporter name:
Original Reporter info from Mantis: ericisko
- Reporter name:
Description:
Running simple program (see attached file) produces exception without traceback which is not very useful.
Exception produced:
An unhandled exception occurred at $0040CA7F :
EListError : List index (0) out of bounds
$0040CA7F TFPLIST__RAISEINDEXERROR, line 24 of C:/temp/lazbuild/fpc-patched/
rtl/objpas/classes/lists.inc
I would expect the whole exception stack to be printed.
Additional information:
Looking at the code, it seems the issue is in TFPList.Error that calls raise with 'at get_caller_addr(get_frame)'. This will cause that AFrame parameter to fpc_raiseexception is nil. Therefore, backtrace stack will be empty.
Modifying procedure p3() in the attached file produces the following results:
-----------------------------------
procedure p3();
begin
raise Exception.Create('test');
end;
An unhandled exception occurred at $004014AE :
Exception : test
$004014AE P1, line 14 of project2.pas
$00401508 P2, line 22 of project2.pas
$00401518 P3, line 27 of project2.pas
$0040152D main, line 31 of project2.pas
-----------------------------------
procedure p3();
begin
raise Exception.Create('test') at get_caller_addr(get_frame);
end;
An unhandled exception occurred at $00401508 :
Exception : test
$00401508 P2, line 22 of project2.pas
This is the same scenario as with TFPList.Error().
-----------------------------------
procedure p3();
begin
raise Exception.Create('test') at get_caller_addr(get_frame), get_caller_frame(get_frame);
end;
An unhandled exception occurred at $00401518 :
Exception : test
$00401518 P2, line 22 of project2.pas
$00401528 P3, line 27 of project2.pas
$0040153D main, line 31 of project2.pas
This produces the correct stack (the last procedure called (p1) is removed but the stack after that is printed).
Mantis conversion info:
- Mantis ID: 12528
- Version: 2.2.2
- Fixed in version: 3.0.0
- Fixed in revision: 22935 (#35f13394)
- Monitored by: » Vladimir (Vladimir Zhirov), » @martin_frb (Martin Friebe)