Remove some outdated TODO/XXX comments
Add 'dbs' command to swap/toggle breakpoints Bind debugger keys to key.fX visual bindings Use --swig in r2-bindings. But still broken
This commit is contained in:
parent
61a10eb2aa
commit
c39d68ad3e
6
TODO
6
TODO
|
@ -25,7 +25,6 @@ Add $EDITOR alias for file open(read/write) -
|
||||||
// show hints for
|
// show hints for
|
||||||
0x100005eca ff2540130000 jmp qword [rip+0x1340] [1]
|
0x100005eca ff2540130000 jmp qword [rip+0x1340] [1]
|
||||||
* Fix ?-
|
* Fix ?-
|
||||||
* Register diff colorization is broken
|
|
||||||
* bar for cursor?
|
* bar for cursor?
|
||||||
* p= show entropy of current block
|
* p= show entropy of current block
|
||||||
- show number of occurrences for each byte
|
- show number of occurrences for each byte
|
||||||
|
@ -41,9 +40,8 @@ Add $EDITOR alias for file open(read/write) -
|
||||||
* add support for sockets in rarun2
|
* add support for sockets in rarun2
|
||||||
* if no debugger supported, say so... r_io must ?
|
* if no debugger supported, say so... r_io must ?
|
||||||
* check search multiple keywords and signatures
|
* check search multiple keywords and signatures
|
||||||
* Fix iterators for r_macro (test only?)
|
* search for antidebug/disasm tricks opcodes
|
||||||
- search for antidebug/disasm tricks opcodes
|
- allows to find interesting points to analyze
|
||||||
- allows to find interesting points to analyze
|
|
||||||
* use slices for r_list_iter primitives
|
* use slices for r_list_iter primitives
|
||||||
|
|
||||||
BUGS:
|
BUGS:
|
||||||
|
|
|
@ -63,7 +63,6 @@ static void get_strings_range(RBinArch *arch, RList *list, int min, ut64 from, u
|
||||||
}
|
}
|
||||||
|
|
||||||
static int is_data_section(RBinArch *a, RBinSection *s) {
|
static int is_data_section(RBinArch *a, RBinSection *s) {
|
||||||
// XXX: DIRTY HACK! should we check sections srwx to be READ ONLY and NONEXEC?
|
|
||||||
if (strstr (a->info->bclass, "MACH0") && strstr (s->name, "_cstring")) // OSX
|
if (strstr (a->info->bclass, "MACH0") && strstr (s->name, "_cstring")) // OSX
|
||||||
return 1;
|
return 1;
|
||||||
if (strstr (a->info->bclass, "ELF") && strstr (s->name, "data")) // LINUX
|
if (strstr (a->info->bclass, "ELF") && strstr (s->name, "data")) // LINUX
|
||||||
|
@ -75,7 +74,6 @@ static int is_data_section(RBinArch *a, RBinSection *s) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: check only in data section. filter chars only in -r mode
|
|
||||||
static RList* get_strings(RBinArch *a, int min) {
|
static RList* get_strings(RBinArch *a, int min) {
|
||||||
RBinSection *section;
|
RBinSection *section;
|
||||||
RListIter *iter;
|
RListIter *iter;
|
||||||
|
@ -97,7 +95,7 @@ static RList* get_strings(RBinArch *a, int min) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (r_list_empty (a->sections)) //if (count == 0)
|
if (r_list_empty (a->sections))
|
||||||
get_strings_range (a, ret, min, 0, a->size, 0);
|
get_strings_range (a, ret, min, 0, a->size, 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -147,12 +145,10 @@ static int r_bin_init_items(RBin *bin, int dummy) {
|
||||||
return R_TRUE;
|
return R_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Free plugins */
|
|
||||||
#define RBINLISTFREE(x) if(x){r_list_free(x);x=NULL;}
|
#define RBINLISTFREE(x) if(x){r_list_free(x);x=NULL;}
|
||||||
static void r_bin_free_items(RBin *bin) {
|
static void r_bin_free_items(RBin *bin) {
|
||||||
int i;
|
int i;
|
||||||
RBinArch *a = &bin->curarch;
|
RBinArch *a = &bin->curarch;
|
||||||
// XXX: drop all those silly conditionals! if it's null is not for freeing
|
|
||||||
RBINLISTFREE (a->entries);
|
RBINLISTFREE (a->entries);
|
||||||
RBINLISTFREE (a->fields);
|
RBINLISTFREE (a->fields);
|
||||||
RBINLISTFREE (a->imports);
|
RBINLISTFREE (a->imports);
|
||||||
|
@ -190,18 +186,8 @@ static void r_bin_init(RBin *bin) {
|
||||||
static int r_bin_extract(RBin *bin, int idx) {
|
static int r_bin_extract(RBin *bin, int idx) {
|
||||||
if (bin->curxtr && bin->curxtr->extract)
|
if (bin->curxtr && bin->curxtr->extract)
|
||||||
return bin->curxtr->extract (bin, idx);
|
return bin->curxtr->extract (bin, idx);
|
||||||
//free (bin->curarch.file);
|
|
||||||
bin->curarch.file = strdup (bin->file);
|
bin->curarch.file = strdup (bin->file);
|
||||||
//if (!(buf = (ut8*)r_file_slurp_range (bin->file, 0, 0xfffff, &bin->curarch.size)))
|
|
||||||
// TODO: use mmap here
|
|
||||||
bin->curarch.buf = r_buf_mmap (bin->file, 0);
|
bin->curarch.buf = r_buf_mmap (bin->file, 0);
|
||||||
/*
|
|
||||||
if (!(buf = (ut8*)r_file_slurp (bin->file, &bin->curarch.size)))
|
|
||||||
return 0;
|
|
||||||
bin->curarch.buf = r_buf_new ();
|
|
||||||
free (bin->curarch.buf->buf);
|
|
||||||
bin->curarch.buf->buf = buf;
|
|
||||||
*/
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +266,6 @@ R_API int r_bin_load(RBin *bin, const char *file, int dummy) {
|
||||||
return r_bin_init_items (bin, dummy);
|
return r_bin_init_items (bin, dummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove this getters.. we have no threads or mutexes to protect here
|
|
||||||
R_API ut64 r_bin_get_baddr(RBin *bin) {
|
R_API ut64 r_bin_get_baddr(RBin *bin) {
|
||||||
return bin->curarch.baddr;
|
return bin->curarch.baddr;
|
||||||
}
|
}
|
||||||
|
@ -355,7 +340,7 @@ R_API int r_bin_is_static (RBin *bin) {
|
||||||
return R_BIN_DBG_STATIC (bin->curarch.info->dbg_info);
|
return R_BIN_DBG_STATIC (bin->curarch.info->dbg_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX Implement in r_bin_meta and deprecate? */
|
// TODO: Integrate with r_bin_dbg */
|
||||||
R_API int r_bin_has_dbg_linenums (RBin *bin) {
|
R_API int r_bin_has_dbg_linenums (RBin *bin) {
|
||||||
return R_BIN_DBG_LINENUMS (bin->curarch.info->dbg_info);
|
return R_BIN_DBG_LINENUMS (bin->curarch.info->dbg_info);
|
||||||
}
|
}
|
||||||
|
@ -373,27 +358,27 @@ R_API RBin* r_bin_new() {
|
||||||
RBinPlugin *static_plugin;
|
RBinPlugin *static_plugin;
|
||||||
RBinXtrPlugin *static_xtr_plugin;
|
RBinXtrPlugin *static_xtr_plugin;
|
||||||
RBin *bin = R_NEW (RBin);
|
RBin *bin = R_NEW (RBin);
|
||||||
if (bin) {
|
if (!bin) return NULL;
|
||||||
memset (bin, 0, sizeof (RBin));
|
memset (bin, 0, sizeof (RBin));
|
||||||
bin->plugins = r_list_new();
|
bin->plugins = r_list_new();
|
||||||
bin->plugins->free = free;
|
bin->plugins->free = free;
|
||||||
for (i=0; bin_static_plugins[i]; i++) {
|
for (i=0; bin_static_plugins[i]; i++) {
|
||||||
static_plugin = R_NEW (RBinPlugin);
|
static_plugin = R_NEW (RBinPlugin);
|
||||||
memcpy (static_plugin, bin_static_plugins[i], sizeof (RBinPlugin));
|
memcpy (static_plugin, bin_static_plugins[i],
|
||||||
r_bin_add (bin, static_plugin);
|
sizeof (RBinPlugin));
|
||||||
}
|
r_bin_add (bin, static_plugin);
|
||||||
bin->binxtrs = r_list_new();
|
}
|
||||||
bin->binxtrs->free = free;
|
bin->binxtrs = r_list_new();
|
||||||
for (i=0; bin_xtr_static_plugins[i]; i++) {
|
bin->binxtrs->free = free;
|
||||||
static_xtr_plugin = R_NEW (RBinXtrPlugin);
|
for (i=0; bin_xtr_static_plugins[i]; i++) {
|
||||||
memcpy (static_xtr_plugin, bin_xtr_static_plugins[i], sizeof (RBinXtrPlugin));
|
static_xtr_plugin = R_NEW (RBinXtrPlugin);
|
||||||
r_bin_xtr_add (bin, static_xtr_plugin);
|
memcpy (static_xtr_plugin, bin_xtr_static_plugins[i],
|
||||||
}
|
sizeof (RBinXtrPlugin));
|
||||||
|
r_bin_xtr_add (bin, static_xtr_plugin);
|
||||||
}
|
}
|
||||||
return bin;
|
return bin;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: handle ARCH and BITS
|
|
||||||
/* arch and bits are implicit in the plugin name, do we really need
|
/* arch and bits are implicit in the plugin name, do we really need
|
||||||
* to overwrite bin->curarch.info? */
|
* to overwrite bin->curarch.info? */
|
||||||
R_API int r_bin_use_arch(RBin *bin, const char *arch, int bits, const char *name) {
|
R_API int r_bin_use_arch(RBin *bin, const char *arch, int bits, const char *name) {
|
||||||
|
@ -417,7 +402,6 @@ R_API int r_bin_use_arch(RBin *bin, const char *arch, int bits, const char *name
|
||||||
}
|
}
|
||||||
|
|
||||||
// DUPDUPDUP
|
// DUPDUPDUP
|
||||||
|
|
||||||
R_API int r_bin_select(RBin *bin, const char *arch, int bits, const char *name) {
|
R_API int r_bin_select(RBin *bin, const char *arch, int bits, const char *name) {
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<bin->narch; i++) {
|
for (i=0; i<bin->narch; i++) {
|
||||||
|
@ -476,15 +460,14 @@ R_API RBuffer *r_bin_create (RBin *bin, const ut8 *code, int codelen, const ut8
|
||||||
R_API RBinObj *r_bin_get_object(RBin *bin, int flags) {
|
R_API RBinObj *r_bin_get_object(RBin *bin, int flags) {
|
||||||
int i;
|
int i;
|
||||||
RBinObj *obj = R_NEW (RBinObj);
|
RBinObj *obj = R_NEW (RBinObj);
|
||||||
if (obj) {
|
if (!obj) return NULL;
|
||||||
obj->symbols = r_bin_get_symbols (bin);
|
obj->symbols = r_bin_get_symbols (bin);
|
||||||
obj->imports = r_bin_get_imports (bin);
|
obj->imports = r_bin_get_imports (bin);
|
||||||
obj->entries = r_bin_get_entries (bin);
|
obj->entries = r_bin_get_entries (bin);
|
||||||
for (i=0; i<R_BIN_SYM_LAST; i++)
|
for (i=0; i<R_BIN_SYM_LAST; i++)
|
||||||
obj->binsym[i] = r_bin_get_sym (bin, i);
|
obj->binsym[i] = r_bin_get_sym (bin, i);
|
||||||
obj->baddr = r_bin_get_baddr (bin);
|
obj->baddr = r_bin_get_baddr (bin);
|
||||||
obj->info = r_bin_get_info (bin);
|
obj->info = r_bin_get_info (bin);
|
||||||
}
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -532,6 +532,19 @@ static void r_core_cmd_bp(RCore *core, const char *input) {
|
||||||
} else eprintf ("No breakpoint defined at 0x%08"PFMT64x"\n", off);
|
} else eprintf ("No breakpoint defined at 0x%08"PFMT64x"\n", off);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 's':
|
||||||
|
{
|
||||||
|
ut64 addr = r_num_math (core->num, input+2);
|
||||||
|
RBreakpointItem *bp = r_bp_get (core->dbg->bp, addr);
|
||||||
|
if (bp) bp->enabled = !bp->enabled;
|
||||||
|
else {
|
||||||
|
if (hwbp) bp = r_bp_add_hw (core->dbg->bp, addr, 1, R_BP_PROT_EXEC);
|
||||||
|
else bp = r_bp_add_sw (core->dbg->bp, addr, 1, R_BP_PROT_EXEC);
|
||||||
|
if (!bp) eprintf ("Cannot set breakpoint (%s)\n", input+2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
r_bp_enable (core->dbg->bp, r_num_math (core->num, input+2), 0);
|
||||||
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
r_bp_enable (core->dbg->bp, r_num_math (core->num, input+2), 1);
|
r_bp_enable (core->dbg->bp, r_num_math (core->num, input+2), 1);
|
||||||
break;
|
break;
|
||||||
|
@ -551,6 +564,7 @@ static void r_core_cmd_bp(RCore *core, const char *input) {
|
||||||
"db sym.main ; add breakpoint into sym.main\n"
|
"db sym.main ; add breakpoint into sym.main\n"
|
||||||
"db 0x804800 ; add breakpoint\n"
|
"db 0x804800 ; add breakpoint\n"
|
||||||
"db -0x804800 ; remove breakpoint\n"
|
"db -0x804800 ; remove breakpoint\n"
|
||||||
|
"dbs 0x8048000 ; toggle breakpoint on given address\n"
|
||||||
"dbe 0x8048000 ; enable breakpoint\n"
|
"dbe 0x8048000 ; enable breakpoint\n"
|
||||||
"dbc 0x8048000 cmd ; run command when breakpoint is hit\n"
|
"dbc 0x8048000 cmd ; run command when breakpoint is hit\n"
|
||||||
"dbd 0x8048000 ; disable breakpoint\n"
|
"dbd 0x8048000 ; disable breakpoint\n"
|
||||||
|
|
|
@ -633,7 +633,7 @@ R_API int r_core_config_init(RCore *core) {
|
||||||
/* fkeys */
|
/* fkeys */
|
||||||
r_config_set (cfg, "key.f1", "");
|
r_config_set (cfg, "key.f1", "");
|
||||||
r_config_desc (cfg, "key.f1", "Commands executed when press F1 key in visual mode");
|
r_config_desc (cfg, "key.f1", "Commands executed when press F1 key in visual mode");
|
||||||
r_config_set (cfg, "key.f2", "");
|
r_config_set (cfg, "key.f2", "dbs $$");
|
||||||
r_config_desc (cfg, "key.f2", "Commands executed when press F2 key in visual mode");
|
r_config_desc (cfg, "key.f2", "Commands executed when press F2 key in visual mode");
|
||||||
r_config_set (cfg, "key.f3", "");
|
r_config_set (cfg, "key.f3", "");
|
||||||
r_config_desc (cfg, "key.f3", "Commands executed when press F3 key in visual mode");
|
r_config_desc (cfg, "key.f3", "Commands executed when press F3 key in visual mode");
|
||||||
|
@ -643,11 +643,11 @@ R_API int r_core_config_init(RCore *core) {
|
||||||
r_config_desc (cfg, "key.f5", "Commands executed when press F5 key in visual mode");
|
r_config_desc (cfg, "key.f5", "Commands executed when press F5 key in visual mode");
|
||||||
r_config_set (cfg, "key.f6", "");
|
r_config_set (cfg, "key.f6", "");
|
||||||
r_config_desc (cfg, "key.f6", "Commands executed when press F6 key in visual mode");
|
r_config_desc (cfg, "key.f6", "Commands executed when press F6 key in visual mode");
|
||||||
r_config_set (cfg, "key.f7", "");
|
r_config_set (cfg, "key.f7", "ds");
|
||||||
r_config_desc (cfg, "key.f7", "Commands executed when press F7 key in visual mode");
|
r_config_desc (cfg, "key.f7", "Commands executed when press F7 key in visual mode");
|
||||||
r_config_set (cfg, "key.f8", "");
|
r_config_set (cfg, "key.f8", "dso");
|
||||||
r_config_desc (cfg, "key.f8", "Commands executed when press F8 key in visual mode");
|
r_config_desc (cfg, "key.f8", "Commands executed when press F8 key in visual mode");
|
||||||
r_config_set (cfg, "key.f9", "");
|
r_config_set (cfg, "key.f9", "dc");
|
||||||
r_config_desc (cfg, "key.f9", "Commands executed when press F9 key in visual mode");
|
r_config_desc (cfg, "key.f9", "Commands executed when press F9 key in visual mode");
|
||||||
r_config_set (cfg, "key.f10", "");
|
r_config_set (cfg, "key.f10", "");
|
||||||
r_config_desc (cfg, "key.f10", "Commands executed when press F10 key in visual mode");
|
r_config_desc (cfg, "key.f10", "Commands executed when press F10 key in visual mode");
|
||||||
|
|
|
@ -18,7 +18,6 @@ static char *r_core_project_file(const char *file) {
|
||||||
return strdup (file);
|
return strdup (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Don't try mkdir rdb if mdkir .radare2 fails. (Maybe R_TRUFAE??)
|
|
||||||
static int r_core_project_init() {
|
static int r_core_project_init() {
|
||||||
int ret;
|
int ret;
|
||||||
char *str = r_str_home (".radare2");
|
char *str = r_str_home (".radare2");
|
||||||
|
|
|
@ -29,7 +29,6 @@ static int r_core_visual_hud(RCore *core) {
|
||||||
char *homehud = r_str_home("/.radare2/hud");
|
char *homehud = r_str_home("/.radare2/hud");
|
||||||
if (homehud)
|
if (homehud)
|
||||||
res = r_cons_hud_file (homehud);
|
res = r_cons_hud_file (homehud);
|
||||||
// TODO: this file needs to be installed
|
|
||||||
if (!res) {
|
if (!res) {
|
||||||
const char *f = R2_LIBDIR"/radare2/"R2_VERSION"/hud/main";
|
const char *f = R2_LIBDIR"/radare2/"R2_VERSION"/hud/main";
|
||||||
if (r_file_exist (f))
|
if (r_file_exist (f))
|
||||||
|
@ -99,25 +98,20 @@ static int visual_fkey(RCore *core, int ch) {
|
||||||
case R_CONS_KEY_F2:
|
case R_CONS_KEY_F2:
|
||||||
cmd = r_config_get (core->config, "key.f2");
|
cmd = r_config_get (core->config, "key.f2");
|
||||||
if (cmd && *cmd) return r_core_cmd0 (core, cmd);
|
if (cmd && *cmd) return r_core_cmd0 (core, cmd);
|
||||||
// TODO: toggle breakpoint
|
|
||||||
break;
|
break;
|
||||||
case R_CONS_KEY_F3:
|
case R_CONS_KEY_F3:
|
||||||
cmd = r_config_get (core->config, "key.f3");
|
cmd = r_config_get (core->config, "key.f3");
|
||||||
if (cmd && *cmd) return r_core_cmd0 (core, cmd);
|
if (cmd && *cmd) return r_core_cmd0 (core, cmd);
|
||||||
// TODO: F3
|
|
||||||
break;
|
break;
|
||||||
case R_CONS_KEY_F4:
|
case R_CONS_KEY_F4:
|
||||||
cmd = r_config_get (core->config, "key.f4");
|
cmd = r_config_get (core->config, "key.f4");
|
||||||
if (cmd && *cmd) return r_core_cmd0 (core, cmd);
|
if (cmd && *cmd) return r_core_cmd0 (core, cmd);
|
||||||
// TODO: F4
|
|
||||||
case R_CONS_KEY_F5:
|
case R_CONS_KEY_F5:
|
||||||
cmd = r_config_get (core->config, "key.f5");
|
cmd = r_config_get (core->config, "key.f5");
|
||||||
if (cmd && *cmd) return r_core_cmd0 (core, cmd);
|
if (cmd && *cmd) return r_core_cmd0 (core, cmd);
|
||||||
// TODO: F5
|
|
||||||
case R_CONS_KEY_F6:
|
case R_CONS_KEY_F6:
|
||||||
cmd = r_config_get (core->config, "key.f6");
|
cmd = r_config_get (core->config, "key.f6");
|
||||||
if (cmd && *cmd) return r_core_cmd0 (core, cmd);
|
if (cmd && *cmd) return r_core_cmd0 (core, cmd);
|
||||||
// TODO: F6
|
|
||||||
break;
|
break;
|
||||||
case R_CONS_KEY_F7:
|
case R_CONS_KEY_F7:
|
||||||
cmd = r_config_get (core->config, "key.f7");
|
cmd = r_config_get (core->config, "key.f7");
|
||||||
|
@ -127,7 +121,6 @@ static int visual_fkey(RCore *core, int ch) {
|
||||||
case R_CONS_KEY_F8:
|
case R_CONS_KEY_F8:
|
||||||
cmd = r_config_get (core->config, "key.f8");
|
cmd = r_config_get (core->config, "key.f8");
|
||||||
if (cmd && *cmd) return r_core_cmd0 (core, cmd);
|
if (cmd && *cmd) return r_core_cmd0 (core, cmd);
|
||||||
// TODO: F8
|
|
||||||
break;
|
break;
|
||||||
case R_CONS_KEY_F9:
|
case R_CONS_KEY_F9:
|
||||||
cmd = r_config_get (core->config, "key.f9");
|
cmd = r_config_get (core->config, "key.f9");
|
||||||
|
@ -158,7 +151,6 @@ void setcursor (RCore *core, int cur) {
|
||||||
core->print->col = curset? 1: 0;
|
core->print->col = curset? 1: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: use r_cmd here in core->vcmd..optimize over 255 table */
|
|
||||||
R_API int r_core_visual_cmd(RCore *core, int ch) {
|
R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||||
RAsmOp op;
|
RAsmOp op;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
@ -168,7 +160,7 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||||
if (ch<2) return 1;
|
if (ch<2) return 1;
|
||||||
|
|
||||||
// do we need hotkeys for data references? not only calls?
|
// do we need hotkeys for data references? not only calls?
|
||||||
if (ch>='0'&&ch<='9') {
|
if (ch>='0'&& ch<='9') {
|
||||||
r_io_sundo_push (core->io, core->offset);
|
r_io_sundo_push (core->io, core->offset);
|
||||||
r_core_seek (core, core->asmqjmps[ch-'0'], 1);
|
r_core_seek (core, core->asmqjmps[ch-'0'], 1);
|
||||||
} else
|
} else
|
||||||
|
@ -313,16 +305,12 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (core->io->va) {
|
if (core->io->va) {
|
||||||
ut64 offset = r_io_section_get_vaddr (core->io, 0);
|
ut64 offset = r_io_section_get_vaddr (core->io, 0);
|
||||||
//ut64 offset = r_io_section_get_vaddr (core->io,
|
|
||||||
// core->file->size-core->blocksize);
|
|
||||||
if (offset == UT64_MAX) {
|
if (offset == UT64_MAX) {
|
||||||
offset = core->file->size - core->blocksize;
|
offset = core->file->size - core->blocksize;
|
||||||
ret = r_core_seek (core, offset, 1);
|
ret = r_core_seek (core, offset, 1);
|
||||||
// memset (core->block, 0xff, core->blocksize);
|
|
||||||
} else {
|
} else {
|
||||||
offset += core->file->size - core->blocksize;
|
offset += core->file->size - core->blocksize;
|
||||||
ret = r_core_seek (core, offset, 1);
|
ret = r_core_seek (core, offset, 1);
|
||||||
// memset (core->block, 0xff, core->blocksize);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ret = r_core_seek (core,
|
ret = r_core_seek (core,
|
||||||
|
@ -423,7 +411,7 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||||
case 'k':
|
case 'k':
|
||||||
if (curset) {
|
if (curset) {
|
||||||
if (core->printidx == 1 || core->printidx == 2)
|
if (core->printidx == 1 || core->printidx == 2)
|
||||||
cols = 4; //r_asm_disassemble (core->assembler, &op, core->block, 32);
|
cols = 4;
|
||||||
cursor -= cols;
|
cursor -= cols;
|
||||||
ocursor = -1;
|
ocursor = -1;
|
||||||
if (cursor<0) {
|
if (cursor<0) {
|
||||||
|
@ -473,14 +461,12 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||||
case ']':
|
case ']':
|
||||||
{
|
{
|
||||||
int scrcols = r_config_get_i (core->config, "scr.cols");
|
int scrcols = r_config_get_i (core->config, "scr.cols");
|
||||||
//if (scrcols<32)
|
r_config_set_i (core->config, "scr.cols", scrcols+2);
|
||||||
r_config_set_i (core->config, "scr.cols", scrcols+2);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
r_core_cmd (core, "dsp", 0);
|
r_core_cmd (core, "dsp", 0);
|
||||||
r_core_cmd (core, ".dr*", 0);
|
r_core_cmd (core, ".dr*", 0);
|
||||||
//r_core_cmd(core, "s eip", 0);
|
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
if (curset) {
|
if (curset) {
|
||||||
|
@ -492,18 +478,15 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||||
} else {
|
} else {
|
||||||
r_core_cmd (core, "ds", 0);
|
r_core_cmd (core, "ds", 0);
|
||||||
r_core_cmd (core, ".dr*", 0);
|
r_core_cmd (core, ".dr*", 0);
|
||||||
//r_core_cmd(core, "s eip", 0);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
if (curset) {
|
if (curset) {
|
||||||
// dcr
|
|
||||||
r_core_cmd (core, "dcr", 0);
|
r_core_cmd (core, "dcr", 0);
|
||||||
curset = 0;
|
curset = 0;
|
||||||
} else {
|
} else {
|
||||||
r_core_cmd (core, "dso", 0);
|
r_core_cmd (core, "dso", 0);
|
||||||
r_core_cmd (core, ".dr*", 0);
|
r_core_cmd (core, ".dr*", 0);
|
||||||
//r_core_cmd(core, "s eip", 0);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
|
@ -579,7 +562,7 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||||
r_io_sundo_push (core->io, core->offset);
|
r_io_sundo_push (core->io, core->offset);
|
||||||
break;
|
break;
|
||||||
case '.':
|
case '.':
|
||||||
r_core_cmd (core, "sr pc", 0); // XXX
|
r_core_cmd (core, "sr pc", 0);
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
r_core_seek_delta (core, core->blocksize);
|
r_core_seek_delta (core, core->blocksize);
|
||||||
|
@ -698,7 +681,8 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||||
return R_TRUE;
|
return R_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: simplify R_ABS(printidx%NPF) into a macro, or just control negative values..
|
|
||||||
|
#define PIDX R_ABS(printidx%NPF)
|
||||||
R_API void r_core_visual_title (RCore *core, int color) {
|
R_API void r_core_visual_title (RCore *core, int color) {
|
||||||
const char *filename;
|
const char *filename;
|
||||||
char pos[512], foo[512], bar[512];
|
char pos[512], foo[512], bar[512];
|
||||||
|
@ -718,9 +702,7 @@ R_API void r_core_visual_title (RCore *core, int color) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4: // XXX pc
|
case 4: // XXX pc
|
||||||
{
|
|
||||||
r_core_block_size (core, core->cons->rows * 5);
|
r_core_block_size (core, core->cons->rows * 5);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 1: // pd
|
case 1: // pd
|
||||||
case 2: // pd+dbg
|
case 2: // pd+dbg
|
||||||
|
@ -742,7 +724,7 @@ R_API void r_core_visual_title (RCore *core, int color) {
|
||||||
|
|
||||||
if (cursor<0) cursor = 0;
|
if (cursor<0) cursor = 0;
|
||||||
if (color) r_cons_strcat (Color_YELLOW);
|
if (color) r_cons_strcat (Color_YELLOW);
|
||||||
strncpy (bar, printfmt[R_ABS (core->printidx%NPF)], sizeof (bar)-1);
|
strncpy (bar, printfmt[PIDX], sizeof (bar)-1);
|
||||||
bar[sizeof (bar)-1] = 0; // '\0'-terminate bar
|
bar[sizeof (bar)-1] = 0; // '\0'-terminate bar
|
||||||
bar[10] = '.'; // chop cmdfmt
|
bar[10] = '.'; // chop cmdfmt
|
||||||
bar[11] = '.'; // chop cmdfmt
|
bar[11] = '.'; // chop cmdfmt
|
||||||
|
@ -755,7 +737,6 @@ R_API void r_core_visual_title (RCore *core, int color) {
|
||||||
snprintf (foo, sizeof (foo), "[0x%08"PFMT64x" %d %s]> %s %s\n",
|
snprintf (foo, sizeof (foo), "[0x%08"PFMT64x" %d %s]> %s %s\n",
|
||||||
core->offset, core->blocksize, filename, bar, pos);
|
core->offset, core->blocksize, filename, bar, pos);
|
||||||
r_cons_printf (foo);
|
r_cons_printf (foo);
|
||||||
//r_cons_printf (" %d %d %d\n", core->printidx, core->cons->rows, core->blocksize);
|
|
||||||
if (color) r_cons_strcat (Color_RESET);
|
if (color) r_cons_strcat (Color_RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -781,7 +762,7 @@ static void r_core_visual_refresh (RCore *core) {
|
||||||
r_cons_column (80);
|
r_cons_column (80);
|
||||||
}
|
}
|
||||||
if (zoom) r_core_cmd (core, "pZ", 0);
|
if (zoom) r_core_cmd (core, "pZ", 0);
|
||||||
else r_core_cmd (core, printfmt[R_ABS (core->printidx%NPF)], 0);
|
else r_core_cmd (core, printfmt[PIDX], 0);
|
||||||
blocksize = core->num->value? core->num->value : core->blocksize;
|
blocksize = core->num->value? core->num->value : core->blocksize;
|
||||||
r_cons_visual_flush ();
|
r_cons_visual_flush ();
|
||||||
}
|
}
|
||||||
|
@ -798,17 +779,8 @@ R_API int r_core_visual(RCore *core, const char *input) {
|
||||||
//r_cons_set_cup (R_TRUE);
|
//r_cons_set_cup (R_TRUE);
|
||||||
|
|
||||||
while (*input) {
|
while (*input) {
|
||||||
if (!r_core_visual_cmd (core, input[0])) {
|
if (!r_core_visual_cmd (core, input[0]))
|
||||||
#if 0
|
|
||||||
r_cons_clear00 ();
|
|
||||||
r_core_cmd (core, printfmt[R_ABS (core->printidx%NPF)], 0);
|
|
||||||
r_cons_any_key ();
|
|
||||||
r_cons_clear00 ();
|
|
||||||
r_cons_set_cup (R_FALSE);
|
|
||||||
r_cons_visual_flush ();
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
input++;
|
input++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,12 @@ echo "Build ${MOD} `pkg-config --libs ${MOD}`"
|
||||||
PYTHON_CONFIG=$(../python-config-wrapper -n)
|
PYTHON_CONFIG=$(../python-config-wrapper -n)
|
||||||
export PYTHON_CONFIG
|
export PYTHON_CONFIG
|
||||||
echo valabind-cc ${LNG} ${MOD} ${VALABINDFLAGS} \
|
echo valabind-cc ${LNG} ${MOD} ${VALABINDFLAGS} \
|
||||||
-NRadare \
|
-NRadare --swig \
|
||||||
-I../../libr/include \
|
-I../../libr/include \
|
||||||
-x --vapidir=../vapi ../vapi/${MOD} \
|
-x --vapidir=../vapi ../vapi/${MOD} \
|
||||||
`pkg-config --cflags --libs ${MOD}`
|
`pkg-config --cflags --libs ${MOD}`
|
||||||
exec valabind-cc ${LNG} ${MOD} ${VALABINDFLAGS} \
|
exec valabind-cc ${LNG} ${MOD} ${VALABINDFLAGS} \
|
||||||
-NRadare \
|
-NRadare --swig \
|
||||||
-I../../libr/include \
|
-I../../libr/include \
|
||||||
-x --vapidir=../vapi ../vapi/${MOD} \
|
-x --vapidir=../vapi ../vapi/${MOD} \
|
||||||
`pkg-config --cflags --libs ${MOD}`
|
`pkg-config --cflags --libs ${MOD}`
|
||||||
|
|
|
@ -6,7 +6,7 @@ PREFIX?=/usr
|
||||||
include ../rules.mk
|
include ../rules.mk
|
||||||
|
|
||||||
tri:
|
tri:
|
||||||
valabind -N Radare -o r_debug.i -m r_debug --vapidir ../../libr/vapi/ r_debug
|
valabind --swig -N Radare -o r_debug.i -m r_debug --vapidir ../../libr/vapi/ r_debug
|
||||||
swig -python -I/usr/include/libr r_debug.i
|
swig -python -I/usr/include/libr r_debug.i
|
||||||
$(CC) 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
|
$(CC) 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
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ mytest:
|
||||||
PYTHONPATH=. python test-r_bin.py
|
PYTHONPATH=. python test-r_bin.py
|
||||||
|
|
||||||
bis:
|
bis:
|
||||||
valabind-cc -NRadare python r_io -I../../libr/include r_io `pkg-config --libs r_io`
|
valabind-cc --swig -NRadare python r_io -I../../libr/include r_io `pkg-config --libs r_io`
|
||||||
|
|
||||||
mrproper:
|
mrproper:
|
||||||
a=python`python --version 2>&1 | cut -d ' ' -f 2 | cut -d . -f 1,2`/site-packages ; \
|
a=python`python --version 2>&1 | cut -d ' ' -f 2 | cut -d . -f 1,2`/site-packages ; \
|
||||||
|
|
Loading…
Reference in New Issue