开源

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
  1. unit StackTrackDemoMain;
  2.  
  3. interface
  4.  
  5. uses
  6. Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7. StdCtrls, AppEvnts, ActnList;
  8.  
  9. type
  10. TMainForm = class(TForm)
  11. ExceptionLogMemo: TMemo;
  12. Button1: TButton;
  13. Button2: TButton;
  14. Button3: TButton;
  15. ListBox1: TListBox;
  16. Button4: TButton;
  17. ApplicationEvents: TApplicationEvents;
  18. Label1: TLabel;
  19. ActionList1: TActionList;
  20. procedure Button1Click(Sender: TObject);
  21. procedure Button2Click(Sender: TObject);
  22. procedure Button3Click(Sender: TObject);
  23. procedure Button4Click(Sender: TObject);
  24. procedure ApplicationEventsException(Sender: TObject; E: Exception);
  25. private
  26. { Private declarations }
  27. public
  28. { Public declarations }
  29. end;
  30.  
  31. var
  32. MainForm: TMainForm;
  33.  
  34. implementation
  35.  
  36. {$R *.DFM}
  37.  
  38. uses
  39. JclDebug;
  40.  
  41. { TMainForm }
  42.  
  43. //--------------------------------------------------------------------------------------------------
  44. // Simulation of various unhandled exceptions
  45. //--------------------------------------------------------------------------------------------------
  46.  
  47. procedure TMainForm.Button1Click(Sender: TObject);
  48. begin
  49. PInteger(nil)^ := ;
  50. end;
  51.  
  52. procedure TMainForm.Button2Click(Sender: TObject);
  53. begin
  54. ListBox1.Items[] := 'a';
  55. end;
  56.  
  57. procedure AAA;
  58. begin
  59. PInteger(nil)^ := ;
  60. end;
  61.  
  62. procedure TMainForm.Button3Click(Sender: TObject);
  63. begin
  64. AAA;
  65. end;
  66.  
  67. procedure TMainForm.Button4Click(Sender: TObject);
  68. begin
  69. ActionList1.Actions[].Execute;
  70. end;
  71.  
  72. //--------------------------------------------------------------------------------------------------
  73. // Simple VCL application unhandled exception handler using JclDebug
  74. //--------------------------------------------------------------------------------------------------
  75.  
  76. procedure TMainForm.ApplicationEventsException(Sender: TObject; E: Exception);
  77. begin
  78. // Log time stamp
  79. ExceptionLogMemo.Lines.Add(DateTimeToStr(Now));
  80.  
  81. // Log unhandled exception stack info to ExceptionLogMemo
  82. JclLastExceptStackListToStrings(ExceptionLogMemo.Lines, False, True, True, False);
  83.  
  84. // Insert empty line
  85. ExceptionLogMemo.Lines.Add('');
  86.  
  87. // Display default VCL unhandled exception dialog
  88. Application.ShowException(E);
  89. end;
  90.  
  91. //--------------------------------------------------------------------------------------------------
  92. // JclDebug initialization and finalization for VCL application
  93. //--------------------------------------------------------------------------------------------------
  94.  
  95. initialization
  96.  
  97. // Enable raw mode (default mode uses stack frames which aren't always generated by the compiler)
  98. Include(JclStackTrackingOptions, stRawMode);
  99. // Disable stack tracking in dynamically loaded modules (it makes stack tracking code a bit faster)
  100. Include(JclStackTrackingOptions, stStaticModuleList);
  101.  
  102. // Initialize Exception tracking
  103. JclStartExceptionTracking;
  104.  
  105. finalization
  106.  
  107. // Uninitialize Exception tracking
  108. JclStopExceptionTracking;
  109.  
  110. end.

获取当前过程函数的名称

记得把上面的jcl debug的选项打开。

self.Caption:= JclDebug.GetLocationInfoStr(Caller(1));

