radare2/libr/reg/reg.c
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

43 lines
739 B
C

#include <r_reg.h>
#include <r_asm.h>
R_API struct r_reg_t *r_reg_init(struct r_reg_t *reg)
{
if (reg) {
reg->h = NULL;
INIT_LIST_HEAD(&reg->handles);
}
return reg;
}
R_API struct r_reg_t *r_reg_new()
{
struct r_reg_t *r = MALLOC_STRUCT(struct r_reg_t);
return r_reg_init(r);
}
R_API struct r_reg_t *r_reg_free(struct r_reg_t *reg)
{
if (reg) {
// TODO: free more things here
free(reg);
}
return NULL;
}
int r_reg_set_arch(struct r_reg_t *reg, int arch, int bits)
{
int ret = R_FALSE;
struct list_head *pos;
list_for_each(pos, &reg->handles) {
struct r_reg_handle_t *h = list_entry(pos, struct r_reg_handle_t, list);
if (h->is_arch(arch, bits)) {
reg->h = h;
ret = R_TRUE;
break;
}
}
return ret;
}