• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 
16 #ifndef DFX_DUMPCATCH_ERRNO_H
17 #define DFX_DUMPCATCH_ERRNO_H
18 
19 #include <cinttypes>
20 #include <string>
21 #include <map>
22 
23 namespace OHOS {
24 namespace HiviewDFX {
25 
26 /**
27  * @brief Dumpcatch error code
28  * It describes the error status of dumpcatch.
29  */
30 enum DumpCatchErrorCode : int32_t {
31     DUMPCATCH_ESUCCESS = 0,                           /* success */
32 
33     DUMPCATCH_EPARAM = 101,                           /* param error */
34     DUMPCATCH_NO_PROCESS,                             /* process has exited */
35     DUMPCATCH_IS_DUMPING,                             /* process is dumping */
36     DUMPCATCH_EPERMISSION,                            /* check permission error */
37     DUMPCATCH_HAS_CRASHED,                            /* process has been crashed */
38     DUMPCATCH_ECONNECT,                               /* failed to connect to faultloggerd */
39     DUMPCATCH_EWRITE,                                 /* failed to write data to faultloggerd */
40     DUMPCATCH_EFD,                                    /* buf or res fd error */
41     DUMPCATCH_EPOLL,                                  /* poll error */
42 
43     DUMPCATCH_DUMP_EPTRACE = 201,                     /* failed to ptrace thread */
44     DUMPCATCH_DUMP_EUNWIND,                           /* failed to unwind */
45     DUMPCATCH_DUMP_EMAP,                              /* failed to find map */
46 
47     DUMPCATCH_TIMEOUT_SIGNAL_BLOCK = 301,             /* signal has been block by target process */
48     DUMPCATCH_TIMEOUT_KERNEL_FROZEN,                  /* target process has been frozen in kernel */
49     DUMPCATCH_TIMEOUT_PROCESS_KILLED,                 /* target process has been killed during dumping */
50     DUMPCATCH_TIMEOUT_DUMP_SLOW,                      /* failed to fully dump due to timeout */
51 
52     DUMPCATCH_UNKNOWN = 400,                          /* unknown reason */
53 
54     DUMPCATCH_KERNELSTACK_ECREATE = 401,              /* kernelstack fail due to create hstackval fail */
55     DUMPCATCH_KERNELSTACK_EOPEN,                      /* kernelstack fail due to open bbox fail */
56     DUMPCATCH_KERNELSTACK_EIOCTL,                     /* kernelstack fail due to ioctl fail */
57     DUMPCATCH_KERNELSTACK_NONEED,                     /* no need to dump kernelstack */
58 };
59 
60 class DfxDumpCatchError {
61 public:
62     static std::string ToString(const int32_t res);
63 };
64 } // namespace HiviewDFX
65 } // namespace OHOS
66 #endif