Tong Shen | 547cdfd | 2014-08-05 01:54:19 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_COMPILER_UTILS_DWARF_CFI_H_ |
| 18 | #define ART_COMPILER_UTILS_DWARF_CFI_H_ |
| 19 | |
| 20 | #include <vector> |
| 21 | |
| 22 | namespace art { |
| 23 | |
| 24 | /** |
| 25 | * @brief Enter a 'DW_CFA_advance_loc' into an FDE buffer |
| 26 | * @param buf FDE buffer. |
| 27 | * @param increment Amount by which to increase the current location. |
| 28 | */ |
| 29 | void DW_CFA_advance_loc(std::vector<uint8_t>* buf, uint32_t increment); |
| 30 | |
| 31 | /** |
| 32 | * @brief Enter a 'DW_CFA_offset_extended_sf' into an FDE buffer |
| 33 | * @param buf FDE buffer. |
| 34 | * @param reg Register number. |
| 35 | * @param offset Offset of register address from CFA. |
| 36 | */ |
| 37 | void DW_CFA_offset_extended_sf(std::vector<uint8_t>* buf, int reg, int32_t offset); |
| 38 | |
| 39 | /** |
| 40 | * @brief Enter a 'DW_CFA_offset' into an FDE buffer |
| 41 | * @param buf FDE buffer. |
| 42 | * @param reg Register number. |
| 43 | * @param offset Offset of register address from CFA. |
| 44 | */ |
| 45 | void DW_CFA_offset(std::vector<uint8_t>* buf, int reg, uint32_t offset); |
| 46 | |
| 47 | /** |
| 48 | * @brief Enter a 'DW_CFA_def_cfa_offset' into an FDE buffer |
| 49 | * @param buf FDE buffer. |
| 50 | * @param offset New offset of CFA. |
| 51 | */ |
| 52 | void DW_CFA_def_cfa_offset(std::vector<uint8_t>* buf, int32_t offset); |
| 53 | |
| 54 | /** |
| 55 | * @brief Enter a 'DW_CFA_remember_state' into an FDE buffer |
| 56 | * @param buf FDE buffer. |
| 57 | */ |
| 58 | void DW_CFA_remember_state(std::vector<uint8_t>* buf); |
| 59 | |
| 60 | /** |
| 61 | * @brief Enter a 'DW_CFA_restore_state' into an FDE buffer |
| 62 | * @param buf FDE buffer. |
| 63 | */ |
| 64 | void DW_CFA_restore_state(std::vector<uint8_t>* buf); |
| 65 | |
| 66 | /** |
| 67 | * @brief Write FDE header into an FDE buffer |
| 68 | * @param buf FDE buffer. |
| 69 | */ |
| 70 | void WriteFDEHeader(std::vector<uint8_t>* buf); |
| 71 | |
| 72 | /** |
| 73 | * @brief Set 'address_range' field of an FDE buffer |
| 74 | * @param buf FDE buffer. |
| 75 | */ |
| 76 | void WriteFDEAddressRange(std::vector<uint8_t>* buf, uint32_t data); |
| 77 | |
| 78 | /** |
| 79 | * @brief Set 'length' field of an FDE buffer |
| 80 | * @param buf FDE buffer. |
| 81 | */ |
| 82 | void WriteCFILength(std::vector<uint8_t>* buf); |
| 83 | |
| 84 | /** |
| 85 | * @brief Pad an FDE buffer with 0 until its size is a multiple of 4 |
| 86 | * @param buf FDE buffer. |
| 87 | */ |
| 88 | void PadCFI(std::vector<uint8_t>* buf); |
| 89 | } // namespace art |
| 90 | |
| 91 | #endif // ART_COMPILER_UTILS_DWARF_CFI_H_ |