mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-22 05:37:06 +00:00
* Add 'install-vapi' target in libr/Makefile
* Fix linking of r_core (r_bin not found) * Lot of fixes for valaswig. libr, r_io and r_debug are now usable from python/perl/ruby - Fix many .vapi files - Enhace the libr.pc - r_hash.deps must be removed - Depends on valaswig-head
This commit is contained in:
parent
56247931d9
commit
e5b6d1582b
@ -48,7 +48,11 @@ pkgcfg:
|
||||
cd asm && ${MAKE} pkgcfg NAME=libr DEPS="r_`echo ${LIBLIST}|sed -e 's, , r_,g'`"
|
||||
# TODO: Magically generate libr.pc.acr here using LIBLIST and so :)
|
||||
|
||||
install:
|
||||
install-vapi:
|
||||
@${INSTALL_DIR} ${PFX}/share/vala/vapi
|
||||
${INSTALL_DATA} vapi/*.vapi vapi/*.deps ${PFX}/share/vala/vapi
|
||||
|
||||
install: install-vapi
|
||||
# TODO :Use INSTALL_DATA_DIR instead of mkdir
|
||||
# libraries
|
||||
@${INSTALL_DIR} ${PFX}/lib
|
||||
@ -68,8 +72,6 @@ install:
|
||||
@${INSTALL_DIR} ${PFX}/lib/pkgconfig
|
||||
for a in ../pkgcfg/*.pc ; do ${INSTALL_DATA} $$a ${PFX}/lib/pkgconfig ; done
|
||||
#${INSTALL_DATA} libr.pc ${PFX}/lib/pkgconfig
|
||||
@${INSTALL_DIR} ${PFX}/share/vala/vapi
|
||||
${INSTALL_DATA} vapi/*.vapi vapi/*.deps ${PFX}/share/vala/vapi
|
||||
@${INSTALL_DIR} ${PFX}/lib/radare2
|
||||
@for a in `find */p -perm /u+x -type f`; \
|
||||
do echo "$$a ${PFX}/lib/radare2"; \
|
||||
|
@ -130,7 +130,7 @@ R_API int r_core_init(struct r_core_t *core)
|
||||
r_asm_set_user_ptr(&core->assembler, core);
|
||||
r_parse_init(&core->parser);
|
||||
r_parse_set_user_ptr(&core->parser, core);
|
||||
r_bin_init(&core->bin);
|
||||
//r_bin_init(&core->bin);
|
||||
r_bininfo_init(&core->bininfo);
|
||||
r_bin_set_user_ptr(&core->bin, core);
|
||||
r_meta_init(&core->meta);
|
||||
|
@ -31,7 +31,7 @@ R_API struct r_core_file_t *r_core_file_open(struct r_core_t *r, const char *fil
|
||||
fh->size = r_io_size(&r->io, fd);
|
||||
list_add(&(fh->list), &r->files);
|
||||
|
||||
r_bin_open(&r->bin, fh->filename, 0, NULL);
|
||||
//r_bin_open(&r->bin, fh->filename, 0, NULL);
|
||||
// XXX: detect plugin automagically or set it in config.c
|
||||
r_bininfo_open(&r->bininfo, fh->filename, 0, "bininfo_addr2line");
|
||||
|
||||
|
@ -117,7 +117,7 @@ typedef struct r_io_bind_t {
|
||||
} rIoBind;
|
||||
|
||||
/* sections */
|
||||
struct r_io_section_t {
|
||||
typedef struct r_io_section_t {
|
||||
char name[256];
|
||||
ut64 from;
|
||||
ut64 to;
|
||||
@ -125,15 +125,15 @@ struct r_io_section_t {
|
||||
ut64 paddr; // offset on disk
|
||||
int rwx;
|
||||
struct list_head list;
|
||||
};
|
||||
} rIoSection;
|
||||
|
||||
struct r_io_cache_t {
|
||||
typedef struct r_io_cache_t {
|
||||
ut64 from;
|
||||
ut64 to;
|
||||
int size;
|
||||
ut8 *data;
|
||||
struct list_head list;
|
||||
};
|
||||
} rIoCache;
|
||||
|
||||
typedef struct r_io_desc_t {
|
||||
int fd;
|
||||
@ -235,6 +235,12 @@ R_API void r_io_wundo_list(struct r_io_t *io);
|
||||
R_API int r_io_wundo_set_t(struct r_io_t *io, struct r_io_undo_w_t *u, int set) ;
|
||||
R_API void r_io_wundo_set_all(struct r_io_t *io, int set);
|
||||
R_API int r_io_wundo_set(struct r_io_t *io, int n, int set);
|
||||
|
||||
/* plugins */
|
||||
extern struct r_io_handle_t r_io_plugin_malloc;
|
||||
extern struct r_io_handle_t r_io_plugin_ptrace;
|
||||
extern struct r_io_handle_t r_io_plugin_debug;
|
||||
extern struct r_io_handle_t r_io_plugin_shm;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
@ -243,10 +249,5 @@ R_API int r_io_wundo_set(struct r_io_t *io, int n, int set);
|
||||
#define CB_IO int (*cb_io)(void *user, CB_READ, CB_WRITE)
|
||||
R_API int r_io_hook(struct r_io_t *io, CB_IO);
|
||||
#endif
|
||||
/* plugins */
|
||||
extern struct r_io_handle_t r_io_plugin_malloc;
|
||||
extern struct r_io_handle_t r_io_plugin_ptrace;
|
||||
extern struct r_io_handle_t r_io_plugin_debug;
|
||||
extern struct r_io_handle_t r_io_plugin_shm;
|
||||
|
||||
#endif
|
||||
|
@ -61,7 +61,7 @@ R_API ut64 r_reg_get_value(struct r_reg_t *reg, struct r_reg_item_t *item);
|
||||
R_API int r_reg_set_value(struct r_reg_t *reg, struct r_reg_item_t *item, ut64 value);
|
||||
R_API float r_reg_get_fvalue(struct r_reg_t *reg, struct r_reg_item_t *item);
|
||||
R_API int r_reg_set_fvalue(struct r_reg_t *reg, struct r_reg_item_t *item, float value);
|
||||
R_API ut64 r_reg_get_pvalue(struct r_reg_t *reg, struct r_reg_item_t *item, ut64 value, int packidx);
|
||||
R_API ut64 r_reg_get_pvalue(struct r_reg_t *reg, struct r_reg_item_t *item, int packidx);
|
||||
R_API int r_reg_set_pvalue(struct r_reg_t *reg, struct r_reg_item_t *item, ut64 value, int packidx);
|
||||
|
||||
/* byte arena */
|
||||
|
@ -4,24 +4,24 @@
|
||||
#include "r_types.h"
|
||||
#include "list.h"
|
||||
|
||||
struct r_syscall_list_t {
|
||||
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 :)
|
||||
struct r_syscall_t {
|
||||
typedef struct r_syscall_t {
|
||||
#if 0
|
||||
int arch; // XXX char *??
|
||||
int os;
|
||||
#endif
|
||||
FILE *fd;
|
||||
struct r_syscall_list_t *sysptr;
|
||||
};
|
||||
} rSyscall;
|
||||
|
||||
enum {
|
||||
R_SYSCALL_OS_LINUX = 0,
|
||||
|
@ -53,8 +53,10 @@ typedef struct r_num_t {
|
||||
ut64 value;
|
||||
void *userptr;
|
||||
} rNum;
|
||||
typedef ut64 (*rNumCallback)(rNum *self, const char *str, int *ok);
|
||||
|
||||
#ifdef R_API
|
||||
R_API struct r_num_t *r_num_new(rNumCallback *cb, void *ptr);
|
||||
|
||||
#define R_BUF_CUR -1
|
||||
R_API struct r_buf_t *r_buf_init(struct r_buf_t *b);
|
||||
@ -94,7 +96,6 @@ R_API void r_num_minmax_swap(ut64 *a, ut64 *b);
|
||||
R_API void r_num_minmax_swap_i(int *a, int *b); // XXX this can be a cpp macro :??
|
||||
R_API ut64 r_num_math(struct r_num_t *num, const char *str);
|
||||
R_API ut64 r_num_get(struct r_num_t *num, const char *str);
|
||||
R_API struct r_num_t *r_num_new(ut64 (*cb)(void*,const char *,int*), void *ptr);
|
||||
R_API void r_num_init(struct r_num_t *num);
|
||||
|
||||
/* strings */
|
||||
|
@ -182,6 +182,7 @@ R_API ut64 r_io_read_i(struct r_io_t *io, ut64 addr, int sz, int endian)
|
||||
|
||||
R_API int r_io_resize(struct r_io_t *io, const char *file, int flags, int mode)
|
||||
{
|
||||
// XXX not implemented
|
||||
#if 0
|
||||
/* TODO */
|
||||
struct r_io_handle_t *plugin = r_io_handle_resolve(file);
|
||||
|
@ -94,7 +94,7 @@ R_API int r_reg_set_fvalue(struct r_reg_t *reg, struct r_reg_item_t *item, float
|
||||
}
|
||||
|
||||
/* packed registers */
|
||||
R_API ut64 r_reg_get_pvalue(struct r_reg_t *reg, struct r_reg_item_t *item, ut64 value, int packidx)
|
||||
R_API ut64 r_reg_get_pvalue(struct r_reg_t *reg, struct r_reg_item_t *item, int packidx)
|
||||
{
|
||||
return 0LL;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ R_API int r_buf_set_bytes(struct r_buf_t *b, ut8 *buf, int length)
|
||||
return R_TRUE;
|
||||
}
|
||||
|
||||
static int r_buf_memcpy(struct r_buf_t *b, ut64 addr, ut8 *dst, const ut8 *src, int len)
|
||||
static int r_buf_cpy(struct r_buf_t *b, ut64 addr, ut8 *dst, const ut8 *src, int len)
|
||||
{
|
||||
int end;
|
||||
if (addr == R_BUF_CUR)
|
||||
@ -67,7 +67,7 @@ static int r_buf_memcpy(struct r_buf_t *b, ut64 addr, ut8 *dst, const ut8 *src,
|
||||
|
||||
R_API int r_buf_read_at(struct r_buf_t *b, ut64 addr, ut8 *buf, int len)
|
||||
{
|
||||
return r_buf_memcpy(b, addr, buf, b->buf, len);
|
||||
return r_buf_cpy(b, addr, buf, b->buf, len);
|
||||
}
|
||||
|
||||
R_API int r_buf_fread_at(struct r_buf_t *b, ut64 addr, ut8 *buf, const char *fmt, int n)
|
||||
@ -107,7 +107,7 @@ R_API int r_buf_fread_at(struct r_buf_t *b, ut64 addr, ut8 *buf, const char *fmt
|
||||
|
||||
R_API int r_buf_write_at(struct r_buf_t *b, ut64 addr, const ut8 *buf, int len)
|
||||
{
|
||||
return r_buf_memcpy(b, addr, b->buf, buf, len);
|
||||
return r_buf_cpy(b, addr, b->buf, buf, len);
|
||||
}
|
||||
|
||||
R_API void r_buf_deinit(struct r_buf_t *b)
|
||||
|
@ -51,7 +51,7 @@ R_API void r_num_init(struct r_num_t *num)
|
||||
num->value = 0LL;
|
||||
}
|
||||
|
||||
R_API struct r_num_t *r_num_new(ut64 (*cb)(void*,const char *,int*), void *ptr)
|
||||
R_API struct r_num_t *r_num_new(rNumCallback *cb, void *ptr)
|
||||
{
|
||||
struct r_num_t *num;
|
||||
num = (struct r_num_t*) malloc(sizeof(struct r_num_t));
|
||||
|
@ -1,2 +1,13 @@
|
||||
r_asm
|
||||
r_hash
|
||||
r_config
|
||||
r_core
|
||||
r_search
|
||||
r_diff
|
||||
r_io
|
||||
r_lib
|
||||
r_syscall
|
||||
r_bp
|
||||
r_reg
|
||||
r_util
|
||||
r_debug
|
||||
|
@ -1 +1,3 @@
|
||||
/* empty */
|
||||
namespace Radare {
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace Radare {
|
||||
public int fd;
|
||||
|
||||
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 close();
|
||||
|
@ -1,2 +1,3 @@
|
||||
r_util
|
||||
r_bp
|
||||
r_reg
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Radare {
|
||||
[Compact]
|
||||
[CCode (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 rDebug {
|
||||
public rBreakpoint bp;
|
||||
public rDebug();
|
||||
@ -61,6 +61,6 @@ namespace Radare {
|
||||
public int pid_add_thread();
|
||||
public int pid_del_thread();
|
||||
//public Process pid_get(int pid); // XXX wrong api syntax 'get' is keyword
|
||||
public bool pid_set_status(ProcessStatus status);
|
||||
//public bool pid_set_status(ProcessStatus status);
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,18 @@
|
||||
/* radare - LGPL - Copyright 2009 nibble<.ds@gmail.com>, pancake <nopcode.org>*/
|
||||
|
||||
[CCode (cheader_filename="r_diff.h")]
|
||||
namespace Radare {
|
||||
[Compact]
|
||||
[CCode (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 rDiff (uint64 off_a = 0LL, uint64 off_b = 0LL);
|
||||
public int buffers (uint8* a, int la, uint8* b, int lb);
|
||||
//public int set_callback(...);
|
||||
public int 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);
|
||||
public static int lines (string file, string sa, int la, string file2, string sb, int lb);
|
||||
|
||||
[Compact]
|
||||
[CCode (cname="struct r_diff_handle_t", destroy_function="", free_function="" )]
|
||||
public struct Operation {
|
||||
public struct Handle {
|
||||
public uint64 a_off;
|
||||
public uint8* a_buf;
|
||||
public int a_len;
|
||||
|
@ -1 +0,0 @@
|
||||
r_hash
|
@ -2,14 +2,16 @@
|
||||
|
||||
namespace Radare {
|
||||
[Compact]
|
||||
[CCode (cheader_filaneme="r_io.h", cname="struct r_io_t", free_function="r_io_free", cprefix="r_io_")]
|
||||
[CCode (cheader_filename="r_io.h", cname="rIo", free_function="r_io_free", cprefix="r_io_")]
|
||||
public class rIo {
|
||||
public enum Flags {
|
||||
[CCode (cprefix="R_IO_")]
|
||||
public enum Perm {
|
||||
READ = 0,
|
||||
WRITE = 1,
|
||||
RDWR = 2,
|
||||
EXEC = 2,
|
||||
}
|
||||
|
||||
[CCode (cprefix="R_IO_SEEK_")]
|
||||
public enum Seek {
|
||||
SET = 0,
|
||||
CUR = 1,
|
||||
@ -17,9 +19,9 @@ namespace Radare {
|
||||
}
|
||||
|
||||
public rIo();
|
||||
public rIo* free();
|
||||
public bool init();
|
||||
public bool set_write_mask(int fd, uint8 *buf, int len);
|
||||
public rIo free();
|
||||
public unowned rIo init();
|
||||
public bool set_write_mask(uint8 *buf, int len);
|
||||
|
||||
/**
|
||||
* Open a file using an uri specifying flags and mode
|
||||
@ -27,50 +29,55 @@ namespace Radare {
|
||||
* uri: URI with path to file
|
||||
* flags: See Radare.Io.Flags
|
||||
* mode: ...
|
||||
*/
|
||||
*/
|
||||
public int open(string uri, int flags, int mode);
|
||||
public int open_as(string urihandler, string path, int flags, int mode);
|
||||
public int read(int fd, out uint8 *buf, int len);
|
||||
public int read(out uint8 *buf, int len);
|
||||
public int read_at(uint64 addr, uint8 *buf, int len);
|
||||
//public rBuf read_buf(uint64 addr, int len);
|
||||
public int write(int fd, uint8 *buf, int len);
|
||||
public rBuffer read_buf(uint64 addr, int len);
|
||||
public int write(uint8 *buf, int len);
|
||||
public uint64 seek(int fd, uint64 addr, int whence);
|
||||
public int system(int fd, string cmd);
|
||||
public int system(string cmd);
|
||||
public int close(int fd);
|
||||
public uint64 size(int fd);
|
||||
|
||||
/* undo */
|
||||
public void undo_enable(int set);
|
||||
public uint64 undo_seek();
|
||||
public void undo_redo();
|
||||
public void undo_push();
|
||||
public void undo_enable(bool set, bool write);
|
||||
//public uint64 undo_seek();
|
||||
//public void undo_redo();
|
||||
//public void undo_push();
|
||||
|
||||
/* handle */
|
||||
public struct Handle {
|
||||
[Compact]
|
||||
[CCode (cname="rIoHandle", cprefix="r_io_handle_")]
|
||||
public class Handle {
|
||||
string name;
|
||||
string desc;
|
||||
// TODO: lot of missing stuff here :)
|
||||
}
|
||||
|
||||
/* TODO: make them methods */
|
||||
public bool handle_open(int fd, Handle plugin);
|
||||
public bool handle_add(Handle plugin);
|
||||
public int handle_generate();
|
||||
//public int handle_generate();
|
||||
public void handle_list();
|
||||
|
||||
/* maps */
|
||||
[CCode (cname="rIoMap", cprefix="r_io_map_")]
|
||||
public struct Map {
|
||||
int fd;
|
||||
uint64 from;
|
||||
uint64 to;
|
||||
}
|
||||
public Map map_resolve(int fd);
|
||||
public bool map_add(int fd, uint64 addr, uint64 size);
|
||||
public bool map_add(int fd, int flags, uint64 delta, uint64 addr, uint64 size);
|
||||
public bool map_del(int fd);
|
||||
public void map_list(); // DEPRECATE
|
||||
public int map_read_at(uint64 addr, uint8 *buf, uint64 len);
|
||||
public int map_write_at(uint64 addr, uint8 *buf, uint64 len);
|
||||
|
||||
/* sections */
|
||||
[CCode (cname="struct r_io_section_t")]
|
||||
[CCode (cname="rIoSection")]
|
||||
public struct Section {
|
||||
string comment;
|
||||
uint64 from;
|
||||
@ -81,12 +88,12 @@ namespace Radare {
|
||||
}
|
||||
|
||||
/* desc */
|
||||
[CCode (cname="struct r_io_desc_t")]
|
||||
[CCode (cname="rIoDesc")]
|
||||
public struct Desc {
|
||||
int fd;
|
||||
int flags;
|
||||
const string name;
|
||||
}
|
||||
public bool desc_add(int fd, string file, Flags flags);
|
||||
public bool desc_add(int fd, string file, Perm perms, Handle handle);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
|
||||
|
||||
[CCode (cheader_filename="r_lib.h", cprefix="r_", lower_case_cprefix="r_")]
|
||||
namespace Radare {
|
||||
[Compact]
|
||||
[CCode (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 rLibrary(string symname);
|
||||
public rLibrary init(string symname);
|
||||
@ -12,10 +11,10 @@ namespace Radare {
|
||||
public string types_get(int idx);
|
||||
|
||||
/* lowlevel api */
|
||||
public void* dl_open(string libname);
|
||||
public static void* dl_open(string libname);
|
||||
public void* dl_sym(string symname);
|
||||
public bool dl_close(void *lh);
|
||||
public bool dl_check_filename(string file);
|
||||
public static bool dl_close(void *lh);
|
||||
public static bool dl_check_filename(string file);
|
||||
/* handlers */
|
||||
// we need delegates here (function pointerz)
|
||||
// public bool add_handler(int type, string desc, /* */, void* user);
|
||||
|
@ -1,71 +1,69 @@
|
||||
/* radare - LGPL - Copyright 2009-2010 pancake<@nopcode.org> */
|
||||
|
||||
[CCode (cheader_filename="r_reg.h", cprefix="r_reg_", lower_case_cprefix="r_reg_")]
|
||||
namespace Radare {
|
||||
[Compact]
|
||||
[CCode (cname="struct r_reg_t", free_function="r_reg_free", cprefix="r_reg_")]
|
||||
public class rRegister {
|
||||
[CCode (cprefix="R_REG_TYPE_")]
|
||||
public enum Type {
|
||||
GPR,
|
||||
DRX,
|
||||
FPU,
|
||||
MMX,
|
||||
XMM,
|
||||
FLG,
|
||||
SEG,
|
||||
LAST,
|
||||
ALL
|
||||
}
|
||||
|
||||
[Compact]
|
||||
[CCode (cname="struct r_reg_item_t", destroy_function="", free_function="" )]
|
||||
public class Item {
|
||||
public string name;
|
||||
public int size;
|
||||
public int offset;
|
||||
public int packed_size;
|
||||
public rRegister.Type type;
|
||||
}
|
||||
|
||||
[Compact]
|
||||
[CCode (cname="struct r_reg_arena_t", destroy_function="", free_function="" )]
|
||||
public class Arena {
|
||||
public uint8* bytes;
|
||||
public int size;
|
||||
}
|
||||
|
||||
[Compact]
|
||||
[CCode (cname="struct r_reg_set_t", destroy_function="", free_function="" )]
|
||||
public class Set {
|
||||
public rRegister.Arena arena;
|
||||
public rList<rRegister.Arena*> arenas;
|
||||
public rList<rRegister.Item*> regs;
|
||||
}
|
||||
|
||||
[NoArrayLength]
|
||||
[CCode (cname="r_reg_types")]
|
||||
public static weak string types[]; //Type.LAST];
|
||||
|
||||
public rRegister();
|
||||
public bool set_profile(string file);
|
||||
public bool set_profile_string(string profile);
|
||||
public rRegister.Item get(string name, int type = -1);
|
||||
/* TODO: use r_array or r_list here */
|
||||
public KernelList<rRegister.Item*> get_list(rRegister.Type type);
|
||||
|
||||
public uint64 get_value(rRegister.Item item);
|
||||
public bool set_value(rRegister.Item item, uint64 val);
|
||||
|
||||
public float get_fvalue(rRegister.Item item);
|
||||
public bool set_fvalue(rRegister.Item item, float val);
|
||||
|
||||
public uint64 get_pvalue(rRegister.Item item, int pidx);
|
||||
public bool set_pvalue(rRegister.Item item, uint64 val, int pidx);
|
||||
|
||||
public uint8* get_bytes(rRegister.Type type, out int size = null);
|
||||
public int set_bytes(rRegister.Type type, uint8* buf, int len);
|
||||
|
||||
public void fit_arena();
|
||||
[Compact]
|
||||
[CCode (cname="struct r_reg_t", free_function="r_reg_free", cprefix="r_reg_")]
|
||||
public class Radare.rRegister {
|
||||
[CCode (cprefix="R_REG_TYPE_")]
|
||||
public enum Type {
|
||||
GPR,
|
||||
DRX,
|
||||
FPU,
|
||||
MMX,
|
||||
XMM,
|
||||
FLG,
|
||||
SEG,
|
||||
LAST,
|
||||
ALL
|
||||
}
|
||||
|
||||
[Compact]
|
||||
[CCode (cname="struct r_reg_item_t", destroy_function="", free_function="" )]
|
||||
public class Item {
|
||||
public string name;
|
||||
public int size;
|
||||
public int offset;
|
||||
public int packed_size;
|
||||
public Type type;
|
||||
}
|
||||
|
||||
[Compact]
|
||||
[CCode (cname="struct r_reg_arena_t", destroy_function="", free_function="" )]
|
||||
public class Arena {
|
||||
public uint8* bytes;
|
||||
public int size;
|
||||
}
|
||||
|
||||
[Compact]
|
||||
[CCode (cname="struct r_reg_set_t", destroy_function="", free_function="" )]
|
||||
public class Set {
|
||||
public rRegister.Arena arena;
|
||||
public rList<rRegister.Arena*> arenas;
|
||||
public rList<rRegister.Item*> regs;
|
||||
}
|
||||
|
||||
[NoArrayLength]
|
||||
[CCode (cname="r_reg_types")]
|
||||
public static weak string types[]; //Type.LAST];
|
||||
|
||||
public rRegister();
|
||||
public bool set_profile(string file);
|
||||
public bool set_profile_string(string profile);
|
||||
public rRegister.Item get(string name, int type = -1);
|
||||
/* TODO: use r_array or r_list here */
|
||||
//public KernelList<rRegister.Item*> get_list(rRegister.Type type);
|
||||
|
||||
public uint64 get_value(rRegister.Item item);
|
||||
public bool set_value(rRegister.Item item, uint64 val);
|
||||
|
||||
public float get_fvalue(Item item);
|
||||
public bool set_fvalue(Item item, float val);
|
||||
|
||||
public uint64 get_pvalue(Item item, int pidx);
|
||||
public bool set_pvalue(Item item, uint64 val, int pidx);
|
||||
|
||||
public uint8* get_bytes(Type type, out int size = null);
|
||||
public int set_bytes(Type type, uint8* buf, int len);
|
||||
|
||||
public void fit_arena();
|
||||
}
|
||||
|
@ -19,8 +19,9 @@ namespace Radare {
|
||||
public bool kw_add_bin(string kw, uint32 kw_len, string binmask, long bm_len);
|
||||
public Keyword kw_list();
|
||||
public int set_callback(Callback cb, void *user);
|
||||
public int pattern(int size); // this is uint? long?
|
||||
public int strings(int min, int max); // this is uint? long?
|
||||
public int pattern_update(int size); // this is uint? long?
|
||||
public int set_pattern_size(int size); // this is uint? long?
|
||||
public int strings_update(uint64 addr, char *buf, int len, int enc);
|
||||
|
||||
[CCode (cprefix="R_SEARCH_", cname="int")]
|
||||
public enum Mode {
|
||||
|
@ -1,56 +1,58 @@
|
||||
/* radare - LGPL - Copyright 2009 pancake<@nopcode.org> */
|
||||
|
||||
[CCode (cheader_filename="r_util.h", cprefix="r_util_", lower_case_cprefix="r_util_")]
|
||||
namespace Radare {
|
||||
[Compact]
|
||||
[CCode (cprefix="r_")]
|
||||
[CCode (cheader_filename="r_util.h", cprefix="r_util_")]
|
||||
public static class rUtil {
|
||||
public static int hex_str2bin (string input, uint8 *buf);
|
||||
//public static int hex_str2bin (string input, uint8 *buf);
|
||||
//public static int hex_bin2str (uint8 *buf, int len, out string str);
|
||||
public static string hex_bin2strdup (uint8 *buf, int len);
|
||||
//public static string hex_bin2strdup (uint8 *buf, int len);
|
||||
/* mem */
|
||||
public static uint8 *mem_mem (uint8 *a, int al, uint8 *b, int bl);
|
||||
public static void mem_copyendian (uint8 *dest, uint8 *orig, int size, int endian);
|
||||
public static void mem_copyloop (uint8 *dest, uint8 *orig, int dsize, int osize);
|
||||
public static void mem_cmp_mask (uint8 *dest, uint8 *orig, uint8 *mask, int len);
|
||||
//public static uint8 *mem_mem (uint8 *a, int al, uint8 *b, int bl);
|
||||
//public static void mem_copyendian (uint8 *dest, uint8 *orig, int size, int endian);
|
||||
//public static void mem_copyloop (uint8 *dest, uint8 *orig, int dsize, int osize);
|
||||
//public static void mem_cmp_mask (uint8 *dest, uint8 *orig, uint8 *mask, int len);
|
||||
/* num */
|
||||
public static uint64 num_get(void *num, string str); // XXX void *
|
||||
//public static uint64 num_get(void *num, string str); // XXX void *
|
||||
//public static int offsetof(void *type, void *member);
|
||||
}
|
||||
|
||||
// ???
|
||||
[CCode (cprefix="r_str")]
|
||||
[CCode (cheader_filename="r_util.h", cprefix="r_str_")]
|
||||
public static class rStr {
|
||||
public rStr();
|
||||
public int hash(string str);
|
||||
}
|
||||
|
||||
[CCode (cprefix="r_num")]
|
||||
[CCode (cheader_filename="r_util.h", cprefix="r_num_")]
|
||||
public static class rNum {
|
||||
public rNum();
|
||||
public rNum(rNumCallback cb, void *user);
|
||||
public uint64 get(string str);
|
||||
public uint64 math(string str);
|
||||
}
|
||||
public delegate uint64 rNumCallback (rNum num, string str, int *ok);
|
||||
|
||||
[CCode (cprefix="r_log")]
|
||||
[CCode (cheader_filename="r_util.h", cprefix="r_log_")]
|
||||
public static class rLog {
|
||||
public bool msg(string str);
|
||||
public bool err(string str);
|
||||
}
|
||||
|
||||
[CCode (cprefix="r_buf_")]
|
||||
[CCode (cheader_filename="r_util.h", cprefix="r_buf_")]
|
||||
public class rBuffer {
|
||||
public rBuffer();
|
||||
public int read_at(uint64 addr, uint8 *buf, int len);
|
||||
public int write_at(uint64 addr, uint8 *buf, int len);
|
||||
public bool set_bytes(uint8 *buf, int len);
|
||||
public bool memcpy(uint64 addr, uint8 *dst, uint8 *src, int len);
|
||||
//public bool memcpy(uint64 addr, uint8 *dst, uint8 *src, int len);
|
||||
/* ... */
|
||||
}
|
||||
|
||||
/* Generic Iterator interfaced with r_iter */
|
||||
#if 0
|
||||
// XXX not yet supported by valaswig ://
|
||||
[Compact]
|
||||
[CCode (cprefix="r_array_", cname="void*")]
|
||||
[CCode (cheader_filename="r_array.h", cprefix="r_array_", cname="void*")]
|
||||
public class rArray<G> {
|
||||
public rArray (int size);
|
||||
public unowned G cur ();
|
||||
@ -74,7 +76,9 @@ namespace Radare {
|
||||
}
|
||||
/* TODO: move this declaration inside rIter to have access to the Generic type */
|
||||
public delegate int rArrayCallback (void *foo);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* TODO: to be removed. not fully compliant */
|
||||
[Compact]
|
||||
[CCode (cprefix="ralist_", cheader_filename="r_types.h,list.h", cname="struct list_head")]
|
||||
@ -91,6 +95,7 @@ namespace Radare {
|
||||
[CCode (cname="ralist_iterator")]
|
||||
public KernelList<G> iterator();
|
||||
}
|
||||
#endif
|
||||
|
||||
[Compact]
|
||||
[CCode (cprefix="r_list_", cheader_filename="r_util.h", cname="struct r_list_t")]
|
||||
@ -98,15 +103,15 @@ namespace Radare {
|
||||
public rList ();
|
||||
public void append(owned G foo);
|
||||
public void prepend(owned G foo);
|
||||
public unowned G get();
|
||||
[CCode (cname="r_list_iterator")]
|
||||
public rListIter<G> iterator();
|
||||
//public unowned G get();
|
||||
//public rListIter<G> iterator();
|
||||
}
|
||||
|
||||
[Compact]
|
||||
[CCode (cprefix="r_list_iter_", cheader_filename="r_list.h", cname="struct r_list_iter_t")]
|
||||
public class rListIter<G> {
|
||||
public bool next();
|
||||
public G @free(G arg);
|
||||
// public G @free(G arg);
|
||||
public unowned G get();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# bin is broken..waiting for the new api
|
||||
all: core regs hash sc socket asm search db io array list
|
||||
all: lang core regs hash sc socket asm search db io array list
|
||||
@true
|
||||
|
||||
bintest:
|
||||
|
@ -26,6 +26,7 @@ install:
|
||||
touch /usr/lib/$$a/r2/__init__.py ; \
|
||||
echo "Installing $$a r2 modules..." ; \
|
||||
cp -rf python/* /usr/lib/$$a/r2 ; \
|
||||
cp -rf python/*libr* /usr/lib/$$a/ ; \
|
||||
done ; \
|
||||
fi
|
||||
|
||||
|
@ -7,4 +7,7 @@ if [ -z "${MOD}" ]; then
|
||||
fi
|
||||
mkdir -p ${LNG}
|
||||
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}`
|
||||
|
@ -3,3 +3,11 @@ LANG_EXT=py
|
||||
LIBS_PFX=_
|
||||
|
||||
include ../rules.mk
|
||||
|
||||
tri:
|
||||
valaswig -o r_debug.i -m r_debug --vapidir ../../libr/vapi/ r_debug
|
||||
swig -python -I/usr/include/libr r_debug.i
|
||||
gcc r_debug_wrap.c -shared -fPIC -I /usr/include/libr -I /usr/include/python2.6/ -o _r_debug.so -lr_debug -lr_bp -lr_reg -lr_util
|
||||
|
||||
bis:
|
||||
valaswig-cc python r_io -I../../libr/include r_io `pkg-config --libs r_io`
|
||||
|
@ -1,4 +1,5 @@
|
||||
from r2.r_hash import rHash, Size_MD4
|
||||
#from r2.r_hash import rHash, Size_MD4
|
||||
from libr import rHash, Size_MD4
|
||||
|
||||
hash = rHash(False)
|
||||
ret = hash.do_md4 ("food", 4)
|
||||
|
@ -1,5 +1,5 @@
|
||||
LIBS=r_bp.so r_asm.so r_diff.so r_debug.so r_hash.so r_cons.so
|
||||
LIBS+=r_core.so r_search.so r_db.so r_lib.so
|
||||
LIBS+=r_core.so r_search.so r_db.so r_lib.so r_io.so libr.so
|
||||
|
||||
.SUFFIXES: .so
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user