* Uppsercase classnames (rCore -> RCore)

- Fixes ruby warnings
  - Follow java syntax conventions
  - Helped to identify and fix bugs in many vapis
  - Sync swig examples
  - Add test-r_core.rb (ruby test for RCore)
* Some work in r_cons, some refactoring and cleanup
  - scr.html is now working again
  - w32 cons support should work now
  - Rename r_cons_get_columns -> r_cons_get_size()
  - But it needs more work
* Typedef all r_range, r_parse and r_anal structs
  - Add missing r_lib.pc in configure.acr
* 'make' clean now removes the libr* in swig/${LANG}/
This commit is contained in:
pancake 2010-01-26 01:28:33 +01:00
parent bd84d7dfa0
commit 54bdfb22bd
76 changed files with 809 additions and 821 deletions

2
configure vendored
View File

@ -436,7 +436,7 @@ for A in ${ENVWORDS} ; do
SEDFLAGS="${SEDFLAGS}s,@${A}@,${VAR},g;"
done
SEDFLAGS="${SEDFLAGS}'"
for A in ./config-user.mk libr/include/r_userconf.h pkgcfg/libr.pc pkgcfg/r_io.pc pkgcfg/r_asm.pc pkgcfg/r_bin.pc pkgcfg/r_bininfo.pc pkgcfg/r_anal.pc pkgcfg/r_hash.pc pkgcfg/r_cons.pc pkgcfg/r_diff.pc pkgcfg/r_core.pc pkgcfg/r_lang.pc pkgcfg/r_socket.pc pkgcfg/r_debug.pc pkgcfg/r_reg.pc pkgcfg/r_cmd.pc pkgcfg/r_config.pc pkgcfg/r_flags.pc pkgcfg/r_meta.pc pkgcfg/r_line.pc pkgcfg/r_syscall.pc pkgcfg/r_macro.pc pkgcfg/r_sign.pc pkgcfg/r_util.pc pkgcfg/r_trace.pc pkgcfg/r_search.pc pkgcfg/r_vm.pc pkgcfg/r_var.pc pkgcfg/r_th.pc pkgcfg/r_bp.pc pkgcfg/r_db.pc ; do # SUBDIRS
for A in ./config-user.mk libr/include/r_userconf.h pkgcfg/libr.pc pkgcfg/r_io.pc pkgcfg/r_asm.pc pkgcfg/r_bin.pc pkgcfg/r_bininfo.pc pkgcfg/r_anal.pc pkgcfg/r_hash.pc pkgcfg/r_cons.pc pkgcfg/r_diff.pc pkgcfg/r_core.pc pkgcfg/r_lang.pc pkgcfg/r_socket.pc pkgcfg/r_debug.pc pkgcfg/r_reg.pc pkgcfg/r_cmd.pc pkgcfg/r_config.pc pkgcfg/r_flags.pc pkgcfg/r_meta.pc pkgcfg/r_line.pc pkgcfg/r_syscall.pc pkgcfg/r_macro.pc pkgcfg/r_sign.pc pkgcfg/r_util.pc pkgcfg/r_trace.pc pkgcfg/r_search.pc pkgcfg/r_vm.pc pkgcfg/r_var.pc pkgcfg/r_th.pc pkgcfg/r_bp.pc pkgcfg/r_db.pc pkgcfg/r_lib.pc ; do # SUBDIRS
if [ -f "${VPATH}/${A}.acr" ]; then
SD_TARGET=${A}
else

View File

@ -83,4 +83,5 @@ SUBDIRS ./config-user.mk libr/include/r_userconf.h
pkgcfg/r_th.pc
pkgcfg/r_bp.pc
pkgcfg/r_db.pc
pkgcfg/r_lib.pc
;

View File

