* Fix osx-x86-32 debug register profile

* Some struct->typedef renaming
This commit is contained in:
pancake 2012-03-07 10:43:02 +01:00
parent 9bc3812ae8
commit 05a0196690
7 changed files with 54 additions and 56 deletions

1
TODO
View File

@ -11,6 +11,7 @@
* Make r_io happy with RList
* RBinCreate:
- mach0 create for darwin-ppc
- mz
- pe64
- plan9 bins
* add support for sockets in rarun2

View File

@ -686,22 +686,22 @@ if (dbg->bits & R_SYS_BITS_32) {
"=a1 ebx\n"
"=a2 ecx\n"
"=a3 edi\n"
"gpr eax .32 8 0\n"
"gpr ebx .32 12 0\n"
"gpr ecx .32 16 0\n"
"gpr edx .32 20 0\n"
"gpr edi .32 24 0\n"
"gpr esi .32 28 0\n"
"gpr ebp .32 32 0\n"
"gpr esp .32 36 0\n"
"seg ss .32 40 0\n"
"gpr eflags .32 44 0 c1p.a.zstido.n.rv\n"
"gpr eip .32 48 0\n"
"seg cs .32 52 0\n"
"seg ds .32 56 0\n"
"seg es .32 60 0\n"
"seg fs .32 64 0\n"
"seg gs .32 68 0\n"
"gpr eax .32 0 0\n"
"gpr ebx .32 4 0\n"
"gpr ecx .32 8 0\n"
"gpr edx .32 12 0\n"
"gpr edi .32 16 0\n"
"gpr esi .32 20 0\n"
"gpr ebp .32 24 0\n"
"gpr esp .32 28 0\n"
"seg ss .32 32 0\n"
"gpr eflags .32 36 0 c1p.a.zstido.n.rv\n"
"gpr eip .32 40 0\n"
"seg cs .32 44 0\n"
"seg ds .32 48 0\n"
"seg es .32 52 0\n"
"seg fs .32 56 0\n"
"seg gs .32 60 0\n"
);
} else if (dbg->bits == R_SYS_BITS_64) {
return strdup (

View File

@ -60,37 +60,37 @@ typedef struct r_reg_t {
#ifdef R_API
R_API const char *r_reg_get_type(int idx);
R_API struct r_reg_t *r_reg_free(struct r_reg_t *reg);
R_API struct r_reg_t *r_reg_new();
//R_API struct r_reg_t *r_reg_new();
R_API int r_reg_set_profile_string(struct r_reg_t *reg, const char *profile);
R_API int r_reg_set_profile(struct r_reg_t *reg, const char *profile);
R_API void *r_reg_free(RReg *reg);
R_API RReg *r_reg_new();
//R_API RReg *r_reg_new();
R_API int r_reg_set_profile_string(RReg *reg, const char *profile);
R_API int r_reg_set_profile(RReg *reg, const char *profile);
R_API const char *r_reg_get_name(struct r_reg_t *reg, int kind);
R_API int r_reg_set_name(struct r_reg_t *reg, int role, const char *name);
R_API const char *r_reg_get_name(RReg *reg, int kind);
R_API int r_reg_set_name(RReg *reg, int role, const char *name);
R_API struct r_reg_item_t *r_reg_get(struct r_reg_t *reg, const char *name, int type);
R_API RList *r_reg_get_list(struct r_reg_t *reg, int type);
R_API struct r_reg_item_t *r_reg_get(RReg *reg, const char *name, int type);
R_API RList *r_reg_get_list(RReg *reg, int type);
/* XXX: dupped ?? */
R_API int r_reg_type_by_name(const char *str);
R_API int r_reg_get_name_idx(const char *type);
/* value */
R_API ut64 r_reg_get_value(struct r_reg_t *reg, struct r_reg_item_t *item);
R_API int r_reg_set_value(struct r_reg_t *reg, struct r_reg_item_t *item, ut64 value);
R_API float r_reg_get_fvalue(struct r_reg_t *reg, struct r_reg_item_t *item);
R_API int r_reg_set_fvalue(struct r_reg_t *reg, struct r_reg_item_t *item, float value);
R_API ut64 r_reg_get_pvalue(struct r_reg_t *reg, struct r_reg_item_t *item, int packidx);
R_API ut64 r_reg_get_value(RReg *reg, struct r_reg_item_t *item);
R_API int r_reg_set_value(RReg *reg, struct r_reg_item_t *item, ut64 value);
R_API float r_reg_get_fvalue(RReg *reg, struct r_reg_item_t *item);
R_API int r_reg_set_fvalue(RReg *reg, struct r_reg_item_t *item, float value);
R_API ut64 r_reg_get_pvalue(RReg *reg, struct r_reg_item_t *item, int packidx);
R_API char *r_reg_get_bvalue(RReg *reg, RRegItem *item);
R_API int r_reg_set_pvalue(struct r_reg_t *reg, struct r_reg_item_t *item, ut64 value, int packidx);
R_API int r_reg_set_pvalue(RReg *reg, struct r_reg_item_t *item, ut64 value, int packidx);
/* byte arena */
R_API ut8* r_reg_get_bytes(struct r_reg_t *reg, int type, int *size);
R_API int r_reg_set_bytes(struct r_reg_t *reg, int type, const ut8* buf, int len);
R_API ut8* r_reg_get_bytes(RReg *reg, int type, int *size);
R_API int r_reg_set_bytes(RReg *reg, int type, const ut8* buf, int len);
R_API RRegArena *r_reg_arena_new (int size);
R_API void r_reg_arena_free(RRegArena* ra);
R_API int r_reg_fit_arena(struct r_reg_t *reg);
R_API int r_reg_fit_arena(RReg *reg);
R_API int r_reg_arena_set(RReg *reg, int n, int copy);
R_API void r_reg_arena_swap(RReg *reg, int copy);
R_API int r_reg_arena_push(RReg *reg);

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2008-2011 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2008-2012 pancake<nopcode.org> */
#include <stdio.h>
#include <string.h>

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2008-2010 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2008-2012 pancake<nopcode.org> */
/* TODO: write li->fds setter/getter helpers */
// TODO: return true/false everywhere,, not -1 or 0
@ -9,10 +9,10 @@
#include "list.h"
#include <stdio.h>
static struct r_io_plugin_t *io_static_plugins[] =
static RIOPlugin *io_static_plugins[] =
{ R_IO_STATIC_PLUGINS };
R_API int r_io_plugin_add(RIO *io, struct r_io_plugin_t *plugin) {
R_API int r_io_plugin_add(RIO *io, RIOPlugin *plugin) {
struct r_io_list_t *li;
if (!plugin || !plugin->name)
return R_FALSE;
@ -39,7 +39,7 @@ R_API int r_io_plugin_init(RIO *io) {
return R_TRUE;
}
R_API struct r_io_plugin_t *r_io_plugin_resolve(RIO *io, const char *filename) {
R_API RIOPlugin *r_io_plugin_resolve(RIO *io, const char *filename) {
struct list_head *pos;
list_for_each_prev(pos, &io->io_list) {
struct r_io_list_t *il = list_entry(pos, struct r_io_list_t, list);
@ -55,13 +55,13 @@ R_API struct r_io_plugin_t *r_io_plugin_resolve(RIO *io, const char *filename) {
/*
DEPRECATED
R_API struct r_io_plugin_t *r_io_plugin_resolve_fd(RIO *io, int fd) {
R_API RIOPlugin *r_io_plugin_resolve_fd(RIO *io, int fd) {
int i;
return NULL;
}
*/
R_API int r_io_plugin_open(RIO *io, int fd, struct r_io_plugin_t *plugin) {
R_API int r_io_plugin_open(RIO *io, int fd, RIOPlugin *plugin) {
#if 0
int i=0;
struct list_head *pos;
@ -82,7 +82,7 @@ R_API int r_io_plugin_open(RIO *io, int fd, struct r_io_plugin_t *plugin) {
return 0;
}
R_API int r_io_plugin_close(RIO *io, int fd, struct r_io_plugin_t *plugin) {
R_API int r_io_plugin_close(RIO *io, int fd, RIOPlugin *plugin) {
return 0;
}

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2011 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2009-2012 pancake<nopcode.org> */
#include <r_reg.h>
#include <r_util.h>
@ -57,17 +57,15 @@ R_API void r_reg_free_internal(RReg *reg) {
}
}
R_API RReg *r_reg_free(RReg *reg) {
if (reg) {
int i;
for (i=0; i<R_REG_TYPE_LAST; i++) {
r_list_destroy (reg->regset[i].pool);
reg->regset[i].pool = NULL;
}
r_reg_free_internal (reg);
free (reg);
R_API void r_reg_free(RReg *reg) {
int i;
if (!reg) return;
for (i=0; i<R_REG_TYPE_LAST; i++) {
r_list_destroy (reg->regset[i].pool);
reg->regset[i].pool = NULL;
}
return NULL;
r_reg_free_internal (reg);
free (reg);
}
R_API RReg *r_reg_new() {
@ -270,8 +268,7 @@ R_API ut64 r_reg_cmp(RReg *reg, RRegItem *item) {
RRegArena *dst = r_list_head (reg->regset[item->type].pool)->n->data;
if (off+len>src->size) len = src->size-off;
if (off+len>dst->size) len = dst->size-off;
if (len>0)
if (memcmp (dst->bytes+off, src->bytes+off, len)) {
if (len>0 && memcmp (dst->bytes+off, src->bytes+off, len)) {
ut64 ret;
int ptr = !(reg->iters%2);
r_reg_arena_set (reg, ptr, 0);

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2009-2012 pancake<nopcode.org> */
#include <r_reg.h>
#include <r_util.h>