1 /* 2 * Copyright (c) 2022 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 OS_OHOS_H 17 #define OS_OHOS_H 18 19 #include <inttypes.h> 20 #include <stdbool.h> 21 22 #include "libunwind_i.h" 23 24 struct map_info; 25 struct unw_cursor; 26 27 extern unw_word_t unw_get_rel_pc (struct unw_cursor *cursor); 28 extern unw_word_t unw_get_previous_instr_sz(unw_cursor_t *cursor); 29 extern struct map_info* unw_get_map (struct unw_cursor *cursor); 30 extern struct map_info* unw_get_maps (struct unw_cursor *cursor); 31 extern int unw_get_symbol_info(struct unw_cursor *cursor, uint64_t pc, int buf_sz, char *buf, uint64_t *sym_start, uint64_t *sym_end); 32 extern int unw_get_symbol_info_by_pc(unw_addr_space_t as, uint64_t pc, int buf_sz, char *buf, uint64_t *sym_start, uint64_t *sym_end); 33 extern void unw_set_target_pid(unw_addr_space_t as, int pid); 34 extern void unw_init_local_address_space(unw_addr_space_t* as); 35 extern void unw_destroy_local_address_space(unw_addr_space_t as); 36 extern void unw_set_context(unw_cursor_t * cursor, uintptr_t regs[], int reg_sz); 37 extern void unw_set_adjust_pc(struct unw_cursor *cursor, uint64_t pc); 38 extern int unw_step_ark_managed_native_frame(int pid, uintptr_t* pc, uintptr_t* fp, uintptr_t* sp, char* buf, size_t buf_sz); 39 extern int unw_get_ark_js_heap_crash_info(int pid, uintptr_t* x20, uintptr_t* fp, int out_js_info, char* buf, size_t buf_sz); 40 extern bool unw_is_ark_managed_frame(struct cursor* c); 41 extern bool unw_get_build_id(struct map_info* map, uint8_t** build_id_ptr, size_t* length); 42 43 #endif 44