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
10extern "C" {
11#endif
12
13const char* ptrace_event_name(int event);
14int write_mem(int pid, uintptr_t addr, const void* buf, int buf_size);
15int 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
18int gdb_disass(int pid, void* base, int len);
19int gdb_mem(int pid, void* base, int len, int group);
20int gdb_reg(int tid, USER_REGS* out);
21int gdb_pause(int pid);
22int gdb_step(int pid);
23int gdb_cont(int pid);
24int gdb_bt(int tid);
25int gdb_break(int tid, uintptr_t address, uint32_t* old_value);
26int gdb_delete(int tid, uintptr_t address, uint32_t old_value);
27int 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