Vincent Snijders wrote:
Michael Van Canneyt wrote:



On Tue, 21 Jun 2005, Vincent Snijders wrote:

Hi,

Sysutil has a function ExceptAddr to current exception address, but no corresponding functions to get the frame count and the frames of the current exception.

Are these function just not yet implemented or are the ommitted on purpose?



Just not yet implemented. Delphi didn't have them either.



Attached are two patches:
1. except.patch implements ExceptFrameCount and ExceptFrames
2. arg.patch fixes a bug in the copying of the commandfilename to the arg array. The #0 character was not copied, so the pchar was not properly terminated.

If these patches are applied in the trunk, wil they be merged into the fixes branch too?

Vincent.
Index: sysutilh.inc
===================================================================
--- sysutilh.inc        (revision 460)
+++ sysutilh.inc        (working copy)
@@ -156,6 +156,8 @@
    { Exception handling routines }
    function ExceptObject: TObject;
    function ExceptAddr: Pointer;
+   function ExceptFrameCount: Longint;
+   function ExceptFrames: PPointer;
    function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: Pointer;
                                   Buffer: PChar; Size: Integer): Integer;
    procedure ShowException(ExceptObject: TObject; ExceptAddr: Pointer);
Index: sysutils.inc
===================================================================
--- sysutils.inc        (revision 460)
+++ sysutils.inc        (working copy)
@@ -362,6 +362,24 @@
     Result:=RaiseList^.Addr;
 end;
 
+function ExceptFrameCount: Longint;
+
+begin
+  If RaiseList=Nil then
+    Result:=0
+  else
+    Result:=RaiseList^.Framecount;
+end;
+
+function ExceptFrames: PPointer;
+
+begin
+  If RaiseList=Nil then
+    Result:=Nil
+  else
+    Result:=RaiseList^.Frames;
+end;
+
 function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: Pointer;
                                Buffer: PChar; Size: Integer): Integer;
 
Index: system.pp
===================================================================
--- system.pp   (revision 460)
+++ system.pp   (working copy)
@@ -177,7 +177,7 @@
     Inc(Arglen);
   until (pc[Arglen]=#0);
   allocarg(count,arglen);
-  move(pc^,argv[count]^,arglen);
+  move(pc^,argv[count]^,arglen+1);
   { Setup cmdline variable }
   cmdline:=GetCommandLine;
   { process arguments }
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to