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

时间:2019-01-28 10:55:49

标签: delphi firemonkey

要获取有关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()中存在错误,但是异常(参数超出范围)的范围太广,无法确切地知道行并且指令是负责任的问题。我无法在开发中重现此错误,因为该错误仅在部署的设备中的某个时间出现。

1 个答案:

答案 0 :(得分:0)

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

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

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