1e41f4b71Sopenharmony_ci# Using Crashpad to Collect Web Component Crash Information
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **Web** component supports process crash information collection using Crashpad.  Crashpad is a process crash information handling tool provided by the Chromium kernel. When a process (including the main process and web rendering process) crashes due to the use of a **Web** component, Crashpad writes the **minidump** file in the sandbox directory of the main process of the application. This file is in binary format and the filename extension is **.dmp**. It records crash causes, thread information, and register information. You can use this file to analyze process crashes related to **Web** components.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciHow to use
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci1. When a process crashes because a **Web** component is used in the application, the corresponding **dmp** file is generated in the sandbox directory of the main process of the application. The sandbox path is as follows:
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci   ```c
10e41f4b71Sopenharmony_ci   /data/storage/el2/log/crashpad
11e41f4b71Sopenharmony_ci   ```
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci2. Obtain the DMP file in the directory and then parse it. The procedure is as follows:
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci   * Use the minidump_stackwalk tool to parse the DMP file, and then you can obtain the process crash information (crash cause, thread information, and register information). The example is as follows (Linux environment):
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci     ```c
18e41f4b71Sopenharmony_ci     ./minidump_stackwalk b678e0b5-894b-4794-9ab3-fb5d6dda06a3.dmp > parsed_stacktrace.txt
19e41f4b71Sopenharmony_ci     ```
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci     You can obtain minidump_stackwalk by compiling the source code of breakpad project. For details, see [Breakpad](https://chromium.googlesource.com/breakpad/breakpad).
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci   * Sample of the parsed file is as follows:
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci     ```c
26e41f4b71Sopenharmony_ci     Crash reason:  SIGSEGV /SEGV_MAPERR    The signal that causes the process crash, which is a segment error.
27e41f4b71Sopenharmony_ci     Crash address: 0x0
28e41f4b71Sopenharmony_ci     Process uptime: 12 seconds
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci     Thread 0 (crashed)                     The Thread 0 crashes.
31e41f4b71Sopenharmony_ci      0 libweb_engine.so + 0x2e0b340        Call stack of layer 0. 0x2e0b340 is the offset address of the .so file, which can be used to decompile and parse the crash source code (depending on the unstripped .so file).
32e41f4b71Sopenharmony_ci          x0 = 0x00000006a5719ff8    x1 = 0x000000019a5a28c0
33e41f4b71Sopenharmony_ci          x2 = 0x0000000000020441    x3 = 0x00000000000001b6
34e41f4b71Sopenharmony_ci          x4 = 0x0000000000000018    x5 = 0x0000000000008065
35e41f4b71Sopenharmony_ci          x6 = 0x0000000000008065    x7 = 0x63ff686067666d60
36e41f4b71Sopenharmony_ci          x8 = 0x0000000000000000    x9 = 0x5f129cf9e7bf008c
37e41f4b71Sopenharmony_ci         x10 = 0x0000000000000001   x11 = 0x0000000000000000
38e41f4b71Sopenharmony_ci         x12 = 0x000000069bfcc6d8   x13 = 0x0000000009a1746e
39e41f4b71Sopenharmony_ci         x14 = 0x0000000000000000   x15 = 0x0000000000000000
40e41f4b71Sopenharmony_ci         x16 = 0x0000000690df4850   x17 = 0x000000010c0d47f8
41e41f4b71Sopenharmony_ci         x18 = 0x0000000000000000   x19 = 0x0000005eea827db8
42e41f4b71Sopenharmony_ci         x20 = 0x0000005eea827c38   x21 = 0x00000006a56b1000
43e41f4b71Sopenharmony_ci         x22 = 0x00000006a8b85020   x23 = 0x00000020002103c0
44e41f4b71Sopenharmony_ci         x24 = 0x00000006a56b8a70   x25 = 0x0000000000000000
45e41f4b71Sopenharmony_ci         x26 = 0x00000006a8b84e00   x27 = 0x0000000000000001
46e41f4b71Sopenharmony_ci         x28 = 0x0000000000000000    fp = 0x0000005eea827c10
47e41f4b71Sopenharmony_ci          lr = 0x000000069fa4b33c    sp = 0x0000005eea827c10
48e41f4b71Sopenharmony_ci          pc = 0x000000069fa4b340
49e41f4b71Sopenharmony_ci         Found by: given as instruction pointer in context
50e41f4b71Sopenharmony_ci      1  libweb_engine.so + 0x2e0b338
51e41f4b71Sopenharmony_ci          fp = 0x0000005eea827d80    lr = 0x000000069fa48d44
52e41f4b71Sopenharmony_ci          sp = 0x0000005eea827c20    pc = 0x000000069fa4b33c
53e41f4b71Sopenharmony_ci         Found by: previous frame's frame pointer
54e41f4b71Sopenharmony_ci      2  libweb_engine.so + 0x2e08d40
55e41f4b71Sopenharmony_ci          fp = 0x0000005eea827e50    lr = 0x00000006a385cef8
56e41f4b71Sopenharmony_ci          sp = 0x0000005eea827d90    pc = 0x000000069fa48d44
57e41f4b71Sopenharmony_ci         Found by: previous frame's frame pointer
58e41f4b71Sopenharmony_ci      3  libweb_engine.so + 0x6c1cef4
59e41f4b71Sopenharmony_ci          fp = 0x0000005eea828260    lr = 0x00000006a0f11298
60e41f4b71Sopenharmony_ci          sp = 0x0000005eea827e60    pc = 0x00000006a385cef8
61e41f4b71Sopenharmony_ci      ......
62e41f4b71Sopenharmony_ci     ```
63e41f4b71Sopenharmony_ci
64e41f4b71Sopenharmony_ci   * Use the llvm toolchain to parse the crash source code. The example is as follows (Linux environment):
65e41f4b71Sopenharmony_ci
66e41f4b71Sopenharmony_ci     ```c
67e41f4b71Sopenharmony_ci     ./llvm-addr2line -Cfpie libweb_engine.so 0x2e0b340
68e41f4b71Sopenharmony_ci     ```
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci     The llvm-addr2line toolchain can be obtained in the SDK.
71e41f4b71Sopenharmony_ci<!--no_check-->
72