• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef DFX_COREDUMP_COMMON_H
16 #define DFX_COREDUMP_COMMON_H
17 #if defined(__aarch64__)
18 
19 #include <csignal>
20 #include <cstdint>
21 #include <sys/types.h>
22 #include <sys/ptrace.h>
23 #include <sys/procfs.h>
24 #include <sys/user.h>
25 
26 namespace OHOS {
27 namespace HiviewDFX {
28 
29 struct DumpMemoryRegions {
30     uint64_t startHex;
31     uint64_t endHex;
32     uint64_t offsetHex;
33     uint64_t memorySizeHex;
34     char start[17];
35     char end[17];
36     char priority[5];
37     char offset[9];
38     char dev[16];
39     unsigned int inode;
40     char pathName[256];
41 };
42 
43 struct FileHeader {
44     uint64_t count;
45     uint64_t pageSize;
46 };
47 
48 struct FileMap {
49     uint64_t start;
50     uint64_t end;
51     uint64_t offset;
52 };
53 
54 struct UserPacMask {
55     uint64_t dataMask;
56     uint64_t insnMask;
57 };
58 
59 struct CoreDumpThread {
60     pid_t targetPid = 0;
61     pid_t targetTid = 0;
62     pid_t vmPid = 0;
63 };
64 
65 struct CoreDumpKeyThreadData {
66     UserPacMask ntUserPacMask;
67     struct user_fpsimd_struct ntFpregset;
68     int fpRegValid;
69     siginfo_t ntSiginfo;
70     prstatus_t ntPrstatus;
71     int prStatusValid;
72 
CoreDumpKeyThreadDataCoreDumpKeyThreadData73     CoreDumpKeyThreadData()
74         : ntUserPacMask {},
75           ntFpregset {},
76           fpRegValid(0),
77           ntSiginfo {},
78           ntPrstatus {},
79           prStatusValid(0)
80     {}
81 };
82 
83 } // namespace HiviewDFX
84 } // namespace OHOS
85 #endif
86 #endif