浏览代码

* Patch from Vincent Snijders:
* 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.

git-svn-id: trunk@461 -

florian 20 年之前
父节点
当前提交
13e3102954
共有 3 个文件被更改,包括 21 次插入1 次删除
  1. 2 0
      rtl/objpas/sysutils/sysutilh.inc
  2. 18 0
      rtl/objpas/sysutils/sysutils.inc
  3. 1 1
      rtl/win32/system.pp

+ 2 - 0
rtl/objpas/sysutils/sysutilh.inc

@@ -156,6 +156,8 @@ type
    { Exception handling routines }
    { Exception handling routines }
    function ExceptObject: TObject;
    function ExceptObject: TObject;
    function ExceptAddr: Pointer;
    function ExceptAddr: Pointer;
+   function ExceptFrameCount: Longint;
+   function ExceptFrames: PPointer;
    function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: Pointer;
    function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: Pointer;
                                   Buffer: PChar; Size: Integer): Integer;
                                   Buffer: PChar; Size: Integer): Integer;
    procedure ShowException(ExceptObject: TObject; ExceptAddr: Pointer);
    procedure ShowException(ExceptObject: TObject; ExceptAddr: Pointer);

+ 18 - 0
rtl/objpas/sysutils/sysutils.inc

@@ -362,6 +362,24 @@ begin
     Result:=RaiseList^.Addr;
     Result:=RaiseList^.Addr;
 end;
 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;
 function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: Pointer;
                                Buffer: PChar; Size: Integer): Integer;
                                Buffer: PChar; Size: Integer): Integer;
 
 

+ 1 - 1
rtl/win32/system.pp

@@ -177,7 +177,7 @@ begin
     Inc(Arglen);
     Inc(Arglen);
   until (pc[Arglen]=#0);
   until (pc[Arglen]=#0);
   allocarg(count,arglen);
   allocarg(count,arglen);
-  move(pc^,argv[count]^,arglen);
+  move(pc^,argv[count]^,arglen+1);
   { Setup cmdline variable }
   { Setup cmdline variable }
   cmdline:=GetCommandLine;
   cmdline:=GetCommandLine;
   { process arguments }
   { process arguments }