Borland Delphi 5/7异常处理失效问题求助及底层实现咨询
异常处理失效问题排查求助
执行TRow.CreateForIxf构造函数后,Delphi的try...except异常处理功能完全失效,程序直接崩溃。
测试函数及调用代码
异常处理测试函数
procedure vmDbg_TestExceptionsHandling(AMarker: string); var i: integer; begin i := UVmDll.DebugPoint(9002, PChar(AMarker)); // #define dbgpnt_HeapCheck 9002 if i <> 1 then ToAppLogger(ll_ERROR, format(' %s->UVmDll.DebugPoint(9002)->heap integrity failure!', [AMarker])); //DBG: try // when Borland RTL space is somehow broken, it will crash here! raise Exception.Create('test exceptions#1 /' + AMarker); except on e: Exception do begin ToAppLogger(ll_ERROR, format(' %s->UVmDll.DebugPoint(99)->%s', [AMarker, ExcErrMsg(e)])); end; end; //DBG: try // inside ScriptVN.dll there is a special handling for point# 99 - it will throw a C++ exception UVmDll.DebugPoint(99, PChar(AMarker)); except on e: Exception do begin ToAppLogger(ll_ERROR, format(' %s->UVmDll.DebugPoint(99)->%s', [AMarker, ExcErrMsg(e)])); end; end; //DBG: try // sometimes it may crash here... raise Exception.Create('test exceptions#2 /' + AMarker); except on e: Exception do begin ToAppLogger(ll_ERROR, format(' %s->UVmDll.DebugPoint(99)->%s', [AMarker, ExcErrMsg(e)])); end; end; end;
测试调用代码
procedure vmDll_Jira790TestCase; var n: integer; ixf: cpp_IInterface; rw, rwx, rwd: TRow; begin isJira790Catch := true; vmDbg_TestExceptionsHandling('Jira790TestCase.0'); //<-- here it works fine rwd := TRow.CreateDummy; vmDbg_TestExceptionsHandling('Jira790TestCase.1'); //<-- here it works fine rw := TRow.Create(true); vmDbg_TestExceptionsHandling('Jira790TestCase.2'); //<-- here it works fine ixf := UVmDll.DataTree__GetContainerInterface(rw.Engine); rwx := TRow.CreateForIxf(ixf); // <-- it crashes on leaving this constructor vmDbg_TestExceptionsHandling('Jira790TestCase.3'); // <-- sometimes it crashes here end;
问题表现与已做验证
- 测试函数核心目的是验证
try...except是否能正常捕获异常,执行TRow.CreateForIxf前的三次调用均正常,之后调用时异常处理完全失效,程序直接崩溃 - 崩溃时调试器提示错误码
0x0eedfade,无调试状态下Windows事件日志仅记录KERNELBASE.dll相关崩溃信息 - 已验证对象VMT有效、堆内存完整,但因不了解Borland Delphi 5/7异常处理底层实现,无法进一步定位问题
环境补充
- 单线程UI应用
- 仅在Windows Server 2012/2016/2019上出现崩溃,Windows 7/部分Win10版本运行正常
- 尝试兼容性模式无效
求助需求
- Borland Delphi 5/7异常处理底层实现的相关文档资料
- 手动排查异常处理结构正确性的方法,包括异常处理结构的类型、存储位置等细节
内容的提问来源于stack exchange,提问作者dmitry_bond
相关产品推荐
相关产品推荐