http://delphi.wikia.com/wiki/JEDI_Code_Library

  1. unit u_JclDebugTest;
  2.  
  3. interface
  4.  
  5. function CurrentFunctionName: string;
  6.  
  7. type
  8. TSomeClass = class
  9. private
  10. public
  11. constructor Create;
  12. destructor Destroy; override;
  13. procedure Test;
  14. end;
  15.  
  16. implementation
  17.  
  18. uses
  19. JclDebug;
  20.  
  21. { TSomeClass }
  22.  
  23. constructor TSomeClass.Create;
  24. begin
  25. WriteLn(CurrentFunctionName);
  26. end;
  27.  
  28. destructor TSomeClass.Destroy;
  29. begin
  30. WriteLn(CurrentFunctionName);
  31. inherited;
  32. end;
  33.  
  34. procedure TSomeClass.Test;
  35. begin
  36. WriteLn(CurrentFunctionName);
  37. end;
  38.  
  39. {$W+}
  40.  
  41. function CurrentFunctionName: string;
  42. begin
  43. Result := jcldebug.GetLocationInfoStr(Caller());
  44. end;
  45.  
  46. end.
  47.  
  48. program jcldebugtest;
  49.  
  50. {$APPTYPE console}
  51.  
  52. uses
  53. u_JclDebugTest;
  54.  
  55. procedure SomeProcedure;
  56. begin
  57. WriteLn(CurrentFunctionName);
  58. with TSomeClass.Create do begin
  59. Test;
  60. Free;
  61. end;
  62. end;
  63.  
  64. begin
  65. WriteLn(CurrentFunctionName);
  66. SomeProcedure;
  67. WriteLn(CurrentFunctionName);
  68. end.
  69.  
  70. This program will output:
  71.  
  72. [0042362D] jcldebugtest.jcldebugtest (Line , "jcldebugtest.dpr")
  73. [004223A7] jcldebugtest.SomeProcedure (Line , "jcldebugtest.dpr")
  74. [0042226C] u_JclDebugTest.TSomeClass.Create (Line , "u_JclDebugTest.pas")
  75. [] u_JclDebugTest.TSomeClass.Test (Line , "u_JclDebugTest.pas")
  76. [004222E5] u_JclDebugTest.TSomeClass.Destroy (Line , "u_JclDebugTest.pas")
  77. [] 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. PHP使用JSON通信

    PHP使用JSON通信 php中使用JSON的Code如下 <?php header("Content-type: text/html; charset=utf-8"); $ ...

  2. Eclipse debug高级技巧(转)

    Debug视图 认识debug视图,红色部分框为线程堆栈视图,黄色部分框为表达式.断点.变量视图,蓝色部分为代码视图. 线程堆栈视图 分别介绍一下这几个按钮的含义: 1.表示当前实现继续运行直到下一个 ...

  3. 在CentOS中将/var等已有目录挂载到新添加的硬盘

    1.查看当前硬盘使用状况: [root@gluster_node1 ~]# df -h Filesystem            Size  Used Avail Use% Mounted on / ...

  4. 优先级反转实验,使用信号量实现【RT-Thread学习笔记 5】

    RTOS中很经典的问题.就是在使用共享资源的时候,优先级低的进程在优先级高的进程之前执行的问题.这里模拟这种情况. 下面的实验模拟了优先级反转的情况: 先定义三个线程: //优先级反转实验 rt_se ...

  5. 如何使用一个对象而非数组元素为ng-options初始化

    a,是引用,而b是一个和a内容相同的另一个对象, 因此不能通过b直接赋值.如果要这样用,就用 track by xxx.id  ,它的作用是通过id(唯一的)去ng-options做一次检索匹配

  6. 关于import caffe出错的解决

    [http://blog.csdn.net/wuzuyu365/article/details/52431062]关于在caffe下,import caffe报错的解决:conda install p ...

  7. java异常笔记

    1:<java核心技术卷一>473页提到:如果在子类中覆盖了超类的一个方法,子类方法中声明的已检查异常不能超过超类方法中声明的异常范围. 显然,如果子类中抛出的异常范围比超类还大.多态将无 ...

  8. 注释驱动的 Spring cache 缓存介绍

    概述 Spring 3.1 引入了激动人心的基于注释(annotation)的缓存(cache)技术,它本质上不是一个具体的缓存实现方案(例如 EHCache 或者 OSCache),而是一个对缓存使 ...

  9. emacs配置eslint 语法检查.找不到node解决

    使用emacs配置eslint 当调用语法检查时报错 Suspicious state from syntax checker javascript-eslint: Checker javascrip ...

  10. SQL加权限

    grant view definition on 存储过程名字 to 用户名