@ -25,15 +25,18 @@ libs:
libr: .objs libr2.${EXT_SO} libr2.${EXT_AR}
# libr.a is not generated by default
libr2.${EXT_AR}:
ar -r libr2.${EXT_AR} .objs/*.o
ifeq ($(WITHPIC),1)
libr2.${EXT_SO}:
${CC} -shared ${PIC_CFLAGS} .objs/*.o -o libr2.${EXT_SO}
libr2.${EXT_AR}:
@echo No archive libr.a. Try --without-pic in configure
else
libr2.${EXT_SO}:
libr2.${EXT_AR}:
ar -r libr2.${EXT_AR} .objs/*.o
endif
# XXX needs autodetection of deps to remake and so..

View File

@ -55,10 +55,10 @@ R_API int r_bp_get_bytes(struct r_bp_t *bp, ut8 *buf, int len, int endian, int i
return 0;
}
R_API rBreakpointItem *r_bp_at_addr(rBreakpoint *bp, ut64 addr, int rwx)
R_API RBreakpointItem *r_bp_at_addr(RBreakpoint *bp, ut64 addr, int rwx)
{
struct list_head *pos;
rBreakpointItem *b;
RBreakpointItem *b;
eprintf ("===ataddr=== 0x%08llx\n", addr);
list_for_each(pos, &bp->bps) {

View File

@ -1,4 +1,7 @@
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
#include <r_bp.h>
#include "../config.h"
// TODO: rename from r_debug_ ...
#if 0
@ -78,14 +81,14 @@ R_API int r_bp_restore(struct r_bp_t *bp, int set)
return R_TRUE;
}
R_API int r_bp_recoil(rBreakpoint *bp, ut64 addr)
R_API int r_bp_recoil(RBreakpoint *bp, ut64 addr)
{
rBreakpointItem *b = r_bp_at_addr (bp, addr, 0xFFFFFF);
if (b) {
eprintf("HIT AT ADDR 0x%llx\n", addr);
eprintf(" recoil = %d\n", b->recoil);
eprintf(" size = %d\n", b->size);
}
RBreakpointItem *b = r_bp_at_addr (bp, addr, 0xFFFFFF);
if (b) {
eprintf("HIT AT ADDR 0x%llx\n", addr);
eprintf(" recoil = %d\n", b->recoil);
eprintf(" size = %d\n", b->size);
}
if (b) if (!b->hw && ((b->addr + b->size) == addr))
return b->recoil;
return 0;

View File

@ -36,8 +36,10 @@ static char *r_cons_buffer = NULL;
static char *r_cons_lastline = NULL;
char *r_cons_filterline = NULL;
char *r_cons_teefile = NULL;
int r_cons_is_html = 0;
int r_cons_interactive = 1;
int r_cons_is_interactive = R_TRUE;
int r_cons_is_html = R_FALSE;
int r_cons_rows = 0;
int r_cons_columns = 0;
int r_cons_lines = 0;
int r_cons_noflush = 0;
@ -79,8 +81,13 @@ R_API void r_cons_break_end()
R_API int r_cons_init()
{
r_cons_stdin_fd = stdin;
r_cons_breaked = R_FALSE;
r_cons_is_interactive = R_TRUE;
r_cons_is_html = R_FALSE;
r_cons_noflush = R_FALSE;
r_cons_get_size (NULL);
#if HAVE_DIETLINE
r_line_init();
r_line_init ();
#endif
//r_cons_palette_init(NULL);
return 0;
@ -101,36 +108,19 @@ static void palloc(int moar)
R_API int r_cons_eof()
{
return feof(r_cons_stdin_fd);
return feof (r_cons_stdin_fd);
}
/* XXX unused ? */
#if 0
static void r_cons_print_real(const char *buf)
{
#if __WINDOWS__
if (r_cons_stdout_fd == 1)
r_cons_w32_print(buf);
else
#endif
if (r_cons_is_html)
r_cons_html_print(buf);
else write(r_cons_stdout_fd, buf, r_cons_buffer_len);
}
#endif
R_API void r_cons_gotoxy(int x, int y)
{
#if __WINDOWS__
static HANDLE hStdout = NULL;
COORD coord;
coord.X = x;
coord.Y = y;
if(!hStdout)
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hStdout,coord);
#else
r_cons_strcat("\x1b[0;0H");
@ -219,7 +209,7 @@ R_API void r_cons_grep(const char *str)
if (*ptr) {
free(grepstr);
grepstr = (char *)strdup(ptr);
/* set the rest of words to grep */
/* set the rest of words to grep */
grepstrings_n = 0;
// TODO: refactor this ugly loop
optr = grepstr;
@ -251,9 +241,10 @@ R_API void r_cons_flush()
if (r_cons_noflush)
return;
if (r_cons_interactive) {
if (r_cons_is_interactive) {
if (r_cons_buffer_len > CONS_MAX_USER) {
if (r_cons_yesno('n', "Do you want to print %d bytes? (y/N)", r_cons_buffer_len)== 0) {
if (r_cons_yesno('n', "Do you want to print %d bytes? (y/N)",
r_cons_buffer_len)== 0) {
r_cons_reset();
return;
}
@ -263,11 +254,18 @@ R_API void r_cons_flush()
if (tee&&tee[0]) {
FILE *d = fopen(tee, "a+");
if (d != NULL) {
fwrite(r_cons_buffer, strlen(r_cons_buffer), 1, d);
fwrite (r_cons_buffer, strlen(r_cons_buffer), 1, d);
fclose(d);
}
// TODO: make this 'write' portable
} else write(1, r_cons_buffer, r_cons_buffer_len);
} else {
// is_html must be a filter, not a write endpoint
if (r_cons_is_html) r_cons_html_print (r_cons_buffer); else
#if __WINDOWS__
r_cons_w32_print (r_cons_buffer);
#else
write (1, r_cons_buffer, r_cons_buffer_len);
#endif
}
r_cons_reset();
}
@ -277,18 +275,13 @@ R_API void r_cons_printf(const char *format, ...)
char buf[CONS_BUFSZ];
va_list ap;
if (strchr(format,'%')==NULL) {
r_cons_strcat(format);
return;
}
va_start(ap, format);
len = vsnprintf(buf, CONS_BUFSZ-1, format, ap);
if (len>0)
r_cons_memcat(buf, len);
va_end(ap);
if (strchr (format, '%')) {
va_start (ap, format);
len = vsnprintf (buf, CONS_BUFSZ-1, format, ap);
if (len>0)
r_cons_memcat (buf, len);
va_end (ap);
} else r_cons_strcat (format);
}
/* TODO: use const char * instead ..strdup at the beggining? */
@ -386,6 +379,8 @@ R_API void r_cons_newline()
else r_cons_strcat("\n");
}
#if 0
/* TODO: deprecated */
R_API int r_cons_get_columns()
{
int columns_i = r_cons_get_real_columns();
@ -399,29 +394,28 @@ R_API int r_cons_get_columns()
return columns_i;
}
#endif
R_API int r_cons_get_real_columns()
{
R_API int r_cons_get_size (int *rows) {
r_cons_columns = 80;
r_cons_rows = 23;
#if __UNIX__
struct winsize win;
if (ioctl(1, TIOCGWINSZ, &win)) {
/* default values */
win.ws_col = 80;
win.ws_row = 23;
if (ioctl (1, TIOCGWINSZ, &win) == 0) {
r_cons_columns = win.ws_col;
r_cons_rows = win.ws_row;
}
#ifdef RADARE_CORE
config.width = win.ws_col;
config.height = win.ws_row;
#endif
return win.ws_col;
#else
return 80;
const char *str = r_sys_getenv ("COLUMNS");
if (str != NULL)
r_cons_columns = atoi (str);
#endif
if (rows)
*rows = r_cons_rows;
return r_cons_columns;
}
R_API int r_cons_yesno(int def, const char *fmt, ...)
{
R_API int r_cons_yesno(int def, const char *fmt, ...) {
va_list ap;
int key = def;
va_start(ap, fmt);
@ -439,7 +433,6 @@ R_API int r_cons_yesno(int def, const char *fmt, ...)
}
/**
*
* void r_cons_set_raw( [0,1] )
*
* Change canonicality of the terminal
@ -471,8 +464,7 @@ R_API void r_cons_set_raw(int b)
termios_init = 1;
}
tcsetattr(0, TCSANOW, &tio_new);
} else
tcsetattr(0, TCSANOW, &tio_old);
} else tcsetattr(0, TCSANOW, &tio_old);
#else
/* TODO : W32 */
#endif
@ -485,9 +477,9 @@ R_API void r_cons_set_raw(int b)
R_API int r_cons_get_arrow(int ch)
{
#if 0
printf("ARROW(0x%x)\n", ch);
fflush(stdout);
r_sys_sleep(3);
printf("ARROW(0x%x)\n", ch);
fflush(stdout);
r_sys_sleep(3);
#endif
if (ch==0x1b) {
ch = r_cons_readchar();
@ -501,10 +493,8 @@ r_sys_sleep(3);
case 0x42: ch='j'; break; // down
case 0x43: ch='l'; break; // right
case 0x44: ch='h'; break; // left
case 0x3b:
break;
default:
ch = 0;
case 0x3b: break;
default: ch = 0;
}
}
}

View File

@ -1,14 +1,15 @@
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
#include <r_cons.h>
int r_cons_html_print(const char *ptr)
// XXX: rename char *r_cons_filter_html(const char *ptr)
R_API int r_cons_html_print(const char *ptr)
{
const char *str = ptr;
int color = 0;
int esc = 0;
const char *str = (char *)ptr;
int len = 0;
int inv = 0;
int color = 0;
for (;ptr[0]; ptr = ptr + 1) {
if (ptr[0] == '\n') {
@ -143,7 +144,7 @@ int r_cons_html_print(const char *ptr)
}
#if __WINDOWS__
int r_cons_w32_print(unsigned char *ptr)
int r_cons_w32_print(ut8 *ptr)
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
int esc = 0;
@ -278,8 +279,7 @@ int r_cons_w32_print(unsigned char *ptr)
}
len++;
}
write(1, str, ptr-str);
write (1, str, ptr-str);
return len;
}
#endif

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
#include <r_core.h>
#include "../config.h"
@ -161,8 +161,9 @@ R_API int r_core_init(struct r_core_t *core)
// XXX fix path here
/* load plugins */
r_core_loadlibs(core);
/* UH? */
r_core_loadlibs (core);
// TODO: get arch from r_bin or from native arch
r_asm_use(&core->assembler, DEFAULT_ARCH);
r_anal_use(&core->anal, DEFAULT_ARCH);
r_bp_use(core->dbg.bp, DEFAULT_ARCH);
@ -174,6 +175,7 @@ R_API int r_core_init(struct r_core_t *core)
R_API struct r_core_t *r_core_free(struct r_core_t *c)
{
/* TODO: it leaks as shit */
free(c);
return NULL;
}

View File

@ -128,7 +128,7 @@ R_API int r_debug_step_over(struct r_debug_t *dbg, int steps)
/* restore program counter after breakpoint hit */
static int r_debug_recoil(struct r_debug_t *dbg) {
int recoil, ret = R_FALSE;
rRegisterItem *ri;
RRegisterItem *ri;
r_debug_reg_sync (dbg, R_REG_TYPE_GPR, R_FALSE);
ri = r_reg_get (dbg->reg, "eip", -1);
if (ri) {

View File

@ -9,7 +9,6 @@
#include "list.h"
#define R_ANAL_NAME(x) "anal" R_LIB_SEPARATOR x
#define R_ANAL_MAXREG 16
enum {
@ -103,9 +102,9 @@ struct r_anal_refline_t {
ut64 to;
int index;
struct list_head list;
};
} RAnalysisRefline;
struct r_anal_aop_t {
typedef struct r_anal_aop_t {
int type; /* type of opcode */
int stackop; /* operation on stack? */
int cond; /* condition type */
@ -118,14 +117,14 @@ struct r_anal_aop_t {
ut64 value; /* reference to value */
int r_dst[R_ANAL_MAXREG]; /* register arguments */
ut64 i_dst[R_ANAL_MAXREG]; /* inmediate arguments */
};
} RAnalysisAop;
struct r_anal_fcn_t {
typedef struct r_anal_function_t {
ut64 from;
ut64 to;
};
} RAnalysisFunction;
struct r_anal_t {
typedef struct r_anal_t {
int bits;
int big_endian;
ut64 pc;
@ -133,25 +132,25 @@ struct r_anal_t {
struct r_anal_ctx_t *ctx;
struct r_anal_handle_t *cur;
struct list_head anals;
};
} RAnalysis;
struct r_anal_ctx_t {
typedef struct r_anal_ctx_t {
/* TODO: add more info here */
/* per opcode deep level */
/* per opcode stack size */
/* basic blocks */
int stacksize;
struct r_anal_t *anal;
};
} RAnalysisContext;
struct r_anal_handle_t {
typedef struct r_anal_handle_t {
char *name;
char *desc;
int (*init)(void *user);
int (*fini)(void *user);
int (*aop)(struct r_anal_t *a, struct r_anal_aop_t *aop, void *data);
struct list_head list;
};
} RAnalysisHandle;
/* anal.c */
#ifdef R_API

View File

@ -32,7 +32,7 @@ enum {
typedef struct r_asm_fastcall_t {
const char *arg[16];
} rAsmFastcall;
} RAsmFastcall;
typedef struct r_asm_aop_t {
int inst_len;
@ -40,14 +40,14 @@ typedef struct r_asm_aop_t {
char buf_asm[R_ASM_BUFSIZE];
char buf_hex[R_ASM_BUFSIZE];
char buf_err[R_ASM_BUFSIZE];
} rAsmAop;
} RAsmAop;
typedef struct r_asm_code_t {
int len;
ut8 *buf;
char *buf_hex;
char *buf_asm;
} rAsmCode;
} RAsmCode;
typedef struct r_asm_t {
int bits;
@ -58,7 +58,7 @@ typedef struct r_asm_t {
struct r_asm_handle_t *cur;
struct r_asm_fastcall_t *fastcall;
struct list_head asms;
} rAsm;
} RAsm;
// TODO: rename to handler?
typedef struct r_asm_handle_t {
@ -75,7 +75,7 @@ typedef struct r_asm_handle_t {
int (*set_subarch)(struct r_asm_t *a, const char *buf);
struct r_asm_fastcall_t *fastcall[R_ASM_FASTCALL_ARGS];
struct list_head list;
} rAsmHandle;
} RAsmHandle;
#ifdef R_API
/* asm.c */

View File

@ -30,7 +30,7 @@ typedef struct r_bin_t {
struct r_buf_t *buf;
struct r_bin_handle_t *cur;
struct list_head bins;
} rBin;
} RBin;
typedef struct r_bin_handle_t {
char *name;
@ -49,12 +49,12 @@ typedef struct r_bin_handle_t {
struct r_bin_info_t* (*info)(struct r_bin_t *bin);
struct r_bin_field_t* (*fields)(struct r_bin_t *bin);
struct list_head list;
} rBinHandle;
} RBinHandle;
typedef struct r_bin_entry_t {
ut64 rva;
ut64 offset;
} rBinEntry;
} RBinEntry;
typedef struct r_bin_section_t {
char name[R_BIN_SIZEOF_STRINGS];
@ -64,7 +64,7 @@ typedef struct r_bin_section_t {
ut64 offset;
ut64 characteristics;
int last;
} rBinSection;
} RBinSection;
#define r_bin_Rarray struct r_bin_symbol_t
typedef struct r_bin_symbol_t {
@ -77,7 +77,7 @@ typedef struct r_bin_symbol_t {
ut64 size;
ut64 ordinal;
int last;
} rBinSymbol;
} RBinSymbol;
typedef struct r_bin_import_t {
char name[R_BIN_SIZEOF_STRINGS];
@ -88,7 +88,7 @@ typedef struct r_bin_import_t {
ut64 ordinal;
ut64 hint;
int last;
} rBinImport;
} RBinImport;
typedef struct r_bin_string_t {
char string[R_BIN_SIZEOF_STRINGS];
@ -97,7 +97,7 @@ typedef struct r_bin_string_t {
ut64 ordinal;
ut64 size;
int last;
} rBinString;
} RBinString;
typedef struct r_bin_info_t {
char type[R_BIN_SIZEOF_STRINGS];
@ -109,14 +109,14 @@ typedef struct r_bin_info_t {
char subsystem[R_BIN_SIZEOF_STRINGS];
int big_endian;
ut64 dbg_info;
} rBinInfo;
} RBinInfo;
typedef struct r_bin_field_t {
char name[R_BIN_SIZEOF_STRINGS];
ut64 rva;
ut64 offset;
int last;
} rBinField;
} RBinField;
typedef struct r_bin_obj_t {
rArray entrys;
@ -125,8 +125,8 @@ typedef struct r_bin_obj_t {
rArray imports;
rArray strings;
rArray fields;
rBinInfo info;
} rBinObject;
RBinInfo info;
} RBinObject;
#ifdef R_API
R_API int r_bin_add(struct r_bin_t *bin, struct r_bin_handle_t *foo);

View File

@ -15,7 +15,7 @@
#define R_BININFO_SIZEOF_NAMES 256
// XXX: rename to rBinMeta...rBinDwarf..rBinFoo ??? rBininfo can be confusing with rBinInfo
// XXX: rename to rBinMeta...rBinDwarf..rBinFoo ??? RBininfo can be confusing with rBinInfo
/* types */
typedef struct r_bininfo_t {
const char *file;
@ -26,7 +26,7 @@ typedef struct r_bininfo_t {
void *user;
struct r_bininfo_handle_t *cur;
struct list_head bins;
} rBininfo;
} RBininfo;
typedef struct r_bininfo_handle_t {
char *name;
@ -40,7 +40,7 @@ typedef struct r_bininfo_handle_t {
int (*close)(struct r_bininfo_t *bin);
int (*check)(struct r_bininfo_t *bin);
struct list_head list;
} rBininfoHandle;
} RBininfoHandle;
#ifdef R_API
/* bininfo.c */

View File

@ -13,7 +13,7 @@ typedef struct r_bp_arch_t {
int length;
int endian;
const ut8 *bytes;
} rBreakpointArch;
} RBreakpointArch;
enum {
R_BP_TYPE_SW,
@ -30,7 +30,7 @@ typedef struct r_bp_handle_t {
int nbps;
struct r_bp_arch_t *bps;
struct list_head list;
} rBreakpointHandler;
} RBreakpointHandler;
typedef struct r_bp_item_t {
ut64 addr;
@ -45,21 +45,21 @@ typedef struct r_bp_item_t {
ut8 *bbytes; /* breakpoint bytes */
int pids[R_BP_MAXPIDS];
struct list_head list;
} rBreakpointItem;
} RBreakpointItem;
typedef int (*rBreakpointCallback)(void *user, int type, ut64 addr, int hw, int rwx);
typedef int (*RBreakpointCallback)(void *user, int type, ut64 addr, int hw, int rwx);
typedef struct r_bp_t {
int trace_all;
ut64 trace_bp;
int nbps;
int stepcont;
rBreakpointCallback breakpoint;
RBreakpointCallback breakpoint;
struct r_io_bind_t iob; // compile time dependency
struct r_bp_handle_t *cur;
struct list_head plugins;
struct list_head bps;
} rBreakpoint;
} RBreakpoint;
enum {
R_BP_PROT_READ = 1,
@ -92,7 +92,7 @@ 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);
R_API rBreakpointItem *r_bp_at_addr(rBreakpoint *bp, ut64 addr, int rwx);
R_API RBreakpointItem *r_bp_at_addr(RBreakpoint *bp, ut64 addr, int rwx);
R_API int r_bp_restore(struct r_bp_t *bp, int set);
R_API int r_bp_recoil(struct r_bp_t *bp, ut64 addr);
#endif

View File

@ -11,7 +11,7 @@ typedef struct r_cmd_item_t {
char cmd[64];
char desc[128];
r_cmd_callback(callback);
} CmdItem;
} RCommandItem;
typedef struct r_cmd_long_item_t {
char cmd[64]; /* long command */
@ -19,14 +19,14 @@ typedef struct r_cmd_long_item_t {
char cmd_short[32]; /* short command */
char desc[128];
struct list_head list;
} CmdLongItem;
} RCommandLongItem;
typedef struct r_cmd_t {
void *data;
r_cmd_nullcallback(nullcallback);
struct list_head lcmds;
struct r_cmd_item_t *cmds[255];
} Cmd;
} RCommand;
#ifdef R_API
R_API int r_cmd_init(struct r_cmd_t *cmd);
@ -38,5 +38,4 @@ R_API int r_cmd_call(struct r_cmd_t *cmd, const char *command);
R_API int r_cmd_call_long(struct r_cmd_t *cmd, const char *input);
R_API char **r_cmd_args(struct r_cmd_t *cmd, int *argc);
#endif
#endif

View File

