Browse Source

Merged revisions 566-567 via svnmerge from
/trunk

git-svn-id: branches/fixes_2_0@674 -

peter 20 years ago
parent
commit
088f6e9170
2 changed files with 18 additions and 15 deletions
  1. 11 1
      fcl/inc/cgiapp.pp
  2. 7 14
      rtl/objpas/classes/streams.inc

+ 11 - 1
fcl/inc/cgiapp.pp

@@ -341,6 +341,9 @@ Procedure TCgiApplication.ShowException(E: Exception);
 
 Var
   TheEmail : String;
+  FrameCount: integer;
+  Frames: PPointer;
+  FrameNumber:Integer;
 
 begin
   If not FContentTypeEmitted then
@@ -355,7 +358,14 @@ begin
     AddResponseLN('<center><hr><h1>'+Title+': ERROR</h1><hr></center><br><br>');
     AddResponseLN(SAppEncounteredError+'<br>');
     AddResponseLN('<ul>');
-    AddResponseLN('<li>'+SError+' <b>'+E.Message+'</b></ul><hr>');
+    AddResponseLN('<li>'+SError+' <b>'+E.Message+'</b>');
+    AddResponseLn('<li> Stack trace:<br>');
+    AddResponseLn(BackTraceStrFunc(ExceptAddr)+'<br>');
+    FrameCount:=ExceptFrameCount;
+    Frames:=ExceptFrames;
+    for FrameNumber := 0 to FrameCount-1 do
+      AddResponseLn(BackTraceStrFunc(Frames[FrameNumber])+'<br>');
+    AddResponseLn('</ul><hr>');
     TheEmail:=Email;
     If (TheEmail<>'') then
       AddResponseLN('<h5><p><i>'+SNotify+Administrator+': <a href="mailto:'+TheEmail+'">'+TheEmail+'</a></i></p></h5>');

+ 7 - 14
rtl/objpas/classes/streams.inc

@@ -589,27 +589,20 @@ function TMemoryStream.Realloc(var NewCapacity: Longint): Pointer;
 Var MoveSize : Longint;
 
 begin
-  If NewCapacity>0 Then // round off to block size.
+  // round off to block size.
+  If NewCapacity<0 Then
+    NewCapacity:=0
+  else  
     NewCapacity := (NewCapacity + (TMSGrow-1)) and not (TMSGROW-1);
   // Only now check !
   If NewCapacity=FCapacity then
     Result:=FMemory
   else
-    If NewCapacity=0 then
-      FreeMem (FMemory,Fcapacity)
-    else
-      begin
-      GetMem (Result,NewCapacity);
+    begin
+      Result:=Reallocmem(FMemory,Newcapacity);
       If Result=Nil then
         Raise EStreamError.Create(SMemoryStreamError);
-      If FCapacity>0 then
-        begin
-        MoveSize:=FSize;
-        If MoveSize>NewCapacity then MoveSize:=NewCapacity;
-        Move (Fmemory^,Result^,MoveSize);
-        FreeMem (FMemory,FCapacity);
-        end;
-      end;
+    end;
 end;