gpt4 book ai didi

delphi - 如何知道产生异常的确切行号

转载 作者:行者123 更新时间:2023-12-03 00:06:47 24 4
gpt4 key购买 nike

为了获取 iOS/Android 部署的应用程序的错误报告,我使用 grijjy 解决方案 ( https://blog.grijjy.com/2017/02/09/build-your-own-error-reporter-part-1-ios/ )。问题是它给了我发生错误的函数名称,但没有提供确切的行号。例如我经常出现这样的错误:

Argument out of range
At address: $002CDD4B (Generics.Collections.TListHelper.CheckItemRange(Integer) + 62)

Call stack:
MyApp $00BB153D Grijjy.Errorreporting.backtrace(Pointer*, Integer) + 8
MyApp $00BB1427 Grijjy.Errorreporting.TgoExceptionReporter.GlobalGetExceptionStackInfo(TExceptionRecord*) + 74
MyApp $001C4D83 Sysutils.Exception.RaisingException(TExceptionRecord*) + 38
MyApp $001E903D Sysutils.RaiseExceptObject(TExceptionRecord*) + 44
MyApp $001B0D9D _RaiseAtExcept(TObject*, Pointer) + 164
MyApp $001B1007 _RaiseExcept(TObject*) + 14
MyApp $002CDD4B Generics.Collections.TListHelper.CheckItemRange(Integer) + 62
MyApp $0059D4B3 Fmx.Controls.TControl.PaintChildren() + 222
MyApp $005BB987 Fmx.Controls.TControl.PaintInternal().DoPaintInternal(Pointer) + 1162
MyApp $005BC165 Fmx.Controls.TControl.PaintInternal().PaintAndClipChild(Pointer) + 500
MyApp $005B8F09 Fmx.Controls.TControl.PaintInternal() + 376
MyApp $007569D5 Fmx.Forms.TCustomForm.PaintRects(Types.TRectF const*, Integer) + 1008
MyApp $0074A001 __stub_in660v62__ZN3Fmx5Forms17TCommonCustomForm10PaintRectsEPKN6System5Types6TRectFEi + 24
MyApp $0068257D Fmx.Platform.Ios.TFMXView3D.drawRect(Iosapi.Foundation.NSRect) + 204
MyApp $00C2BA57 DispatchToDelphi + 82
MyApp $00C2B927 dispatch_first_stage_intercept + 18
QuartzCore $246A9F63 <redacted> + 106
QuartzCore $2468E551 <redacted> + 204
QuartzCore $2468E211 <redacted> + 24
QuartzCore $2468D6D1 <redacted> + 368
QuartzCore $2468D3A5 <redacted> + 520
QuartzCore $24686B2B <redacted> + 138
CoreFoundation $220456C9 <redacted> + 20
CoreFoundation $220439CD <redacted> + 280
CoreFoundation $22043DFF <redacted> + 958
CoreFoundation $21F93229 CFRunLoopRunSpecific + 520
CoreFoundation $21F93015 CFRunLoopRunInMode + 108
GraphicsServices $23583AC9 GSEventRunModal + 160
UIKit $26667189 UIApplicationMain + 144
MyApp $003CBF15 Iosapi.Uikit.UIApplicationMain(Integer, Byte**, Pointer, Pointer) + 8
MyApp $00676843 Fmx.Platform.Ios.TPlatformCocoaTouch.Run() + 70
MyApp $006767FB __stub_in92s__ZN3Fmx8Platform3Ios19TPlatformCocoaTouch3RunEv + 10
MyApp $0074628F Fmx.Forms.TApplication.Run() + 182
MyApp $00C2B893 main + 246
$1FE2EF0F

因此,通过这份报告,我知道函数 Fmx.Controls.TControl.PaintChildren() 有问题,但异常(exception)情况(参数超出范围)是范围太广,无法准确了解线路和指令是造成问题的原因。我无法在开发中重现此错误,因为它仅在部署的设备中的某个时候出现。

最佳答案

日志中的+62值是问题的字节偏移量,因此您可以检查汇编器并查看堆栈中方法的偏移量,大概是$0059D4B3 并查找第 222 个字节,您应该能够通过运行调试器并中断该方法来回溯哪个操作导致了问题:显示的汇编器应该足以了解代码中问题所在的位置。

在非托管程序中很难跟踪行号,除非供应商提供开箱即用的支持。你尝试过 madExcept 吗?

我们目前正在使用 Eurekalog,但行号不适用于我们的项目。如果我没记错的话,madExcept 有这个功能。

关于delphi - 如何知道产生异常的确切行号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54400408/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com