@ -23,7 +23,7 @@ typedef struct r_config_node_t {
char **cb_ptr_s;
int (*callback)(void *user, void *data);
struct list_head list;
} rConfigNode;
} RConfigNode;
typedef struct r_config_t {
int lock;
@ -32,25 +32,25 @@ typedef struct r_config_t {
void *user;
void (*printf)(const char *str, ...);
struct list_head nodes;
} rConfig;
} RConfig;
#ifdef R_API
R_API struct r_config_t *r_config_new(void *user);
R_API int r_config_free(struct r_config_t *cfg);
R_API int r_config_init(struct r_config_t *core, void *user);
R_API void r_config_lock(rConfig *cfg, int l);
R_API int r_config_eval(rConfig *cfg, const char *str);
R_API struct r_config_node_t *r_config_set_i(rConfig *cfg, const char *name, const ut64 i);
R_API struct r_config_node_t *r_config_set_cb(rConfig *cfg, const char *name, const char *value, int (*callback)(void *user, void *data));
R_API struct r_config_node_t *r_config_set_i_cb(rConfig *cfg, const char *name, int ivalue, int (*callback)(void *user, void *data));
R_API int r_config_rm(rConfig *cfg, const char *name);
R_API struct r_config_node_t *r_config_set(rConfig *cfg, const char *name, const char *value);
R_API ut64 r_config_get_i(rConfig *cfg, const char *name);
R_API const char *r_config_get(rConfig *cfg, const char *name);
R_API void r_config_list(rConfig *cfg, const char *str, int rad);
R_API struct r_config_node_t *r_config_node_get(rConfig *cfg, const char *name);
R_API void r_config_lock(RConfig *cfg, int l);
R_API int r_config_eval(RConfig *cfg, const char *str);
R_API struct r_config_node_t *r_config_set_i(RConfig *cfg, const char *name, const ut64 i);
R_API struct r_config_node_t *r_config_set_cb(RConfig *cfg, const char *name, const char *value, int (*callback)(void *user, void *data));
R_API struct r_config_node_t *r_config_set_i_cb(RConfig *cfg, const char *name, int ivalue, int (*callback)(void *user, void *data));
R_API int r_config_rm(RConfig *cfg, const char *name);
R_API struct r_config_node_t *r_config_set(RConfig *cfg, const char *name, const char *value);
R_API ut64 r_config_get_i(RConfig *cfg, const char *name);
R_API const char *r_config_get(RConfig *cfg, const char *name);
R_API void r_config_list(RConfig *cfg, const char *str, int rad);
R_API struct r_config_node_t *r_config_node_get(RConfig *cfg, const char *name);
R_API struct r_config_node_t *r_config_node_new(const char *name, const char *value);
R_API int r_config_swap(rConfig *cfg, const char *name);
R_API int r_config_swap(RConfig *cfg, const char *name);
#endif
#endif

View File

@ -40,7 +40,6 @@
#define C_BGRAY "\x1b[1;38m"
/* palette */
#define CONS_PALETTE_SIZE 22
#define CONS_COLORS_SIZE 21
enum {
@ -77,7 +76,7 @@ enum {
#define COLOR_AD C_GREEN
#endif
/* XXX */
/* XXX : global variables? or a struct with a singleton? */
extern FILE *stdin_fd;
extern FILE *r_cons_stdin_fd;
extern int r_cons_stdout_fd;
@ -87,7 +86,9 @@ extern const char *r_cons_palette_default;
const char *r_cons_colors[CONS_COLORS_SIZE+1];
extern char r_cons_palette[CONS_PALETTE_SIZE][8];
extern const char *dl_prompt;
extern int r_cons_lines;
extern int r_cons_columns;
extern int r_cons_rows;
extern int r_cons_lines; // private or public?
extern int r_cons_is_html;
extern int r_cons_noflush;
extern char *r_cons_filterline;
@ -128,11 +129,8 @@ R_API int r_cons_readchar();
R_API void r_cons_any_key();
R_API int r_cons_eof();
/* colors */
R_API int r_cons_palette_init(const unsigned char *pal);
R_API int r_cons_get_real_columns();
R_API int r_cons_get_columns();
R_API int r_cons_get_size(int *rows);
R_API int r_cons_get_arrow(int ch);
R_API int r_cons_html_print(const char *ptr);

View File

@ -33,7 +33,7 @@ typedef struct r_core_file_t {
int fd;
int dbg;
struct list_head list;
} rCoreFile;
} RCoreFile;
typedef struct r_core_t {
ut64 offset;
@ -65,7 +65,7 @@ typedef struct r_core_t {
struct r_macro_t macro;
struct r_config_t config;
struct r_search_t *search;
} rCore;
} RCore;
#ifdef R_API
R_API int r_core_init(struct r_core_t *core);

View File

@ -26,7 +26,7 @@ typedef struct r_crypto_t {
int output_size;
void *user;
struct list_head handlers;
} rCrypto;
} RCrypto;
typedef struct r_crypto_handle_t {
const char *name;
@ -38,7 +38,7 @@ typedef struct r_crypto_handle_t {
int (*use)(const char *algo);
int (*fini)(struct r_crypto_t *cry);
struct list_head list;
} rCryptoHandle;
} RCryptoHandle;
#ifdef R_API
R_API struct r_crypto_t *r_crypto_init(struct r_crypto_t *cry, int hard);

View File

@ -16,7 +16,7 @@ typedef struct r_db_t {
int blocks_sz[R_DB_KEYS];
void *cb_user;
int (*cb_free)(void *db, const void *item, void *user);
} rDatabase;
} RDatabase;
typedef struct r_db_iter_t {
struct r_db_t *db;
@ -25,7 +25,7 @@ typedef struct r_db_iter_t {
int path[256]; /* for each depth level */
int ptr; /* pointer in block nodes (repeated childs) */
void *cur;
} rDatabaseIter;
} RDatabaseIter;
/* table */
typedef struct r_db_table_t {
@ -34,7 +34,7 @@ typedef struct r_db_table_t {
char *fmt;
char *args;
int *offset;
} rDatabaseTable;
} RDatabaseTable;
#ifdef R_API
R_API void r_db_init(struct r_db_t *db);

View File

@ -37,7 +37,7 @@ typedef struct r_debug_t {
- list of mapped memory (from /proc/XX/maps)
- list of managed memory (allocated in child...)
*/
} rDebug;
} RDebug;
/* TODO: pass dbg and user data pointer everywhere */
typedef struct r_debug_handle_t {
@ -54,7 +54,7 @@ typedef struct r_debug_handle_t {
int (*wait)(int pid);
int (*contsc)(int pid, int sc);
/* registers */
rBreakpointCallback breakpoint;
RBreakpointCallback breakpoint;
int (*reg_read)(struct r_debug_t *dbg, int type, ut8 *buf, int size);
char* (*reg_profile)();
int (*reg_write)(int pid, int type, const ut8 *buf, int size); //XXX struct r_regset_t regs);
@ -63,7 +63,7 @@ typedef struct r_debug_handle_t {
int (*mem_free)(void *user, ut64 addr);
struct list_head list;
} rDebugHandle;
} RDebugHandle;
// TODO: rename to r_debug_process_t ? maybe a thread too ?
typedef struct r_debug_pid_t {
@ -74,7 +74,7 @@ typedef struct r_debug_pid_t {
struct list_head childs;
struct r_debug_pid_t *parent;
struct list_head list;
} rDebugPid;
} RDebugPid;
#ifdef R_API
R_API int r_debug_use(struct r_debug_t *dbg, const char *str);

View File

@ -14,7 +14,7 @@ typedef struct r_diff_op_t {
ut64 b_off;
const ut8 *b_buf;
int b_len;
} rDiffOp;
} RDiffOp;
typedef struct r_diff_t {
ut64 off_a;
@ -23,7 +23,7 @@ typedef struct r_diff_t {
void *user;
int (*callback)(struct r_diff_t *d, void *user,
struct r_diff_op_t *op);
} rDiff;
} RDiff;
/* XXX: this api needs to be reviewed , constructor with offa+offb?? */
#ifdef R_API

View File

@ -24,7 +24,7 @@ typedef struct r_flag_item_t {
const char *cmd;
unsigned char data[R_FLAG_BUF_SIZE]; // only take a minor part of the data
struct list_head list;
} rFlagItem;
} RFlagItem;
typedef struct r_flag_t {
int space_idx;
@ -36,7 +36,7 @@ typedef struct r_flag_t {
struct btree_node *ntree; /* index by name */
#endif
struct list_head flags;
} rFlag;
} RFlag;
#ifdef R_API
R_API struct r_flag_t * r_flag_new();

View File

@ -41,7 +41,7 @@ typedef struct r_hash_t {
SHA512_CTX sha512;
int rst;
ut8 digest[128];
} rHash;
} RHash;
#define R_HASH_SIZE_MD4 16
#define R_HASH_SIZE_MD5 16

View File

@ -1,8 +1,9 @@
#ifndef _LIB_R_IO_H_
#define _LIB_R_IO_H_
#include "r_types.h"
#include "list.h"
#include <r_types.h>
#include <r_util.h>
#include <list.h>
#define R_IO_READ 4
#define R_IO_WRITE 2
@ -22,7 +23,7 @@ typedef struct r_io_map_t {
ut64 from;
ut64 to;
struct list_head list;
} rIoMap;
} RIoMap;
/* stores write and seek changes */
#define R_IO_UNDOS 64
@ -37,7 +38,7 @@ typedef struct r_io_undo_t {
int fd[R_IO_UNDOS];
int idx;
int limit;
} rIoUndo;
} RIoUndo;
typedef struct r_io_undo_w_t {
int set;
@ -46,7 +47,7 @@ typedef struct r_io_undo_w_t {
ut8 *n; /* new data */
int len; /* length */
struct list_head list;
} rIoUndoWrite;
} RIoUndoWrite;
typedef struct r_io_t {
int fd;
@ -70,7 +71,7 @@ typedef struct r_io_t {
struct list_head maps;
struct list_head desc;
struct list_head cache;
} rIo;
} RIo;
//struct r_io_handle_fd_t {
// ... store io changes here
@ -94,27 +95,27 @@ typedef struct r_io_handle_t {
int (*handle_open)(struct r_io_t *io, const char *);
//int (*handle_fd)(struct r_io_t *, int);
int fds[R_IO_NFDS];
} rIoHandle;
} RIoHandle;
typedef struct r_io_list_t {
struct r_io_handle_t *plugin;
struct list_head list;
} rIoList;
} RIoList;
/* TODO: find better name... rIoSetFd_Callback? ..Func? .. too camels here */
typedef int (*rIoSetFd)(rIo *io, int fd);
typedef int (*rIoReadAt)(rIo *io, ut64 addr, ut8 *buf, int size);
typedef int (*rIoWriteAt)(rIo *io, ut64 addr, const ut8 *buf, int size);
/* TODO: find better name... RIoSetFd_Callback? ..Func? .. too camels here */
typedef int (*RIoSetFd)(RIo *io, int fd);
typedef int (*RIoReadAt)(RIo *io, ut64 addr, ut8 *buf, int size);
typedef int (*RIoWriteAt)(RIo *io, ut64 addr, const ut8 *buf, int size);
/* compile time dependency */
typedef struct r_io_bind_t {
int init;
struct r_io_t *io;
rIoSetFd set_fd;
rIoReadAt read_at;
rIoWriteAt write_at;
} rIoBind;
RIoSetFd set_fd;
RIoReadAt read_at;
RIoWriteAt write_at;
} RIoBind;
/* sections */
typedef struct r_io_section_t {
@ -125,7 +126,7 @@ typedef struct r_io_section_t {
ut64 paddr; // offset on disk
int rwx;
struct list_head list;
} rIoSection;
} RIoSection;
typedef struct r_io_cache_t {
ut64 from;
@ -133,7 +134,7 @@ typedef struct r_io_cache_t {
int size;
ut8 *data;
struct list_head list;
} rIoCache;
} RIoCache;
typedef struct r_io_desc_t {
int fd;
@ -141,7 +142,7 @@ typedef struct r_io_desc_t {
char name[4096];
struct r_io_handle_t *handle;
struct list_head list;
} rIoDesc;
} RIoDesc;
#ifdef R_API
#define r_io_bind_init(x) memset(&x,0,sizeof(x))
@ -165,7 +166,7 @@ R_API int r_io_open(struct r_io_t *io, const char *file, int flags, int mode);
R_API int r_io_open_as(struct r_io_t *io, const char *urihandler, const char *file, int flags, int mode);
R_API int r_io_redirect(struct r_io_t *io, const char *file);
R_API int r_io_set_fd(struct r_io_t *io, int fd);
R_API struct r_buf_t *r_io_read_buf(struct r_io_t *io, ut64 addr, int len);
R_API RBuffer *r_io_read_buf(struct r_io_t *io, ut64 addr, int len);
R_API int r_io_read(struct r_io_t *io, ut8 *buf, int len);
R_API int r_io_read_at(struct r_io_t *io, ut64 addr, ut8 *buf, int len);
R_API ut64 r_io_read_i(struct r_io_t *io, ut64 addr, int sz, int endian);

