1 /* 2 * Copyright (c) 2021 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 HIVIEW_FAULTLOG_INFO_H 16 #define HIVIEW_FAULTLOG_INFO_H 17 #include <cstdint> 18 #include <string> 19 namespace OHOS { 20 namespace HiviewDFX { 21 class FaultLogInfo { 22 public: 23 ~FaultLogInfo(); 24 25 int32_t GetId() const; 26 int32_t GetProcessId() const; 27 28 // the fd is managed by fault log info obj 29 // it will be closed in destructor 30 int32_t GetRawFileDescriptor() const; 31 int32_t GetFaultType() const; 32 int64_t GetTimeStamp() const; 33 std::string GetStringFaultType() const; 34 std::string GetFaultReason() const; 35 std::string GetModuleName() const; 36 std::string GetFaultSummary() const; 37 38 void SetId(int32_t id); 39 void SetProcessId(int32_t pid); 40 void SetTimeStamp(int64_t ts); 41 void SetFaultType(int32_t faultType); 42 void SetFaultReason(const std::string &reason); 43 void SetModuleName(const std::string &module); 44 void SetFaultSummary(const std::string &summary); 45 void SetRawFileDescriptor(int32_t fd); 46 47 private: 48 int32_t pid_ {-1}; 49 int32_t uid_ {-1}; 50 int32_t type_ {0}; 51 int32_t fd_ {-1}; 52 int64_t ts_ {0}; 53 std::string reason_; 54 std::string module_; 55 std::string summary_; 56 }; 57 } // namespace HiviewDFX 58 } // namespace OHOS 59 #endif // HIVIEW_FAULTLOG_INFO_H