mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-01 17:40:34 +00:00
* Show error if no hud file found
* Fix 'o file 0xaddr' parsing issue * 'om' now works without size (file size) - fixed help message * Use xor'd byte in r_io_desc_new ();
This commit is contained in:
parent
e1f0829cf2
commit
fd6388de60
@ -183,7 +183,7 @@ static int arm_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len)
|
||||
op->stackop = R_ANAL_STACK_INCSTACK;
|
||||
op->value = -b[0];
|
||||
} else
|
||||
if( (code[i] == 0x1eff2fe1) ||(code[i] == 0xe12fff1e)) { // bx lr
|
||||
if ( (code[i] == 0x1eff2fe1) ||(code[i] == 0xe12fff1e)) { // bx lr
|
||||
op->type = R_ANAL_OP_TYPE_RET;
|
||||
op->eob = 1;
|
||||
} else
|
||||
@ -239,6 +239,7 @@ static int arm_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len)
|
||||
}
|
||||
return op->length;
|
||||
}
|
||||
|
||||
static int set_reg_profile(RAnal *anal) {
|
||||
/* XXX Dupped Profiles */
|
||||
return r_reg_set_profile_string (anal->reg,
|
||||
|
@ -4404,7 +4404,7 @@ static int cmd_open(void *data, const char *input) {
|
||||
break;
|
||||
case ' ':
|
||||
ptr = strchr (input+1, ' ');
|
||||
if (ptr && ptr[0]=='0' && ptr[1]=='x') { // hack to fix opening files with space in path
|
||||
if (ptr && ptr[1]=='0' && ptr[2]=='x') { // hack to fix opening files with space in path
|
||||
*ptr = '\0';
|
||||
addr = r_num_math (core->num, ptr+1);
|
||||
} else {
|
||||
@ -4427,12 +4427,6 @@ static int cmd_open(void *data, const char *input) {
|
||||
break;
|
||||
case 'm':
|
||||
switch (input[1]) {
|
||||
case '?':
|
||||
r_cons_printf ("Usage: om[-] [arg] file maps\n");
|
||||
r_cons_printf ("om list all defined IO maps\n");
|
||||
r_cons_printf ("om-0x10000 remove the map at given address\n");
|
||||
r_cons_printf ("om 0x10000 remove the map at given address\n");
|
||||
break;
|
||||
case ' ':
|
||||
// i need to parse delta, offset, size
|
||||
{
|
||||
@ -4446,17 +4440,17 @@ static int cmd_open(void *data, const char *input) {
|
||||
char *q = strchr (p+1, ' ');
|
||||
*p = 0;
|
||||
fd = r_num_math (core->num, s);
|
||||
addr = r_num_math (core->num, p+1);
|
||||
if (q) {
|
||||
char *r = strchr (q+1, ' ');
|
||||
*q = 0;
|
||||
addr = r_num_math (core->num, p+1);
|
||||
if (r) {
|
||||
*r = 0;
|
||||
size = r_num_math (core->num, q+1);
|
||||
delta = r_num_math (core->num, r+1);
|
||||
} else size = r_num_math (core->num, q+1);
|
||||
r_io_map_add (core->io, fd, 0, delta, addr, size);
|
||||
} else eprintf ("Usage: om fd addr size [delta]\n");
|
||||
} else size = r_io_size (core->io);
|
||||
r_io_map_add (core->io, fd, 0, delta, addr, size);
|
||||
} else eprintf ("Usage: om fd addr size [delta]\n");
|
||||
free (s);
|
||||
}
|
||||
@ -4474,6 +4468,14 @@ static int cmd_open(void *data, const char *input) {
|
||||
im->fd, im->delta, im->from, im->to);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case '?':
|
||||
r_cons_printf ("Usage: om[-] [arg] file maps\n");
|
||||
r_cons_printf ("om list all defined IO maps\n");
|
||||
r_cons_printf ("om-0x10000 remove the map at given address\n");
|
||||
r_cons_printf ("om fd addr [size] create new io map\n");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
@ -4484,11 +4486,11 @@ static int cmd_open(void *data, const char *input) {
|
||||
eprintf ("Usage: o[o-] [file] ([offset])\n"
|
||||
" o list opened files\n"
|
||||
" oo reopen current file (kill+fork in debugger)\n"
|
||||
" o 4 priorize io on fd 4 (bring to front)\n"
|
||||
" o-1 close file index 1\n"
|
||||
" o /bin/ls open /bin/ls file\n"
|
||||
" o /bin/ls 0x8048000 map file\n"
|
||||
" om list all maps\n"
|
||||
" o 4 priorize io on fd 4 (bring to front)\n"
|
||||
" o-1 close file index 1\n");
|
||||
" om[?] create, list, remove IO maps\n");
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
@ -28,6 +28,8 @@ static int r_core_visual_hud(RCore *core) {
|
||||
// TODO: this file needs to be installed
|
||||
if (!res)
|
||||
res = r_cons_hud_file (R2_LIBDIR"/radare2/"R2_VERSION"/hud/main");
|
||||
if (!res)
|
||||
r_cons_message ("Cannot find hud file");
|
||||
r_cons_clear ();
|
||||
if (res) {
|
||||
p = strchr (res, '\t');
|
||||
|
@ -23,7 +23,11 @@ R_API RIODesc *r_io_desc_new(RIOPlugin *plugin, int fd, const char *name, int fl
|
||||
}
|
||||
desc->plugin = plugin;
|
||||
desc->flags = flags;
|
||||
desc->fd = (fd == -1)? ((int) ((size_t) desc) & 0xffffff): fd;
|
||||
if (fd == -1) {
|
||||
ut8 *p = &desc->fd;
|
||||
desc->fd = ((int) ((size_t) desc) & 0xffffff);
|
||||
desc->fd = p[0]^p[1]^p[2]^p[3];
|
||||
} else desc->fd = fd;
|
||||
desc->data = data;
|
||||
return desc;
|
||||
}
|
||||
|
@ -182,11 +182,12 @@ R_API int r_io_read_at(RIO *io, ut64 addr, ut8 *buf, int len) {
|
||||
#else
|
||||
int ret, l, olen = len;
|
||||
int w = 0;
|
||||
|
||||
#if 1
|
||||
// HACK?: if io->va == 0 -> call seek+read without checking sections ?
|
||||
if (!io->va) {
|
||||
r_io_map_select (io, addr);
|
||||
// r_io_seek (io, addr, R_IO_SEEK_SET);
|
||||
r_io_map_select (io, addr);
|
||||
ret = r_io_read_internal (io, buf, len);
|
||||
if (io->cached) {
|
||||
r_io_cache_read (io, addr, buf, len);
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
/* TODO: write li->fds setter/getter helpers */
|
||||
// TODO: return true/false everywhere,, not -1 or 0
|
||||
// TODO: use RList here
|
||||
|
||||
#include "r_io.h"
|
||||
#include "../config.h"
|
||||
|
Loading…
Reference in New Issue
Block a user