delphijcljedi使用

lypzxy lypzxy     2022-08-17     695

关键词:

开源

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)^ := 0;
end;

procedure TMainForm.Button2Click(Sender: TObject);
begin
  ListBox1.Items[1] := 'a';
end;

procedure AAA;
begin
  PInteger(nil)^ := 0;
end;

procedure TMainForm.Button3Click(Sender: TObject);
begin
  AAA;
end;

procedure TMainForm.Button4Click(Sender: TObject);
begin
  ActionList1.Actions[0].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.
View Code

 

获取当前过程函数的名称

记得把上面的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(1));
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 18, "jcldebugtest.dpr")
[004223A7] jcldebugtest.SomeProcedure (Line 10, "jcldebugtest.dpr")
[0042226C] u_JclDebugTest.TSomeClass.Create (Line 34, "u_JclDebugTest.pas")
[00422352] u_JclDebugTest.TSomeClass.Test (Line 45, "u_JclDebugTest.pas")
[004222E5] u_JclDebugTest.TSomeClass.Destroy (Line 39, "u_JclDebugTest.pas")
[00423651] jcldebugtest.jcldebugtest (Line 20, "jcldebugtest.dpr")
View Code

 http://stackoverflow.com/questions/19450140/combining-log4delphi-and-jcl-debug

http://stackoverflow.com/questions/19496046/get-name-of-the-previous-calling-method

使用“使用严格”作为“使用强”的备份

】使用“使用严格”作为“使用强”的备份【英文标题】:Using"usingstrict"asabackupfor"usestrong"【发布时间】:2016-06-1604:26:29【问题描述】:有没有办法使用"usestrong";并使用"usestrict";作为备份?因为Google... 查看详情

在使用加载数据流步骤的猪中,使用(使用 PigStorage)和不使用它有啥区别?

】在使用加载数据流步骤的猪中,使用(使用PigStorage)和不使用它有啥区别?【英文标题】:InpigwhileusingLoaddataflowstepwhatisdifferencewithusing(UsingPigStorage)andwithoutusingit?在使用加载数据流步骤的猪中,使用(使用PigStorage)和不使用它... 查看详情

MySQL db 在按日期排序时使用“使用位置;使用临时;使用文件排序”

】MySQLdb在按日期排序时使用“使用位置;使用临时;使用文件排序”【英文标题】:MySQLdbisusing"Usingwhere;Usingtemporary;Usingfilesort"whensortingbydate【发布时间】:2011-07-2207:56:47【问题描述】:我有一个包含一堆记录的数据库,... 查看详情

如何使用 AutoMapper 使用 EntityFramework 使用嵌套列表更新对象?

】如何使用AutoMapper使用EntityFramework使用嵌套列表更新对象?【英文标题】:HowtouseAutoMapperforupdatingObjectwithnestedListusingEntityFramework?【发布时间】:2022-01-0315:40:44【问题描述】:我想使用AutoMapper将带有嵌套列表的EntityDto映射到实体... 查看详情

qt静态编译时使用openssl有三种方式(不使用,动态使用,静态使用,默认是动态使用)

