mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 05:59:30 +02:00
* Optimization for code size.
git-svn-id: trunk@5331 -
This commit is contained in:
parent
21bd30b47c
commit
4bfe0e6819
@ -671,6 +671,7 @@ Procedure FinalizeHeap;forward;
|
||||
Procedure InternalExit;
|
||||
var
|
||||
current_exit : Procedure;
|
||||
pstdout : ^Text;
|
||||
{$if defined(MSWINDOWS) or defined(OS2)}
|
||||
i : longint;
|
||||
{$endif}
|
||||
@ -688,18 +689,19 @@ Begin
|
||||
{ Finalize units }
|
||||
FinalizeUnits;
|
||||
{ Show runtime error and exit }
|
||||
pstdout:=@stdout;
|
||||
If erroraddr<>nil Then
|
||||
Begin
|
||||
Writeln(stdout,'Runtime error ',Errorcode,' at $',hexstr(PtrInt(Erroraddr),sizeof(PtrInt)*2));
|
||||
Writeln(pstdout^,'Runtime error ',Errorcode,' at $',hexstr(PtrInt(Erroraddr),sizeof(PtrInt)*2));
|
||||
{ to get a nice symify }
|
||||
Writeln(stdout,BackTraceStrFunc(Erroraddr));
|
||||
dump_stack(stdout,ErrorBase);
|
||||
Writeln(stdout,'');
|
||||
Writeln(pstdout^,BackTraceStrFunc(Erroraddr));
|
||||
dump_stack(pstdout^,ErrorBase);
|
||||
Writeln(pstdout^,'');
|
||||
End;
|
||||
{ Make sure that all output is written to the redirected file }
|
||||
Flush(Output);
|
||||
Flush(ErrOutput);
|
||||
Flush(StdOut);
|
||||
Flush(pstdout^);
|
||||
Flush(StdErr);
|
||||
{$if defined(MSWINDOWS) or defined(OS2)}
|
||||
{ finally release the heap if possible, especially
|
||||
|
@ -279,28 +279,33 @@ threadvar
|
||||
|
||||
|
||||
Procedure Errno2InOutRes;
|
||||
var
|
||||
res : Word;
|
||||
pErrno : ^longint;
|
||||
Begin
|
||||
{ DO NOT MODIFY UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING }
|
||||
case Errno of
|
||||
pErrno:=@Errno;
|
||||
case pErrno^ of
|
||||
ERROR_WRITE_PROTECT..ERROR_GEN_FAILURE :
|
||||
begin
|
||||
{ This is the offset to the Win32 to add to directly map }
|
||||
{ to the DOS/TP compatible error codes when in this range }
|
||||
InOutRes := word(errno)+131;
|
||||
res := word(pErrno^)+131;
|
||||
end;
|
||||
ERROR_DIR_NOT_EMPTY,
|
||||
ERROR_ALREADY_EXISTS,
|
||||
ERROR_SHARING_VIOLATION :
|
||||
begin
|
||||
InOutRes :=5;
|
||||
res :=5;
|
||||
end;
|
||||
else
|
||||
begin
|
||||
{ other error codes can directly be mapped }
|
||||
InOutRes := Word(errno);
|
||||
res := Word(pErrno^);
|
||||
end;
|
||||
end;
|
||||
errno:=0;
|
||||
pErrno^:=0;
|
||||
InOutRes:=res;
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user