View File

@ -9,7 +9,7 @@ typedef struct r_lang_t {
void *user;
struct list_head defs;
struct list_head langs;
} rLang;
} RLang;
typedef struct r_lang_handle_t {
const char *name;
@ -22,14 +22,14 @@ typedef struct r_lang_handle_t {
int (*run_file)(struct r_lang_t *user, const char *file);
int (*set_argv)(struct r_lang_t *user, int argc, char **argv);
struct list_head list;
} rLangHandle;
} RLangHandle;
typedef struct r_lang_def_t {
char *name;
char *type;
void *value;
struct list_head list;
} rLangDef;
} RLangDef;
#ifdef R_API
R_API struct r_lang_t *r_lang_new();
@ -49,5 +49,4 @@ R_API int r_lang_prompt(struct r_lang_t *lang);
R_API int r_lang_define(struct r_lang_t *lang, const char *type, const char *name, void *value);
R_API void r_lang_undef(struct r_lang_t *lang);
#endif
#endif

View File

@ -29,7 +29,7 @@ typedef struct r_lib_plugin_t {
struct r_lib_handler_t *handler;
void *dl_handler; // DL HANDLER
struct list_head list;
} rLibraryPlugin;
} RLibraryPlugin;
/* store list of initialized plugin handlers */
typedef struct r_lib_handler_t {
@ -39,14 +39,14 @@ typedef struct r_lib_handler_t {
int (*constructor)(struct r_lib_plugin_t *, void *user, void *data);
int (*destructor)(struct r_lib_plugin_t *, void *user, void *data);
struct list_head list;
} rLibraryHandler;
} RLibraryHandler;
/* this structure should be pointed by the 'radare_plugin' symbol
found in the loaded .so */
typedef struct r_lib_struct_t {
int type;
void *data; /* pointer to data handled by plugin handler */
} rLibraryStruct;
} RLibraryStruct;
//extern const char *r_lib_types[];
@ -73,7 +73,7 @@ typedef struct r_lib_t {
char symname[32];
struct list_head plugins;
struct list_head handlers;
} rLibrary;
} RLibrary;
#ifdef R_API
R_API struct r_lib_t *r_lib_init(struct r_lib_t *lib, const char *symname);

View File

@ -11,7 +11,7 @@
typedef struct r_macro_label_t {
char name[80];
char *ptr;
} rMacrolabel;
} RMacrolabel;
typedef struct r_macro_item_t {
char *name;
@ -19,7 +19,7 @@ typedef struct r_macro_item_t {
char *code;
int nargs;
struct list_head list;
} rMacroItem;
} RMacroItem;
typedef struct r_macro_t {
int counter;
@ -33,7 +33,7 @@ typedef struct r_macro_t {
int labels_n;
struct r_macro_label_t labels[MACRO_LABELS];
struct list_head macros;
} rMacro;
} RMacro;
#ifdef R_API
R_API void r_macro_init(struct r_macro_t *mac);

View File

@ -10,7 +10,7 @@ typedef struct r_meta_count_t {
int xref_code;
int xref_data;
/* TODO: ... */
} rMetaCount;
} RMetaCount;
#if 0
TODO:
@ -30,14 +30,14 @@ typedef struct r_meta_item_t {
// int times;
char *str;
struct list_head list;
} rMetaItem;
} RMetaItem;
typedef struct r_meta_t {
struct list_head data;
// struct reflines_t *reflines = NULL;
// struct list_head comments;
// struct list_head xrefs;
} rMeta;
} RMeta;
enum {
R_META_WHERE_PREV = -1,

View File

@ -9,13 +9,13 @@
// XXX : remove this define???
#define R_PARSE_STRLEN 256
struct r_parse_t {
typedef struct r_parse_t {
void *user;
struct r_parse_handle_t *cur;
struct list_head parsers;
};
} RParse;
struct r_parse_handle_t {
typedef struct r_parse_handle_t {
char *name;
char *desc;
int (*init)(void *user);
@ -23,7 +23,7 @@ struct r_parse_handle_t {
int (*parse)(struct r_parse_t *p, void *data, char *str);
int (*assemble)(struct r_parse_t *p, char *data, char *str);
struct list_head list;
};
} RParseHandle;
/* parse.c */
R_API struct r_parse_t *r_parse_new();

View File

@ -24,7 +24,7 @@ typedef struct r_print_t {
int ocur;
int flags;
int addrmod;
} rPrint;
} RPrint;
#ifdef R_API
R_API struct r_print_t *r_print_new();

View File

@ -5,20 +5,21 @@
#include "r_util.h"
#include "list.h"
struct r_range_item_t {
typedef struct r_range_item_t {
ut64 fr;
ut64 to;
ut8 *data;
int datalen;
struct list_head list;
};
} RRangeItem;
struct r_range_t {
typedef struct r_range_t {
int count;
int changed;
struct list_head ranges;
};
} RRange;
#ifdef R_API
int r_range_init(struct r_range_t *r);
struct r_range_t *r_range_new();
struct r_range_t *r_range_new_from_string(const char *string);
@ -36,5 +37,5 @@ int r_range_percent(struct r_range_t *rgs);
int r_range_list(struct r_range_t *rgs, int rad);
int r_range_get_n(struct r_range_t *rgs, int n, ut64 *from, ut64 *to);
struct r_range_t *r_range_inverse(struct r_range_t *rgs, ut64 from, ut64 to, int flags);
#endif
#endif

View File

@ -24,26 +24,26 @@ typedef struct r_reg_item_t {
int offset; // offset in data structure
int packed_size; /* 0 means no packed register, 1byte pack, 2b pack... */
struct list_head list;
} rRegisterItem;
} RRegisterItem;
typedef struct r_reg_arena_t {
ut8 *bytes;
int size;
struct list_head list;
} rRegisterArena;
} RRegisterArena;
typedef struct r_reg_set_t {
struct r_reg_arena_t *arena;
struct list_head arenas; /* r_reg_arena_t */
struct list_head regs; /* r_reg_item_t */
} rRegisterSet;
} RRegisterSet;
typedef struct r_reg_t {
char *profile;
struct r_reg_set_t regset[R_REG_TYPE_LAST];
} rRegister;
} RRegister;
#define r_reg_new() r_reg_init (MALLOC_STRUCT (rRegister))
#define r_reg_new() r_reg_init (MALLOC_STRUCT (RRegister))
#ifdef R_API
extern const char *r_reg_types[R_REG_TYPE_LAST+1];

View File

@ -29,16 +29,16 @@ typedef struct r_search_kw_t {
int count;
int kwidx;
struct list_head list;
} rSearchKeyword;
} RSearchKeyword;
typedef struct r_search_hit_t {
ut64 addr;
struct r_search_kw_t *kw;
int len;
struct list_head list;
} rSearchHit;
} RSearchHit;
typedef int (*rSearchCallback)(struct r_search_kw_t *kw, void *user, ut64 where);
typedef int (*RSearchCallback)(struct r_search_kw_t *kw, void *user, ut64 where);
typedef struct r_search_t {
int n_kws;
@ -48,11 +48,11 @@ typedef struct r_search_t {
ut32 string_max; /* max number of matches */
void *user; /* user data */
//int (*callback)(struct r_search_kw_t *kw, void *user, ut64 where);
rSearchCallback callback;
RSearchCallback callback;
//struct r_search_binparse_t *bp;
struct list_head kws; //r_search_hw_t kws;
struct list_head hits; //r_search_hit_t hits;
} rSearch;
} RSearch;
#ifdef R_API
R_API struct r_search_t *r_search_new(int mode);
@ -88,8 +88,7 @@ R_API int r_search_xrefs_update(struct r_search_t *s, ut64 from, const ut8 *buf,
R_API int r_search_pattern(struct r_search_t *s, ut32 size);
R_API int r_search_strings(struct r_search_t *s, ut32 min, ut32 max);
//R_API int r_search_set_callback(struct r_search_t *s, int (*callback)(struct r_search_kw_t *, void *, ut64), void *user);
R_API int r_search_set_callback(struct r_search_t *s, rSearchCallback(callback), void *user);
R_API int r_search_set_callback(struct r_search_t *s, RSearchCallback(callback), void *user);
R_API int r_search_begin(struct r_search_t *s);
#endif
#endif

View File

@ -11,12 +11,12 @@ typedef struct r_sign_item_t {
ut8 *bytes;
ut32 csum;
struct list_head list;
} rSignItem;
} RSignItem;
typedef struct r_sign_t {
int count;
struct list_head items;
} rSign;
} RSign;
#ifdef R_API
R_API int r_sign_generate(struct r_sign_t *sig, const char *file, FILE *fd);

View File

@ -8,8 +8,25 @@
/* struct r_socket_t *sock = r_socket_new(R_SOCKET_TCP, "gogle.com", 80); */
/* struct r_socket_t *sock = r_socket_proc_new(R_SOCKET_PROCESS, "/bin/ls", 80); */
/* process */
#ifdef R_API
#if __UNIX__
R_API int r_socket_unix_connect(const char *file);
R_API int r_socket_unix_listen(const char *file);
#endif
R_API int r_socket_flush(int fd);
R_API void r_socket_block(int fd, int block);
R_API int r_socket_ready(int fd, int secs, int usecs);
R_API int r_socket_read(int fd, unsigned char *read, int len);
R_API int r_socket_puts(int fd, char *buf);
R_API int r_socket_write(int fd, void *buf, int len);
R_API int r_socket_connect(char *host, int port);
R_API int r_socket_listen(int port);
R_API int r_socket_accept(int fd);
R_API int r_socket_gets(int fd, char *buf, int size);
R_API void r_socket_printf(int fd, const char *fmt, ...);
R_API char *r_socket_to_string(int fd);
/* process */
struct r_socket_proc_t {
int fd0[2];
int fd1[2];
@ -24,28 +41,5 @@ R_API int r_socket_proc_close(struct r_socket_proc_t *sp);
#define r_socket_proc_printf(x,y) r_socket_printf(x->fd0[1],y)
#define r_socket_proc_ready(x,y,z) r_socket_ready(x->fd1[0],y,z)
// read from stdout of process is fd1[0]
// write to stdin of process is fd0[1]
/* socket */
#if __UNIX__
R_API int r_socket_unix_connect(const char *file);
R_API int r_socket_unix_listen(const char *file);
#endif
R_API int r_socket_flush(int fd);
R_API void r_socket_block(int fd, int block);
R_API int r_socket_ready(int fd, int secs, int usecs);
R_API int r_socket_read(int fd, unsigned char *read, int len);
R_API int r_socket_puts(int fd, char *buf);
R_API int r_socket_write(int fd, void *buf, int len);
R_API int r_socket_connect(char *host, int port);
R_API int r_socket_listen(int port);
R_API int r_socket_accept(int fd);
R_API int r_socket_gets(int fd, char *buf, int size);
R_API void r_socket_printf(int fd, const char *fmt, ...);
R_API char *r_socket_to_string(int fd);
#endif

View File

@ -4,25 +4,6 @@
#include "r_types.h"
#include "list.h"
typedef struct r_syscall_list_t {
const char *name;
int swi;
int num;
int args;
char *sargs;
} rSyscallList;
// TODO: use this as arg to store state :)
typedef struct r_syscall_t {
#if 0
int arch; // XXX char *??
int os;
#endif
FILE *fd;
struct r_syscall_list_t *sysptr;
} rSyscall;
enum {
R_SYSCALL_OS_LINUX = 0,
R_SYSCALL_OS_NETBSD,
@ -39,7 +20,48 @@ enum {
R_SYSCALL_ARCH_SPARC
};
typedef struct r_syscall_list_t {
const char *name;
int swi;
int num;
int args;
char *sargs;
} RSyscallList;
// TODO: use this as arg to store state :)
typedef struct r_syscall_t {
#if 0
int arch; // XXX char *??
int os;
#endif
FILE *fd;
struct r_syscall_list_t *sysptr;
} RSyscall;
//#define R_SYSCALL_CTX struct r_syscall_t
/* plugin struct */
typedef struct r_syscall_handle_t {
char *name;
char *arch;
char *os;
char *desc;
int bits;
int nargs;
struct r_syscall_args_t *args;
struct list_head list;
} RSyscallHandle;
typedef struct r_syscall_arch_handle_t {
char *name;
char *arch;
char *desc;
int *bits;
int nargs;
struct r_syscall_args_t **args;
struct list_head list;
} RSyscallArchHandle;
#ifdef R_API
struct r_syscall_t *r_syscall_new();
void r_syscall_free(struct r_syscall_t *ctx);
void r_syscall_init(struct r_syscall_t *ctx);
@ -50,27 +72,6 @@ int r_syscall_get(struct r_syscall_t *ctx, const char *str);
struct r_syscall_list_t *r_syscall_get_n(struct r_syscall_t *ctx, int n);
const char *r_syscall_get_i(struct r_syscall_t *ctx, int num, int swi);
void r_syscall_list(struct r_syscall_t *ctx);
/* plugin struct */
struct r_syscall_handle_t {
char *name;
char *arch;
char *os;
char *desc;
int bits;
int nargs;
struct r_syscall_args_t *args;
struct list_head list;
};
struct r_syscall_arch_handle_t {
char *name;
char *arch;
char *desc;
int *bits;
int nargs;
struct r_syscall_args_t **args;
struct list_head list;
};
#endif
#endif

View File

@ -27,7 +27,7 @@
typedef struct r_th_lock_t {
int refs;
R_TH_LOCK_T lock;
} rThreadLock;
} RThreadLock;
typedef struct r_th_t {
R_TH_TID tid;
@ -38,12 +38,12 @@ typedef struct r_th_t {
int breaked; // thread aims to be interruped
int delay; // delay the startup of the thread N seconds
int ready; // thread is properly setup
} rThread;
} RThread;
typedef struct r_th_pool_t {
int size;
struct r_th_t **threads;
} rThreadPool;
} RThreadPool;
#ifdef R_API
R_API struct r_th_t *r_th_new(R_TH_FUNCTION(fun), void *user, int delay);

