mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 20:59:06 +02:00
- removed 1.x specific FindGlobalComponent
- added writing stack trace of exception in Application.HandleException git-svn-id: trunk@7260 -
This commit is contained in:
parent
74a953ad16
commit
79896c7112
@ -1,14 +1,13 @@
|
|||||||
{ This file was automatically created by Lazarus. Do not edit!
|
{ This file was automatically created by Lazarus. Do not edit!
|
||||||
This source is only used to compile and install
|
This source is only used to compile and install the package.
|
||||||
the package FPCUnitTestRunner 0.1.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unit FPCUnitTestRunner;
|
unit FPCUnitTestRunner;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
GuiTestRunner;
|
GuiTestRunner;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
{ This file was automatically created by Lazarus. Do not edit!
|
{ This file was automatically created by Lazarus. Do not edit!
|
||||||
This source is only used to compile and install
|
This source is only used to compile and install the package.
|
||||||
the package fpcunitide 0.1.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unit fpcunitide;
|
unit fpcunitide;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
FPCUnitLazIDEIntf, LazarusPackageIntf;
|
FPCUnitLazIDEIntf, LazarusPackageIntf;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
begin
|
begin
|
||||||
RegisterUnit('FPCUnitLazIDEIntf', @FPCUnitLazIDEIntf.Register);
|
RegisterUnit('FPCUnitLazIDEIntf',@FPCUnitLazIDEIntf.Register);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
RegisterPackage('fpcunitide', @Register);
|
RegisterPackage('fpcunitide',@Register);
|
||||||
end.
|
end.
|
||||||
|
@ -53,12 +53,6 @@ uses
|
|||||||
Classes, SysUtils, TypInfo, LCLProc, LResources, Forms, Controls, LCLIntf,
|
Classes, SysUtils, TypInfo, LCLProc, LResources, Forms, Controls, LCLIntf,
|
||||||
Dialogs, JITForm, ComponentReg, IDEProcs;
|
Dialogs, JITForm, ComponentReg, IDEProcs;
|
||||||
|
|
||||||
{$IFNDEF VER1_0}
|
|
||||||
{$IFNDEF VER1_9_8}
|
|
||||||
{$DEFINE RegisterFindGlobalComponent}
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
type
|
type
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
TJITFormError = (
|
TJITFormError = (
|
||||||
@ -694,11 +688,7 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
DoFinishReading;
|
DoFinishReading;
|
||||||
finally
|
finally
|
||||||
{$IFDEF RegisterFindGlobalComponent}
|
|
||||||
UnregisterFindGlobalComponentProc(@MyFindGlobalComponent);
|
UnregisterFindGlobalComponentProc(@MyFindGlobalComponent);
|
||||||
{$ELSE}
|
|
||||||
FindGlobalComponent:=nil;
|
|
||||||
{$ENDIF}
|
|
||||||
if DestroyDriver then Reader.Driver.Free;
|
if DestroyDriver then Reader.Driver.Free;
|
||||||
Reader.Free;
|
Reader.Free;
|
||||||
end;
|
end;
|
||||||
@ -725,11 +715,7 @@ begin
|
|||||||
DestroyDriver:=false;
|
DestroyDriver:=false;
|
||||||
Reader:=CreateLRSReader(BinStream,DestroyDriver);
|
Reader:=CreateLRSReader(BinStream,DestroyDriver);
|
||||||
MyFindGlobalComponentProc:=@OnFindGlobalComponent;
|
MyFindGlobalComponentProc:=@OnFindGlobalComponent;
|
||||||
{$IFDEF RegisterFindGlobalComponent}
|
|
||||||
RegisterFindGlobalComponentProc(@MyFindGlobalComponent);
|
RegisterFindGlobalComponentProc(@MyFindGlobalComponent);
|
||||||
{$ELSE}
|
|
||||||
FindGlobalComponent:=@MyFindGlobalComponent;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFDEF VerboseJITForms}
|
{$IFDEF VerboseJITForms}
|
||||||
writeln('[TJITComponentList.InitReading] A');
|
writeln('[TJITComponentList.InitReading] A');
|
||||||
@ -901,11 +887,7 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
DoFinishReading;
|
DoFinishReading;
|
||||||
finally
|
finally
|
||||||
{$IFDEF RegisterFindGlobalComponent}
|
|
||||||
UnregisterFindGlobalComponentProc(@MyFindGlobalComponent);
|
UnregisterFindGlobalComponentProc(@MyFindGlobalComponent);
|
||||||
{$ELSE}
|
|
||||||
FindGlobalComponent:=nil;
|
|
||||||
{$ENDIF}
|
|
||||||
if DestroyDriver then Reader.Driver.Free;
|
if DestroyDriver then Reader.Driver.Free;
|
||||||
Reader.Free;
|
Reader.Free;
|
||||||
end;
|
end;
|
||||||
|
30
lcl/forms.pp
30
lcl/forms.pp
@ -34,28 +34,7 @@ interface
|
|||||||
{$ASSERTIONS ON}
|
{$ASSERTIONS ON}
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
{$IF VER1_0_8 or VER1_0_10}
|
{$DEFINE HasDefaultValues}
|
||||||
// There is a problem with try..except and calling JIT procedures, so we can't
|
|
||||||
// use the FCL TDataModule at the moment
|
|
||||||
{ $DEFINE UseFCLDataModule}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFNDEF VER1_0}
|
|
||||||
{$DEFINE HasDefaultValues}
|
|
||||||
{$IFNDEF VER1_9_8}
|
|
||||||
{$DEFINE RegisterFindGlobalComponent}
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
// FPC 1.9.7 and later have exceptions which contain stack frames
|
|
||||||
// If you are using an early version of fpc 1.9.7 you can define
|
|
||||||
// ExceptionHasNoFrames to disable using stackframes.
|
|
||||||
{$IFDEF VER1_0}
|
|
||||||
{$DEFINE ExceptionHasNoFrames}
|
|
||||||
{$ENDIF}
|
|
||||||
{$IFDEF VER1_9_6}
|
|
||||||
{$DEFINE ExceptionHasNoFrames}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Math, FPCAdds, LCLStrConsts, LCLType, LCLProc, LCLIntf,
|
Classes, SysUtils, Math, FPCAdds, LCLStrConsts, LCLType, LCLProc, LCLIntf,
|
||||||
@ -1264,14 +1243,10 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
{$IFDEF ExceptionHasNoFrames}
|
|
||||||
procedure ExceptionOccurred(Sender: TObject; Addr,Frame: Pointer);
|
|
||||||
{$ELSE}
|
|
||||||
procedure ExceptionOccurred(Sender: TObject; Addr:Pointer; FrameCount: Longint;
|
procedure ExceptionOccurred(Sender: TObject; Addr:Pointer; FrameCount: Longint;
|
||||||
Frames: PPointer);
|
Frames: PPointer);
|
||||||
var
|
var
|
||||||
FrameNumber: integer;
|
FrameNumber: integer;
|
||||||
{$ENDIF}
|
|
||||||
Begin
|
Begin
|
||||||
DebugLn('[FORMS.PP] ExceptionOccurred ');
|
DebugLn('[FORMS.PP] ExceptionOccurred ');
|
||||||
if HaltingProgram or HandlingException then Halt;
|
if HaltingProgram or HandlingException then Halt;
|
||||||
@ -1280,11 +1255,10 @@ Begin
|
|||||||
DebugLn(' Sender=',Sender.ClassName);
|
DebugLn(' Sender=',Sender.ClassName);
|
||||||
if Sender is Exception then begin
|
if Sender is Exception then begin
|
||||||
DebugLn(' Exception=',Exception(Sender).Message);
|
DebugLn(' Exception=',Exception(Sender).Message);
|
||||||
{$IFNDEF ExceptionHasNoFrames}
|
|
||||||
DebugLn(' Stack trace:');
|
DebugLn(' Stack trace:');
|
||||||
|
DebugLn(BackTraceStrFunc(ExceptAddr));
|
||||||
for FrameNumber := 0 to FrameCount-1 do
|
for FrameNumber := 0 to FrameCount-1 do
|
||||||
DebugLn(BackTraceStrFunc(Frames[FrameNumber]));
|
DebugLn(BackTraceStrFunc(Frames[FrameNumber]));
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
DebugLn(' Sender=nil');
|
DebugLn(' Sender=nil');
|
||||||
|
@ -33,17 +33,17 @@ type
|
|||||||
TStreamSeekType = int64;
|
TStreamSeekType = int64;
|
||||||
TMemStreamSeekType = integer;
|
TMemStreamSeekType = integer;
|
||||||
TCompareMemSize = integer;
|
TCompareMemSize = integer;
|
||||||
|
|
||||||
{$IFDEF VER1_0}
|
|
||||||
PCardinal = ^Cardinal;
|
|
||||||
PtrInt = Longint;
|
|
||||||
PtrUInt = Cardinal;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
PHandle = ^THandle;
|
PHandle = ^THandle;
|
||||||
|
|
||||||
function StrToWord(const s: string): word;
|
function StrToWord(const s: string): word;
|
||||||
|
|
||||||
|
{$IFDEF VER2_0_0}
|
||||||
|
// These functions were introduced after fpc 2.0.0
|
||||||
|
function ExceptFrameCount: Longint;
|
||||||
|
function ExceptFrames: PPointer;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
function StrToWord(const s: string): word;
|
function StrToWord(const s: string): word;
|
||||||
@ -58,6 +58,23 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF VER2_0_0}
|
||||||
|
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;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -816,6 +816,20 @@ end;
|
|||||||
Handles all messages first then the Idle
|
Handles all messages first then the Idle
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TApplication.HandleException(Sender: TObject);
|
procedure TApplication.HandleException(Sender: TObject);
|
||||||
|
|
||||||
|
procedure DumpStack;
|
||||||
|
var
|
||||||
|
FrameCount: integer;
|
||||||
|
Frames: PPointer;
|
||||||
|
FrameNumber:Integer;
|
||||||
|
begin
|
||||||
|
DebugLn(' Stack trace:');
|
||||||
|
DebugLn(BackTraceStrFunc(ExceptAddr));
|
||||||
|
FrameCount:=ExceptFrameCount;
|
||||||
|
Frames:=ExceptFrames;
|
||||||
|
for FrameNumber := 0 to FrameCount-1 do
|
||||||
|
DebugLn(BackTraceStrFunc(Frames[FrameNumber]));
|
||||||
|
end;
|
||||||
begin
|
begin
|
||||||
if Self=nil then exit;
|
if Self=nil then exit;
|
||||||
if AppHandlingException in FFlags then begin
|
if AppHandlingException in FFlags then begin
|
||||||
@ -831,6 +845,7 @@ begin
|
|||||||
// before we do anything, write it down
|
// before we do anything, write it down
|
||||||
if ExceptObject is Exception then begin
|
if ExceptObject is Exception then begin
|
||||||
DebugLn('TApplication.HandleException ',Exception(ExceptObject).Message);
|
DebugLn('TApplication.HandleException ',Exception(ExceptObject).Message);
|
||||||
|
DumpStack;
|
||||||
end else begin
|
end else begin
|
||||||
DebugLn('TApplication.HandleException Strange Exception ');
|
DebugLn('TApplication.HandleException Strange Exception ');
|
||||||
end;
|
end;
|
||||||
@ -1404,9 +1419,6 @@ var
|
|||||||
Instance: TComponent;
|
Instance: TComponent;
|
||||||
ok: boolean;
|
ok: boolean;
|
||||||
AForm: TForm;
|
AForm: TForm;
|
||||||
{$IFNDEF RegisterFindGlobalComponent}
|
|
||||||
OldFindGlobalComponent: TFindGlobalComponent;
|
|
||||||
{$ENDIF}
|
|
||||||
begin
|
begin
|
||||||
// Allocate the instance, without calling the constructor
|
// Allocate the instance, without calling the constructor
|
||||||
Instance := TComponent(InstanceClass.NewInstance);
|
Instance := TComponent(InstanceClass.NewInstance);
|
||||||
@ -1414,12 +1426,7 @@ begin
|
|||||||
// events and constructors can refer to it
|
// events and constructors can refer to it
|
||||||
TComponent(Reference) := Instance;
|
TComponent(Reference) := Instance;
|
||||||
|
|
||||||
{$IFDEF RegisterFindGlobalComponent}
|
|
||||||
RegisterFindGlobalComponentProc(@FindApplicationComponent);
|
RegisterFindGlobalComponentProc(@FindApplicationComponent);
|
||||||
{$ELSE}
|
|
||||||
OldFindGlobalComponent:=FindGlobalComponent;
|
|
||||||
FindGlobalComponent:=@FindApplicationComponent;
|
|
||||||
{$ENDIF}
|
|
||||||
ok:=false;
|
ok:=false;
|
||||||
try
|
try
|
||||||
Instance.Create(Self);
|
Instance.Create(Self);
|
||||||
@ -1427,11 +1434,7 @@ begin
|
|||||||
finally
|
finally
|
||||||
if not ok then
|
if not ok then
|
||||||
TComponent(Reference) := nil;
|
TComponent(Reference) := nil;
|
||||||
{$IFDEF RegisterFindGlobalComponent}
|
|
||||||
UnregisterFindGlobalComponentProc(@FindApplicationComponent);
|
UnregisterFindGlobalComponentProc(@FindApplicationComponent);
|
||||||
{$ELSE}
|
|
||||||
FindGlobalComponent:=OldFindGlobalComponent;
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (Instance is TForm) then begin
|
if (Instance is TForm) then begin
|
||||||
@ -1485,6 +1488,10 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.123 2005/06/21 14:41:16 vincents
|
||||||
|
- removed 1.x specific FindGlobalComponent
|
||||||
|
- added writing stack trace of exception in Application.HandleException
|
||||||
|
|
||||||
Revision 1.122 2005/06/17 15:49:55 mattias
|
Revision 1.122 2005/06/17 15:49:55 mattias
|
||||||
added TApplication.ShowMainForm from George Lober
|
added TApplication.ShowMainForm from George Lober
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user