harmony 鸿蒙Crash Event Overview

  • 2025-06-12
  • 浏览 (4)

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.

Name Type Description
time number Event triggering time, in ms.
crash_type string Crash type, which can be NativeCrash (native exception) or JsError (JS exception). For details about problem analysis, see Analyzing C++ Crash and Analyzing JS Crash.
foreground boolean Whether 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_version string Application version.
bundle_name string Application name.
pid number Process ID of an application.
uid number User ID of an application.
uuid string Error ID, which is generated based on fault information and uniquely identifies crash faults of the same type.
exception object Exception information in brief. For details, see exception. For details about all fault information, see the external_log file.
hilog string[] Log information, which displays a maximum of 100 lines of HiLog logs. For more logs, see the fault log file.
threads object[] 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+ boolean Whether 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

Name Type Description
name string Exception type.
message string Exception cause.
stack string Exception call stack.

exception of NativeCrash

Name Type Description
message string Exception cause.
signal object Signal information. For details, see signal.
thread_name string Thread name.
tid number Thread ID.
frames object[] Thread call stack. For details, see frame.

signal

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

Name Type Description
signo number Signal value.
code number Level-2 signal category.
address string Address where an access error occurs.

thread

Name Type Description
thread_name string Thread name.
tid number Thread ID.
frames object[] Thread call stack. For details, see frame.

frame

Native frame

Name Type Description
file string File name. It may also be anonymous memory mapping, such as [heap] and [stack].
symbol string Function name. If the name length exceeds 256 bytes, the name is deleted to prevent unknown issues.
buildId string Unique file ID. A file may not contain buildId. For details, see C++ Crash Logs.
pc string Number of offset bytes in a file.
offset number Number of offset bytes in a function.

JS frame

Name Type Description
file string File name.
packageName string Module package name.
symbol string Function name.
line number Line number of the exception code.
column number Column 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++)

0  赞