View File

@ -1,7 +1,7 @@
/* radare - LGPL - Copyright 2009 pancake<@nopcode.org> */
#ifndef _INCLUDE_R_ASM_H_
#define _INCLUDE_R_ASM_H_
#ifndef _INCLUDE_R_TRACE_H_
#define _INCLUDE_R_TRACE_H_
#include <r_types.h>
#include <list.h>
@ -13,7 +13,7 @@ typedef struct r_trace_t {
int tag;
int dup;
int (*printf)(const char *str,...);
} rTrace;
} RTrace;
typedef struct r_trace_item_t {
ut64 addr;
@ -23,7 +23,7 @@ typedef struct r_trace_item_t {
int count;
struct timeval tm;
struct list_head list;
} rTraceItem;
} RTraceItem;
#ifdef R_API
R_API int r_trace_init(struct r_trace_t *t);

View File

@ -52,7 +52,6 @@
#define R_FALSE 0
/* types */
#undef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#undef _GNU_SOURCE

View File

@ -18,7 +18,7 @@ typedef struct r_mem_pool_t {
int nodesize;
int poolsize;
int poolcount;
} rMemPool;
} RMemoryPool;
/* buf */
typedef struct r_buf_t {
@ -26,7 +26,7 @@ typedef struct r_buf_t {
int length;
int cur;
ut64 base;
} rBuffer;
} RBuffer;
/* r_cache */
// TOTHINK: move into a separated library?
@ -34,29 +34,29 @@ typedef struct r_cache_item_t {
ut64 addr;
char *str;
struct list_head list;
} rCacheItem;
} RCacheItem;
typedef struct r_cache_t {
ut64 start;
ut64 end;
struct list_head items;
} rCache;
} RCache;
typedef struct r_prof_t {
struct timeval begin;
double result;
} rProf;
} RProfile;
/* numbers */
typedef struct r_num_t {
ut64 (*callback)(void *userptr, const char *str, int *ok);
ut64 value;
void *userptr;
} rNum;
typedef ut64 (*rNumCallback)(rNum *self, const char *str, int *ok);
} RNum;
typedef ut64 (*RNumCallback)(RNum *self, const char *str, int *ok);
#ifdef R_API
R_API struct r_num_t *r_num_new(rNumCallback *cb, void *ptr);
R_API struct r_num_t *r_num_new(RNumCallback *cb, void *ptr);
#define R_BUF_CUR -1
R_API struct r_buf_t *r_buf_init(struct r_buf_t *b);
@ -75,7 +75,7 @@ R_API struct r_mem_pool_t *r_mem_pool_free(struct r_mem_pool_t *pool);
R_API void* r_mem_pool_alloc(struct r_mem_pool_t *pool);
R_API int r_mem_count(ut8 **addr);
R_API void r_cache_init(struct r_cache_t *lang);
R_API rCache* r_cache_new();
R_API RCache* r_cache_new();
R_API void r_cache_free(struct r_cache_t *c);
R_API char *r_cache_get(struct r_cache_t *c, ut64 addr);
R_API int r_cache_set(struct r_cache_t *c, ut64 addr, char *str);
@ -107,7 +107,7 @@ R_API void r_num_init(struct r_num_t *num);
#define iswhitechar(x) (x==' '||x=='\t'||x=='\n'||x=='\r')
#define iswhitespace(x) (x==' '||x=='\t')
#define isseparator(x) (x==' '||x=='\t'||x=='\n'||x=='\r'||x==' '|| \
x==','||x==';'||x==':'||x=='['||x==']'||x=='('||x==')'||x=='{'||x=='}')
x==','||x==';'||x==':'||x=='['||x==']'||x=='('||x==')'||x=='{'||x=='}')
#define ishexchar(x) ((x>='0'&&x<='9') || (x>='a'&&x<='f') || (x>='A'&&x<='F')) {
/* stabilized */

View File

@ -14,33 +14,33 @@ enum {
R_VAR_TYPE_ARGREG
};
struct r_var_anal_t {
typedef struct r_var_anal_t {
int type;
int delta;
int count;
};
} RVariableAnalysis;
struct r_var_type_t {
typedef struct r_var_type_t {
char name[128];
char fmt[128];
unsigned int size;
struct list_head list;
};
} RVariableType;
struct r_var_t {
typedef struct r_var_t {
int anal_size;
struct r_var_anal_t anal[R_VAR_ANAL_MAX];
struct list_head vartypes;
struct list_head vars;
};
} RVariable;
struct r_var_access_t {
typedef struct r_var_access_t {
ut64 addr;
int set;
struct list_head list;
};
} RVariableAccess;
struct r_var_item_t {
typedef struct r_var_item_t {
int type; /* global, local... */
ut64 addr; /* address where it is used */
ut64 eaddr; /* address where it is used */
@ -50,8 +50,9 @@ struct r_var_item_t {
char vartype[128];
struct list_head access; /* list of accesses for this var */
struct list_head list;
};
} RVariableItem;
#ifdef R_API
/* api */
R_API struct r_var_t *r_var_new();
R_API void r_var_free(struct r_var_t *var);
@ -71,5 +72,6 @@ R_API int r_var_list(struct r_var_t *var, ut64 addr, int delta);
R_API int r_var_anal_get(struct r_var_t *var, int type);
R_API void r_var_anal_reset(struct r_var_t *var);
R_API int r_var_anal_add(struct r_var_t *var, int type, int delta);
#endif
#endif

View File

@ -27,18 +27,18 @@ typedef struct r_vm_reg_t {
char *get;
char *set;
struct list_head list;
} rVmReg;
} RVmReg;
typedef struct r_vm_op_t {
char opcode[32];
char code[1024];
struct list_head list;
} rVmOp;
} RVmOp;
typedef struct r_vm_reg_type {
int type;
char *str;
} rVmRegType;
} RVmRegType;
typedef struct r_vm_cpu_t {
const char *pc;
@ -51,14 +51,14 @@ typedef struct r_vm_cpu_t {
const char *a3;
const char *ret;
const char *zf;
} rVmCpu;
} RVmCpu;
typedef struct r_vm_change_t {
ut64 from;
ut64 to;
ut8 *data;
struct list_head list;
} rVmChange;
} RVmChange;
typedef struct r_vm_t {
struct r_vm_reg_t *rec;
@ -73,12 +73,11 @@ typedef struct r_vm_t {
int (*read)(void *user, ut64 addr, ut8 *buf, int len);
int (*write)(void *user, ut64 addr, ut8 *buf, int len);
void *user;
} rVm;
} RVm;
#ifdef R_API
R_API ut64 vm_reg_get(const char *name);
R_API void vm_stack_push(ut64 _val);
#if 0
static ut64 r_vm_get_value(struct r_vm_t *vm, const char *str);
static ut64 r_vm_get_math(struct r_vm_t *vm, const char *str);

View File

