• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 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_FRAME_H
16 #define DFX_FRAME_H
17 
18 #include <cinttypes>
19 #include <memory>
20 #include <string>
21 #include "string_printf.h"
22 
23 namespace OHOS {
24 namespace HiviewDFX {
25 class DfxMap;
26 
27 /**
28  * @brief Native Frame struct
29  * It serves as the public definition of the native stack frame.
30  */
31 struct DfxFrame {
32     /** whether is Js frame */
33     bool isJsFrame {false};
34     /** frame index */
35     size_t index {0};
36     /** program counter register value */
37     uint64_t pc {0};
38     /** relative program counter value */
39     uint64_t relPc {0};
40     /** stack pointer value */
41     uint64_t sp {0};
42     /** map offset */
43     uint64_t mapOffset {0};
44     /** function byte offset */
45     uint64_t funcOffset {0};
46     /** elf file name */
47     std::string mapName {""};
48     /** function name */
49     std::string funcName {""};
50     /** elf file build id */
51     std::string buildId {""};
52     /** map cache */
53     std::shared_ptr<DfxMap> map;
54 #if defined(ENABLE_MIXSTACK)
55     /** Js frame code line */
56     int32_t line {0};
57     /** Js frame code column */
58     int32_t column {0};
59 #endif
60 };
61 } // namespace HiviewDFX
62 } // namespace OHOS
63 #endif
64