[fpc-devel] ExceptAddr, but no ExceptFrameCount and ExceptFrames

Florian Klaempfl florian at freepascal.org
Tue Jun 21 14:08:37 CEST 2005


Vincent Snijders wrote:

> 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?

If we should do so ;)

> 
> 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 }

Applying to which path, i.e. OS :)?




More information about the fpc-devel mailing list