radare2/libr/include/r_bp.h
pancake 91ad40d663 * Major unfinished refactoring for r_debug and r_bp
- radare2 debugger is now broken
  - r_reg has grown a bit more
  - Better separation of debugger elements
* r_bp now has r_bp_add_hw and r_bp_add_sw() calls
  - Added minimal support for breakpoint handlers
  - Import th0rpe's watchpoint expression parser engine
* iob moved from r_debug to r_bp
* Arch types has been moved into r_asm
  - Soft compile time dependency
* Update pkg-config .pc files
2009-09-14 00:37:28 +02:00

100 lines
2.4 KiB
C

#ifndef _INCLUDE_LIBR_BP_H_
#define _INCLUDE_LIBR_BP_H_
#include <r_types.h>
#include <r_io.h>
#include "list.h"
#define R_BP_MAXPIDS 10
#define R_BP_CONT_NORMAL 0
#define R_BP_CONT_NORMAL 0
struct r_bp_arch_t {
int length;
int endian;
const ut8 *bytes;
};
enum {
R_BP_TYPE_SW,
R_BP_TYPE_HW,
R_BP_TYPE_COND,
R_BP_TYPE_FAULT,
};
struct r_bp_handle_t {
char *name;
char *arch;
int type; // R_BP_TYPE_SW
int nbps;
struct r_bp_arch_t *bps;
struct list_head list;
};
struct r_bp_item_t {
ut64 addr;
int size;
int rwx;
int hw;
int trace;
int enabled;
int hits;
ut8 *obytes; /* original bytes */
ut8 *bbytes; /* breakpoint bytes */
int pids[R_BP_MAXPIDS];
struct list_head list;
};
struct r_bp_t {
int trace_all;
ut64 trace_bp;
int nbps;
int stepcont;
struct r_io_bind_t iob; // compile time dependency
struct r_bp_handle_t *cur;
struct list_head plugins;
struct list_head bps;
};
enum {
R_BP_READ = 1,
R_BP_WRITE = 2,
R_BP_EXEC = 4,
};
R_API int r_bp_init(struct r_bp_t *bp);
R_API struct r_bp_t *r_bp_new();
R_API struct r_bp_t *r_bp_free(struct r_bp_t *bp);
R_API int r_bp_del(struct r_bp_t *bp, ut64 addr);
R_API int r_bp_handle_add(struct r_bp_t *bp, struct r_bp_handle_t *foo);
R_API int r_bp_handle_set(struct r_bp_t *bp, const char *name);
R_API int r_bp_handle_del(struct r_bp_t *bp, const char *name);
R_API void r_bp_handle_list(struct r_bp_t *bp);
R_API int r_bp_in(struct r_bp_t *bp, ut64 addr, int rwx);
R_API int r_bp_list(struct r_bp_t *bp, int rad);
R_API int r_bp_get_bytes(struct r_bp_t *bp, ut8 *buf, int len, int endian, int idx);
R_API int r_bp_set_trace(struct r_bp_t *bp, ut64 addr, int set);
R_API int r_bp_set_trace_bp(struct r_bp_t *bp, ut64 addr, int set);
R_API struct r_bp_item_t *r_bp_enable(struct r_bp_t *bp, ut64 addr, int set);
R_API int r_bp_add_cond(struct r_bp_t *bp, const char *cond);
R_API int r_bp_del_cond(struct r_bp_t *bp, int idx);
R_API int r_bp_add_fault(struct r_bp_t *bp, ut64 addr, int size, int rwx);
R_API struct r_bp_item_t *r_bp_add_sw(struct r_bp_t *bp, ut64 addr, int size, int rwx);
R_API struct r_bp_item_t *r_bp_add_hw(struct r_bp_t *bp, ut64 addr, int size, int rwx);
/* plugin pointers */
extern struct r_bp_handle_t r_bp_plugin_x86;
extern struct r_bp_handle_t r_bp_plugin_arm;
extern struct r_bp_handle_t r_bp_plugin_powerpc;
extern struct r_bp_handle_t r_bp_plugin_mips;
extern struct r_bp_handle_t r_bp_plugin_sparc;
#endif