mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-02 18:27:18 +00:00
79 lines
1.9 KiB
C
79 lines
1.9 KiB
C
#ifndef _INCLUDE_R_DEBUG_H_
|
|
#define _INCLUDE_R_DEBUG_H_
|
|
|
|
#include <r_types.h>
|
|
#include <r_util.h>
|
|
#include <r_reg.h>
|
|
#include <r_syscall.h>
|
|
#include "list.h"
|
|
|
|
enum {
|
|
R_DBG_ARCH_NULL = 0,
|
|
R_DBG_ARCH_X86,
|
|
R_DBG_ARCH_ARM,
|
|
R_DBG_ARCH_PPC,
|
|
R_DBG_ARCH_M68K,
|
|
R_DBG_ARCH_JAVA,
|
|
R_DBG_ARCH_MIPS,
|
|
R_DBG_ARCH_SPARC,
|
|
R_DBG_ARCH_CSR,
|
|
R_DBG_ARCH_MSIL,
|
|
R_DBG_ARCH_OBJD,
|
|
R_DBG_ARCH_BF
|
|
};
|
|
|
|
/* TODO: pass dbg and user data pointer everywhere */
|
|
struct r_debug_handle_t {
|
|
const char *name;
|
|
int (*attach)(int pid);
|
|
int (*detach)(int pid);
|
|
int (*step)(int pid); // if step() is NULL; reimplement it with traps
|
|
int (*cont)(int pid);
|
|
int (*wait)(int pid);
|
|
int (*contsc)(int pid, int sc);
|
|
struct list_head list;
|
|
};
|
|
|
|
struct r_debug_t {
|
|
int pid; /* selected process id */
|
|
int tid; /* selected thread id */
|
|
int swstep; /* steps with software traps */
|
|
int steps; /* counter of steps done */
|
|
struct r_reg_t reg;
|
|
/* io */
|
|
int (*read)(int pid, u64 addr, u8 *buf, int len);
|
|
int (*write)(int pid, u64 addr, u8 *buf, int len);
|
|
struct r_debug_handle_t *h;
|
|
struct list_head handlers;
|
|
};
|
|
|
|
int r_debug_handle_add(struct r_debug_t *dbg, struct r_debug_handle_t *foo);
|
|
int r_debug_handle_set(struct r_debug_t *dbg, const char *str);
|
|
int r_debug_handle_init(struct r_debug_t *dbg);
|
|
int r_debug_init(struct r_debug_t *dbg);
|
|
|
|
int r_debug_step(struct r_debug_t *dbg, int steps);
|
|
int r_debug_continue(struct r_debug_t *dbg);
|
|
int r_debug_select(struct r_debug_t *dbg, int pid, int tid);
|
|
/* handle.c */
|
|
int r_debug_handle_init(struct r_debug_t *dbg);
|
|
int r_debug_handle_set(struct r_debug_t *dbg, const char *str);
|
|
int r_debug_handle_list(struct r_debug_t *dbg, const char *str);
|
|
int r_debug_handle_add(struct r_debug_t *dbg, struct r_debug_handle_t *foo);
|
|
|
|
#if 0
|
|
Missing callbacks
|
|
=================
|
|
- alloc
|
|
- dealloc
|
|
- list maps
|
|
- change memory protections
|
|
- touchtrace
|
|
- filedescriptor set/get/mod..
|
|
- get/set signals
|
|
- get regs, set regs
|
|
|
|
#endif
|
|
|
|
#endif
|