【问题标题】:How to use "PLCrashreporter" on Xcode Debug如何在 Xcode Debug 上使用“PLCrashreporter”
【发布时间】:2017-01-24 11:57:36
【问题描述】:

我想在 Xcode 调试器模式下使用“plcrashreporter”库。

我将“plcrashreporter”添加到我的testAPP,然后运行,因为这个代码if (debugger_should_exit()),testAPP crash。我知道是因为调试器捕获了所有崩溃而不是CrashReporter。然后我直接通过模拟器打开应用程序.它成功了。

但是,不能在 Xcode 中调试是不方便的。我猜 Debugger 上的演示会崩溃,因为作者类似debugger_should_exit().maybe 也使用了 falg P_TRACED。我尝试修改相关的地方,但也崩溃了,以及控制台日志:

[PLCrashReport] PLCrashMachExceptionForward:648: Unsupported exception behavior: 0x1 (MACH_EXCEPTION_CODES=true)
[PLCrashReport] plframe_cursor_read_compact_unwind:66: Could not find a loaded image for the current frame pc: 0x7fff6224f35b
[PLCrashReport] grow:121: WARNING: Growing the AsyncAllocator free list via vm_allocate(). Increasing the initial size of this allocator is recommended.
[PLCrashReport] plcrash_writer_write_signal:1143: Warning -- unhandled signal sicode (signo=9, code=0). This is a bug.

我找到一个应用程序可以解决这个问题,但我不知道如何。请帮助我,谢谢。

【问题讨论】:

  • 添加日志:来自调试器的消息:因信号 11 而终止
  • 一个临时解决方案,我使用debugger_should_exit() 使“PLCrashreporter”启用或不启用。

标签: ios objective-c xcode debugging


【解决方案1】:

您是希望通过应用程序进行调试,还是只是查看日志?

您可以运行更改运行模式以禁用调试模式,这将允许您查看应用程序的日志输出。因为现在禁用调试模式,PLCrashReporter 现在将运行。您可以格式化崩溃报告的打印并查看它的日志内容。

guard let crashData = try? crashReporter.loadPendingCrashReportDataAndReturnError(), let reportData = try? PLCrashReport(data: crashData), !report.isKind(of: NSNull.classForCoder()) else {
  crashReporter.purgePendingCrashReport()
  return
}

let crash: NSString = PLCrashReportTextFormatter.stringValue(for: reportData, with: PLCrashReportTextFormatiOS)! as NSString

print("Crash report:\n \(crash)")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-05
    • 2015-10-18
    • 2016-09-22
    • 1970-01-01
    • 1970-01-01
    • 2019-04-26
    • 2021-07-11
    相关资源
    最近更新 更多