Delphi JCL JEDI使用 jclDebug
开源
https://github.com/project-jedi/jcl
jclDebug
下载jcl,还要下载https://github.com/project-jedi/jedi里的2个inc文件
放到jcl-master\jcl\source\include\jedi目录里。
运行jcl\install.bat 安装。没有dpk工程文件。


JclDebug

unit StackTrackDemoMain; interface uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, AppEvnts, ActnList; type
TMainForm = class(TForm)
ExceptionLogMemo: TMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
ListBox1: TListBox;
Button4: TButton;
ApplicationEvents: TApplicationEvents;
Label1: TLabel;
ActionList1: TActionList;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure ApplicationEventsException(Sender: TObject; E: Exception);
private
{ Private declarations }
public
{ Public declarations }
end; var
MainForm: TMainForm; implementation {$R *.DFM} uses
JclDebug; { TMainForm } //--------------------------------------------------------------------------------------------------
// Simulation of various unhandled exceptions
//-------------------------------------------------------------------------------------------------- procedure TMainForm.Button1Click(Sender: TObject);
begin
PInteger(nil)^ := ;
end; procedure TMainForm.Button2Click(Sender: TObject);
begin
ListBox1.Items[] := 'a';
end; procedure AAA;
begin
PInteger(nil)^ := ;
end; procedure TMainForm.Button3Click(Sender: TObject);
begin
AAA;
end; procedure TMainForm.Button4Click(Sender: TObject);
begin
ActionList1.Actions[].Execute;
end; //--------------------------------------------------------------------------------------------------
// Simple VCL application unhandled exception handler using JclDebug
//-------------------------------------------------------------------------------------------------- procedure TMainForm.ApplicationEventsException(Sender: TObject; E: Exception);
begin
// Log time stamp
ExceptionLogMemo.Lines.Add(DateTimeToStr(Now)); // Log unhandled exception stack info to ExceptionLogMemo
JclLastExceptStackListToStrings(ExceptionLogMemo.Lines, False, True, True, False); // Insert empty line
ExceptionLogMemo.Lines.Add(''); // Display default VCL unhandled exception dialog
Application.ShowException(E);
end; //--------------------------------------------------------------------------------------------------
// JclDebug initialization and finalization for VCL application
//-------------------------------------------------------------------------------------------------- initialization // Enable raw mode (default mode uses stack frames which aren't always generated by the compiler)
Include(JclStackTrackingOptions, stRawMode);
// Disable stack tracking in dynamically loaded modules (it makes stack tracking code a bit faster)
Include(JclStackTrackingOptions, stStaticModuleList); // Initialize Exception tracking
JclStartExceptionTracking; finalization // Uninitialize Exception tracking
JclStopExceptionTracking; end.
获取当前过程函数的名称
记得把上面的jcl debug的选项打开。
self.Caption:= JclDebug.GetLocationInfoStr(Caller(1));
http://delphi.wikia.com/wiki/JEDI_Code_Library
unit u_JclDebugTest; interface function CurrentFunctionName: string; type
TSomeClass = class
private
public
constructor Create;
destructor Destroy; override;
procedure Test;
end; implementation uses
JclDebug; { TSomeClass } constructor TSomeClass.Create;
begin
WriteLn(CurrentFunctionName);
end; destructor TSomeClass.Destroy;
begin
WriteLn(CurrentFunctionName);
inherited;
end; procedure TSomeClass.Test;
begin
WriteLn(CurrentFunctionName);
end; {$W+} function CurrentFunctionName: string;
begin
Result := jcldebug.GetLocationInfoStr(Caller());
end; end. program jcldebugtest; {$APPTYPE console} uses
u_JclDebugTest; procedure SomeProcedure;
begin
WriteLn(CurrentFunctionName);
with TSomeClass.Create do begin
Test;
Free;
end;
end; begin
WriteLn(CurrentFunctionName);
SomeProcedure;
WriteLn(CurrentFunctionName);
end. This program will output: [0042362D] jcldebugtest.jcldebugtest (Line , "jcldebugtest.dpr")
[004223A7] jcldebugtest.SomeProcedure (Line , "jcldebugtest.dpr")
[0042226C] u_JclDebugTest.TSomeClass.Create (Line , "u_JclDebugTest.pas")
[] u_JclDebugTest.TSomeClass.Test (Line , "u_JclDebugTest.pas")
[004222E5] u_JclDebugTest.TSomeClass.Destroy (Line , "u_JclDebugTest.pas")
[] jcldebugtest.jcldebugtest (Line , "jcldebugtest.dpr")
http://stackoverflow.com/questions/19450140/combining-log4delphi-and-jcl-debug
http://stackoverflow.com/questions/19496046/get-name-of-the-previous-calling-method
Delphi JCL JEDI使用 jclDebug的更多相关文章
- Delphi与字符编码(实战篇)(MultiByteToWideChar会返回转换后的宽字符串长度)
本文目标: 了解Delphi的字符串类型 字符编码的检测与转换 简体繁体转换 0. 导言 看完“.Net与字符编码(理论篇)”,我们明白了字符是自然语言中的最小单位,在存储和传输的过程中可以使用三种编 ...
- Delphi:基于jcl的Bugsplat Crash收集单元
//BugSplat Crash模拟.net数据封装 unit uBugSplat; interface uses Windows, SysUtils, Classes, StrUtils, Shel ...
- Jedi项目,还真得好好看看,有许多控件和新封装的API(Delphi里面没有)
以前没有重视 http://www.delphi-jedi.org/ https://github.com/project-jedi https://sourceforge.net/projects/ ...
- delphi代码实现创建dump文件
I used a "watchdog" thread for this, which checks if the mainform is responding, and make ...
- Delphi:Exception输出堆栈信息
起源: 用习惯了c#之Exception的StackTrace,在程序出异常crash时候能够以其定位出问题的模块及行号,用回Delphi 2009,发现没有这东西. 显然,在编译环境日新月异的今天, ...
- Delphi 控件大全
delphi 控件大全(确实很全) delphi 控件查询:http://www.torry.net/ http://www.jrsoftware.org Tb97 最有名的工具条(ToolBar ...
- delphi 控件大全(确实很全)
delphi 控件查询:http://www.torry.net/ http://www.jrsoftware.org Tb97 最有名的工具条(ToolBar)控件库,仿Office97,如TDoC ...
- Delphi经验总结(2)
Q: 怎么来改变ListBox的字体呢?就修改其中的一行. A: 先把ListBox1.Style 设成lbOwnerDrawFixed 然后在 OnDrawItem 事件下写下如下代码 proced ...
- DLL Injection with Delphi(转载)
原始链接 I had recently spent some time playing around with the simple to use DelphiDetours package from ...
随机推荐
- Mysql 日志 (转)
MySQL日志: 主要包含:错误日志.查询日志.慢查询日志.事务日志.二进制日志: 错误日志 在mysql数据库中,错误日志功能是默认开启的.并且,错误日志无法被禁止.默认情况下,错误日志存储在mys ...
- 【新手】python爬虫遍历贴吧用户
想法是遍历学校贴吧的用户,获取用户的数据用来分析,因为是初学python,就一点一点的写,变量命名也不规范,见谅 系统:windows 版本:python 3.5 #获取河北大学工商学院吧1000页以 ...
- Elasticsearch【JAVA REST Client】客户端操作
ES系统作为集群,环境搭建非常方便简单. 现在在我们的应用中,如何对这个集群进行操作呢? 我们利用ES系统,通常都是下面的架构: 在这里,客户端的请求通过LB进行负载均衡,因为操作任何一个ES的实例, ...
- SQL的OPENROWSET开启和使用方法
[转载]SQL的OPENROWSET开启和使用方法 1.开始 -> 所有程序 -> Microsoft SQL Server 2005 -> 配置工具 -> SQL Se ...
- (Xaml) Type 'DeviceA' is not defined.
修改了一些Xaml, 始终提示 Compiler error(s) encountered processing expression "deviceA.B".Type 'Devi ...
- HDU 1394 Minimum Inversion Number(最小逆序数 线段树)
Minimum Inversion Number [题目链接]Minimum Inversion Number [题目类型]最小逆序数 线段树 &题意: 求一个数列经过n次变换得到的数列其中的 ...
- 用git管理自己读的书
福昕阅读器,可以方便地做书签和备注.使用git去管理图书和示例代码,一方面能够很好地保存这些资料,方便查找:另外一方面,无论在家,还是在公司,都能很好地同步自己学习的进度. 福昕阅读器5(视图--&g ...
- java线程池
http://cuisuqiang.iteye.com/blog/2019372 Java四种线程池的使用 java线程线程池监控 Java通过Executors提供四种线程池,分别为:newCach ...
- G不可失
html和css部分和引用的库 <!DOCTYPE html><html lang="en"><head> <meta charset=& ...
- spring mvc使用@InitBinder 标签对表单数据绑定
在SpringMVC中,bean中定义了Date,double等类型,如果没有做任何处理的话,日期以及double都无法绑定. 解决的办法就是使用spring mvc提供的@InitBinder标签 ...