开源

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工程文件。

运行bat文件,弹出下面的界面,点install即可。
 
like this
http://stackoverflow.com/questions/32881718/installing-jvcl-into-delphi-10-seattle

 
 

JclDebug

jcl\source\windows\JclDebug.pas
这包含了个Demo
jcl\examples\windows\debug\stacktrack.dproj
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的更多相关文章

  1. Delphi与字符编码(实战篇)(MultiByteToWideChar会返回转换后的宽字符串长度)

    本文目标: 了解Delphi的字符串类型 字符编码的检测与转换 简体繁体转换 0. 导言 看完“.Net与字符编码(理论篇)”,我们明白了字符是自然语言中的最小单位,在存储和传输的过程中可以使用三种编 ...

  2. Delphi:基于jcl的Bugsplat Crash收集单元

    //BugSplat Crash模拟.net数据封装 unit uBugSplat; interface uses Windows, SysUtils, Classes, StrUtils, Shel ...

  3. Jedi项目,还真得好好看看,有许多控件和新封装的API(Delphi里面没有)

    以前没有重视 http://www.delphi-jedi.org/ https://github.com/project-jedi https://sourceforge.net/projects/ ...

  4. delphi代码实现创建dump文件

    I used a "watchdog" thread for this, which checks if the mainform is responding, and make ...

  5. Delphi:Exception输出堆栈信息

    起源: 用习惯了c#之Exception的StackTrace,在程序出异常crash时候能够以其定位出问题的模块及行号,用回Delphi 2009,发现没有这东西. 显然,在编译环境日新月异的今天, ...

  6. Delphi 控件大全

    delphi 控件大全(确实很全)   delphi 控件查询:http://www.torry.net/ http://www.jrsoftware.org Tb97 最有名的工具条(ToolBar ...

  7. delphi 控件大全(确实很全)

    delphi 控件查询:http://www.torry.net/ http://www.jrsoftware.org Tb97 最有名的工具条(ToolBar)控件库,仿Office97,如TDoC ...

  8. Delphi经验总结(2)

    Q: 怎么来改变ListBox的字体呢?就修改其中的一行. A: 先把ListBox1.Style 设成lbOwnerDrawFixed 然后在 OnDrawItem 事件下写下如下代码 proced ...

  9. DLL Injection with Delphi(转载)

    原始链接 I had recently spent some time playing around with the simple to use DelphiDetours package from ...

随机推荐

  1. Process的Waitfor() 引起代码死锁

    Java用process调用c#的exe后,process.waitfor(). exe执行会停在某处.据说是waitfor引起的exe子线程死锁. 先存一个链接 http://yearsaaaa12 ...

  2. Memcached 数据缓存系统

    Memcached 数据缓存系统 常用命令及使用:http://www.cnblogs.com/wayne173/p/5652034.html Memcached是一个自由开源的,高性能,分布式内存对 ...

  3. 支持Cookie并开放了一些特殊设置项的HttpWebClient

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.N ...

  4. HDU2896 病毒侵袭

    题目大意:给出若干病毒的特征码,不超过500个.每个病毒的特征码长度在20~200之间.现在有若干网站的源代码,要检测网站的源代码中是否包含病毒.网站的个数不超过1000个,每个网站的源代码长度在70 ...

  5. [git]rebase和merge

    转自:http://blog.csdn.net/wh_19910525/article/details/7554489 Git merge是用来合并两个分支的. git merge b # 将b分支合 ...

  6. ARC中KVO开发注意

    1 在ARC 中 KVO开发 添加监听和去掉监听必需 一一匹配,不要有过的去掉监听否则会有可能导致对象无法释放. 例如,在一个viewcontroller中添加webview 并监听webview的c ...

  7. makefile小例子

    makefile的知识点应该很多,看网上的很多教程就能看出来,长的可以写一本书.记录一下自己用的一个简单的makefile, 方便以后查找. 先看一下程序的目录结构: [root@localhost ...

  8. HTML input="file" 浏览时只显示指定文件类型 xls、xlsx、csv

    html input="file" 浏览时只显示指定文件类型 xls.xlsx.csv <input id="fileSelect" type=" ...

  9. 常用Java排序算法

    常用Java排序算法 冒泡排序 .选择排序.快速排序 package com.javaee.corejava; public class DataSort { public DataSort() { ...

  10. Python的第三天

    一.字典 字典是另一种可变容器模型,且可存储任意类型对象. 字典的每个键值(key=>value)对用冒号(:)分割,每个对之间用逗号(,)分割,整个字典包括在花括号({})中 ,格式如下所示: ...