Changeset 40 for ExceptionLogger
- Timestamp:
- Sep 9, 2010, 1:58:30 PM (14 years ago)
- Location:
- ExceptionLogger
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
ExceptionLogger/CustomLineInfo.pas
r39 r40 94 94 exit; 95 95 end; 96 e.processaddress :=ptruint(baseaddr)-e.processaddress;96 e.processaddress := ptruint(baseaddr) - e.processaddress; 97 97 StabsFunctionRelative := E.FunctionRelative; 98 98 if FindExeSection(e,'.stab',stabofs,stablen) and … … 109 109 end; 110 110 111 112 111 procedure CloseStabs; 113 112 begin 114 113 CloseExeFile(e); 115 114 end; 116 117 115 118 116 function GetLineInfo(addr:ptruint;var func,source:shortstring;var line:longint) : boolean; … … 248 246 end; 249 247 250 251 248 function StabBackTraceStr(addr:Pointer):shortstring; 252 249 var … … 291 288 end; 292 289 293 294 290 initialization 295 BackTraceStrFunc :=@StabBackTraceStr;291 BackTraceStrFunc := @StabBackTraceStr; 296 292 297 293 finalization -
ExceptionLogger/UExceptionForm.lfm
r39 r40 3 3 Height = 316 4 4 Top = 171 5 Width = 6 825 Width = 691 6 6 Caption = 'Exception info' 7 7 ClientHeight = 316 8 ClientWidth = 6 828 ClientWidth = 691 9 9 OnCreate = FormCreate 10 10 OnDestroy = FormDestroy … … 12 12 LCLVersion = '0.9.29' 13 13 object ButtonClose: TButton 14 Left = 6 0214 Left = 611 15 15 Height = 25 16 16 Top = 286 … … 22 22 end 23 23 object ButtonKill: TButton 24 Left = 5 1224 Left = 521 25 25 Height = 25 26 26 Top = 286 … … 35 35 Height = 277 36 36 Top = 3 37 Width = 6 6937 Width = 678 38 38 ActivePage = TabSheet2 39 39 Anchors = [akTop, akLeft, akRight, akBottom] … … 59 59 Caption = 'Call stack' 60 60 ClientHeight = 251 61 ClientWidth = 6 6161 ClientWidth = 670 62 62 object ListView1: TListView 63 63 Left = 4 64 64 Height = 241 65 65 Top = 7 66 Width = 6 5566 Width = 664 67 67 Anchors = [akTop, akLeft, akRight, akBottom] 68 68 Columns = < … … 77 77 item 78 78 Caption = 'Class' 79 Width = 1 0079 Width = 150 80 80 end 81 81 item … … 99 99 end 100 100 end 101 object CheckBoxIgnore: TCheckBox 102 Left = 10 103 Height = 17 104 Top = 298 105 Width = 169 106 Anchors = [akLeft, akBottom] 107 Caption = 'Next time ignore this exception' 108 TabOrder = 3 109 end 101 110 end -
ExceptionLogger/UExceptionForm.lrt
r39 r40 10 10 TEXCEPTIONFORM.LISTVIEW1.COLUMNS[4].CAPTION=Unit 11 11 TEXCEPTIONFORM.LISTVIEW1.COLUMNS[5].CAPTION=Line 12 TEXCEPTIONFORM.CHECKBOXIGNORE.CAPTION=Next time ignore this exception -
ExceptionLogger/UExceptionForm.pas
r39 r40 18 18 ButtonKill: TButton; 19 19 ButtonClose: TButton; 20 CheckBoxIgnore: TCheckBox; 20 21 ListView1: TListView; 21 22 MemoExceptionInfo: TMemo; … … 42 43 procedure TExceptionForm.FormShow(Sender: TObject); 43 44 begin 45 PageControl1.ActivePageIndex := 0; 46 CheckBoxIgnore.Checked := False; 44 47 end; 45 48 … … 56 59 procedure TExceptionForm.ButtonKillClick(Sender: TObject); 57 60 begin 58 Halt; 61 //Halt; 62 Application.Terminate; 59 63 end; 60 64 -
ExceptionLogger/UExceptionLogger.pas
r39 r40 21 21 StackTrace: TStackTrace; 22 22 LastException: Exception; 23 IgnoreList: TStringList; 23 24 constructor Create(AOwner: TComponent); override; 24 25 destructor Destroy; override; … … 54 55 end; 55 56 56 57 57 { TExceptionLogger } 58 58 … … 60 60 begin 61 61 inherited Create(AOwner); 62 IgnoreList := TStringList.Create; 62 63 StackTrace := TStackTrace.Create; 63 64 MaxCallStackDepth := 20; … … 69 70 begin 70 71 StackTrace.Free; 72 IgnoreList.Free; 71 73 inherited Destroy; 72 74 end; … … 155 157 Report: TStringList; 156 158 begin 157 Report := TStringList.Create; 158 try 159 CreateTextReport(Report); 160 if FLogFileName <> '' then begin 161 LogToFile(Report); 162 LogStackTraceToFile(StackTrace); 159 if IgnoreList.IndexOf(LastException.ClassName) = -1 then begin 160 Report := TStringList.Create; 161 try 162 CreateTextReport(Report); 163 if FLogFileName <> '' then begin 164 LogToFile(Report); 165 LogStackTraceToFile(StackTrace); 166 end; 167 ExceptionForm.MemoExceptionInfo.Lines.Assign(Report); 168 ShowReportForm; 169 finally 170 Report.Free; 163 171 end; 164 ExceptionForm.MemoExceptionInfo.Lines.Assign(Report); 165 ShowReportForm; 166 finally 167 Report.Free; 172 if ExceptionForm.CheckBoxIgnore.Checked then 173 IgnoreList.Add(LastException.ClassName); 168 174 end; 169 175 end;
Note:
See TracChangeset
for help on using the changeset viewer.