* 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:
parent
bd84d7dfa0
commit
54bdfb22bd
|
@ -436,7 +436,7 @@ for A in ${ENVWORDS} ; do
|
||||||
SEDFLAGS="${SEDFLAGS}s,@${A}@,${VAR},g;"
|
SEDFLAGS="${SEDFLAGS}s,@${A}@,${VAR},g;"
|
||||||
done
|
done
|
||||||
SEDFLAGS="${SEDFLAGS}'"
|
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
|
if [ -f "${VPATH}/${A}.acr" ]; then
|
||||||
SD_TARGET=${A}
|
SD_TARGET=${A}
|
||||||
else
|
else
|
||||||
|
|
|
@ -83,4 +83,5 @@ SUBDIRS ./config-user.mk libr/include/r_userconf.h
|
||||||
pkgcfg/r_th.pc
|
pkgcfg/r_th.pc
|
||||||
pkgcfg/r_bp.pc
|
pkgcfg/r_bp.pc
|
||||||
pkgcfg/r_db.pc
|
pkgcfg/r_db.pc
|
||||||
|
pkgcfg/r_lib.pc
|
||||||
;
|
;
|
||||||
|
|
|
@ -25,15 +25,18 @@ libs:
|
||||||
|
|
||||||
libr: .objs libr2.${EXT_SO} libr2.${EXT_AR}
|
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)
|
ifeq ($(WITHPIC),1)
|
||||||
libr2.${EXT_SO}:
|
libr2.${EXT_SO}:
|
||||||
${CC} -shared ${PIC_CFLAGS} .objs/*.o -o 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
|
else
|
||||||
libr2.${EXT_SO}:
|
libr2.${EXT_SO}:
|
||||||
|
|
||||||
|
libr2.${EXT_AR}:
|
||||||
|
ar -r libr2.${EXT_AR} .objs/*.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# XXX needs autodetection of deps to remake and so..
|
# XXX needs autodetection of deps to remake and so..
|
||||||
|
|
|
@ -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;
|
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;
|
struct list_head *pos;
|
||||||
rBreakpointItem *b;
|
RBreakpointItem *b;
|
||||||
|
|
||||||
eprintf ("===ataddr=== 0x%08llx\n", addr);
|
eprintf ("===ataddr=== 0x%08llx\n", addr);
|
||||||
list_for_each(pos, &bp->bps) {
|
list_for_each(pos, &bp->bps) {
|
||||||
|
|
11
libr/bp/io.c
11
libr/bp/io.c
|
@ -1,4 +1,7 @@
|
||||||
|
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
|
||||||
|
|
||||||
#include <r_bp.h>
|
#include <r_bp.h>
|
||||||
|
#include "../config.h"
|
||||||
|
|
||||||
// TODO: rename from r_debug_ ...
|
// TODO: rename from r_debug_ ...
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -78,14 +81,14 @@ R_API int r_bp_restore(struct r_bp_t *bp, int set)
|
||||||
return R_TRUE;
|
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);
|
RBreakpointItem *b = r_bp_at_addr (bp, addr, 0xFFFFFF);
|
||||||
if (b) {
|
if (b) {
|
||||||
eprintf("HIT AT ADDR 0x%llx\n", addr);
|
eprintf("HIT AT ADDR 0x%llx\n", addr);
|
||||||
eprintf(" recoil = %d\n", b->recoil);
|
eprintf(" recoil = %d\n", b->recoil);
|
||||||
eprintf(" size = %d\n", b->size);
|
eprintf(" size = %d\n", b->size);
|
||||||
}
|
}
|
||||||
if (b) if (!b->hw && ((b->addr + b->size) == addr))
|
if (b) if (!b->hw && ((b->addr + b->size) == addr))
|
||||||
return b->recoil;
|
return b->recoil;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
114
libr/cons/cons.c
114
libr/cons/cons.c
|
@ -36,8 +36,10 @@ static char *r_cons_buffer = NULL;
|
||||||
static char *r_cons_lastline = NULL;
|
static char *r_cons_lastline = NULL;
|
||||||
char *r_cons_filterline = NULL;
|
char *r_cons_filterline = NULL;
|
||||||
char *r_cons_teefile = NULL;
|
char *r_cons_teefile = NULL;
|
||||||
int r_cons_is_html = 0;
|
int r_cons_is_interactive = R_TRUE;
|
||||||
int r_cons_interactive = 1;
|
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_lines = 0;
|
||||||
int r_cons_noflush = 0;
|
int r_cons_noflush = 0;
|
||||||
|
|
||||||
|
@ -79,8 +81,13 @@ R_API void r_cons_break_end()
|
||||||
R_API int r_cons_init()
|
R_API int r_cons_init()
|
||||||
{
|
{
|
||||||
r_cons_stdin_fd = stdin;
|
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
|
#if HAVE_DIETLINE
|
||||||
r_line_init();
|
r_line_init ();
|
||||||
#endif
|
#endif
|
||||||
//r_cons_palette_init(NULL);
|
//r_cons_palette_init(NULL);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -101,36 +108,19 @@ static void palloc(int moar)
|
||||||
|
|
||||||
R_API int r_cons_eof()
|
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)
|
R_API void r_cons_gotoxy(int x, int y)
|
||||||
{
|
{
|
||||||
#if __WINDOWS__
|
#if __WINDOWS__
|
||||||
static HANDLE hStdout = NULL;
|
static HANDLE hStdout = NULL;
|
||||||
COORD coord;
|
COORD coord;
|
||||||
|
|
||||||
coord.X = x;
|
coord.X = x;
|
||||||
coord.Y = y;
|
coord.Y = y;
|
||||||
|
|
||||||
if(!hStdout)
|
if(!hStdout)
|
||||||
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
|
||||||
SetConsoleCursorPosition(hStdout,coord);
|
SetConsoleCursorPosition(hStdout,coord);
|
||||||
#else
|
#else
|
||||||
r_cons_strcat("\x1b[0;0H");
|
r_cons_strcat("\x1b[0;0H");
|
||||||
|
@ -251,9 +241,10 @@ R_API void r_cons_flush()
|
||||||
if (r_cons_noflush)
|
if (r_cons_noflush)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (r_cons_interactive) {
|
if (r_cons_is_interactive) {
|
||||||
if (r_cons_buffer_len > CONS_MAX_USER) {
|
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();
|
r_cons_reset();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -263,11 +254,18 @@ R_API void r_cons_flush()
|
||||||
if (tee&&tee[0]) {
|
if (tee&&tee[0]) {
|
||||||
FILE *d = fopen(tee, "a+");
|
FILE *d = fopen(tee, "a+");
|
||||||
if (d != NULL) {
|
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);
|
fclose(d);
|
||||||
}
|
}
|
||||||
// TODO: make this 'write' portable
|
} else {
|
||||||
} else write(1, r_cons_buffer, r_cons_buffer_len);
|
// 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();
|
r_cons_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,18 +275,13 @@ R_API void r_cons_printf(const char *format, ...)
|
||||||
char buf[CONS_BUFSZ];
|
char buf[CONS_BUFSZ];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
if (strchr(format,'%')==NULL) {
|
if (strchr (format, '%')) {
|
||||||
r_cons_strcat(format);
|
va_start (ap, format);
|
||||||
return;
|
len = vsnprintf (buf, CONS_BUFSZ-1, format, ap);
|
||||||
}
|
|
||||||
|
|
||||||
va_start(ap, format);
|
|
||||||
|
|
||||||
len = vsnprintf(buf, CONS_BUFSZ-1, format, ap);
|
|
||||||
if (len>0)
|
if (len>0)
|
||||||
r_cons_memcat(buf, len);
|
r_cons_memcat (buf, len);
|
||||||
|
va_end (ap);
|
||||||
va_end(ap);
|
} else r_cons_strcat (format);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: use const char * instead ..strdup at the beggining? */
|
/* TODO: use const char * instead ..strdup at the beggining? */
|
||||||
|
@ -386,6 +379,8 @@ R_API void r_cons_newline()
|
||||||
else r_cons_strcat("\n");
|
else r_cons_strcat("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* TODO: deprecated */
|
||||||
R_API int r_cons_get_columns()
|
R_API int r_cons_get_columns()
|
||||||
{
|
{
|
||||||
int columns_i = r_cons_get_real_columns();
|
int columns_i = r_cons_get_real_columns();
|
||||||
|
@ -399,29 +394,28 @@ R_API int r_cons_get_columns()
|
||||||
|
|
||||||
return columns_i;
|
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__
|
#if __UNIX__
|
||||||
struct winsize win;
|
struct winsize win;
|
||||||
|
if (ioctl (1, TIOCGWINSZ, &win) == 0) {
|
||||||
if (ioctl(1, TIOCGWINSZ, &win)) {
|
r_cons_columns = win.ws_col;
|
||||||
/* default values */
|
r_cons_rows = win.ws_row;
|
||||||
win.ws_col = 80;
|
|
||||||
win.ws_row = 23;
|
|
||||||
}
|
}
|
||||||
#ifdef RADARE_CORE
|
|
||||||
config.width = win.ws_col;
|
|
||||||
config.height = win.ws_row;
|
|
||||||
#endif
|
|
||||||
return win.ws_col;
|
|
||||||
#else
|
#else
|
||||||
return 80;
|
const char *str = r_sys_getenv ("COLUMNS");
|
||||||
|
if (str != NULL)
|
||||||
|
r_cons_columns = atoi (str);
|
||||||
#endif
|
#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;
|
va_list ap;
|
||||||
int key = def;
|
int key = def;
|
||||||
va_start(ap, fmt);
|
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] )
|
* void r_cons_set_raw( [0,1] )
|
||||||
*
|
*
|
||||||
* Change canonicality of the terminal
|
* Change canonicality of the terminal
|
||||||
|
@ -471,8 +464,7 @@ R_API void r_cons_set_raw(int b)
|
||||||
termios_init = 1;
|
termios_init = 1;
|
||||||
}
|
}
|
||||||
tcsetattr(0, TCSANOW, &tio_new);
|
tcsetattr(0, TCSANOW, &tio_new);
|
||||||
} else
|
} else tcsetattr(0, TCSANOW, &tio_old);
|
||||||
tcsetattr(0, TCSANOW, &tio_old);
|
|
||||||
#else
|
#else
|
||||||
/* TODO : W32 */
|
/* TODO : W32 */
|
||||||
#endif
|
#endif
|
||||||
|
@ -485,9 +477,9 @@ R_API void r_cons_set_raw(int b)
|
||||||
R_API int r_cons_get_arrow(int ch)
|
R_API int r_cons_get_arrow(int ch)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
printf("ARROW(0x%x)\n", ch);
|
printf("ARROW(0x%x)\n", ch);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
r_sys_sleep(3);
|
r_sys_sleep(3);
|
||||||
#endif
|
#endif
|
||||||
if (ch==0x1b) {
|
if (ch==0x1b) {
|
||||||
ch = r_cons_readchar();
|
ch = r_cons_readchar();
|
||||||
|
@ -501,10 +493,8 @@ r_sys_sleep(3);
|
||||||
case 0x42: ch='j'; break; // down
|
case 0x42: ch='j'; break; // down
|
||||||
case 0x43: ch='l'; break; // right
|
case 0x43: ch='l'; break; // right
|
||||||
case 0x44: ch='h'; break; // left
|
case 0x44: ch='h'; break; // left
|
||||||
case 0x3b:
|
case 0x3b: break;
|
||||||
break;
|
default: ch = 0;
|
||||||
default:
|
|
||||||
ch = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
|
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
|
||||||
|
|
||||||
#include <r_cons.h>
|
#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;
|
int esc = 0;
|
||||||
const char *str = (char *)ptr;
|
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int inv = 0;
|
int inv = 0;
|
||||||
int color = 0;
|
|
||||||
|
|
||||||
for (;ptr[0]; ptr = ptr + 1) {
|
for (;ptr[0]; ptr = ptr + 1) {
|
||||||
if (ptr[0] == '\n') {
|
if (ptr[0] == '\n') {
|
||||||
|
@ -143,7 +144,7 @@ int r_cons_html_print(const char *ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __WINDOWS__
|
#if __WINDOWS__
|
||||||
int r_cons_w32_print(unsigned char *ptr)
|
int r_cons_w32_print(ut8 *ptr)
|
||||||
{
|
{
|
||||||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
int esc = 0;
|
int esc = 0;
|
||||||
|
@ -278,8 +279,7 @@ int r_cons_w32_print(unsigned char *ptr)
|
||||||
}
|
}
|
||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
write(1, str, ptr-str);
|
write (1, str, ptr-str);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
|
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
|
||||||
|
|
||||||
#include <r_core.h>
|
#include <r_core.h>
|
||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
|
@ -161,8 +161,9 @@ R_API int r_core_init(struct r_core_t *core)
|
||||||
// XXX fix path here
|
// XXX fix path here
|
||||||
|
|
||||||
/* load plugins */
|
/* load plugins */
|
||||||
r_core_loadlibs(core);
|
r_core_loadlibs (core);
|
||||||
/* UH? */
|
|
||||||
|
// TODO: get arch from r_bin or from native arch
|
||||||
r_asm_use(&core->assembler, DEFAULT_ARCH);
|
r_asm_use(&core->assembler, DEFAULT_ARCH);
|
||||||
r_anal_use(&core->anal, DEFAULT_ARCH);
|
r_anal_use(&core->anal, DEFAULT_ARCH);
|
||||||
r_bp_use(core->dbg.bp, 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)
|
R_API struct r_core_t *r_core_free(struct r_core_t *c)
|
||||||
{
|
{
|
||||||
|
/* TODO: it leaks as shit */
|
||||||
free(c);
|
free(c);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ R_API int r_debug_step_over(struct r_debug_t *dbg, int steps)
|
||||||
/* restore program counter after breakpoint hit */
|
/* restore program counter after breakpoint hit */
|
||||||
static int r_debug_recoil(struct r_debug_t *dbg) {
|
static int r_debug_recoil(struct r_debug_t *dbg) {
|
||||||
int recoil, ret = R_FALSE;
|
int recoil, ret = R_FALSE;
|
||||||
rRegisterItem *ri;
|
RRegisterItem *ri;
|
||||||
r_debug_reg_sync (dbg, R_REG_TYPE_GPR, R_FALSE);
|
r_debug_reg_sync (dbg, R_REG_TYPE_GPR, R_FALSE);
|
||||||
ri = r_reg_get (dbg->reg, "eip", -1);
|
ri = r_reg_get (dbg->reg, "eip", -1);
|
||||||
if (ri) {
|
if (ri) {
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
#define R_ANAL_NAME(x) "anal" R_LIB_SEPARATOR x
|
#define R_ANAL_NAME(x) "anal" R_LIB_SEPARATOR x
|
||||||
|
|
||||||
#define R_ANAL_MAXREG 16
|
#define R_ANAL_MAXREG 16
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -103,9 +102,9 @@ struct r_anal_refline_t {
|
||||||
ut64 to;
|
ut64 to;
|
||||||
int index;
|
int index;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
};
|
} RAnalysisRefline;
|
||||||
|
|
||||||
struct r_anal_aop_t {
|
typedef struct r_anal_aop_t {
|
||||||
int type; /* type of opcode */
|
int type; /* type of opcode */
|
||||||
int stackop; /* operation on stack? */
|
int stackop; /* operation on stack? */
|
||||||
int cond; /* condition type */
|
int cond; /* condition type */
|
||||||
|
@ -118,14 +117,14 @@ struct r_anal_aop_t {
|
||||||
ut64 value; /* reference to value */
|
ut64 value; /* reference to value */
|
||||||
int r_dst[R_ANAL_MAXREG]; /* register arguments */
|
int r_dst[R_ANAL_MAXREG]; /* register arguments */
|
||||||
ut64 i_dst[R_ANAL_MAXREG]; /* inmediate arguments */
|
ut64 i_dst[R_ANAL_MAXREG]; /* inmediate arguments */
|
||||||
};
|
} RAnalysisAop;
|
||||||
|
|
||||||
struct r_anal_fcn_t {
|
typedef struct r_anal_function_t {
|
||||||
ut64 from;
|
ut64 from;
|
||||||
ut64 to;
|
ut64 to;
|
||||||
};
|
} RAnalysisFunction;
|
||||||
|
|
||||||
struct r_anal_t {
|
typedef struct r_anal_t {
|
||||||
int bits;
|
int bits;
|
||||||
int big_endian;
|
int big_endian;
|
||||||
ut64 pc;
|
ut64 pc;
|
||||||
|
@ -133,25 +132,25 @@ struct r_anal_t {
|
||||||
struct r_anal_ctx_t *ctx;
|
struct r_anal_ctx_t *ctx;
|
||||||
struct r_anal_handle_t *cur;
|
struct r_anal_handle_t *cur;
|
||||||
struct list_head anals;
|
struct list_head anals;
|
||||||
};
|
} RAnalysis;
|
||||||
|
|
||||||
struct r_anal_ctx_t {
|
typedef struct r_anal_ctx_t {
|
||||||
/* TODO: add more info here */
|
/* TODO: add more info here */
|
||||||
/* per opcode deep level */
|
/* per opcode deep level */
|
||||||
/* per opcode stack size */
|
/* per opcode stack size */
|
||||||
/* basic blocks */
|
/* basic blocks */
|
||||||
int stacksize;
|
int stacksize;
|
||||||
struct r_anal_t *anal;
|
struct r_anal_t *anal;
|
||||||
};
|
} RAnalysisContext;
|
||||||
|
|
||||||
struct r_anal_handle_t {
|
typedef struct r_anal_handle_t {
|
||||||
char *name;
|
char *name;
|
||||||
char *desc;
|
char *desc;
|
||||||
int (*init)(void *user);
|
int (*init)(void *user);
|
||||||
int (*fini)(void *user);
|
int (*fini)(void *user);
|
||||||
int (*aop)(struct r_anal_t *a, struct r_anal_aop_t *aop, void *data);
|
int (*aop)(struct r_anal_t *a, struct r_anal_aop_t *aop, void *data);
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
};
|
} RAnalysisHandle;
|
||||||
|
|
||||||
/* anal.c */
|
/* anal.c */
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
|
|
|
@ -32,7 +32,7 @@ enum {
|
||||||
|
|
||||||
typedef struct r_asm_fastcall_t {
|
typedef struct r_asm_fastcall_t {
|
||||||
const char *arg[16];
|
const char *arg[16];
|
||||||
} rAsmFastcall;
|
} RAsmFastcall;
|
||||||
|
|
||||||
typedef struct r_asm_aop_t {
|
typedef struct r_asm_aop_t {
|
||||||
int inst_len;
|
int inst_len;
|
||||||
|
@ -40,14 +40,14 @@ typedef struct r_asm_aop_t {
|
||||||
char buf_asm[R_ASM_BUFSIZE];
|
char buf_asm[R_ASM_BUFSIZE];
|
||||||
char buf_hex[R_ASM_BUFSIZE];
|
char buf_hex[R_ASM_BUFSIZE];
|
||||||
char buf_err[R_ASM_BUFSIZE];
|
char buf_err[R_ASM_BUFSIZE];
|
||||||
} rAsmAop;
|
} RAsmAop;
|
||||||
|
|
||||||
typedef struct r_asm_code_t {
|
typedef struct r_asm_code_t {
|
||||||
int len;
|
int len;
|
||||||
ut8 *buf;
|
ut8 *buf;
|
||||||
char *buf_hex;
|
char *buf_hex;
|
||||||
char *buf_asm;
|
char *buf_asm;
|
||||||
} rAsmCode;
|
} RAsmCode;
|
||||||
|
|
||||||
typedef struct r_asm_t {
|
typedef struct r_asm_t {
|
||||||
int bits;
|
int bits;
|
||||||
|
@ -58,7 +58,7 @@ typedef struct r_asm_t {
|
||||||
struct r_asm_handle_t *cur;
|
struct r_asm_handle_t *cur;
|
||||||
struct r_asm_fastcall_t *fastcall;
|
struct r_asm_fastcall_t *fastcall;
|
||||||
struct list_head asms;
|
struct list_head asms;
|
||||||
} rAsm;
|
} RAsm;
|
||||||
|
|
||||||
// TODO: rename to handler?
|
// TODO: rename to handler?
|
||||||
typedef struct r_asm_handle_t {
|
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);
|
int (*set_subarch)(struct r_asm_t *a, const char *buf);
|
||||||
struct r_asm_fastcall_t *fastcall[R_ASM_FASTCALL_ARGS];
|
struct r_asm_fastcall_t *fastcall[R_ASM_FASTCALL_ARGS];
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rAsmHandle;
|
} RAsmHandle;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
/* asm.c */
|
/* asm.c */
|
||||||
|
|
|
@ -30,7 +30,7 @@ typedef struct r_bin_t {
|
||||||
struct r_buf_t *buf;
|
struct r_buf_t *buf;
|
||||||
struct r_bin_handle_t *cur;
|
struct r_bin_handle_t *cur;
|
||||||
struct list_head bins;
|
struct list_head bins;
|
||||||
} rBin;
|
} RBin;
|
||||||
|
|
||||||
typedef struct r_bin_handle_t {
|
typedef struct r_bin_handle_t {
|
||||||
char *name;
|
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_info_t* (*info)(struct r_bin_t *bin);
|
||||||
struct r_bin_field_t* (*fields)(struct r_bin_t *bin);
|
struct r_bin_field_t* (*fields)(struct r_bin_t *bin);
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rBinHandle;
|
} RBinHandle;
|
||||||
|
|
||||||
typedef struct r_bin_entry_t {
|
typedef struct r_bin_entry_t {
|
||||||
ut64 rva;
|
ut64 rva;
|
||||||
ut64 offset;
|
ut64 offset;
|
||||||
} rBinEntry;
|
} RBinEntry;
|
||||||
|
|
||||||
typedef struct r_bin_section_t {
|
typedef struct r_bin_section_t {
|
||||||
char name[R_BIN_SIZEOF_STRINGS];
|
char name[R_BIN_SIZEOF_STRINGS];
|
||||||
|
@ -64,7 +64,7 @@ typedef struct r_bin_section_t {
|
||||||
ut64 offset;
|
ut64 offset;
|
||||||
ut64 characteristics;
|
ut64 characteristics;
|
||||||
int last;
|
int last;
|
||||||
} rBinSection;
|
} RBinSection;
|
||||||
|
|
||||||
#define r_bin_Rarray struct r_bin_symbol_t
|
#define r_bin_Rarray struct r_bin_symbol_t
|
||||||
typedef struct r_bin_symbol_t {
|
typedef struct r_bin_symbol_t {
|
||||||
|
@ -77,7 +77,7 @@ typedef struct r_bin_symbol_t {
|
||||||
ut64 size;
|
ut64 size;
|
||||||
ut64 ordinal;
|
ut64 ordinal;
|
||||||
int last;
|
int last;
|
||||||
} rBinSymbol;
|
} RBinSymbol;
|
||||||
|
|
||||||
typedef struct r_bin_import_t {
|
typedef struct r_bin_import_t {
|
||||||
char name[R_BIN_SIZEOF_STRINGS];
|
char name[R_BIN_SIZEOF_STRINGS];
|
||||||
|
@ -88,7 +88,7 @@ typedef struct r_bin_import_t {
|
||||||
ut64 ordinal;
|
ut64 ordinal;
|
||||||
ut64 hint;
|
ut64 hint;
|
||||||
int last;
|
int last;
|
||||||
} rBinImport;
|
} RBinImport;
|
||||||
|
|
||||||
typedef struct r_bin_string_t {
|
typedef struct r_bin_string_t {
|
||||||
char string[R_BIN_SIZEOF_STRINGS];
|
char string[R_BIN_SIZEOF_STRINGS];
|
||||||
|
@ -97,7 +97,7 @@ typedef struct r_bin_string_t {
|
||||||
ut64 ordinal;
|
ut64 ordinal;
|
||||||
ut64 size;
|
ut64 size;
|
||||||
int last;
|
int last;
|
||||||
} rBinString;
|
} RBinString;
|
||||||
|
|
||||||
typedef struct r_bin_info_t {
|
typedef struct r_bin_info_t {
|
||||||
char type[R_BIN_SIZEOF_STRINGS];
|
char type[R_BIN_SIZEOF_STRINGS];
|
||||||
|
@ -109,14 +109,14 @@ typedef struct r_bin_info_t {
|
||||||
char subsystem[R_BIN_SIZEOF_STRINGS];
|
char subsystem[R_BIN_SIZEOF_STRINGS];
|
||||||
int big_endian;
|
int big_endian;
|
||||||
ut64 dbg_info;
|
ut64 dbg_info;
|
||||||
} rBinInfo;
|
} RBinInfo;
|
||||||
|
|
||||||
typedef struct r_bin_field_t {
|
typedef struct r_bin_field_t {
|
||||||
char name[R_BIN_SIZEOF_STRINGS];
|
char name[R_BIN_SIZEOF_STRINGS];
|
||||||
ut64 rva;
|
ut64 rva;
|
||||||
ut64 offset;
|
ut64 offset;
|
||||||
int last;
|
int last;
|
||||||
} rBinField;
|
} RBinField;
|
||||||
|
|
||||||
typedef struct r_bin_obj_t {
|
typedef struct r_bin_obj_t {
|
||||||
rArray entrys;
|
rArray entrys;
|
||||||
|
@ -125,8 +125,8 @@ typedef struct r_bin_obj_t {
|
||||||
rArray imports;
|
rArray imports;
|
||||||
rArray strings;
|
rArray strings;
|
||||||
rArray fields;
|
rArray fields;
|
||||||
rBinInfo info;
|
RBinInfo info;
|
||||||
} rBinObject;
|
} RBinObject;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API int r_bin_add(struct r_bin_t *bin, struct r_bin_handle_t *foo);
|
R_API int r_bin_add(struct r_bin_t *bin, struct r_bin_handle_t *foo);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#define R_BININFO_SIZEOF_NAMES 256
|
#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 */
|
/* types */
|
||||||
typedef struct r_bininfo_t {
|
typedef struct r_bininfo_t {
|
||||||
const char *file;
|
const char *file;
|
||||||
|
@ -26,7 +26,7 @@ typedef struct r_bininfo_t {
|
||||||
void *user;
|
void *user;
|
||||||
struct r_bininfo_handle_t *cur;
|
struct r_bininfo_handle_t *cur;
|
||||||
struct list_head bins;
|
struct list_head bins;
|
||||||
} rBininfo;
|
} RBininfo;
|
||||||
|
|
||||||
typedef struct r_bininfo_handle_t {
|
typedef struct r_bininfo_handle_t {
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -40,7 +40,7 @@ typedef struct r_bininfo_handle_t {
|
||||||
int (*close)(struct r_bininfo_t *bin);
|
int (*close)(struct r_bininfo_t *bin);
|
||||||
int (*check)(struct r_bininfo_t *bin);
|
int (*check)(struct r_bininfo_t *bin);
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rBininfoHandle;
|
} RBininfoHandle;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
/* bininfo.c */
|
/* bininfo.c */
|
||||||
|
|
|
@ -13,7 +13,7 @@ typedef struct r_bp_arch_t {
|
||||||
int length;
|
int length;
|
||||||
int endian;
|
int endian;
|
||||||
const ut8 *bytes;
|
const ut8 *bytes;
|
||||||
} rBreakpointArch;
|
} RBreakpointArch;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
R_BP_TYPE_SW,
|
R_BP_TYPE_SW,
|
||||||
|
@ -30,7 +30,7 @@ typedef struct r_bp_handle_t {
|
||||||
int nbps;
|
int nbps;
|
||||||
struct r_bp_arch_t *bps;
|
struct r_bp_arch_t *bps;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rBreakpointHandler;
|
} RBreakpointHandler;
|
||||||
|
|
||||||
typedef struct r_bp_item_t {
|
typedef struct r_bp_item_t {
|
||||||
ut64 addr;
|
ut64 addr;
|
||||||
|
@ -45,21 +45,21 @@ typedef struct r_bp_item_t {
|
||||||
ut8 *bbytes; /* breakpoint bytes */
|
ut8 *bbytes; /* breakpoint bytes */
|
||||||
int pids[R_BP_MAXPIDS];
|
int pids[R_BP_MAXPIDS];
|
||||||
struct list_head list;
|
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 {
|
typedef struct r_bp_t {
|
||||||
int trace_all;
|
int trace_all;
|
||||||
ut64 trace_bp;
|
ut64 trace_bp;
|
||||||
int nbps;
|
int nbps;
|
||||||
int stepcont;
|
int stepcont;
|
||||||
rBreakpointCallback breakpoint;
|
RBreakpointCallback breakpoint;
|
||||||
struct r_io_bind_t iob; // compile time dependency
|
struct r_io_bind_t iob; // compile time dependency
|
||||||
struct r_bp_handle_t *cur;
|
struct r_bp_handle_t *cur;
|
||||||
struct list_head plugins;
|
struct list_head plugins;
|
||||||
struct list_head bps;
|
struct list_head bps;
|
||||||
} rBreakpoint;
|
} RBreakpoint;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
R_BP_PROT_READ = 1,
|
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_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 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_restore(struct r_bp_t *bp, int set);
|
||||||
R_API int r_bp_recoil(struct r_bp_t *bp, ut64 addr);
|
R_API int r_bp_recoil(struct r_bp_t *bp, ut64 addr);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,7 +11,7 @@ typedef struct r_cmd_item_t {
|
||||||
char cmd[64];
|
char cmd[64];
|
||||||
char desc[128];
|
char desc[128];
|
||||||
r_cmd_callback(callback);
|
r_cmd_callback(callback);
|
||||||
} CmdItem;
|
} RCommandItem;
|
||||||
|
|
||||||
typedef struct r_cmd_long_item_t {
|
typedef struct r_cmd_long_item_t {
|
||||||
char cmd[64]; /* long command */
|
char cmd[64]; /* long command */
|
||||||
|
@ -19,14 +19,14 @@ typedef struct r_cmd_long_item_t {
|
||||||
char cmd_short[32]; /* short command */
|
char cmd_short[32]; /* short command */
|
||||||
char desc[128];
|
char desc[128];
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} CmdLongItem;
|
} RCommandLongItem;
|
||||||
|
|
||||||
typedef struct r_cmd_t {
|
typedef struct r_cmd_t {
|
||||||
void *data;
|
void *data;
|
||||||
r_cmd_nullcallback(nullcallback);
|
r_cmd_nullcallback(nullcallback);
|
||||||
struct list_head lcmds;
|
struct list_head lcmds;
|
||||||
struct r_cmd_item_t *cmds[255];
|
struct r_cmd_item_t *cmds[255];
|
||||||
} Cmd;
|
} RCommand;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API int r_cmd_init(struct r_cmd_t *cmd);
|
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 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);
|
R_API char **r_cmd_args(struct r_cmd_t *cmd, int *argc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,7 +23,7 @@ typedef struct r_config_node_t {
|
||||||
char **cb_ptr_s;
|
char **cb_ptr_s;
|
||||||
int (*callback)(void *user, void *data);
|
int (*callback)(void *user, void *data);
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rConfigNode;
|
} RConfigNode;
|
||||||
|
|
||||||
typedef struct r_config_t {
|
typedef struct r_config_t {
|
||||||
int lock;
|
int lock;
|
||||||
|
@ -32,25 +32,25 @@ typedef struct r_config_t {
|
||||||
void *user;
|
void *user;
|
||||||
void (*printf)(const char *str, ...);
|
void (*printf)(const char *str, ...);
|
||||||
struct list_head nodes;
|
struct list_head nodes;
|
||||||
} rConfig;
|
} RConfig;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API struct r_config_t *r_config_new(void *user);
|
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_free(struct r_config_t *cfg);
|
||||||
R_API int r_config_init(struct r_config_t *core, void *user);
|
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 void r_config_lock(RConfig *cfg, int l);
|
||||||
R_API int r_config_eval(rConfig *cfg, const char *str);
|
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_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_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 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 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 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 ut64 r_config_get_i(RConfig *cfg, const char *name);
|
||||||
R_API const char *r_config_get(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 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_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 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
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#define C_BGRAY "\x1b[1;38m"
|
#define C_BGRAY "\x1b[1;38m"
|
||||||
|
|
||||||
/* palette */
|
/* palette */
|
||||||
|
|
||||||
#define CONS_PALETTE_SIZE 22
|
#define CONS_PALETTE_SIZE 22
|
||||||
#define CONS_COLORS_SIZE 21
|
#define CONS_COLORS_SIZE 21
|
||||||
enum {
|
enum {
|
||||||
|
@ -77,7 +76,7 @@ enum {
|
||||||
#define COLOR_AD C_GREEN
|
#define COLOR_AD C_GREEN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* XXX */
|
/* XXX : global variables? or a struct with a singleton? */
|
||||||
extern FILE *stdin_fd;
|
extern FILE *stdin_fd;
|
||||||
extern FILE *r_cons_stdin_fd;
|
extern FILE *r_cons_stdin_fd;
|
||||||
extern int r_cons_stdout_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];
|
const char *r_cons_colors[CONS_COLORS_SIZE+1];
|
||||||
extern char r_cons_palette[CONS_PALETTE_SIZE][8];
|
extern char r_cons_palette[CONS_PALETTE_SIZE][8];
|
||||||
extern const char *dl_prompt;
|
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_is_html;
|
||||||
extern int r_cons_noflush;
|
extern int r_cons_noflush;
|
||||||
extern char *r_cons_filterline;
|
extern char *r_cons_filterline;
|
||||||
|
@ -128,11 +129,8 @@ R_API int r_cons_readchar();
|
||||||
R_API void r_cons_any_key();
|
R_API void r_cons_any_key();
|
||||||
R_API int r_cons_eof();
|
R_API int r_cons_eof();
|
||||||
|
|
||||||
/* colors */
|
|
||||||
R_API int r_cons_palette_init(const unsigned char *pal);
|
R_API int r_cons_palette_init(const unsigned char *pal);
|
||||||
|
R_API int r_cons_get_size(int *rows);
|
||||||
R_API int r_cons_get_real_columns();
|
|
||||||
R_API int r_cons_get_columns();
|
|
||||||
R_API int r_cons_get_arrow(int ch);
|
R_API int r_cons_get_arrow(int ch);
|
||||||
R_API int r_cons_html_print(const char *ptr);
|
R_API int r_cons_html_print(const char *ptr);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ typedef struct r_core_file_t {
|
||||||
int fd;
|
int fd;
|
||||||
int dbg;
|
int dbg;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rCoreFile;
|
} RCoreFile;
|
||||||
|
|
||||||
typedef struct r_core_t {
|
typedef struct r_core_t {
|
||||||
ut64 offset;
|
ut64 offset;
|
||||||
|
@ -65,7 +65,7 @@ typedef struct r_core_t {
|
||||||
struct r_macro_t macro;
|
struct r_macro_t macro;
|
||||||
struct r_config_t config;
|
struct r_config_t config;
|
||||||
struct r_search_t *search;
|
struct r_search_t *search;
|
||||||
} rCore;
|
} RCore;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API int r_core_init(struct r_core_t *core);
|
R_API int r_core_init(struct r_core_t *core);
|
||||||
|
|
|
@ -26,7 +26,7 @@ typedef struct r_crypto_t {
|
||||||
int output_size;
|
int output_size;
|
||||||
void *user;
|
void *user;
|
||||||
struct list_head handlers;
|
struct list_head handlers;
|
||||||
} rCrypto;
|
} RCrypto;
|
||||||
|
|
||||||
typedef struct r_crypto_handle_t {
|
typedef struct r_crypto_handle_t {
|
||||||
const char *name;
|
const char *name;
|
||||||
|
@ -38,7 +38,7 @@ typedef struct r_crypto_handle_t {
|
||||||
int (*use)(const char *algo);
|
int (*use)(const char *algo);
|
||||||
int (*fini)(struct r_crypto_t *cry);
|
int (*fini)(struct r_crypto_t *cry);
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rCryptoHandle;
|
} RCryptoHandle;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API struct r_crypto_t *r_crypto_init(struct r_crypto_t *cry, int hard);
|
R_API struct r_crypto_t *r_crypto_init(struct r_crypto_t *cry, int hard);
|
||||||
|
|
|
@ -16,7 +16,7 @@ typedef struct r_db_t {
|
||||||
int blocks_sz[R_DB_KEYS];
|
int blocks_sz[R_DB_KEYS];
|
||||||
void *cb_user;
|
void *cb_user;
|
||||||
int (*cb_free)(void *db, const void *item, void *user);
|
int (*cb_free)(void *db, const void *item, void *user);
|
||||||
} rDatabase;
|
} RDatabase;
|
||||||
|
|
||||||
typedef struct r_db_iter_t {
|
typedef struct r_db_iter_t {
|
||||||
struct r_db_t *db;
|
struct r_db_t *db;
|
||||||
|
@ -25,7 +25,7 @@ typedef struct r_db_iter_t {
|
||||||
int path[256]; /* for each depth level */
|
int path[256]; /* for each depth level */
|
||||||
int ptr; /* pointer in block nodes (repeated childs) */
|
int ptr; /* pointer in block nodes (repeated childs) */
|
||||||
void *cur;
|
void *cur;
|
||||||
} rDatabaseIter;
|
} RDatabaseIter;
|
||||||
|
|
||||||
/* table */
|
/* table */
|
||||||
typedef struct r_db_table_t {
|
typedef struct r_db_table_t {
|
||||||
|
@ -34,7 +34,7 @@ typedef struct r_db_table_t {
|
||||||
char *fmt;
|
char *fmt;
|
||||||
char *args;
|
char *args;
|
||||||
int *offset;
|
int *offset;
|
||||||
} rDatabaseTable;
|
} RDatabaseTable;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API void r_db_init(struct r_db_t *db);
|
R_API void r_db_init(struct r_db_t *db);
|
||||||
|
|
|
@ -37,7 +37,7 @@ typedef struct r_debug_t {
|
||||||
- list of mapped memory (from /proc/XX/maps)
|
- list of mapped memory (from /proc/XX/maps)
|
||||||
- list of managed memory (allocated in child...)
|
- list of managed memory (allocated in child...)
|
||||||
*/
|
*/
|
||||||
} rDebug;
|
} RDebug;
|
||||||
|
|
||||||
/* TODO: pass dbg and user data pointer everywhere */
|
/* TODO: pass dbg and user data pointer everywhere */
|
||||||
typedef struct r_debug_handle_t {
|
typedef struct r_debug_handle_t {
|
||||||
|
@ -54,7 +54,7 @@ typedef struct r_debug_handle_t {
|
||||||
int (*wait)(int pid);
|
int (*wait)(int pid);
|
||||||
int (*contsc)(int pid, int sc);
|
int (*contsc)(int pid, int sc);
|
||||||
/* registers */
|
/* registers */
|
||||||
rBreakpointCallback breakpoint;
|
RBreakpointCallback breakpoint;
|
||||||
int (*reg_read)(struct r_debug_t *dbg, int type, ut8 *buf, int size);
|
int (*reg_read)(struct r_debug_t *dbg, int type, ut8 *buf, int size);
|
||||||
char* (*reg_profile)();
|
char* (*reg_profile)();
|
||||||
int (*reg_write)(int pid, int type, const ut8 *buf, int size); //XXX struct r_regset_t regs);
|
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);
|
int (*mem_free)(void *user, ut64 addr);
|
||||||
|
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rDebugHandle;
|
} RDebugHandle;
|
||||||
|
|
||||||
// TODO: rename to r_debug_process_t ? maybe a thread too ?
|
// TODO: rename to r_debug_process_t ? maybe a thread too ?
|
||||||
typedef struct r_debug_pid_t {
|
typedef struct r_debug_pid_t {
|
||||||
|
@ -74,7 +74,7 @@ typedef struct r_debug_pid_t {
|
||||||
struct list_head childs;
|
struct list_head childs;
|
||||||
struct r_debug_pid_t *parent;
|
struct r_debug_pid_t *parent;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rDebugPid;
|
} RDebugPid;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API int r_debug_use(struct r_debug_t *dbg, const char *str);
|
R_API int r_debug_use(struct r_debug_t *dbg, const char *str);
|
||||||
|
|
|
@ -14,7 +14,7 @@ typedef struct r_diff_op_t {
|
||||||
ut64 b_off;
|
ut64 b_off;
|
||||||
const ut8 *b_buf;
|
const ut8 *b_buf;
|
||||||
int b_len;
|
int b_len;
|
||||||
} rDiffOp;
|
} RDiffOp;
|
||||||
|
|
||||||
typedef struct r_diff_t {
|
typedef struct r_diff_t {
|
||||||
ut64 off_a;
|
ut64 off_a;
|
||||||
|
@ -23,7 +23,7 @@ typedef struct r_diff_t {
|
||||||
void *user;
|
void *user;
|
||||||
int (*callback)(struct r_diff_t *d, void *user,
|
int (*callback)(struct r_diff_t *d, void *user,
|
||||||
struct r_diff_op_t *op);
|
struct r_diff_op_t *op);
|
||||||
} rDiff;
|
} RDiff;
|
||||||
|
|
||||||
/* XXX: this api needs to be reviewed , constructor with offa+offb?? */
|
/* XXX: this api needs to be reviewed , constructor with offa+offb?? */
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
|
|
|
@ -24,7 +24,7 @@ typedef struct r_flag_item_t {
|
||||||
const char *cmd;
|
const char *cmd;
|
||||||
unsigned char data[R_FLAG_BUF_SIZE]; // only take a minor part of the data
|
unsigned char data[R_FLAG_BUF_SIZE]; // only take a minor part of the data
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rFlagItem;
|
} RFlagItem;
|
||||||
|
|
||||||
typedef struct r_flag_t {
|
typedef struct r_flag_t {
|
||||||
int space_idx;
|
int space_idx;
|
||||||
|
@ -36,7 +36,7 @@ typedef struct r_flag_t {
|
||||||
struct btree_node *ntree; /* index by name */
|
struct btree_node *ntree; /* index by name */
|
||||||
#endif
|
#endif
|
||||||
struct list_head flags;
|
struct list_head flags;
|
||||||
} rFlag;
|
} RFlag;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API struct r_flag_t * r_flag_new();
|
R_API struct r_flag_t * r_flag_new();
|
||||||
|
|
|
@ -41,7 +41,7 @@ typedef struct r_hash_t {
|
||||||
SHA512_CTX sha512;
|
SHA512_CTX sha512;
|
||||||
int rst;
|
int rst;
|
||||||
ut8 digest[128];
|
ut8 digest[128];
|
||||||
} rHash;
|
} RHash;
|
||||||
|
|
||||||
#define R_HASH_SIZE_MD4 16
|
#define R_HASH_SIZE_MD4 16
|
||||||
#define R_HASH_SIZE_MD5 16
|
#define R_HASH_SIZE_MD5 16
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#ifndef _LIB_R_IO_H_
|
#ifndef _LIB_R_IO_H_
|
||||||
#define _LIB_R_IO_H_
|
#define _LIB_R_IO_H_
|
||||||
|
|
||||||
#include "r_types.h"
|
#include <r_types.h>
|
||||||
#include "list.h"
|
#include <r_util.h>
|
||||||
|
#include <list.h>
|
||||||
|
|
||||||
#define R_IO_READ 4
|
#define R_IO_READ 4
|
||||||
#define R_IO_WRITE 2
|
#define R_IO_WRITE 2
|
||||||
|
@ -22,7 +23,7 @@ typedef struct r_io_map_t {
|
||||||
ut64 from;
|
ut64 from;
|
||||||
ut64 to;
|
ut64 to;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rIoMap;
|
} RIoMap;
|
||||||
|
|
||||||
/* stores write and seek changes */
|
/* stores write and seek changes */
|
||||||
#define R_IO_UNDOS 64
|
#define R_IO_UNDOS 64
|
||||||
|
@ -37,7 +38,7 @@ typedef struct r_io_undo_t {
|
||||||
int fd[R_IO_UNDOS];
|
int fd[R_IO_UNDOS];
|
||||||
int idx;
|
int idx;
|
||||||
int limit;
|
int limit;
|
||||||
} rIoUndo;
|
} RIoUndo;
|
||||||
|
|
||||||
typedef struct r_io_undo_w_t {
|
typedef struct r_io_undo_w_t {
|
||||||
int set;
|
int set;
|
||||||
|
@ -46,7 +47,7 @@ typedef struct r_io_undo_w_t {
|
||||||
ut8 *n; /* new data */
|
ut8 *n; /* new data */
|
||||||
int len; /* length */
|
int len; /* length */
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rIoUndoWrite;
|
} RIoUndoWrite;
|
||||||
|
|
||||||
typedef struct r_io_t {
|
typedef struct r_io_t {
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -70,7 +71,7 @@ typedef struct r_io_t {
|
||||||
struct list_head maps;
|
struct list_head maps;
|
||||||
struct list_head desc;
|
struct list_head desc;
|
||||||
struct list_head cache;
|
struct list_head cache;
|
||||||
} rIo;
|
} RIo;
|
||||||
|
|
||||||
//struct r_io_handle_fd_t {
|
//struct r_io_handle_fd_t {
|
||||||
// ... store io changes here
|
// ... 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_open)(struct r_io_t *io, const char *);
|
||||||
//int (*handle_fd)(struct r_io_t *, int);
|
//int (*handle_fd)(struct r_io_t *, int);
|
||||||
int fds[R_IO_NFDS];
|
int fds[R_IO_NFDS];
|
||||||
} rIoHandle;
|
} RIoHandle;
|
||||||
|
|
||||||
typedef struct r_io_list_t {
|
typedef struct r_io_list_t {
|
||||||
struct r_io_handle_t *plugin;
|
struct r_io_handle_t *plugin;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rIoList;
|
} RIoList;
|
||||||
|
|
||||||
|
|
||||||
/* TODO: find better name... rIoSetFd_Callback? ..Func? .. too camels here */
|
/* TODO: find better name... RIoSetFd_Callback? ..Func? .. too camels here */
|
||||||
typedef int (*rIoSetFd)(rIo *io, int fd);
|
typedef int (*RIoSetFd)(RIo *io, int fd);
|
||||||
typedef int (*rIoReadAt)(rIo *io, ut64 addr, ut8 *buf, int size);
|
typedef int (*RIoReadAt)(RIo *io, ut64 addr, ut8 *buf, int size);
|
||||||
typedef int (*rIoWriteAt)(rIo *io, ut64 addr, const ut8 *buf, int size);
|
typedef int (*RIoWriteAt)(RIo *io, ut64 addr, const ut8 *buf, int size);
|
||||||
|
|
||||||
/* compile time dependency */
|
/* compile time dependency */
|
||||||
typedef struct r_io_bind_t {
|
typedef struct r_io_bind_t {
|
||||||
int init;
|
int init;
|
||||||
struct r_io_t *io;
|
struct r_io_t *io;
|
||||||
rIoSetFd set_fd;
|
RIoSetFd set_fd;
|
||||||
rIoReadAt read_at;
|
RIoReadAt read_at;
|
||||||
rIoWriteAt write_at;
|
RIoWriteAt write_at;
|
||||||
} rIoBind;
|
} RIoBind;
|
||||||
|
|
||||||
/* sections */
|
/* sections */
|
||||||
typedef struct r_io_section_t {
|
typedef struct r_io_section_t {
|
||||||
|
@ -125,7 +126,7 @@ typedef struct r_io_section_t {
|
||||||
ut64 paddr; // offset on disk
|
ut64 paddr; // offset on disk
|
||||||
int rwx;
|
int rwx;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rIoSection;
|
} RIoSection;
|
||||||
|
|
||||||
typedef struct r_io_cache_t {
|
typedef struct r_io_cache_t {
|
||||||
ut64 from;
|
ut64 from;
|
||||||
|
@ -133,7 +134,7 @@ typedef struct r_io_cache_t {
|
||||||
int size;
|
int size;
|
||||||
ut8 *data;
|
ut8 *data;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rIoCache;
|
} RIoCache;
|
||||||
|
|
||||||
typedef struct r_io_desc_t {
|
typedef struct r_io_desc_t {
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -141,7 +142,7 @@ typedef struct r_io_desc_t {
|
||||||
char name[4096];
|
char name[4096];
|
||||||
struct r_io_handle_t *handle;
|
struct r_io_handle_t *handle;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rIoDesc;
|
} RIoDesc;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
#define r_io_bind_init(x) memset(&x,0,sizeof(x))
|
#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_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_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 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(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 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);
|
R_API ut64 r_io_read_i(struct r_io_t *io, ut64 addr, int sz, int endian);
|
||||||
|
|
|
@ -9,7 +9,7 @@ typedef struct r_lang_t {
|
||||||
void *user;
|
void *user;
|
||||||
struct list_head defs;
|
struct list_head defs;
|
||||||
struct list_head langs;
|
struct list_head langs;
|
||||||
} rLang;
|
} RLang;
|
||||||
|
|
||||||
typedef struct r_lang_handle_t {
|
typedef struct r_lang_handle_t {
|
||||||
const char *name;
|
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 (*run_file)(struct r_lang_t *user, const char *file);
|
||||||
int (*set_argv)(struct r_lang_t *user, int argc, char **argv);
|
int (*set_argv)(struct r_lang_t *user, int argc, char **argv);
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rLangHandle;
|
} RLangHandle;
|
||||||
|
|
||||||
typedef struct r_lang_def_t {
|
typedef struct r_lang_def_t {
|
||||||
char *name;
|
char *name;
|
||||||
char *type;
|
char *type;
|
||||||
void *value;
|
void *value;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rLangDef;
|
} RLangDef;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API struct r_lang_t *r_lang_new();
|
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 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);
|
R_API void r_lang_undef(struct r_lang_t *lang);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,7 +29,7 @@ typedef struct r_lib_plugin_t {
|
||||||
struct r_lib_handler_t *handler;
|
struct r_lib_handler_t *handler;
|
||||||
void *dl_handler; // DL HANDLER
|
void *dl_handler; // DL HANDLER
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rLibraryPlugin;
|
} RLibraryPlugin;
|
||||||
|
|
||||||
/* store list of initialized plugin handlers */
|
/* store list of initialized plugin handlers */
|
||||||
typedef struct r_lib_handler_t {
|
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 (*constructor)(struct r_lib_plugin_t *, void *user, void *data);
|
||||||
int (*destructor)(struct r_lib_plugin_t *, void *user, void *data);
|
int (*destructor)(struct r_lib_plugin_t *, void *user, void *data);
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rLibraryHandler;
|
} RLibraryHandler;
|
||||||
|
|
||||||
/* this structure should be pointed by the 'radare_plugin' symbol
|
/* this structure should be pointed by the 'radare_plugin' symbol
|
||||||
found in the loaded .so */
|
found in the loaded .so */
|
||||||
typedef struct r_lib_struct_t {
|
typedef struct r_lib_struct_t {
|
||||||
int type;
|
int type;
|
||||||
void *data; /* pointer to data handled by plugin handler */
|
void *data; /* pointer to data handled by plugin handler */
|
||||||
} rLibraryStruct;
|
} RLibraryStruct;
|
||||||
|
|
||||||
//extern const char *r_lib_types[];
|
//extern const char *r_lib_types[];
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ typedef struct r_lib_t {
|
||||||
char symname[32];
|
char symname[32];
|
||||||
struct list_head plugins;
|
struct list_head plugins;
|
||||||
struct list_head handlers;
|
struct list_head handlers;
|
||||||
} rLibrary;
|
} RLibrary;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API struct r_lib_t *r_lib_init(struct r_lib_t *lib, const char *symname);
|
R_API struct r_lib_t *r_lib_init(struct r_lib_t *lib, const char *symname);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
typedef struct r_macro_label_t {
|
typedef struct r_macro_label_t {
|
||||||
char name[80];
|
char name[80];
|
||||||
char *ptr;
|
char *ptr;
|
||||||
} rMacrolabel;
|
} RMacrolabel;
|
||||||
|
|
||||||
typedef struct r_macro_item_t {
|
typedef struct r_macro_item_t {
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -19,7 +19,7 @@ typedef struct r_macro_item_t {
|
||||||
char *code;
|
char *code;
|
||||||
int nargs;
|
int nargs;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rMacroItem;
|
} RMacroItem;
|
||||||
|
|
||||||
typedef struct r_macro_t {
|
typedef struct r_macro_t {
|
||||||
int counter;
|
int counter;
|
||||||
|
@ -33,7 +33,7 @@ typedef struct r_macro_t {
|
||||||
int labels_n;
|
int labels_n;
|
||||||
struct r_macro_label_t labels[MACRO_LABELS];
|
struct r_macro_label_t labels[MACRO_LABELS];
|
||||||
struct list_head macros;
|
struct list_head macros;
|
||||||
} rMacro;
|
} RMacro;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API void r_macro_init(struct r_macro_t *mac);
|
R_API void r_macro_init(struct r_macro_t *mac);
|
||||||
|
|
|
@ -10,7 +10,7 @@ typedef struct r_meta_count_t {
|
||||||
int xref_code;
|
int xref_code;
|
||||||
int xref_data;
|
int xref_data;
|
||||||
/* TODO: ... */
|
/* TODO: ... */
|
||||||
} rMetaCount;
|
} RMetaCount;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
TODO:
|
TODO:
|
||||||
|
@ -30,14 +30,14 @@ typedef struct r_meta_item_t {
|
||||||
// int times;
|
// int times;
|
||||||
char *str;
|
char *str;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rMetaItem;
|
} RMetaItem;
|
||||||
|
|
||||||
typedef struct r_meta_t {
|
typedef struct r_meta_t {
|
||||||
struct list_head data;
|
struct list_head data;
|
||||||
// struct reflines_t *reflines = NULL;
|
// struct reflines_t *reflines = NULL;
|
||||||
// struct list_head comments;
|
// struct list_head comments;
|
||||||
// struct list_head xrefs;
|
// struct list_head xrefs;
|
||||||
} rMeta;
|
} RMeta;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
R_META_WHERE_PREV = -1,
|
R_META_WHERE_PREV = -1,
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
// XXX : remove this define???
|
// XXX : remove this define???
|
||||||
#define R_PARSE_STRLEN 256
|
#define R_PARSE_STRLEN 256
|
||||||
|
|
||||||
struct r_parse_t {
|
typedef struct r_parse_t {
|
||||||
void *user;
|
void *user;
|
||||||
struct r_parse_handle_t *cur;
|
struct r_parse_handle_t *cur;
|
||||||
struct list_head parsers;
|
struct list_head parsers;
|
||||||
};
|
} RParse;
|
||||||
|
|
||||||
struct r_parse_handle_t {
|
typedef struct r_parse_handle_t {
|
||||||
char *name;
|
char *name;
|
||||||
char *desc;
|
char *desc;
|
||||||
int (*init)(void *user);
|
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 (*parse)(struct r_parse_t *p, void *data, char *str);
|
||||||
int (*assemble)(struct r_parse_t *p, char *data, char *str);
|
int (*assemble)(struct r_parse_t *p, char *data, char *str);
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
};
|
} RParseHandle;
|
||||||
|
|
||||||
/* parse.c */
|
/* parse.c */
|
||||||
R_API struct r_parse_t *r_parse_new();
|
R_API struct r_parse_t *r_parse_new();
|
||||||
|
|
|
@ -24,7 +24,7 @@ typedef struct r_print_t {
|
||||||
int ocur;
|
int ocur;
|
||||||
int flags;
|
int flags;
|
||||||
int addrmod;
|
int addrmod;
|
||||||
} rPrint;
|
} RPrint;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API struct r_print_t *r_print_new();
|
R_API struct r_print_t *r_print_new();
|
||||||
|
|
|
@ -5,20 +5,21 @@
|
||||||
#include "r_util.h"
|
#include "r_util.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
struct r_range_item_t {
|
typedef struct r_range_item_t {
|
||||||
ut64 fr;
|
ut64 fr;
|
||||||
ut64 to;
|
ut64 to;
|
||||||
ut8 *data;
|
ut8 *data;
|
||||||
int datalen;
|
int datalen;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
};
|
} RRangeItem;
|
||||||
|
|
||||||
struct r_range_t {
|
typedef struct r_range_t {
|
||||||
int count;
|
int count;
|
||||||
int changed;
|
int changed;
|
||||||
struct list_head ranges;
|
struct list_head ranges;
|
||||||
};
|
} RRange;
|
||||||
|
|
||||||
|
#ifdef R_API
|
||||||
int r_range_init(struct r_range_t *r);
|
int r_range_init(struct r_range_t *r);
|
||||||
struct r_range_t *r_range_new();
|
struct r_range_t *r_range_new();
|
||||||
struct r_range_t *r_range_new_from_string(const char *string);
|
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_list(struct r_range_t *rgs, int rad);
|
||||||
int r_range_get_n(struct r_range_t *rgs, int n, ut64 *from, ut64 *to);
|
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);
|
struct r_range_t *r_range_inverse(struct r_range_t *rgs, ut64 from, ut64 to, int flags);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -24,26 +24,26 @@ typedef struct r_reg_item_t {
|
||||||
int offset; // offset in data structure
|
int offset; // offset in data structure
|
||||||
int packed_size; /* 0 means no packed register, 1byte pack, 2b pack... */
|
int packed_size; /* 0 means no packed register, 1byte pack, 2b pack... */
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rRegisterItem;
|
} RRegisterItem;
|
||||||
|
|
||||||
typedef struct r_reg_arena_t {
|
typedef struct r_reg_arena_t {
|
||||||
ut8 *bytes;
|
ut8 *bytes;
|
||||||
int size;
|
int size;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rRegisterArena;
|
} RRegisterArena;
|
||||||
|
|
||||||
typedef struct r_reg_set_t {
|
typedef struct r_reg_set_t {
|
||||||
struct r_reg_arena_t *arena;
|
struct r_reg_arena_t *arena;
|
||||||
struct list_head arenas; /* r_reg_arena_t */
|
struct list_head arenas; /* r_reg_arena_t */
|
||||||
struct list_head regs; /* r_reg_item_t */
|
struct list_head regs; /* r_reg_item_t */
|
||||||
} rRegisterSet;
|
} RRegisterSet;
|
||||||
|
|
||||||
typedef struct r_reg_t {
|
typedef struct r_reg_t {
|
||||||
char *profile;
|
char *profile;
|
||||||
struct r_reg_set_t regset[R_REG_TYPE_LAST];
|
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
|
#ifdef R_API
|
||||||
extern const char *r_reg_types[R_REG_TYPE_LAST+1];
|
extern const char *r_reg_types[R_REG_TYPE_LAST+1];
|
||||||
|
|
|
@ -29,16 +29,16 @@ typedef struct r_search_kw_t {
|
||||||
int count;
|
int count;
|
||||||
int kwidx;
|
int kwidx;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rSearchKeyword;
|
} RSearchKeyword;
|
||||||
|
|
||||||
typedef struct r_search_hit_t {
|
typedef struct r_search_hit_t {
|
||||||
ut64 addr;
|
ut64 addr;
|
||||||
struct r_search_kw_t *kw;
|
struct r_search_kw_t *kw;
|
||||||
int len;
|
int len;
|
||||||
struct list_head list;
|
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 {
|
typedef struct r_search_t {
|
||||||
int n_kws;
|
int n_kws;
|
||||||
|
@ -48,11 +48,11 @@ typedef struct r_search_t {
|
||||||
ut32 string_max; /* max number of matches */
|
ut32 string_max; /* max number of matches */
|
||||||
void *user; /* user data */
|
void *user; /* user data */
|
||||||
//int (*callback)(struct r_search_kw_t *kw, void *user, ut64 where);
|
//int (*callback)(struct r_search_kw_t *kw, void *user, ut64 where);
|
||||||
rSearchCallback callback;
|
RSearchCallback callback;
|
||||||
//struct r_search_binparse_t *bp;
|
//struct r_search_binparse_t *bp;
|
||||||
struct list_head kws; //r_search_hw_t kws;
|
struct list_head kws; //r_search_hw_t kws;
|
||||||
struct list_head hits; //r_search_hit_t hits;
|
struct list_head hits; //r_search_hit_t hits;
|
||||||
} rSearch;
|
} RSearch;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API struct r_search_t *r_search_new(int mode);
|
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_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_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, 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);
|
R_API int r_search_begin(struct r_search_t *s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,12 +11,12 @@ typedef struct r_sign_item_t {
|
||||||
ut8 *bytes;
|
ut8 *bytes;
|
||||||
ut32 csum;
|
ut32 csum;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rSignItem;
|
} RSignItem;
|
||||||
|
|
||||||
typedef struct r_sign_t {
|
typedef struct r_sign_t {
|
||||||
int count;
|
int count;
|
||||||
struct list_head items;
|
struct list_head items;
|
||||||
} rSign;
|
} RSign;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API int r_sign_generate(struct r_sign_t *sig, const char *file, FILE *fd);
|
R_API int r_sign_generate(struct r_sign_t *sig, const char *file, FILE *fd);
|
||||||
|
|
|
@ -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_new(R_SOCKET_TCP, "gogle.com", 80); */
|
||||||
/* struct r_socket_t *sock = r_socket_proc_new(R_SOCKET_PROCESS, "/bin/ls", 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 {
|
struct r_socket_proc_t {
|
||||||
int fd0[2];
|
int fd0[2];
|
||||||
int fd1[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_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)
|
#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
|
#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
|
#endif
|
||||||
|
|
|
@ -4,25 +4,6 @@
|
||||||
#include "r_types.h"
|
#include "r_types.h"
|
||||||
#include "list.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 {
|
enum {
|
||||||
R_SYSCALL_OS_LINUX = 0,
|
R_SYSCALL_OS_LINUX = 0,
|
||||||
R_SYSCALL_OS_NETBSD,
|
R_SYSCALL_OS_NETBSD,
|
||||||
|
@ -39,7 +20,48 @@ enum {
|
||||||
R_SYSCALL_ARCH_SPARC
|
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
|
//#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();
|
struct r_syscall_t *r_syscall_new();
|
||||||
void r_syscall_free(struct r_syscall_t *ctx);
|
void r_syscall_free(struct r_syscall_t *ctx);
|
||||||
void r_syscall_init(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);
|
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);
|
const char *r_syscall_get_i(struct r_syscall_t *ctx, int num, int swi);
|
||||||
void r_syscall_list(struct r_syscall_t *ctx);
|
void r_syscall_list(struct r_syscall_t *ctx);
|
||||||
|
#endif
|
||||||
/* 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
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
typedef struct r_th_lock_t {
|
typedef struct r_th_lock_t {
|
||||||
int refs;
|
int refs;
|
||||||
R_TH_LOCK_T lock;
|
R_TH_LOCK_T lock;
|
||||||
} rThreadLock;
|
} RThreadLock;
|
||||||
|
|
||||||
typedef struct r_th_t {
|
typedef struct r_th_t {
|
||||||
R_TH_TID tid;
|
R_TH_TID tid;
|
||||||
|
@ -38,12 +38,12 @@ typedef struct r_th_t {
|
||||||
int breaked; // thread aims to be interruped
|
int breaked; // thread aims to be interruped
|
||||||
int delay; // delay the startup of the thread N seconds
|
int delay; // delay the startup of the thread N seconds
|
||||||
int ready; // thread is properly setup
|
int ready; // thread is properly setup
|
||||||
} rThread;
|
} RThread;
|
||||||
|
|
||||||
typedef struct r_th_pool_t {
|
typedef struct r_th_pool_t {
|
||||||
int size;
|
int size;
|
||||||
struct r_th_t **threads;
|
struct r_th_t **threads;
|
||||||
} rThreadPool;
|
} RThreadPool;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API struct r_th_t *r_th_new(R_TH_FUNCTION(fun), void *user, int delay);
|
R_API struct r_th_t *r_th_new(R_TH_FUNCTION(fun), void *user, int delay);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* radare - LGPL - Copyright 2009 pancake<@nopcode.org> */
|
/* radare - LGPL - Copyright 2009 pancake<@nopcode.org> */
|
||||||
|
|
||||||
#ifndef _INCLUDE_R_ASM_H_
|
#ifndef _INCLUDE_R_TRACE_H_
|
||||||
#define _INCLUDE_R_ASM_H_
|
#define _INCLUDE_R_TRACE_H_
|
||||||
|
|
||||||
#include <r_types.h>
|
#include <r_types.h>
|
||||||
#include <list.h>
|
#include <list.h>
|
||||||
|
@ -13,7 +13,7 @@ typedef struct r_trace_t {
|
||||||
int tag;
|
int tag;
|
||||||
int dup;
|
int dup;
|
||||||
int (*printf)(const char *str,...);
|
int (*printf)(const char *str,...);
|
||||||
} rTrace;
|
} RTrace;
|
||||||
|
|
||||||
typedef struct r_trace_item_t {
|
typedef struct r_trace_item_t {
|
||||||
ut64 addr;
|
ut64 addr;
|
||||||
|
@ -23,7 +23,7 @@ typedef struct r_trace_item_t {
|
||||||
int count;
|
int count;
|
||||||
struct timeval tm;
|
struct timeval tm;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rTraceItem;
|
} RTraceItem;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API int r_trace_init(struct r_trace_t *t);
|
R_API int r_trace_init(struct r_trace_t *t);
|
||||||
|
|
|
@ -52,7 +52,6 @@
|
||||||
#define R_FALSE 0
|
#define R_FALSE 0
|
||||||
|
|
||||||
/* types */
|
/* types */
|
||||||
|
|
||||||
#undef _FILE_OFFSET_BITS
|
#undef _FILE_OFFSET_BITS
|
||||||
#define _FILE_OFFSET_BITS 64
|
#define _FILE_OFFSET_BITS 64
|
||||||
#undef _GNU_SOURCE
|
#undef _GNU_SOURCE
|
||||||
|
|
|
@ -18,7 +18,7 @@ typedef struct r_mem_pool_t {
|
||||||
int nodesize;
|
int nodesize;
|
||||||
int poolsize;
|
int poolsize;
|
||||||
int poolcount;
|
int poolcount;
|
||||||
} rMemPool;
|
} RMemoryPool;
|
||||||
|
|
||||||
/* buf */
|
/* buf */
|
||||||
typedef struct r_buf_t {
|
typedef struct r_buf_t {
|
||||||
|
@ -26,7 +26,7 @@ typedef struct r_buf_t {
|
||||||
int length;
|
int length;
|
||||||
int cur;
|
int cur;
|
||||||
ut64 base;
|
ut64 base;
|
||||||
} rBuffer;
|
} RBuffer;
|
||||||
|
|
||||||
/* r_cache */
|
/* r_cache */
|
||||||
// TOTHINK: move into a separated library?
|
// TOTHINK: move into a separated library?
|
||||||
|
@ -34,29 +34,29 @@ typedef struct r_cache_item_t {
|
||||||
ut64 addr;
|
ut64 addr;
|
||||||
char *str;
|
char *str;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rCacheItem;
|
} RCacheItem;
|
||||||
|
|
||||||
typedef struct r_cache_t {
|
typedef struct r_cache_t {
|
||||||
ut64 start;
|
ut64 start;
|
||||||
ut64 end;
|
ut64 end;
|
||||||
struct list_head items;
|
struct list_head items;
|
||||||
} rCache;
|
} RCache;
|
||||||
|
|
||||||
typedef struct r_prof_t {
|
typedef struct r_prof_t {
|
||||||
struct timeval begin;
|
struct timeval begin;
|
||||||
double result;
|
double result;
|
||||||
} rProf;
|
} RProfile;
|
||||||
|
|
||||||
/* numbers */
|
/* numbers */
|
||||||
typedef struct r_num_t {
|
typedef struct r_num_t {
|
||||||
ut64 (*callback)(void *userptr, const char *str, int *ok);
|
ut64 (*callback)(void *userptr, const char *str, int *ok);
|
||||||
ut64 value;
|
ut64 value;
|
||||||
void *userptr;
|
void *userptr;
|
||||||
} rNum;
|
} RNum;
|
||||||
typedef ut64 (*rNumCallback)(rNum *self, const char *str, int *ok);
|
typedef ut64 (*RNumCallback)(RNum *self, const char *str, int *ok);
|
||||||
|
|
||||||
#ifdef R_API
|
#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
|
#define R_BUF_CUR -1
|
||||||
R_API struct r_buf_t *r_buf_init(struct r_buf_t *b);
|
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 void* r_mem_pool_alloc(struct r_mem_pool_t *pool);
|
||||||
R_API int r_mem_count(ut8 **addr);
|
R_API int r_mem_count(ut8 **addr);
|
||||||
R_API void r_cache_init(struct r_cache_t *lang);
|
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 void r_cache_free(struct r_cache_t *c);
|
||||||
R_API char *r_cache_get(struct r_cache_t *c, ut64 addr);
|
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);
|
R_API int r_cache_set(struct r_cache_t *c, ut64 addr, char *str);
|
||||||
|
|
|
@ -14,33 +14,33 @@ enum {
|
||||||
R_VAR_TYPE_ARGREG
|
R_VAR_TYPE_ARGREG
|
||||||
};
|
};
|
||||||
|
|
||||||
struct r_var_anal_t {
|
typedef struct r_var_anal_t {
|
||||||
int type;
|
int type;
|
||||||
int delta;
|
int delta;
|
||||||
int count;
|
int count;
|
||||||
};
|
} RVariableAnalysis;
|
||||||
|
|
||||||
struct r_var_type_t {
|
typedef struct r_var_type_t {
|
||||||
char name[128];
|
char name[128];
|
||||||
char fmt[128];
|
char fmt[128];
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
};
|
} RVariableType;
|
||||||
|
|
||||||
struct r_var_t {
|
typedef struct r_var_t {
|
||||||
int anal_size;
|
int anal_size;
|
||||||
struct r_var_anal_t anal[R_VAR_ANAL_MAX];
|
struct r_var_anal_t anal[R_VAR_ANAL_MAX];
|
||||||
struct list_head vartypes;
|
struct list_head vartypes;
|
||||||
struct list_head vars;
|
struct list_head vars;
|
||||||
};
|
} RVariable;
|
||||||
|
|
||||||
struct r_var_access_t {
|
typedef struct r_var_access_t {
|
||||||
ut64 addr;
|
ut64 addr;
|
||||||
int set;
|
int set;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
};
|
} RVariableAccess;
|
||||||
|
|
||||||
struct r_var_item_t {
|
typedef struct r_var_item_t {
|
||||||
int type; /* global, local... */
|
int type; /* global, local... */
|
||||||
ut64 addr; /* address where it is used */
|
ut64 addr; /* address where it is used */
|
||||||
ut64 eaddr; /* address where it is used */
|
ut64 eaddr; /* address where it is used */
|
||||||
|
@ -50,8 +50,9 @@ struct r_var_item_t {
|
||||||
char vartype[128];
|
char vartype[128];
|
||||||
struct list_head access; /* list of accesses for this var */
|
struct list_head access; /* list of accesses for this var */
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
};
|
} RVariableItem;
|
||||||
|
|
||||||
|
#ifdef R_API
|
||||||
/* api */
|
/* api */
|
||||||
R_API struct r_var_t *r_var_new();
|
R_API struct r_var_t *r_var_new();
|
||||||
R_API void r_var_free(struct r_var_t *var);
|
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 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 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);
|
R_API int r_var_anal_add(struct r_var_t *var, int type, int delta);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,18 +27,18 @@ typedef struct r_vm_reg_t {
|
||||||
char *get;
|
char *get;
|
||||||
char *set;
|
char *set;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rVmReg;
|
} RVmReg;
|
||||||
|
|
||||||
typedef struct r_vm_op_t {
|
typedef struct r_vm_op_t {
|
||||||
char opcode[32];
|
char opcode[32];
|
||||||
char code[1024];
|
char code[1024];
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rVmOp;
|
} RVmOp;
|
||||||
|
|
||||||
typedef struct r_vm_reg_type {
|
typedef struct r_vm_reg_type {
|
||||||
int type;
|
int type;
|
||||||
char *str;
|
char *str;
|
||||||
} rVmRegType;
|
} RVmRegType;
|
||||||
|
|
||||||
typedef struct r_vm_cpu_t {
|
typedef struct r_vm_cpu_t {
|
||||||
const char *pc;
|
const char *pc;
|
||||||
|
@ -51,14 +51,14 @@ typedef struct r_vm_cpu_t {
|
||||||
const char *a3;
|
const char *a3;
|
||||||
const char *ret;
|
const char *ret;
|
||||||
const char *zf;
|
const char *zf;
|
||||||
} rVmCpu;
|
} RVmCpu;
|
||||||
|
|
||||||
typedef struct r_vm_change_t {
|
typedef struct r_vm_change_t {
|
||||||
ut64 from;
|
ut64 from;
|
||||||
ut64 to;
|
ut64 to;
|
||||||
ut8 *data;
|
ut8 *data;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
} rVmChange;
|
} RVmChange;
|
||||||
|
|
||||||
typedef struct r_vm_t {
|
typedef struct r_vm_t {
|
||||||
struct r_vm_reg_t *rec;
|
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 (*read)(void *user, ut64 addr, ut8 *buf, int len);
|
||||||
int (*write)(void *user, ut64 addr, ut8 *buf, int len);
|
int (*write)(void *user, ut64 addr, ut8 *buf, int len);
|
||||||
void *user;
|
void *user;
|
||||||
} rVm;
|
} RVm;
|
||||||
|
|
||||||
#ifdef R_API
|
#ifdef R_API
|
||||||
R_API ut64 vm_reg_get(const char *name);
|
R_API ut64 vm_reg_get(const char *name);
|
||||||
R_API void vm_stack_push(ut64 _val);
|
R_API void vm_stack_push(ut64 _val);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static ut64 r_vm_get_value(struct r_vm_t *vm, const char *str);
|
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);
|
static ut64 r_vm_get_math(struct r_vm_t *vm, const char *str);
|
||||||
|
|
|
@ -26,10 +26,9 @@ R_API struct r_io_t *r_io_new() {
|
||||||
return r_io_init (MALLOC_STRUCT (struct r_io_t));
|
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;
|
RBuffer *b = MALLOC_STRUCT(RBuffer);
|
||||||
b = MALLOC_STRUCT(struct r_buf_t);
|
|
||||||
b->buf = malloc(len);
|
b->buf = malloc(len);
|
||||||
len = r_io_read_at(io, addr, b->buf, len);
|
len = r_io_read_at(io, addr, b->buf, len);
|
||||||
if (len<0) len = 0;
|
if (len<0) len = 0;
|
||||||
|
|
|
@ -375,7 +375,7 @@ R_API char *r_line_readline(int argc, const char **argv)
|
||||||
int ch, i, len = 0;
|
int ch, i, len = 0;
|
||||||
int opt = 0;
|
int opt = 0;
|
||||||
int gcomp = 0; /* grep completion */
|
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_idx = r_line_buffer_len = 0;
|
||||||
r_line_buffer[0]='\0';
|
r_line_buffer[0]='\0';
|
||||||
|
@ -424,7 +424,7 @@ R_API char *r_line_readline(int argc, const char **argv)
|
||||||
buf[0] = ch;
|
buf[0] = ch;
|
||||||
|
|
||||||
// printf("\x1b[K\r");
|
// printf("\x1b[K\r");
|
||||||
columns = r_cons_get_real_columns ()-2;
|
columns = r_cons_get_size (NULL)-2;
|
||||||
if (columns <1)
|
if (columns <1)
|
||||||
columns = 40;
|
columns = 40;
|
||||||
if (r_line_echo)
|
if (r_line_echo)
|
||||||
|
|
|
@ -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 */
|
/* TODO: make this parser better and cleaner */
|
||||||
R_API int r_reg_set_profile_string(struct r_reg_t *reg, const char *str)
|
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 ret = R_FALSE;
|
||||||
int lastchar = 0;
|
int lastchar = 0;
|
||||||
int chidx = 0;
|
int chidx = 0;
|
||||||
|
|
|
@ -51,7 +51,7 @@ R_API void r_num_init(struct r_num_t *num)
|
||||||
num->value = 0LL;
|
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;
|
struct r_num_t *num;
|
||||||
num = (struct r_num_t*) malloc(sizeof(struct r_num_t));
|
num = (struct r_num_t*) malloc(sizeof(struct r_num_t));
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
/* radare - LGPL - Copyright 2009, 2010 nibble<.ds@gmail.com> */
|
/* radare - LGPL - Copyright 2009, 2010 nibble<.ds@gmail.com> */
|
||||||
|
|
||||||
namespace Radare {
|
[Compact]
|
||||||
[Compact]
|
[CCode (cheader_filename="r_asm.h", cname="struct r_asm_t", free_function="r_asm_free", cprefix="r_asm_")]
|
||||||
[CCode (cheader_filename="r_asm.h", cname="struct r_asm_t", free_function="r_asm_free", cprefix="r_asm_")]
|
public class Radare.RAsm {
|
||||||
public class rAsm {
|
|
||||||
[CCode (cprefix="R_ASM_ARCH_", cname="int")]
|
[CCode (cprefix="R_ASM_ARCH_", cname="int")]
|
||||||
public enum Arch {
|
public enum Arch {
|
||||||
NONE,
|
NONE,
|
||||||
|
@ -57,9 +56,9 @@ namespace Radare {
|
||||||
public string buf_err;
|
public string buf_err;
|
||||||
public void *aux;
|
public void *aux;
|
||||||
|
|
||||||
public rAsm();
|
public RAsm();
|
||||||
|
|
||||||
public weak rAsm init();
|
public weak RAsm init();
|
||||||
public int list();
|
public int list();
|
||||||
public bool use(string name);
|
public bool use(string name);
|
||||||
// public bool set_arch(Asm.Arch arch);
|
// public bool set_arch(Asm.Arch arch);
|
||||||
|
@ -67,16 +66,15 @@ namespace Radare {
|
||||||
public bool set_syntax(Syntax syntax);
|
public bool set_syntax(Syntax syntax);
|
||||||
public bool set_pc(uint64 addr);
|
public bool set_pc(uint64 addr);
|
||||||
public bool set_big_endian(bool big);
|
public bool set_big_endian(bool big);
|
||||||
//public bool set_parser(rAsm.Parser parser, parse_cb cb, void *aux);
|
//public bool set_parser(RAsm.Parser parser, parse_cb cb, void *aux);
|
||||||
public int disassemble(out Aop aop, uint8 *buf, uint64 length);
|
public int disassemble(out Aop aop, uint8 *buf, uint64 length);
|
||||||
public int assemble(out Aop aop, string buf);
|
public int assemble(out Aop aop, string buf);
|
||||||
public Code? mdisassemble(uint8 *buf, uint64 length);
|
public Code? mdisassemble(uint8 *buf, uint64 length);
|
||||||
public Code? massemble(string buf);
|
public Code? massemble(string buf);
|
||||||
public weak string fastcall(int idx, int num);
|
// public weak string fastcall(int idx, int num);
|
||||||
//public int parse();
|
//public int parse();
|
||||||
// This is the destructor
|
// This is the destructor
|
||||||
public void free();
|
public void free();
|
||||||
}
|
|
||||||
|
|
||||||
public static delegate int parse_cb(rAsm a);
|
public static delegate int parse_cb(RAsm a);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
namespace Radare {
|
namespace Radare {
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cname="struct r_bin_t", free_function="r_bin_free", cprefix="r_bin_")]
|
[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 const string file;
|
||||||
public int fd;
|
public int fd;
|
||||||
|
|
||||||
public rBin();
|
public RBin();
|
||||||
//public int open(string file, bool rw, string? plugin_name = null);
|
//public int open(string file, bool rw, string? plugin_name = null);
|
||||||
|
|
||||||
public int init(string file, int rw);
|
public int init(string file, int rw);
|
||||||
|
@ -17,11 +17,11 @@ namespace Radare {
|
||||||
public Entrypoint get_entry();
|
public Entrypoint get_entry();
|
||||||
|
|
||||||
// TODO: deprecate
|
// TODO: deprecate
|
||||||
public rList<rBin.Symbol*> symbols;
|
public rList<Symbol*> symbols;
|
||||||
|
|
||||||
//public rArray<rBin.Section> get_sections();
|
//public rArray<RBin.Section> get_sections();
|
||||||
//public rArray<rBin.Symbol> get_symbols();
|
//public rArray<RBin.Symbol> get_symbols();
|
||||||
//public rArray<rBin.Import> get_imports();
|
//public rArray<RBin.Import> get_imports();
|
||||||
|
|
||||||
public Info* get_info();
|
public Info* get_info();
|
||||||
public uint64 get_section_offset(string name);
|
public uint64 get_section_offset(string name);
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
namespace Radare {
|
namespace Radare {
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cname="struct r_bininfo_t", free_function="r_bininfo_free", cprefix="r_bininfo_")]
|
[CCode (cname="struct r_bininfo_t", free_function="r_bininfo_free", cprefix="r_bininfo_")]
|
||||||
public class rBininfo {
|
public class RBininfo {
|
||||||
public rBininfo ();
|
public RBininfo ();
|
||||||
// XXX bad signature?
|
// XXX bad signature?
|
||||||
public int get_line (uint64 addr, out string file, int len, int *line);
|
public int get_line (uint64 addr, out string file, int len, int *line);
|
||||||
public bool set_source_path (string path);
|
public bool set_source_path (string path);
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
|
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
|
||||||
|
|
||||||
[CCode (cheader_filename="r_bp.h", cprefix="r_bp", lower_case_cprefix="r_bp_")]
|
[Compact]
|
||||||
namespace Radare {
|
[CCode (cheader_filename="r_bp.h", cname="struct r_bp_t", free_function="r_bp_free", cprefix="r_bp_")]
|
||||||
[Compact]
|
public class Radare.RBreakpoint {
|
||||||
[CCode (cname="struct r_bp_t", free_function="r_bp_free", cprefix="r_bp_")]
|
public RBreakpoint ();
|
||||||
public class rBreakpoint {
|
|
||||||
public rBreakpoint ();
|
|
||||||
public bool use (string arch);
|
public bool use (string arch);
|
||||||
public void enable (uint64 addr, bool enabled);
|
public void enable (uint64 addr, bool enabled);
|
||||||
public bool at_addr (uint64 addr, int rwx);
|
public bool at_addr (uint64 addr, int rwx);
|
||||||
|
@ -34,7 +32,7 @@ namespace Radare {
|
||||||
}
|
}
|
||||||
|
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cname="struct r_bp_item_t", cprefix="r_bp_item")]
|
[CCode (cname="RBreakpointItem")]
|
||||||
public struct Item {
|
public struct Item {
|
||||||
uint64 addr;
|
uint64 addr;
|
||||||
int size;
|
int size;
|
||||||
|
@ -46,5 +44,4 @@ namespace Radare {
|
||||||
uint8* bbytes;
|
uint8* bbytes;
|
||||||
int[] pids;
|
int[] pids;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
namespace Radare {
|
namespace Radare {
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cprefix="r_config_", cname="struct r_config_t", free_function="r_config_free")]
|
[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);
|
public void init (void *user);
|
||||||
//TODO: public void setup_file(string file);
|
//TODO: public void setup_file(string file);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,17 @@
|
||||||
namespace Radare {
|
namespace Radare {
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cname="struct r_cons_t", free_function="r_cons_free", cprefix="r_cons_")]
|
[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 printf(string fmt, ...);
|
||||||
public static void strcat(string str);
|
public static void strcat(string str);
|
||||||
public static void memcat(string str, int len);
|
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 fgets(out string buf, int len, int argc, string argv[]);
|
||||||
public static int readchar();
|
public static int readchar();
|
||||||
public static void any_key();
|
public static void any_key();
|
||||||
public static int eof();
|
|
||||||
public static int get_columns();
|
public static int get_columns();
|
||||||
public static int get_real_columns();
|
public static int get_real_columns();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
namespace Radare {
|
namespace Radare {
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cheader_filename="r_core.h", cname="struct r_core_t", free_function="r_core_free", cprefix="r_core_")]
|
[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 */
|
/* lifecycle */
|
||||||
public rCore();
|
public RCore();
|
||||||
|
|
||||||
/* commands */
|
/* commands */
|
||||||
public int prompt();
|
public int prompt();
|
||||||
|
@ -21,7 +21,7 @@ namespace Radare {
|
||||||
public int seek(uint64 addr, bool rb);
|
public int seek(uint64 addr, bool rb);
|
||||||
|
|
||||||
/* files */
|
/* files */
|
||||||
public rCore.File file_open(string file, int mode);
|
public RCore.File file_open(string file, int mode);
|
||||||
|
|
||||||
// XXX mode = Radare.Io.Mode
|
// XXX mode = Radare.Io.Mode
|
||||||
[Compact]
|
[Compact]
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
namespace Radare {
|
namespace Radare {
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cname="struct r_crypto_t", free_function="r_crypto_free", cprefix="r_crypto_")]
|
[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")]
|
[CCode (cprefix="R_CRYPTO_DIR")]
|
||||||
public enum Direction {
|
public enum Direction {
|
||||||
|
@ -20,7 +20,7 @@ namespace Radare {
|
||||||
CFB
|
CFB
|
||||||
}
|
}
|
||||||
|
|
||||||
public rCrypto();
|
public RCrypto();
|
||||||
public bool use(string algorithm);
|
public bool use(string algorithm);
|
||||||
// public bool set_key(uint8 *key, Crypto.Mode mode, Crypto.Direction direction);
|
// public bool set_key(uint8 *key, Crypto.Mode mode, Crypto.Direction direction);
|
||||||
public bool set_iv(uint8 *iv);
|
public bool set_iv(uint8 *iv);
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
/* 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_")]
|
[Compact]
|
||||||
namespace Radare {
|
[CCode (cheader_filename="r_db.h", cname="struct r_db_t", free_function="r_db_free", cprefix="r_db_")]
|
||||||
[Compact]
|
public class Radare.RDatabase {
|
||||||
[CCode (cname="struct r_db_t", free_function="r_db_free", cprefix="r_db_")]
|
|
||||||
public class rDatabase {
|
|
||||||
/* lifecycle */
|
/* lifecycle */
|
||||||
public rDatabase();
|
public RDatabase();
|
||||||
/**
|
/**
|
||||||
* Initializes a database object
|
* Initializes a database object
|
||||||
*/
|
*/
|
||||||
|
@ -23,5 +21,4 @@ namespace Radare {
|
||||||
/* stacky! */
|
/* stacky! */
|
||||||
public int push(ref uint8* buf);
|
public int push(ref uint8* buf);
|
||||||
public uint8 *pop();
|
public uint8 *pop();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
|
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
|
||||||
|
|
||||||
namespace Radare {
|
[Compact]
|
||||||
[Compact]
|
[CCode (cheader_filename="r_debug.h", cname="struct r_debug_t", free_function="r_debug_free", cprefix="r_debug_")]
|
||||||
[CCode (cheader_filename="r_debug.h", cname="struct r_debug_t", free_function="r_debug_free", cprefix="r_debug_")]
|
public class Radare.RDebug {
|
||||||
public class rDebug {
|
public RBreakpoint bp;
|
||||||
public rBreakpoint bp;
|
public RDebug();
|
||||||
public rDebug();
|
|
||||||
|
|
||||||
public bool use(string plugin);
|
public bool use(string plugin);
|
||||||
|
|
||||||
|
@ -62,5 +61,4 @@ namespace Radare {
|
||||||
public int pid_del_thread();
|
public int pid_del_thread();
|
||||||
//public Process pid_get(int pid); // XXX wrong api syntax 'get' is keyword
|
//public Process pid_get(int pid); // XXX wrong api syntax 'get' is keyword
|
||||||
//public bool pid_set_status(ProcessStatus status);
|
//public bool pid_set_status(ProcessStatus status);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
namespace Radare {
|
namespace Radare {
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cheader_filename="r_diff.h", cname="struct r_diff_t", free_function="r_diff_free", cprefix="r_diff_")]
|
[CCode (cheader_filename="r_diff.h", cname="struct r_diff_t", free_function="r_diff_free", cprefix="r_diff_")]
|
||||||
public class rDiff {
|
public class RDiff {
|
||||||
public rDiff (uint64 off_a = 0LL, uint64 off_b = 0LL);
|
public RDiff (uint64 off_a = 0LL, uint64 off_b = 0LL);
|
||||||
public int buffers (uint8* a, int la, uint8* b, int lb);
|
public int buffers (uint8* a, int la, uint8* b, int lb);
|
||||||
//public int set_callback(...);
|
//public int set_callback(...);
|
||||||
public int buffers_distance (uint8 *a, int la, uint8 *b, int lb, out int distance, out double similarity);
|
public int buffers_distance (uint8 *a, int la, uint8 *b, int lb, out int distance, out double similarity);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
/* This vapi has been manually generated by me */
|
/* This vapi has been manually generated by me */
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cheader_filename="r_hash.h", cprefix="r_hash_", cname="struct r_hash_t", free_function="r_hash_free")]
|
[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_")]
|
[CCode (cprefix="R_HASH_")]
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum Algorithm {
|
public enum Algorithm {
|
||||||
|
@ -39,7 +39,7 @@ public class Radare.rHash {
|
||||||
public static int pcprint(uint8 *buf, uint64 len);
|
public static int pcprint(uint8 *buf, uint64 len);
|
||||||
|
|
||||||
/* methods */
|
/* methods */
|
||||||
public rHash(bool rst);
|
public RHash(bool rst);
|
||||||
// public void init(int rst, Algorithm bits);
|
// public void init(int rst, Algorithm bits);
|
||||||
public void init(bool rst, int bits);
|
public void init(bool rst, int bits);
|
||||||
public uint8 *do_md4(uint8 *input, uint32 len);
|
public uint8 *do_md4(uint8 *input, uint32 len);
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace Radare {
|
namespace Radare {
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cheader_filename="r_io.h", cname="rIo", free_function="r_io_free", cprefix="r_io_")]
|
[CCode (cheader_filename="r_io.h,r_util.h", cname="RIo", free_function="r_io_free", cprefix="r_io_")]
|
||||||
public class rIo {
|
public class RIo {
|
||||||
[CCode (cprefix="R_IO_")]
|
[CCode (cprefix="R_IO_")]
|
||||||
public enum Perm {
|
public enum Perm {
|
||||||
READ = 0,
|
READ = 0,
|
||||||
|
@ -18,9 +18,9 @@ namespace Radare {
|
||||||
END = 2,
|
END = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
public rIo();
|
public RIo();
|
||||||
public rIo free();
|
public RIo free();
|
||||||
public unowned rIo init();
|
public unowned RIo init();
|
||||||
public bool set_write_mask(uint8 *buf, int len);
|
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 open_as(string urihandler, string path, int flags, int mode);
|
||||||
public int read(out uint8 *buf, int len);
|
public int read(out uint8 *buf, int len);
|
||||||
public int read_at(uint64 addr, 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 int write(uint8 *buf, int len);
|
||||||
public uint64 seek(int fd, uint64 addr, int whence);
|
public uint64 seek(int fd, uint64 addr, int whence);
|
||||||
public int system(string cmd);
|
public int system(string cmd);
|
||||||
|
@ -49,7 +49,7 @@ namespace Radare {
|
||||||
|
|
||||||
/* handle */
|
/* handle */
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cname="rIoHandle", cprefix="r_io_handle_")]
|
[CCode (cname="RIoHandle", cprefix="r_io_handle_")]
|
||||||
public class Handle {
|
public class Handle {
|
||||||
string name;
|
string name;
|
||||||
string desc;
|
string desc;
|
||||||
|
@ -63,7 +63,7 @@ namespace Radare {
|
||||||
public void handle_list();
|
public void handle_list();
|
||||||
|
|
||||||
/* maps */
|
/* maps */
|
||||||
[CCode (cname="rIoMap", cprefix="r_io_map_")]
|
[CCode (cname="RIoMap", cprefix="r_io_map_")]
|
||||||
public struct Map {
|
public struct Map {
|
||||||
int fd;
|
int fd;
|
||||||
uint64 from;
|
uint64 from;
|
||||||
|
@ -77,7 +77,7 @@ namespace Radare {
|
||||||
public int map_write_at(uint64 addr, uint8 *buf, uint64 len);
|
public int map_write_at(uint64 addr, uint8 *buf, uint64 len);
|
||||||
|
|
||||||
/* sections */
|
/* sections */
|
||||||
[CCode (cname="rIoSection")]
|
[CCode (cname="RIoSection")]
|
||||||
public struct Section {
|
public struct Section {
|
||||||
string comment;
|
string comment;
|
||||||
uint64 from;
|
uint64 from;
|
||||||
|
@ -88,7 +88,7 @@ namespace Radare {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* desc */
|
/* desc */
|
||||||
[CCode (cname="rIoDesc")]
|
[CCode (cname="RIoDesc")]
|
||||||
public struct Desc {
|
public struct Desc {
|
||||||
int fd;
|
int fd;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
namespace Radare {
|
namespace Radare {
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cname="struct r_lang_t", free_function="r_lang_free", cprefix="r_lang_")]
|
[CCode (cname="struct r_lang_t", free_function="r_lang_free", cprefix="r_lang_")]
|
||||||
public class Language {
|
public class RLanguage {
|
||||||
public Language();
|
public RLanguage();
|
||||||
public bool define(string type, string name, void* ptr);
|
public bool define(string type, string name, void* ptr);
|
||||||
public bool @add(Language.Handler handler);
|
public bool @add(Language.Handler handler);
|
||||||
public bool use(string name);
|
public bool use(string name);
|
||||||
|
@ -24,7 +24,7 @@ namespace Radare {
|
||||||
public string help;
|
public string help;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Language.Handler cur;
|
public Handler cur;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
namespace Radare {
|
namespace Radare {
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cheader_filename="r_lib.h", cprefix="r_lib_", cname="struct r_lib_t", free_function="r_lib_free")]
|
[CCode (cheader_filename="r_lib.h", cprefix="r_lib_", cname="struct r_lib_t", free_function="r_lib_free")]
|
||||||
public class rLibrary {
|
public class RLibrary {
|
||||||
public rLibrary(string symname);
|
public RLibrary(string symname);
|
||||||
public rLibrary init(string symname);
|
public RLibrary init(string symname);
|
||||||
public bool close(void *ptr);
|
public bool close(void *ptr);
|
||||||
public void* opendir(string path);
|
public void* opendir(string path);
|
||||||
public string types_get(int idx);
|
public string types_get(int idx);
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
namespace Radare {
|
namespace Radare {
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cname="struct r_parse_t", free_function="r_parse_free", cprefix="r_parse_")]
|
[CCode (cname="struct r_parse_t", free_function="r_parse_free", cprefix="r_parse_")]
|
||||||
public class Parse {
|
public class RParse {
|
||||||
public Parse();
|
public RParse();
|
||||||
|
|
||||||
public int init();
|
public int init();
|
||||||
public int list();
|
public int list();
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
/* 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_")]
|
[Compact]
|
||||||
namespace Radare {
|
[CCode (cheader_filename="r_range.h", cname="struct r_range_t", free_function="r_range_free", cprefix="r_range_")]
|
||||||
[Compact]
|
public class Radare.RRange {
|
||||||
[CCode (cname="struct r_range_t", free_function="r_range_free", cprefix="r_range_")]
|
|
||||||
public class rRange {
|
|
||||||
/* lifecycle */
|
/* lifecycle */
|
||||||
public Range();
|
public RRange();
|
||||||
public Range.from_string(string str);
|
public RRange.from_string(string str);
|
||||||
|
|
||||||
public Range.Item *item_get(uint64 addr);
|
public Item *item_get(uint64 addr);
|
||||||
public uint64 size();
|
public uint64 size();
|
||||||
public uint64 add_from_string(string str);
|
public uint64 add_from_string(string str);
|
||||||
public uint64 add_string(string str);
|
public uint64 add_string(string str);
|
||||||
|
@ -24,12 +22,11 @@ namespace Radare {
|
||||||
public Range *inverse(uint64 fr, uint64 to, int flags);
|
public Range *inverse(uint64 fr, uint64 to, int flags);
|
||||||
|
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cname="struct r_core_file_t", cprefix="r_core_")]
|
[CCode (cname="struct r_range_item_t", cprefix="r_range_item_")]
|
||||||
public static struct Item {
|
public static struct Item {
|
||||||
public uint64 fr;
|
public uint64 fr;
|
||||||
public uint64 to;
|
public uint64 to;
|
||||||
public uint8 *data;
|
public uint8 *data;
|
||||||
public int datalen;
|
public int datalen;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
/* radare - LGPL - Copyright 2009-2010 pancake<@nopcode.org> */
|
/* radare - LGPL - Copyright 2009-2010 pancake<@nopcode.org> */
|
||||||
|
|
||||||
[CCode (cheader_filename="r_reg.h", cprefix="r_reg_", lower_case_cprefix="r_reg_")]
|
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cname="struct r_reg_t", free_function="r_reg_free", cprefix="r_reg_")]
|
[CCode (cheader_filename="r_reg.h", cname="struct r_reg_t", free_function="r_reg_free", cprefix="r_reg_")]
|
||||||
public class Radare.rRegister {
|
public class Radare.RRegister {
|
||||||
[CCode (cprefix="R_REG_TYPE_")]
|
[CCode (cprefix="R_REG_TYPE_", cname="int")]
|
||||||
public enum Type {
|
public enum Type {
|
||||||
GPR,
|
GPR,
|
||||||
DRX,
|
DRX,
|
||||||
|
@ -37,24 +36,24 @@ public class Radare.rRegister {
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cname="struct r_reg_set_t", destroy_function="", free_function="" )]
|
[CCode (cname="struct r_reg_set_t", destroy_function="", free_function="" )]
|
||||||
public class Set {
|
public class Set {
|
||||||
public rRegister.Arena arena;
|
public RRegister.Arena arena;
|
||||||
public rList<rRegister.Arena*> arenas;
|
public RList<Arena*> arenas;
|
||||||
public rList<rRegister.Item*> regs;
|
public RList<Item*> regs;
|
||||||
}
|
}
|
||||||
|
|
||||||
[NoArrayLength]
|
[NoArrayLength]
|
||||||
[CCode (cname="r_reg_types")]
|
[CCode (cname="r_reg_types")]
|
||||||
public static weak string types[]; //Type.LAST];
|
public static weak string types[]; //Type.LAST];
|
||||||
|
|
||||||
public rRegister();
|
public RRegister();
|
||||||
public bool set_profile(string file);
|
public bool set_profile(string file);
|
||||||
public bool set_profile_string(string profile);
|
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 */
|
/* 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 uint64 get_value(Item item);
|
||||||
public bool set_value(rRegister.Item item, uint64 val);
|
public bool set_value(Item item, uint64 val);
|
||||||
|
|
||||||
public float get_fvalue(Item item);
|
public float get_fvalue(Item item);
|
||||||
public bool set_fvalue(Item item, float val);
|
public bool set_fvalue(Item item, float val);
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
|
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
|
||||||
|
|
||||||
[CCode (cheader_filename="r_search.h")]
|
[Compact]
|
||||||
namespace Radare {
|
[CCode (cheader_filename="r_search.h", cname="struct r_search_t", free_function="r_search_free", cprefix="r_search_")]
|
||||||
|
public class Radare.RSearch {
|
||||||
[Compact]
|
public RSearch (Mode mode);
|
||||||
[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_mode (Mode mode);
|
||||||
public bool set_string_limits (uint32 min, uint32 max);
|
public bool set_string_limits (uint32 min, uint32 max);
|
||||||
public bool begin();
|
public bool begin();
|
||||||
|
@ -45,8 +42,7 @@ namespace Radare {
|
||||||
public int idx;
|
public int idx;
|
||||||
public int count;
|
public int count;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
[CCode (cname="rSearchCallback")]
|
[CCode (cname="RSearchCallback")]
|
||||||
public static delegate int Callback(rSearch.Keyword s, void *user, uint64 addr);
|
public static delegate int Callback(Keyword s, void *user, uint64 addr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,21 +2,20 @@
|
||||||
|
|
||||||
/* TODO: Add simpletype instead of int so, we can use it as an object */
|
/* 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_")]
|
[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")]
|
[CCode (cname="r_socket_connect")]
|
||||||
public rSocket.connect(string host, int port);
|
public RSocket.connect(string host, int port);
|
||||||
[CCode (cname="r_socket_listen")]
|
[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();
|
public int close();
|
||||||
[NoArrayLength]
|
public int gets(ref string buf, int len);
|
||||||
public int gets(string buf, int len);
|
|
||||||
public int printf(string str, ...);
|
public int printf(string str, ...);
|
||||||
public int accept();
|
public int accept();
|
||||||
public void block(bool blocking);
|
public void block(bool blocking);
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
|
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
|
||||||
|
|
||||||
[CCode (cheader_filename="r_syscall.h", cprefix="r_", lower_case_cprefix="r_")]
|
[Compact]
|
||||||
namespace Radare {
|
[CCode (cheader_filename="r_syscall.h", cname="struct r_syscall_t", free_function="r_syscall_free", cprefix="r_syscall_")]
|
||||||
[Compact]
|
public class Radare.RSyscall {
|
||||||
[CCode (cname="struct r_syscall_t", free_function="r_syscall_free", cprefix="r_syscall_")]
|
|
||||||
public class rSyscall {
|
|
||||||
|
|
||||||
[CCode (cprefix="R_SYSCALL_OS_")]
|
[CCode (cprefix="R_SYSCALL_OS_")]
|
||||||
public enum OS {
|
public enum OS {
|
||||||
|
@ -18,12 +16,11 @@ namespace Radare {
|
||||||
X86 = 0, PPC, ARM, MIPS, SPARC
|
X86 = 0, PPC, ARM, MIPS, SPARC
|
||||||
}
|
}
|
||||||
|
|
||||||
public rSyscall();
|
public RSyscall();
|
||||||
public void setup(int os, int arch);
|
public void setup(int os, int arch);
|
||||||
public void setup_file(string file);
|
public void setup_file(string file);
|
||||||
public int get(string syscall);
|
public int get(string syscall);
|
||||||
public string get_i(int num, int swi);
|
public string get_i(int num, int swi);
|
||||||
public string get_n(int num);
|
public string get_n(int num);
|
||||||
public void list();
|
public void list();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
/* radare - LGPL - Copyright 2009 pancake<@nopcode.org> */
|
/* radare - LGPL - Copyright 2009 pancake<@nopcode.org> */
|
||||||
|
|
||||||
namespace Radare {
|
//[Compact]
|
||||||
[Compact]
|
//[CCode (cheader_filename="r_util.h", cprefix="r_util_")]
|
||||||
[CCode (cheader_filename="r_util.h", cprefix="r_util_")]
|
//public static class Radare.RUtil {
|
||||||
public static class rUtil {
|
|
||||||
//public static int hex_str2bin (string input, uint8 *buf);
|
//public static int hex_str2bin (string input, uint8 *buf);
|
||||||
//public static int hex_bin2str (uint8 *buf, int len, out string str);
|
//public static int hex_bin2str (uint8 *buf, int len, out string str);
|
||||||
//public static string hex_bin2strdup (uint8 *buf, int len);
|
//public static string hex_bin2strdup (uint8 *buf, int len);
|
||||||
|
@ -15,46 +14,47 @@ namespace Radare {
|
||||||
/* num */
|
/* num */
|
||||||
//public static uint64 num_get(void *num, string str); // XXX void *
|
//public static uint64 num_get(void *num, string str); // XXX void *
|
||||||
//public static int offsetof(void *type, void *member);
|
//public static int offsetof(void *type, void *member);
|
||||||
}
|
//}
|
||||||
|
|
||||||
// ???
|
// ??? wtf
|
||||||
[CCode (cheader_filename="r_util.h", cprefix="r_str_")]
|
[CCode (cheader_filename="r_util.h", cprefix="r_str_")]
|
||||||
public static class rStr {
|
public static class RString {
|
||||||
public rStr();
|
public RString();
|
||||||
public int hash(string str);
|
public int hash(string str);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CCode (cheader_filename="r_util.h", cprefix="r_num_")]
|
[CCode (cheader_filename="r_util.h", cprefix="r_num_")]
|
||||||
public static class rNum {
|
public static class RNum {
|
||||||
public rNum(rNumCallback cb, void *user);
|
public RNum(RNumCallback cb, void *user);
|
||||||
public uint64 get(string str);
|
public uint64 get(string str);
|
||||||
public uint64 math(string str);
|
public uint64 math(string str);
|
||||||
}
|
}
|
||||||
public delegate uint64 rNumCallback (rNum num, string str, int *ok);
|
public delegate uint64 RNumCallback (RNum num, string str, int *ok);
|
||||||
|
|
||||||
[CCode (cheader_filename="r_util.h", cprefix="r_log_")]
|
[CCode (cheader_filename="r_util.h", cprefix="r_log_")]
|
||||||
public static class rLog {
|
public static class RLog {
|
||||||
public bool msg(string str);
|
public bool msg(string str);
|
||||||
public bool err(string str);
|
public bool err(string str);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CCode (cheader_filename="r_util.h", cprefix="r_buf_")]
|
[Compact]
|
||||||
public class rBuffer {
|
[CCode (cname="RBuffer", cheader_filename="r_util.h", cprefix="r_buf_")]
|
||||||
public rBuffer();
|
public class RBuffer {
|
||||||
|
public RBuffer();
|
||||||
public int read_at(uint64 addr, uint8 *buf, int len);
|
public int read_at(uint64 addr, uint8 *buf, int len);
|
||||||
public int write_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 set_bytes(uint8 *buf, int len);
|
||||||
//public bool memcpy(uint64 addr, uint8 *dst, uint8 *src, 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
|
#if 0
|
||||||
// XXX not yet supported by valaswig ://
|
// XXX not yet supported by valaswig ://
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cheader_filename="r_array.h", cprefix="r_array_", cname="void*")]
|
[CCode (cheader_filename="r_array.h", cprefix="r_array_", cname="void*")]
|
||||||
public class rArray<G> {
|
public class RArray<G> {
|
||||||
public rArray (int size);
|
public RArray (int size);
|
||||||
public unowned G cur ();
|
public unowned G cur ();
|
||||||
public bool next ();
|
public bool next ();
|
||||||
public void rewind ();
|
public void rewind ();
|
||||||
|
@ -73,16 +73,16 @@ namespace Radare {
|
||||||
iter.vala:55.23-55.28: error: The name `name' does not exist in the context of `G'
|
iter.vala:55.23-55.28: error: The name `name' does not exist in the context of `G'
|
||||||
public delegate int rIterCallback (G foo);
|
public delegate int rIterCallback (G foo);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
/* TODO: move this declaration inside rIter to have access to the Generic type */
|
/* TODO: move this declaration inside rIter to have access to the Generic type */
|
||||||
public delegate int rArrayCallback (void *foo);
|
public delegate int rArrayCallback (void *foo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* TODO: to be removed. not fully compliant */
|
/* TODO: to be removed. not fully compliant */
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cprefix="ralist_", cheader_filename="r_types.h,list.h", cname="struct list_head")]
|
[CCode (cprefix="ralist_", cheader_filename="r_types.h,list.h", cname="struct list_head")]
|
||||||
public class KernelList<G> {
|
public class KernelList<G> {
|
||||||
public KernelList ();
|
public KernelList ();
|
||||||
[CCode (cname="ralist_next")]
|
[CCode (cname="ralist_next")]
|
||||||
public bool next();
|
public bool next();
|
||||||
|
@ -94,32 +94,32 @@ namespace Radare {
|
||||||
public unowned G get();
|
public unowned G get();
|
||||||
[CCode (cname="ralist_iterator")]
|
[CCode (cname="ralist_iterator")]
|
||||||
public KernelList<G> iterator();
|
public KernelList<G> iterator();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cprefix="r_list_", cheader_filename="r_util.h", cname="struct r_list_t")]
|
[CCode (cprefix="r_list_", cheader_filename="r_util.h", cname="struct r_list_t")]
|
||||||
public class rList<G> {
|
public class RList<G> {
|
||||||
public rList ();
|
public RList ();
|
||||||
public void append(owned G foo);
|
public void append(owned G foo);
|
||||||
public void prepend(owned G foo);
|
public void prepend(owned G foo);
|
||||||
//public unowned G get();
|
//public unowned G get();
|
||||||
//public rListIter<G> iterator();
|
//public rListIter<G> iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cprefix="r_list_iter_", cheader_filename="r_list.h", cname="struct r_list_iter_t")]
|
[CCode (cprefix="r_list_iter_", cheader_filename="r_list.h", cname="struct r_list_iter_t")]
|
||||||
public class rListIter<G> {
|
public class RListIter<G> {
|
||||||
public bool next();
|
public bool next();
|
||||||
// public G @free(G arg);
|
// public G @free(G arg);
|
||||||
public unowned G get();
|
public unowned G get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: deprecated by r_iter ??? */
|
/* TODO: deprecated by r_iter ??? */
|
||||||
/*
|
/*
|
||||||
[Compact]
|
[Compact]
|
||||||
[CCode (cprefix="rarray_", cheader_filename="r_types.h", cname="void")]
|
[CCode (cprefix="rarray_", cheader_filename="r_types.h", cname="void")]
|
||||||
public static class rArray<G> {
|
public static class rArray<G> {
|
||||||
[CCode (cname="rarray_next", generic_type_pos=2)]
|
[CCode (cname="rarray_next", generic_type_pos=2)]
|
||||||
public bool next(); //int type=0);
|
public bool next(); //int type=0);
|
||||||
[CCode (cname="")]
|
[CCode (cname="")]
|
||||||
|
@ -128,6 +128,5 @@ namespace Radare {
|
||||||
public unowned G get(); //int type=0);
|
public unowned G get(); //int type=0);
|
||||||
[CCode (cname="rarray_iterator")] //, generic_type_pos=2)]
|
[CCode (cname="rarray_iterator")] //, generic_type_pos=2)]
|
||||||
public rArray<G> iterator();
|
public rArray<G> iterator();
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -54,8 +54,8 @@ oldtest:
|
||||||
python test.py
|
python test.py
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf python/*.so python/*.c python/*.i
|
rm -rf python/*.so python/*.c python/*.i python/libr*
|
||||||
rm -rf perl/*.so perl/*.pm perl/*.c perl/*.i
|
rm -rf perl/*.so perl/*.pm perl/*.c perl/*.i perl/libr*
|
||||||
rm -rf ruby/*.so ruby/*.c ruby/*.i
|
rm -rf ruby/*.so ruby/*.c ruby/*.i ruby/libr*
|
||||||
|
|
||||||
.PHONY: ruby python perl clean oldtest test all
|
.PHONY: ruby python perl clean oldtest test all
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
|
||||||
LNG=$1
|
LNG=$1
|
||||||
MOD=$2
|
MOD=$2
|
||||||
if [ -z "${MOD}" ]; then
|
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}.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}`
|
||||||
|
|
|
@ -11,7 +11,7 @@ def disasm(a, arch, op):
|
||||||
else:
|
else:
|
||||||
print "HEX: %s"%code.buf_hex
|
print "HEX: %s"%code.buf_hex
|
||||||
|
|
||||||
a = rAsm()
|
a = RAsm()
|
||||||
print "---[ name ]-----[ description ]----------"
|
print "---[ name ]-----[ description ]----------"
|
||||||
a.list()
|
a.list()
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
from r_bp import *
|
from r_bp import *
|
||||||
|
|
||||||
a = rBreakpoint ()
|
a = RBreakpoint ()
|
||||||
a.use ('x86')
|
a.use ('x86')
|
||||||
a.add_hw (0x8048000, 10, 0)
|
a.add_hw (0x8048000, 10, 0)
|
||||||
a.add_sw (0x8048000, 10, 0)
|
a.add_sw (0x8048000, 10, 0)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#from r2.r_hash import rHash, Size_MD4
|
#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)
|
ret = hash.do_md4 ("food", 4)
|
||||||
str = "md4: "
|
str = "md4: "
|
||||||
for i in range(0, Size_MD4):
|
for i in range(0, Size_MD4):
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/ruby
|
#!/usr/bin/ruby
|
||||||
|
|
||||||
require 'r_bp'
|
require 'libr'
|
||||||
|
|
||||||
bp = R_bp::RBreakpoint.new
|
bp = Libr::RBreakpoint.new
|
||||||
bp.use('x86');
|
bp.use('x86');
|
||||||
bp.add_hw(0x8048400,0,0);
|
bp.add_hw(0x8048400,0,0);
|
||||||
bp.list(0)
|
bp.list(0)
|
||||||
|
|
|
@ -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");
|
Loading…
Reference in New Issue