openharmony 鸿蒙 hiappevent-watcher-crash-events

2025-06-12 浏览 (1)

Crash Event Overview

Overview

Crash is an unexpected exit of an application process. Specifically, crash events occur in the following scenarios:

  1. The native code does not process C++ crash signals.
  2. The JS/ArkTS code does process exceptions.

The following describes the meanings and specifications of fields in crash events. For details about how to use the ArkTs and C/C++ APIs provided by HiAppEvent to subscribe to system crash events, see the following documents:

Fields

params

The params parameter in the event information is described as follows.

NameTypeDescription
timenumberEvent triggering time, in ms.
crash_typestringCrash type, which can be NativeCrash (native exception) or JsError (JS exception). For details about problem analysis, see Analyzing C++ Crash and Analyzing JS Crash.
foregroundbooleanWhether the application is running in the foreground. The value true indicates that the application is in the foreground, and the value false indicates the opposite.
bundle_versionstringApplication version.
bundle_namestringApplication name.
pidnumberProcess ID of an application.
uidnumberUser ID of an application.
uuidstringError ID, which is generated based on fault information and uniquely identifies crash faults of the same type.
exceptionobjectException information in brief. For details, see exception. For details about all fault information, see the external_log file.
hilogstring[]Log information, which displays a maximum of 100 lines of HiLog logs. For more logs, see the fault log file.
threadsobject[]Full thread call stack. For details, see thread. This field applies only to NativeCrash events.
external_log12+string[]Path of the error log file. To avoid failed writing of new log files due to insufficient directory space, delete the log files after they are processed. For details about the threshold, see the log_over_limit field.
log_over_limit12+booleanWhether the size of generated fault log files and existing log files exceeds the upper limit (5 MB). The value true indicates that the upper limit is exceeded and logs fail to be written. The value false indicates that the upper limit is not exceeded.

exception

exception of JsError

NameTypeDescription
namestringException type.
messagestringException cause.
stackstringException call stack.

exception of NativeCrash

NameTypeDescription
messagestringException cause.
signalobjectSignal information. For details, see signal.
thread_namestringThread name.
tidnumberThread ID.
framesobject[]Thread call stack. For details, see frame.

signal

For details about the signals, see C++ Crash Signals.

NameTypeDescription
signonumberSignal value.
codenumberLevel-2 signal category.
addressstringAddress where an access error occurs.

thread

NameTypeDescription
thread_namestringThread name.
tidnumberThread ID.
framesobject[]Thread call stack. For details, see frame.

frame

Native frame

NameTypeDescription
filestringFile name. It may also be anonymous memory mapping, such as [heap] and [stack].
symbolstringFunction name. If the name length exceeds 256 bytes, the name is deleted to prevent unknown issues.
buildIdstringUnique file ID. A file may not contain buildId. For details, see C++ Crash Logs.
pcstringNumber of offset bytes in a file.
offsetnumberNumber of offset bytes in a function.

JS frame

NameTypeDescription
filestringFile name.
packageNamestringModule package name.
symbolstringFunction name.
linenumberLine number of the exception code.
columnnumberColumn number of the exception code.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Performance Analysis Kit

harmony 鸿蒙Analyzing Application Freeze

harmony 鸿蒙Development of Application Recovery

harmony 鸿蒙Analyzing C++ Crash

harmony 鸿蒙Development of Error Manager

harmony 鸿蒙hdc

harmony 鸿蒙Event Reporting

harmony 鸿蒙Introduction to HiAppEvent

harmony 鸿蒙Subscribing to Address Sanitizer Events (ArkTS)

harmony 鸿蒙Subscribing to Address Sanitizer Events (C/C++)

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/sKHYQn