@ -26,10 +26,9 @@ R_API struct r_io_t *r_io_new() {
return r_io_init (MALLOC_STRUCT (struct r_io_t));
}
R_API struct r_buf_t *r_io_read_buf(struct r_io_t *io, ut64 addr, int len)
R_API RBuffer *r_io_read_buf(struct r_io_t *io, ut64 addr, int len)
{
struct r_buf_t *b;
b = MALLOC_STRUCT(struct r_buf_t);
RBuffer *b = MALLOC_STRUCT(RBuffer);
b->buf = malloc(len);
len = r_io_read_at(io, addr, b->buf, len);
if (len<0) len = 0;

View File

@ -375,7 +375,7 @@ R_API char *r_line_readline(int argc, const char **argv)
int ch, i, len = 0;
int opt = 0;
int gcomp = 0; /* grep completion */
int columns = r_cons_get_real_columns()-2;
int columns = r_cons_get_size (NULL)-2;
r_line_buffer_idx = r_line_buffer_len = 0;
r_line_buffer[0]='\0';
@ -424,7 +424,7 @@ R_API char *r_line_readline(int argc, const char **argv)
buf[0] = ch;
// printf("\x1b[K\r");
columns = r_cons_get_real_columns ()-2;
columns = r_cons_get_size (NULL)-2;
if (columns <1)
columns = 40;
if (r_line_echo)

View File

@ -104,7 +104,7 @@ static int r_reg_set_word(struct r_reg_item_t *item, int idx, char *word) {
/* TODO: make this parser better and cleaner */
R_API int r_reg_set_profile_string(struct r_reg_t *reg, const char *str)
{
rRegisterItem *item;
RRegisterItem *item;
int ret = R_FALSE;
int lastchar = 0;
int chidx = 0;

View File

@ -51,7 +51,7 @@ R_API void r_num_init(struct r_num_t *num)
num->value = 0LL;
}
R_API struct r_num_t *r_num_new(rNumCallback *cb, void *ptr)
R_API struct r_num_t *r_num_new(RNumCallback *cb, void *ptr)
{
struct r_num_t *num;
num = (struct r_num_t*) malloc(sizeof(struct r_num_t));

View File

@ -1,82 +1,80 @@
/* radare - LGPL - Copyright 2009, 2010 nibble<.ds@gmail.com> */
namespace Radare {
[Compact]
[CCode (cheader_filename="r_asm.h", cname="struct r_asm_t", free_function="r_asm_free", cprefix="r_asm_")]
public class Radare.RAsm {
[CCode (cprefix="R_ASM_ARCH_", cname="int")]
public enum Arch {
NONE,
X86,
ARM,
PPC,
M68K,
JAVA,
MIPS,
SPARC,
CSR,
MSIL,
OBJD,
BF
}
[CCode (cprefix="R_ASM_SYNTAX_", cname="int")]
public enum Syntax {
NONE,
INTEL,
ATT
}
[Compact]
[CCode (cheader_filename="r_asm.h", cname="struct r_asm_t", free_function="r_asm_free", cprefix="r_asm_")]
public class rAsm {
[CCode (cprefix="R_ASM_ARCH_", cname="int")]
public enum Arch {
NONE,
X86,
ARM,
PPC,
M68K,
JAVA,
MIPS,
SPARC,
CSR,
MSIL,
OBJD,
BF
}
[CCode (cprefix="R_ASM_SYNTAX_", cname="int")]
public enum Syntax {
NONE,
INTEL,
ATT
}
[Compact]
[CCode (cname="struct r_asm_aop_t", destroy_function="" )]
public struct Aop {
public int inst_len;
public uint8 *buf;
public string buf_asm;
public string buf_hex;
public string buf_err;
//pointer
}
[CCode (cname="struct r_asm_code_t", destroy_function="" )]
public struct Code {
public int len;
public uint8* buf;
public string buf_hex;
public string buf_asm;
}
public int arch;
public int bits;
public bool big_endian;
public int syntax;
public int parser;
public uint64 pc;
[CCode (cname="struct r_asm_aop_t", destroy_function="" )]
public struct Aop {
public int inst_len;
public uint8 *buf;
public string buf_asm;
public string buf_hex;
public string buf_err;
public void *aux;
public rAsm();
public weak rAsm init();
public int list();
public bool use(string name);
// public bool set_arch(Asm.Arch arch);
public bool set_bits(int bits);
public bool set_syntax(Syntax syntax);
public bool set_pc(uint64 addr);
public bool set_big_endian(bool big);
//public bool set_parser(rAsm.Parser parser, parse_cb cb, void *aux);
public int disassemble(out Aop aop, uint8 *buf, uint64 length);
public int assemble(out Aop aop, string buf);
public Code? mdisassemble(uint8 *buf, uint64 length);
public Code? massemble(string buf);
public weak string fastcall(int idx, int num);
//public int parse();
// This is the destructor
public void free();
//pointer
}
public static delegate int parse_cb(rAsm a);
[CCode (cname="struct r_asm_code_t", destroy_function="" )]
public struct Code {
public int len;
public uint8* buf;
public string buf_hex;
public string buf_asm;
}
public int arch;
public int bits;
public bool big_endian;
public int syntax;
public int parser;
public uint64 pc;
public string buf_asm;
public string buf_hex;
public string buf_err;
public void *aux;
public RAsm();
public weak RAsm init();
public int list();
public bool use(string name);
// public bool set_arch(Asm.Arch arch);
public bool set_bits(int bits);
public bool set_syntax(Syntax syntax);
public bool set_pc(uint64 addr);
public bool set_big_endian(bool big);
//public bool set_parser(RAsm.Parser parser, parse_cb cb, void *aux);
public int disassemble(out Aop aop, uint8 *buf, uint64 length);
public int assemble(out Aop aop, string buf);
public Code? mdisassemble(uint8 *buf, uint64 length);
public Code? massemble(string buf);
// public weak string fastcall(int idx, int num);
//public int parse();
// This is the destructor
public void free();
public static delegate int parse_cb(RAsm a);
}

View File

@ -4,11 +4,11 @@
namespace Radare {
[Compact]
[CCode (cname="struct r_bin_t", free_function="r_bin_free", cprefix="r_bin_")]
public class rBin {
public class RBin {
public const string file;
public int fd;
public rBin();
public RBin();
//public int open(string file, bool rw, string? plugin_name = null);
public int init(string file, int rw);
@ -17,11 +17,11 @@ namespace Radare {
public Entrypoint get_entry();
// TODO: deprecate
public rList<rBin.Symbol*> symbols;
public rList<Symbol*> symbols;
//public rArray<rBin.Section> get_sections();
//public rArray<rBin.Symbol> get_symbols();
//public rArray<rBin.Import> get_imports();
//public rArray<RBin.Section> get_sections();
//public rArray<RBin.Symbol> get_symbols();
//public rArray<RBin.Import> get_imports();
public Info* get_info();
public uint64 get_section_offset(string name);

View File

@ -4,8 +4,8 @@
namespace Radare {
[Compact]
[CCode (cname="struct r_bininfo_t", free_function="r_bininfo_free", cprefix="r_bininfo_")]
public class rBininfo {
public rBininfo ();
public class RBininfo {
public RBininfo ();
// XXX bad signature?
public int get_line (uint64 addr, out string file, int len, int *line);
public bool set_source_path (string path);

View File

@ -1,50 +1,47 @@
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
[Compact]
[CCode (cheader_filename="r_bp.h", cname="struct r_bp_t", free_function="r_bp_free", cprefix="r_bp_")]
public class Radare.RBreakpoint {
public RBreakpoint ();
public bool use (string arch);
public void enable (uint64 addr, bool enabled);
public bool at_addr (uint64 addr, int rwx);
public Item add_sw (uint64 addr, int len, int rwx);
public Item add_hw (uint64 addr, int len, int rwx);
public bool add_fault (uint64 addr, int len, int rwx);
public int add_cond (string cond);
public bool del (uint64 addr);
public bool del_cond (int idx);
/* TODO: deprecate the list() method.. language iterators should be enought */
public int list (bool rad);
[CCode (cprefix="R_BP_PROT_")]
public enum Protection {
READ,
WRITE,
EXEC
}
[CCode (cprefix="R_BP_TYPE_")]
public enum Type {
SW,
HW,
COND
}
[CCode (cheader_filename="r_bp.h", cprefix="r_bp", lower_case_cprefix="r_bp_")]
namespace Radare {
[Compact]
[CCode (cname="struct r_bp_t", free_function="r_bp_free", cprefix="r_bp_")]
public class rBreakpoint {
public rBreakpoint ();
public bool use (string arch);
public void enable (uint64 addr, bool enabled);
public bool at_addr (uint64 addr, int rwx);
public Item add_sw (uint64 addr, int len, int rwx);
public Item add_hw (uint64 addr, int len, int rwx);
public bool add_fault (uint64 addr, int len, int rwx);
public int add_cond (string cond);
public bool del (uint64 addr);
public bool del_cond (int idx);
/* TODO: deprecate the list() method.. language iterators should be enought */
public int list (bool rad);
[CCode (cprefix="R_BP_PROT_")]
public enum Protection {
READ,
WRITE,
EXEC
}
[CCode (cprefix="R_BP_TYPE_")]
public enum Type {
SW,
HW,
COND
}
[Compact]
[CCode (cname="struct r_bp_item_t", cprefix="r_bp_item")]
public struct Item {
uint64 addr;
int size;
int rwx;
int hw;
int trace;
int enabled;
uint8* obytes;
uint8* bbytes;
int[] pids;
}
[CCode (cname="RBreakpointItem")]
public struct Item {
uint64 addr;
int size;
int rwx;
int hw;
int trace;
int enabled;
uint8* obytes;
uint8* bbytes;
int[] pids;
}
}

View File

@ -2,7 +2,7 @@
namespace Radare {
[Compact]
[CCode (cprefix="r_config_", cname="struct r_config_t", free_function="r_config_free")]
public class rConfig {
public class RConfig {
public void init (void *user);
//TODO: public void setup_file(string file);

View File

@ -4,7 +4,17 @@
namespace Radare {
[Compact]
[CCode (cname="struct r_cons_t", free_function="r_cons_free", cprefix="r_cons_")]
public class rCons {
public class RCons {
public static bool init (); /* you have to call this before using it */
public static bool is_interactive;
public static bool is_html;
public static bool eof();
/* size of terminal */
public static int rows;
public static int columns;
public static void printf(string fmt, ...);
public static void strcat(string str);
public static void memcat(string str, int len);
@ -13,7 +23,6 @@ namespace Radare {
//public static int fgets(out string buf, int len, int argc, string argv[]);
public static int readchar();
public static void any_key();
public static int eof();
public static int get_columns();
public static int get_real_columns();
}

View File

@ -3,9 +3,9 @@
namespace Radare {
[Compact]
[CCode (cheader_filename="r_core.h", cname="struct r_core_t", free_function="r_core_free", cprefix="r_core_")]
public class rCore {
public class RCore {
/* lifecycle */
public rCore();
public RCore();
/* commands */
public int prompt();
@ -21,7 +21,7 @@ namespace Radare {
public int seek(uint64 addr, bool rb);
/* files */
public rCore.File file_open(string file, int mode);
public RCore.File file_open(string file, int mode);
// XXX mode = Radare.Io.Mode
[Compact]

View File

@ -4,7 +4,7 @@
namespace Radare {
[Compact]
[CCode (cname="struct r_crypto_t", free_function="r_crypto_free", cprefix="r_crypto_")]
public class rCrypto {
public class RCrypto {
[CCode (cprefix="R_CRYPTO_DIR")]
public enum Direction {
@ -20,7 +20,7 @@ namespace Radare {
CFB
}
public rCrypto();
public RCrypto();
public bool use(string algorithm);
// public bool set_key(uint8 *key, Crypto.Mode mode, Crypto.Direction direction);
public bool set_iv(uint8 *iv);

View File

@ -1,27 +1,24 @@
/* radare - LGPL - Copyright 2009 pancake<@nopcode.org> */
/* radare - LGPL - Copyright 2009-2010 pancake<@nopcode.org> */
[CCode (cheader_filename="r_db.h", cprefix="r_db_", lower_case_cprefix="r_db_")]
namespace Radare {
[Compact]
[CCode (cname="struct r_db_t", free_function="r_db_free", cprefix="r_db_")]
public class rDatabase {
/* lifecycle */
public rDatabase();
/**
* Initializes a database object
*/
public void init();
public void free();
[Compact]
[CCode (cheader_filename="r_db.h", cname="struct r_db_t", free_function="r_db_free", cprefix="r_db_")]
public class Radare.RDatabase {
/* lifecycle */
public RDatabase();
/**
* Initializes a database object
*/
public void init();
public void free();
/* storage */
public int add_id(int off, int size);
public bool @add(void *b);
public bool add_unique(void *b);
public bool delete(void *b);
public void* get(int key, uint8* buf);
/* storage */
public int add_id(int off, int size);
public bool @add(void *b);
public bool add_unique(void *b);
public bool delete(void *b);
public void* get(int key, uint8* buf);
/* stacky! */
public int push(ref uint8* buf);
public uint8 *pop();
}
/* stacky! */
public int push(ref uint8* buf);
public uint8 *pop();
}

View File

@ -1,66 +1,64 @@
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
namespace Radare {
[Compact]
[CCode (cheader_filename="r_debug.h", cname="struct r_debug_t", free_function="r_debug_free", cprefix="r_debug_")]
public class Radare.RDebug {
public RBreakpoint bp;
public RDebug();
public bool use(string plugin);
/* life cycle */
public bool attach(int pid);
public bool detach(int pid);
// TODO: add attribute to invert arraylen
public bool startv(string[] argv); // XXX
public bool start(string cmd);
public int stop_reason();
/* control flow */
public bool wait();
public bool step(int count);
//public bool kill(int pid, int sig);
public bool step_over(int count);
public bool @continue();
public bool continue_until(uint64 addr);
public bool continue_syscall(int syscall);
//public bool mmu_alloc(uint64 size, out uint64 size);
//public bool mmu_free(uint64 addr);
/* registers */
[Compact]
[CCode (cheader_filename="r_debug.h", cname="struct r_debug_t", free_function="r_debug_free", cprefix="r_debug_")]
public class rDebug {
public rBreakpoint bp;
public rDebug();
[CCode (cname="struct r_debug_t", free_function="r_debug_free", cprefix="r_debug_")]
public struct Register {
public bool use(string plugin);
}
bool reg_sync(bool set);
bool reg_list(int type, int size, bool rad); // TODO must be depreacted
/* life cycle */
public bool attach(int pid);
public bool detach(int pid);
// TODO: add attribute to invert arraylen
public bool startv(string[] argv); // XXX
public bool start(string cmd);
public int stop_reason();
/* control flow */
public bool wait();
public bool step(int count);
//public bool kill(int pid, int sig);
public bool step_over(int count);
public bool @continue();
public bool continue_until(uint64 addr);
public bool continue_syscall(int syscall);
//public bool mmu_alloc(uint64 size, out uint64 size);
//public bool mmu_free(uint64 addr);
/* registers */
[Compact]
[CCode (cname="struct r_debug_t", free_function="r_debug_free", cprefix="r_debug_")]
public struct Register {
}
bool reg_sync(bool set);
bool reg_list(int type, int size, bool rad); // TODO must be depreacted
/* processes */
public struct Process {
public int pid;
public int status;
public int runnable;
// list for childs
// list for threads
//public struct Process *parent;
}
/* processes */
public struct Process {
public int pid;
public int status;
public int runnable;
// list for childs
// list for threads
//public struct Process *parent;
}
// XXX cname=int must be deprecated by valaswig
[CCode (cprefix="R_DBG_PROC_", cname="int")]
public enum ProcessStatus {
STOP,
RUN,
SLEEP,
ZOMBIE,
}
public int pid_add();
public int pid_del();
public int pid_add_thread();
public int pid_del_thread();
//public Process pid_get(int pid); // XXX wrong api syntax 'get' is keyword
//public bool pid_set_status(ProcessStatus status);
[CCode (cprefix="R_DBG_PROC_", cname="int")]
public enum ProcessStatus {
STOP,
RUN,
SLEEP,
ZOMBIE,
}
public int pid_add();
public int pid_del();
public int pid_add_thread();
public int pid_del_thread();
//public Process pid_get(int pid); // XXX wrong api syntax 'get' is keyword
//public bool pid_set_status(ProcessStatus status);
}

View File

@ -3,8 +3,8 @@
namespace Radare {
[Compact]
[CCode (cheader_filename="r_diff.h", cname="struct r_diff_t", free_function="r_diff_free", cprefix="r_diff_")]
public class rDiff {
public rDiff (uint64 off_a = 0LL, uint64 off_b = 0LL);
public class RDiff {
public RDiff (uint64 off_a = 0LL, uint64 off_b = 0LL);
public int buffers (uint8* a, int la, uint8* b, int lb);
//public int set_callback(...);
public int buffers_distance (uint8 *a, int la, uint8 *b, int lb, out int distance, out double similarity);

View File

@ -3,7 +3,7 @@
/* This vapi has been manually generated by me */
[Compact]
[CCode (cheader_filename="r_hash.h", cprefix="r_hash_", cname="struct r_hash_t", free_function="r_hash_free")]
public class Radare.rHash {
public class Radare.RHash {
[CCode (cprefix="R_HASH_")]
[Flags]
public enum Algorithm {
@ -39,7 +39,7 @@ public class Radare.rHash {
public static int pcprint(uint8 *buf, uint64 len);
/* methods */
public rHash(bool rst);
public RHash(bool rst);
// public void init(int rst, Algorithm bits);
public void init(bool rst, int bits);
public uint8 *do_md4(uint8 *input, uint32 len);

View File

@ -2,8 +2,8 @@
namespace Radare {
[Compact]
[CCode (cheader_filename="r_io.h", cname="rIo", free_function="r_io_free", cprefix="r_io_")]
public class rIo {
[CCode (cheader_filename="r_io.h,r_util.h", cname="RIo", free_function="r_io_free", cprefix="r_io_")]
public class RIo {
[CCode (cprefix="R_IO_")]
public enum Perm {
READ = 0,
@ -18,9 +18,9 @@ namespace Radare {
END = 2,
}
public rIo();
public rIo free();
public unowned rIo init();
public RIo();
public RIo free();
public unowned RIo init();
public bool set_write_mask(uint8 *buf, int len);
/**
@ -34,7 +34,7 @@ namespace Radare {
public int open_as(string urihandler, string path, int flags, int mode);
public int read(out uint8 *buf, int len);
public int read_at(uint64 addr, uint8 *buf, int len);
public rBuffer read_buf(uint64 addr, int len);
public RBuffer *read_buf(uint64 addr, int len);
public int write(uint8 *buf, int len);
public uint64 seek(int fd, uint64 addr, int whence);
public int system(string cmd);
@ -49,7 +49,7 @@ namespace Radare {
/* handle */
[Compact]
[CCode (cname="rIoHandle", cprefix="r_io_handle_")]
[CCode (cname="RIoHandle", cprefix="r_io_handle_")]
public class Handle {
string name;
string desc;
@ -63,7 +63,7 @@ namespace Radare {
public void handle_list();
/* maps */
[CCode (cname="rIoMap", cprefix="r_io_map_")]
[CCode (cname="RIoMap", cprefix="r_io_map_")]
public struct Map {
int fd;
uint64 from;
@ -77,7 +77,7 @@ namespace Radare {
public int map_write_at(uint64 addr, uint8 *buf, uint64 len);
/* sections */
[CCode (cname="rIoSection")]
[CCode (cname="RIoSection")]
public struct Section {
string comment;
uint64 from;
@ -88,7 +88,7 @@ namespace Radare {
}
/* desc */
[CCode (cname="rIoDesc")]
[CCode (cname="RIoDesc")]
public struct Desc {
int fd;
int flags;

View File

@ -4,8 +4,8 @@
namespace Radare {
[Compact]
[CCode (cname="struct r_lang_t", free_function="r_lang_free", cprefix="r_lang_")]
public class Language {
public Language();
public class RLanguage {
public RLanguage();
public bool define(string type, string name, void* ptr);
public bool @add(Language.Handler handler);
public bool use(string name);
@ -24,7 +24,7 @@ namespace Radare {
public string help;
}
public Language.Handler cur;
public Handler cur;
}
}

View File

@ -3,9 +3,9 @@
namespace Radare {
[Compact]
[CCode (cheader_filename="r_lib.h", cprefix="r_lib_", cname="struct r_lib_t", free_function="r_lib_free")]
public class rLibrary {
public rLibrary(string symname);
public rLibrary init(string symname);
public class RLibrary {
public RLibrary(string symname);
public RLibrary init(string symname);
public bool close(void *ptr);
public void* opendir(string path);
public string types_get(int idx);

View File

@ -4,8 +4,8 @@
namespace Radare {
[Compact]
[CCode (cname="struct r_parse_t", free_function="r_parse_free", cprefix="r_parse_")]
public class Parse {
public Parse();
public class RParse {
public RParse();
public int init();
public int list();

View File

@ -1,35 +1,32 @@
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
[CCode (cheader_filename="r_range.h", cprefix="r_range", lower_case_cprefix="r_range_")]
namespace Radare {
[Compact]
[CCode (cname="struct r_range_t", free_function="r_range_free", cprefix="r_range_")]
public class rRange {
/* lifecycle */
public Range();
public Range.from_string(string str);
[Compact]
[CCode (cheader_filename="r_range.h", cname="struct r_range_t", free_function="r_range_free", cprefix="r_range_")]
public class Radare.RRange {
/* lifecycle */
public RRange();
public RRange.from_string(string str);
public Range.Item *item_get(uint64 addr);
public uint64 size();
public uint64 add_from_string(string str);
public uint64 add_string(string str);
//public uint64 add(uint64 fr, uint64 to, int rw);
public Item *item_get(uint64 addr);
public uint64 size();
public uint64 add_from_string(string str);
public uint64 add_string(string str);
//public uint64 add(uint64 fr, uint64 to, int rw);
// public bool sub(uint64 fr, uint64 to);
//public bool merge(Range r);
public bool contains(uint64 addr);
public bool sort();
//public bool percent(); // XXX
public bool list(bool rad); // XXX
public bool get_n(int n, out uint64 fr, out uint64 to);
public Range *inverse(uint64 fr, uint64 to, int flags);
//public bool merge(Range r);
public bool contains(uint64 addr);
public bool sort();
//public bool percent(); // XXX
public bool list(bool rad); // XXX
public bool get_n(int n, out uint64 fr, out uint64 to);
public Range *inverse(uint64 fr, uint64 to, int flags);
[Compact]
[CCode (cname="struct r_core_file_t", cprefix="r_core_")]
public static struct Item {
public uint64 fr;
public uint64 to;
public uint8 *data;
public int datalen;
}
[Compact]
[CCode (cname="struct r_range_item_t", cprefix="r_range_item_")]
public static struct Item {
public uint64 fr;
public uint64 to;
public uint8 *data;
public int datalen;
}
}

View File

@ -1,10 +1,9 @@
/* radare - LGPL - Copyright 2009-2010 pancake<@nopcode.org> */
[CCode (cheader_filename="r_reg.h", cprefix="r_reg_", lower_case_cprefix="r_reg_")]
[Compact]
[CCode (cname="struct r_reg_t", free_function="r_reg_free", cprefix="r_reg_")]
public class Radare.rRegister {
[CCode (cprefix="R_REG_TYPE_")]
[CCode (cheader_filename="r_reg.h", cname="struct r_reg_t", free_function="r_reg_free", cprefix="r_reg_")]
public class Radare.RRegister {
[CCode (cprefix="R_REG_TYPE_", cname="int")]
public enum Type {
GPR,
DRX,
@ -37,24 +36,24 @@ public class Radare.rRegister {
[Compact]
[CCode (cname="struct r_reg_set_t", destroy_function="", free_function="" )]
public class Set {
public rRegister.Arena arena;
public rList<rRegister.Arena*> arenas;
public rList<rRegister.Item*> regs;
public RRegister.Arena arena;
public RList<Arena*> arenas;
public RList<Item*> regs;
}
[NoArrayLength]
[CCode (cname="r_reg_types")]
public static weak string types[]; //Type.LAST];
public rRegister();
public RRegister();
public bool set_profile(string file);
public bool set_profile_string(string profile);
public rRegister.Item get(string name, int type = -1);
public Item get(string name, int type = -1);
/* TODO: use r_array or r_list here */
//public KernelList<rRegister.Item*> get_list(rRegister.Type type);
//public KernelList<RRegister.Item*> get_list(RRegister.Type type);
public uint64 get_value(rRegister.Item item);
public bool set_value(rRegister.Item item, uint64 val);
public uint64 get_value(Item item);
public bool set_value(Item item, uint64 val);
public float get_fvalue(Item item);
public bool set_fvalue(Item item, float val);

View File

@ -1,52 +1,48 @@
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
[CCode (cheader_filename="r_search.h")]
namespace Radare {
[Compact]
[CCode (cheader_filename="r_search.h", cname="struct r_search_t", free_function="r_search_free", cprefix="r_search_")]
public class Radare.RSearch {
public RSearch (Mode mode);
public bool set_mode (Mode mode);
public bool set_string_limits (uint32 min, uint32 max);
public bool begin();
public void kw_reset();
public void reset();
public bool update(out uint64 from, uint8 *buf, long len);
public bool update_i(uint64 from, uint8 *buf, long len);
public bool kw_add(string kw, string binmask);
public bool kw_add_hex(string kw, string binmask);
public bool kw_add_bin(string kw, uint32 kw_len, string binmask, long bm_len);
public Keyword kw_list();
public int set_callback(Callback cb, void *user);
public int pattern_update(int size); // this is uint? long?
public int set_pattern_size(int size); // this is uint? long?
public int strings_update(uint64 addr, char *buf, int len, int enc);
[Compact]
[CCode (cname="struct r_search_t", free_function="r_search_free", cprefix="r_search_")]
public class rSearch {
public rSearch (Mode mode);
public bool set_mode (Mode mode);
public bool set_string_limits (uint32 min, uint32 max);
public bool begin();
public void kw_reset();
public void reset();
public bool update(out uint64 from, uint8 *buf, long len);
public bool update_i(uint64 from, uint8 *buf, long len);
public bool kw_add(string kw, string binmask);
public bool kw_add_hex(string kw, string binmask);
public bool kw_add_bin(string kw, uint32 kw_len, string binmask, long bm_len);
public Keyword kw_list();
public int set_callback(Callback cb, void *user);
public int pattern_update(int size); // this is uint? long?
public int set_pattern_size(int size); // this is uint? long?
public int strings_update(uint64 addr, char *buf, int len, int enc);
[CCode (cprefix="R_SEARCH_", cname="int")]
public enum Mode {
KEYWORD,
REGEXP,
PATTERN,
STRING,
XREFS,
AES
}
[Compact]
[CCode (cname="struct r_search_kw_t")]
public struct Keyword {
public unowned string keyword;
public unowned string binmask;
public uint8 *bin_keyword;
public uint8 *bin_binmask;
public int keyword_length;
public int binmask_length;
public int idx;
public int count;
}
[CCode (cprefix="R_SEARCH_", cname="int")]
public enum Mode {
KEYWORD,
REGEXP,
PATTERN,
STRING,
XREFS,
AES
}
[CCode (cname="rSearchCallback")]
public static delegate int Callback(rSearch.Keyword s, void *user, uint64 addr);
[Compact]
[CCode (cname="struct r_search_kw_t")]
public struct Keyword {
public unowned string keyword;
public unowned string binmask;
public uint8 *bin_keyword;
public uint8 *bin_binmask;
public int keyword_length;
public int binmask_length;
public int idx;
public int count;
}
[CCode (cname="RSearchCallback")]
public static delegate int Callback(Keyword s, void *user, uint64 addr);
}

View File

@ -2,21 +2,20 @@
/* TODO: Add simpletype instead of int so, we can use it as an object */
[SimpleType]
[CCode (cname="int", cheader_filename="r_socket.h", cprefix="r_socket_")]
public struct Radare.rSocket : int
public struct Radare.RSocket : int
{
public bool ready(int secs, int usecs);
[NoArrayLength]
public int read(string *buf, int len);
[NoArrayLength]
public int write(int fd, void *buf, int len);
[CCode (cname="r_socket_connect")]
public rSocket.connect(string host, int port);
public RSocket.connect(string host, int port);
[CCode (cname="r_socket_listen")]
public rSocket.listen(int port);
public RSocket.listen(int port);
public bool ready(int secs, int usecs);
public int read(ref string buf, int len);
public int write(int fd, void *buf, int len);
public int close();
[NoArrayLength]
public int gets(string buf, int len);
public int gets(ref string buf, int len);
public int printf(string str, ...);
public int accept();
public void block(bool blocking);

View File

@ -1,29 +1,26 @@
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
[CCode (cheader_filename="r_syscall.h", cprefix="r_", lower_case_cprefix="r_")]
namespace Radare {
[Compact]
[CCode (cname="struct r_syscall_t", free_function="r_syscall_free", cprefix="r_syscall_")]
public class rSyscall {
[Compact]
[CCode (cheader_filename="r_syscall.h", cname="struct r_syscall_t", free_function="r_syscall_free", cprefix="r_syscall_")]
public class Radare.RSyscall {
[CCode (cprefix="R_SYSCALL_OS_")]
public enum OS {
LINUX = 0,
NETBSD, OPENBSD, FREEBSD,
DARWIN
}
[CCode (cprefix="R_SYSCALL_ARCH_")]
public enum ARCH {
X86 = 0, PPC, ARM, MIPS, SPARC
}
public rSyscall();
public void setup(int os, int arch);
public void setup_file(string file);
public int get(string syscall);
public string get_i(int num, int swi);
public string get_n(int num);
public void list();
[CCode (cprefix="R_SYSCALL_OS_")]
public enum OS {
LINUX = 0,
NETBSD, OPENBSD, FREEBSD,
DARWIN
}
[CCode (cprefix="R_SYSCALL_ARCH_")]
public enum ARCH {
X86 = 0, PPC, ARM, MIPS, SPARC
}
public RSyscall();
public void setup(int os, int arch);
public void setup_file(string file);
public int get(string syscall);
public string get_i(int num, int swi);
public string get_n(int num);
public void list();
}

View File

@ -1,133 +1,132 @@
/* radare - LGPL - Copyright 2009 pancake<@nopcode.org> */
namespace Radare {
[Compact]
[CCode (cheader_filename="r_util.h", cprefix="r_util_")]
public static class rUtil {
//public static int hex_str2bin (string input, uint8 *buf);
//public static int hex_bin2str (uint8 *buf, int len, out string str);
//public static string hex_bin2strdup (uint8 *buf, int len);
/* mem */
//public static uint8 *mem_mem (uint8 *a, int al, uint8 *b, int bl);
//public static void mem_copyendian (uint8 *dest, uint8 *orig, int size, int endian);
//public static void mem_copyloop (uint8 *dest, uint8 *orig, int dsize, int osize);
//public static void mem_cmp_mask (uint8 *dest, uint8 *orig, uint8 *mask, int len);
/* num */
//public static uint64 num_get(void *num, string str); // XXX void *
//public static int offsetof(void *type, void *member);
}
//[Compact]
//[CCode (cheader_filename="r_util.h", cprefix="r_util_")]
//public static class Radare.RUtil {
//public static int hex_str2bin (string input, uint8 *buf);
//public static int hex_bin2str (uint8 *buf, int len, out string str);
//public static string hex_bin2strdup (uint8 *buf, int len);
/* mem */
//public static uint8 *mem_mem (uint8 *a, int al, uint8 *b, int bl);
//public static void mem_copyendian (uint8 *dest, uint8 *orig, int size, int endian);
//public static void mem_copyloop (uint8 *dest, uint8 *orig, int dsize, int osize);
//public static void mem_cmp_mask (uint8 *dest, uint8 *orig, uint8 *mask, int len);
/* num */
//public static uint64 num_get(void *num, string str); // XXX void *
//public static int offsetof(void *type, void *member);
//}
// ???
[CCode (cheader_filename="r_util.h", cprefix="r_str_")]
public static class rStr {
public rStr();
public int hash(string str);
}
// ??? wtf
[CCode (cheader_filename="r_util.h", cprefix="r_str_")]
public static class RString {
public RString();
public int hash(string str);
}
[CCode (cheader_filename="r_util.h", cprefix="r_num_")]
public static class rNum {
public rNum(rNumCallback cb, void *user);
public uint64 get(string str);
public uint64 math(string str);
}
public delegate uint64 rNumCallback (rNum num, string str, int *ok);
[CCode (cheader_filename="r_util.h", cprefix="r_num_")]
public static class RNum {
public RNum(RNumCallback cb, void *user);
public uint64 get(string str);
public uint64 math(string str);
}
public delegate uint64 RNumCallback (RNum num, string str, int *ok);
[CCode (cheader_filename="r_util.h", cprefix="r_log_")]
public static class rLog {
public bool msg(string str);
public bool err(string str);
}
[CCode (cheader_filename="r_util.h", cprefix="r_log_")]
public static class RLog {
public bool msg(string str);
public bool err(string str);
}
[CCode (cheader_filename="r_util.h", cprefix="r_buf_")]
public class rBuffer {
public rBuffer();
public int read_at(uint64 addr, uint8 *buf, int len);
public int write_at(uint64 addr, uint8 *buf, int len);
public bool set_bytes(uint8 *buf, int len);
//public bool memcpy(uint64 addr, uint8 *dst, uint8 *src, int len);
/* ... */
}
[Compact]
[CCode (cname="RBuffer", cheader_filename="r_util.h", cprefix="r_buf_")]
public class RBuffer {
public RBuffer();
public int read_at(uint64 addr, uint8 *buf, int len);
public int write_at(uint64 addr, uint8 *buf, int len);
public bool set_bytes(uint8 *buf, int len);
//public bool memcpy(uint64 addr, uint8 *dst, uint8 *src, int len);
/* ... */
}
/* Generic Iterator interfaced with r_iter */
/* Generic Iterator interfaced with r_iter */
#if 0
// XXX not yet supported by valaswig ://
[Compact]
[CCode (cheader_filename="r_array.h", cprefix="r_array_", cname="void*")]
public class rArray<G> {
public rArray (int size);
public unowned G cur ();
public bool next ();
public void rewind ();
public unowned G get ();
public unowned rArray<G> get_n (int idx);
public unowned G prev ();
public void delete ();
public unowned G first ();
public void @foreach (rArrayCallback cb);
public unowned G free ();
public void set (int idx, owned G data);
public rArray<G> iterator ();
/* defining the callback here results in signature of:
static gint __lambda1__void*r_iter_callback (IterableObject* foo, gpointer self) {
^---- wtf!
iter.vala:55.23-55.28: error: The name `name' does not exist in the context of `G'
public delegate int rIterCallback (G foo);
*/
}
/* TODO: move this declaration inside rIter to have access to the Generic type */
public delegate int rArrayCallback (void *foo);
[Compact]
[CCode (cheader_filename="r_array.h", cprefix="r_array_", cname="void*")]
public class RArray<G> {
public RArray (int size);
public unowned G cur ();
public bool next ();
public void rewind ();
public unowned G get ();
public unowned rArray<G> get_n (int idx);
public unowned G prev ();
public void delete ();
public unowned G first ();
public void @foreach (rArrayCallback cb);
public unowned G free ();
public void set (int idx, owned G data);
public rArray<G> iterator ();
/* defining the callback here results in signature of:
static gint __lambda1__void*r_iter_callback (IterableObject* foo, gpointer self) {
^---- wtf!
iter.vala:55.23-55.28: error: The name `name' does not exist in the context of `G'
public delegate int rIterCallback (G foo);
*/
}
/* TODO: move this declaration inside rIter to have access to the Generic type */
public delegate int rArrayCallback (void *foo);
#endif
#if 0
/* TODO: to be removed. not fully compliant */
[Compact]
[CCode (cprefix="ralist_", cheader_filename="r_types.h,list.h", cname="struct list_head")]
public class KernelList<G> {
public KernelList ();
[CCode (cname="ralist_next")]
public bool next();
[CCode (cname="ralist_append")]
public void append(owned G foo);
[CCode (cname="")]
public G @free(G arg);
[CCode (cname="ralist_get", generic_type_pos=2)]
public unowned G get();
[CCode (cname="ralist_iterator")]
public KernelList<G> iterator();
}
/* TODO: to be removed. not fully compliant */
[Compact]
[CCode (cprefix="ralist_", cheader_filename="r_types.h,list.h", cname="struct list_head")]
public class KernelList<G> {
public KernelList ();
[CCode (cname="ralist_next")]
public bool next();
[CCode (cname="ralist_append")]
public void append(owned G foo);
[CCode (cname="")]
public G @free(G arg);
[CCode (cname="ralist_get", generic_type_pos=2)]
public unowned G get();
[CCode (cname="ralist_iterator")]
public KernelList<G> iterator();
}
#endif
[Compact]
[CCode (cprefix="r_list_", cheader_filename="r_util.h", cname="struct r_list_t")]
public class rList<G> {
public rList ();
public void append(owned G foo);
public void prepend(owned G foo);
//public unowned G get();
//public rListIter<G> iterator();
}
[Compact]
[CCode (cprefix="r_list_iter_", cheader_filename="r_list.h", cname="struct r_list_iter_t")]
public class rListIter<G> {
public bool next();
// public G @free(G arg);
public unowned G get();
}
/* TODO: deprecated by r_iter ??? */
/*
[Compact]
[CCode (cprefix="rarray_", cheader_filename="r_types.h", cname="void")]
public static class rArray<G> {
[CCode (cname="rarray_next", generic_type_pos=2)]
public bool next(); //int type=0);
[CCode (cname="")]
public G @free(G arg);
[CCode (cname="rarray_get", generic_type_pos=2)]
public unowned G get(); //int type=0);
[CCode (cname="rarray_iterator")] //, generic_type_pos=2)]
public rArray<G> iterator();
}
*/
[Compact]
[CCode (cprefix="r_list_", cheader_filename="r_util.h", cname="struct r_list_t")]
public class RList<G> {
public RList ();
public void append(owned G foo);
public void prepend(owned G foo);
//public unowned G get();
//public rListIter<G> iterator();
}
[Compact]
[CCode (cprefix="r_list_iter_", cheader_filename="r_list.h", cname="struct r_list_iter_t")]
public class RListIter<G> {
public bool next();
// public G @free(G arg);
public unowned G get();
}
/* TODO: deprecated by r_iter ??? */
/*
[Compact]
[CCode (cprefix="rarray_", cheader_filename="r_types.h", cname="void")]
public static class rArray<G> {
[CCode (cname="rarray_next", generic_type_pos=2)]
public bool next(); //int type=0);
[CCode (cname="")]
public G @free(G arg);
[CCode (cname="rarray_get", generic_type_pos=2)]
public unowned G get(); //int type=0);
[CCode (cname="rarray_iterator")] //, generic_type_pos=2)]
public rArray<G> iterator();
}
*/

View File

@ -54,8 +54,8 @@ oldtest:
python test.py
clean:
rm -rf python/*.so python/*.c python/*.i
rm -rf perl/*.so perl/*.pm perl/*.c perl/*.i
rm -rf ruby/*.so ruby/*.c ruby/*.i
rm -rf python/*.so python/*.c python/*.i python/libr*
rm -rf perl/*.so perl/*.pm perl/*.c perl/*.i perl/libr*
rm -rf ruby/*.so ruby/*.c ruby/*.i ruby/libr*
.PHONY: ruby python perl clean oldtest test all

View File

@ -1,4 +1,6 @@
#!/bin/sh
#
LNG=$1
MOD=$2
if [ -z "${MOD}" ]; then
@ -10,4 +12,8 @@ cd ${LNG}
#valaswig-cc ${LNG} ${MOD} -I../../libr/include ../../libr/vapi/${MOD}.vapi -l${MOD} -L../../libr/$(echo ${MOD} | sed -e s,r_,,)
valaswig-cc ${LNG} ${MOD} -I../../libr/include ../../libr/vapi/${MOD} `pkg-config --libs ${MOD}`
echo LIBS = `pkg-config --libs ${MOD}`
valaswig-cc ${LNG} ${MOD} \
--vapidir=../../libr/vapi -I../../libr/include \
../../libr/vapi/${MOD} `pkg-config --libs ${MOD}`

View File

@ -11,7 +11,7 @@ def disasm(a, arch, op):
else:
print "HEX: %s"%code.buf_hex
a = rAsm()
a = RAsm()
print "---[ name ]-----[ description ]----------"
a.list()

View File

@ -2,7 +2,7 @@
from r_bp import *
a = rBreakpoint ()
a = RBreakpoint ()
a.use ('x86')
a.add_hw (0x8048000, 10, 0)
a.add_sw (0x8048000, 10, 0)

View File

@ -1,7 +1,7 @@
#from r2.r_hash import rHash, Size_MD4
from libr import rHash, Size_MD4
from libr import RHash, Size_MD4
hash = rHash(False)
hash = RHash(False)
ret = hash.do_md4 ("food", 4)
str = "md4: "
for i in range(0, Size_MD4):

View File

@ -1,8 +1,8 @@
#!/usr/bin/ruby
require 'r_bp'
require 'libr'
bp = R_bp::RBreakpoint.new
bp = Libr::RBreakpoint.new
bp.use('x86');
bp.add_hw(0x8048400,0,0);
bp.list(0)

7
swig/ruby/test-r_core.rb Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/ruby
require 'libr'
core = Libr::RCore.new
core.file_open("/bin/ls", 0);
print core.cmd_str("pd 20");