Fix #7088 - Remove io->raw and .keepio

This commit is contained in:
radare 2017-03-22 16:42:58 +01:00 committed by GitHub
parent 1d21b17ec6
commit 3d65ec6903
6 changed files with 6 additions and 44 deletions

View File

@ -496,7 +496,7 @@ static int core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int depth
// real read.
// this is unnecessary if its contiguous
buflen = r_io_read_at (core->io, at+delta, buf, core->anal->opt.bb_max_size);
if (core->io->va && !core->io->raw) {
if (core->io->va) {
if (!r_io_is_valid_offset (core->io, at+delta, !core->anal->opt.noncode)) {
goto error;
}
@ -1319,7 +1319,7 @@ R_API int r_core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int dept
r_anal_build_range_on_hints (core->anal);
r_core_seek_archbits (core, at);
if (core->io->va && !core->io->raw) {
if (core->io->va) {
if (!r_io_is_valid_offset (core->io, at, !core->anal->opt.noncode)) {
return false;
}

View File

@ -675,7 +675,6 @@ static int cb_timezone(void *user, void *data) {
}
static int cb_cfgdebug(void *user, void *data) {
int ioraw = 1;
RCore *core = (RCore*) user;
RConfigNode *node = (RConfigNode*) data;
if (!core) return false;
@ -704,15 +703,6 @@ static int cb_cfgdebug(void *user, void *data) {
if (core->dbg) r_debug_use (core->dbg, NULL);
core->bin->is_debugger = false;
}
if (core->io) {
r_config_set (core->config, "io.va", "true");
if (core->dbg && core->dbg->h) {
ioraw = core->dbg->h->keepio? 0: 1;
} else {
ioraw = 0;
}
}
r_config_set (core->config, "io.raw", ioraw? "true": "false");
return true;
}
@ -1145,13 +1135,6 @@ static int cb_iopava(void *user, void *data) {
return true;
}
static int cb_ioraw(void *user, void *data) {
RCore *core = (RCore *) user;
RConfigNode *node = (RConfigNode *) data;
r_io_set_raw (core->io, node->i_value);
return true;
}
static int cb_ioff(void *user, void *data) {
RCore *core = (RCore *) user;
RConfigNode *node = (RConfigNode *) data;
@ -2247,7 +2230,6 @@ R_API int r_core_config_init(RCore *core) {
SETI("io.buffer.from", 0, "Lower address of buffered cache");
SETI("io.buffer.to", 0, "Higher address of buffered cache");
SETCB("io.cache", "false", &cb_iocache, "Enable cache for io changes");
SETCB("io.raw", "false", &cb_ioraw, "Ignore maps/sections and use raw io");
SETCB("io.ff", "true", &cb_ioff, "Fill invalid buffers with 0xff instead of returning error");
SETICB("io.0xff", 0xff, &cb_io_oxff, "Use this value instead of 0xff to fill unallocated areas");
SETCB("io.aslr", "false", &cb_ioaslr, "Disable ASLR for spawn and such");

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2013-2015 pancake */
/* radare - LGPL - Copyright 2013-2017 pancake */
// r2 -Desil ls
#include <r_asm.h>
@ -136,7 +136,6 @@ static int __reg_read (RDebug *dbg, int type, ut8 *buf, int size) {
RDebugPlugin r_debug_plugin_esil = {
.name = "esil",
.keepio = 1,
.license = "LGPL3",
.arch = "any", // TODO: exception!
.bits = R_SYS_BITS_32 | R_SYS_BITS_64,
@ -156,7 +155,7 @@ RDebugPlugin r_debug_plugin_esil = {
};
#ifndef CORELIB
struct r_lib_struct_t radare_plugin = {
RLibStruct radare_plugin = {
.type = R_LIB_TYPE_DBG,
.data = &r_debug_plugin_esil,
.version = R2_VERSION

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2016 pancake */
/* radare - LGPL - Copyright 2016-2017 pancake */
#include <r_io.h>
#include <r_asm.h>
@ -128,7 +128,6 @@ static int __io_kill(RDebug *dbg, int pid, int tid, int sig) {
RDebugPlugin r_debug_plugin_io = {
.name = "io",
.keepio = 1,
.license = "MIT",
.arch = "any", // TODO: exception!
.bits = R_SYS_BITS_32 | R_SYS_BITS_64,

View File

@ -124,7 +124,6 @@ typedef struct r_io_t {
int raised;
int va;
bool pava;
int raw;
int vio; // remove that when vio replaces the old stuff
int sectonly;
char *referer;
@ -290,7 +289,6 @@ typedef struct r_io_range_t {
/* io/plugin.c */
R_API RIO *r_io_new(void);
R_API RIO *r_io_free(RIO *io);
R_API void r_io_set_raw(RIO *io, int raw);
R_API bool r_io_plugin_init(RIO *io);
R_API void r_io_raise (RIO *io, int fd);
R_API int r_io_plugin_generate(RIO *io);
@ -319,7 +317,6 @@ R_API int r_io_is_valid_offset (RIO *io, ut64 offset, int hasperm);
R_API RIODesc *r_io_use_fd(RIO *io, int fd);
R_API int r_io_use_desc(RIO *io, RIODesc *fd);
R_API const ut8* r_io_get_raw(RIO *io, ut64 addr, int *len);
R_API RBuffer *r_io_read_buf(RIO *io, ut64 addr, int len);
R_API int r_io_vread(RIO *io, ut64 vaddr, ut8 *buf, int len);
R_API int r_io_read_internal(RIO *io, ut8 *buf, int len);

View File

@ -359,10 +359,6 @@ int r_io_read_cr (RIO *io, ut64 addr, ut8 *buf, int len) {
return R_FAIL;
if (io->ff)
memset (buf, io->Oxff, len);
if (io->raw) {
r_io_seek (io, addr, R_IO_SEEK_SET);
return r_io_read_internal (io, buf, len);
}
if (io->va) {
r_io_vread (io, addr, buf, len); //must check return-stat
if (io->cached)
@ -409,13 +405,6 @@ R_API int r_io_read_at(RIO *io, ut64 addr, ut8 *buf, int len) {
}
}
if (io->raw) {
if (r_io_seek (io, addr, R_IO_SEEK_SET) == UT64_MAX) {
memset (buf, io->Oxff, len);
}
return r_io_read_internal (io, buf, len);
}
io->off = addr;
memset (buf, io->Oxff, len); // probably unnecessary
@ -818,7 +807,7 @@ R_API ut64 r_io_seek(RIO *io, ut64 offset, int whence) {
// XXX: list_empty trick must be done in r_io_set_va();
//eprintf ("-(seek)-> 0x%08llx\n", offset);
//if (!io->debug && io->va && !r_list_empty (io->sections)) {
if (!io->debug || !io->raw) { //
if (!io->debug) {
if (io->va && !r_list_empty (io->sections)) {
ut64 o = r_io_section_vaddr_to_maddr_try (io, offset);
if (o != UT64_MAX) {
@ -1116,10 +1105,6 @@ static RIO *r_io_bind_get_io(RIOBind *bnd) {
return bnd? bnd->io: NULL;
}
R_API void r_io_set_raw(RIO *io, int raw) {
io->raw = raw? 1: 0;
}
// check if reading at offset or writting to offset is reasonable
R_API int r_io_is_valid_offset(RIO *io, ut64 offset, int hasperm) {
if (!io) {