| 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #ifndef _DEBUG_H |
| 6 | #define _DEBUG_H |
| 7 | #include <inttypes.h> |
| 8 | |
| 9 | #ifdef __cplusplus |
| 10 | extern "C" { |
| 11 | #endif |
| 12 | |
| 13 | const char* ptrace_event_name(int event); |
| 14 | int write_mem(int pid, uintptr_t addr, const void* buf, int buf_size); |
| 15 | int read_mem(int pid, uintptr_t addr, void* buf, int buf_size); |
| 16 | |
| 17 | // these function used by gdb console to debug dead-lock/crash in recording |
| 18 | int gdb_disass(int pid, void* base, int len); |
| 19 | int gdb_mem(int pid, void* base, int len, int group); |
| 20 | int gdb_reg(int tid, USER_REGS* out); |
| 21 | int gdb_pause(int pid); |
| 22 | int gdb_step(int pid); |
| 23 | int gdb_cont(int pid); |
| 24 | int gdb_bt(int tid); |
| 25 | int gdb_break(int tid, uintptr_t address, uint32_t* old_value); |
| 26 | int gdb_delete(int tid, uintptr_t address, uint32_t old_value); |
| 27 | int gdb_print(int pid, uintptr_t module_base, const char* filename, |
| 28 | uintptr_t var_address, const char* type_name); |
| 29 | |
| 30 | #ifdef __cplusplus |
| 31 | } |
| 32 | #endif |
| 33 | |
| 34 | #endif |
| 35 | |
| 36 | |