WhencompilingQtyoucanchooseoneoftheseoptionsbasedontheconfigurecommandline:noOpenSSLsupport(-no-openssl)QtNetworkdynamicallyopeningOpenSSLlibs(-openssl;default)QtNetworklinkingtoOpenSSL(-openssl-linke 查看详情

何时使用自旋锁?何时使用互斥体?

中断上下文只能使用自旋锁。任务睡眠时只能使用互斥体。需求建议的加锁方法低开销加锁优先使用自旋锁短期锁定优先使用自旋锁长期加锁优先使用互斥体中断上下文加锁使用自旋锁持有锁需要睡眠使用互斥体  查看详情

kettlejava脚本组件的使用说明(简单使用升级使用)

文章目录前言Kettlejava脚本组件的使用说明(简单使用、升级使用)01简单使用02升级使用前言  如果您觉得有用的话,记得给博主点个赞,评论,收藏一键三连啊,写作不易啊^_^。  而且听说点赞的人每天的运气... 查看详情

使用pidstat监控资源使用

 linux可以使用pidstat命令监控系统资源,比如监控cup使用如下:pidstat-u1还可以使用-r(内存)-d(硬盘) 查看详情

如何使用公钥加密字符串并使用 MimeKit 使用私钥解密?

】如何使用公钥加密字符串并使用MimeKit使用私钥解密?【英文标题】:HowtoencryptstringwithpublickeyanddecryptusingprivatekeyusingMimeKit?【发布时间】:2021-04-0118:27:35【问题描述】:我很难寻找有关如何使用公钥证书加密字符串并使用Mimekit... 查看详情

如何使用 webpack 使用它

】如何使用webpack使用它【英文标题】:Howtoconsumethiswithwebpack【发布时间】:2015-10-1405:17:20【问题描述】:如何在webpackreact应用程序中使用这个repo:https://github.com/chris-rudmin/Recorderjs我已经创建了一个新的库并以es6模块样式导出主... 查看详情

使用 C++ 和 Boost(或不使用?)检查是不是正在使用特定端口?

】使用C++和Boost(或不使用?)检查是不是正在使用特定端口?【英文标题】:UsingC++andBoost(ornot?)tocheckifaspecificportisbeingused?使用C++和Boost(或不使用?)检查是否正在使用特定端口?【发布时间】:2016-01-2607:04:05【问题描述】:... 查看详情

Mysql查询使用索引使用文件排序使用临时

】Mysql查询使用索引使用文件排序使用临时【英文标题】:Mysqlqueryusingindexusingfilesortusingtemporary【发布时间】:2014-08-2713:58:18【问题描述】:我的数据库中有以下两个表:表1:图片列:jeid[和其他]主键:jeid行数:160万表2:媒体... 查看详情

如何使用 React 使用 Notion API

】如何使用React使用NotionAPI【英文标题】:HowtoconsumeNotionAPIwithReact【发布时间】:2021-08-0601:54:19【问题描述】:我正在尝试使用新的NotionAPI作为我个人网站的CMS。作为一种改进方法,我尝试将它与React一起使用。但它似乎不允许CO... 查看详情

如何使用@JmsListener 暂停并开始使用消息

】如何使用@JmsListener暂停并开始使用消息【英文标题】:Howtopauseandstartconsumingmessageusing@JmsListener【发布时间】:2016-07-0223:47:57【问题描述】:我使用的是SpringBoot1.3.2版。我正在使用@JmsListener为我使用JmsTemplate创建/生成的消息使用... 查看详情

为啥使用最近最少使用的简单缓存机制?

】为啥使用最近最少使用的简单缓存机制?【英文标题】:WhyistheSimpleLeastRecentlyUsedCacheMechanismused?为什么使用最近最少使用的简单缓存机制?【发布时间】:2018-03-0208:27:47【问题描述】:我使用JProfiler检查Java微服务,同时使用JMe... 查看详情

使用 Makecert 设置密钥使用属性

】使用Makecert设置密钥使用属性【英文标题】:SettingKeyUsageattributeswithMakecert【发布时间】:2011-02-2615:45:58【问题描述】:是否可以使用makecert或任何其他我可以用来生成我自己的测试证书的工具来设置密钥使用属性?我感兴趣的... 查看详情

使用 multiDexEnabled 而不使用 Gradle,而是使用 Eclipse 构建过程

】使用multiDexEnabled而不使用Gradle,而是使用Eclipse构建过程【英文标题】:UsemultiDexEnabledwithoutGradlebutEclipsebuildprocessinstead【发布时间】:2015-01-0109:14:22【问题描述】:由于最新的SDK版本,创建具有多个dex文件(https://developer.android.co... 查看详情

使用 jQuery 使用 WCF 服务

】使用jQuery使用WCF服务【英文标题】:ConsumingWCFserviceusingjQuery【发布时间】:2011-08-1023:55:33【问题描述】:到目前为止,我已经使用了Web服务,并且运行良好。我添加了一个新的WCF服务。我正在使用jQuery调用服务。这就是我使用... 查看详情