mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-26 17:15:38 +00:00
* r_core
- Fix 'S' and 'S=' * r_io - Add field 'debug' to r_io_t - More refactoring of io.va code
This commit is contained in:
parent
28ef002c21
commit
c1c8c32284
@ -34,9 +34,7 @@ static int config_bigendian_callback(void *user, void *data) {
|
|||||||
static int config_iova_callback(void *user, void *data) {
|
static int config_iova_callback(void *user, void *data) {
|
||||||
RCore *core = (RCore *) user;
|
RCore *core = (RCore *) user;
|
||||||
RConfigNode *node = (RConfigNode *) data;
|
RConfigNode *node = (RConfigNode *) data;
|
||||||
if (r_config_get_i (core->config, "cfg.debug"))
|
core->io->va = node->i_value;
|
||||||
core->io->va = 0;
|
|
||||||
else core->io->va = node->i_value;
|
|
||||||
return R_TRUE;
|
return R_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,6 +48,7 @@ static int config_iocache_callback(void *user, void *data) {
|
|||||||
static int config_cfgdebug_callback(void *user, void *data) {
|
static int config_cfgdebug_callback(void *user, void *data) {
|
||||||
RCore *core = (RCore*) user;
|
RCore *core = (RCore*) user;
|
||||||
RConfigNode *node = (RConfigNode*) data;
|
RConfigNode *node = (RConfigNode*) data;
|
||||||
|
core->io->debug = node->i_value;
|
||||||
if (node->i_value) {
|
if (node->i_value) {
|
||||||
r_debug_use (core->dbg, r_config_get (core->config, "dbg.backend"));
|
r_debug_use (core->dbg, r_config_get (core->config, "dbg.backend"));
|
||||||
r_debug_select (core->dbg, core->file->fd, core->file->fd);
|
r_debug_select (core->dbg, core->file->fd, core->file->fd);
|
||||||
|
@ -56,6 +56,7 @@ typedef struct r_io_t {
|
|||||||
int cached;
|
int cached;
|
||||||
int cached_read;
|
int cached_read;
|
||||||
ut64 off;
|
ut64 off;
|
||||||
|
int debug;
|
||||||
int va;
|
int va;
|
||||||
char *redirect;
|
char *redirect;
|
||||||
/* write mask */
|
/* write mask */
|
||||||
|
@ -270,7 +270,7 @@ R_API ut64 r_io_seek(struct r_io_t *io, ut64 offset, int whence) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// XXX: list_empty trick must be done in r_io_set_va();
|
// XXX: list_empty trick must be done in r_io_set_va();
|
||||||
offset = (io->va && !list_empty (&io->sections))?
|
offset = (!io->debug && io->va && !list_empty (&io->sections))?
|
||||||
r_io_section_vaddr_to_offset (io, offset) : offset;
|
r_io_section_vaddr_to_offset (io, offset) : offset;
|
||||||
// TODO: implement io->enforce_seek here!
|
// TODO: implement io->enforce_seek here!
|
||||||
if (io->plugin && io->plugin->lseek)
|
if (io->plugin && io->plugin->lseek)
|
||||||
@ -281,7 +281,7 @@ R_API ut64 r_io_seek(struct r_io_t *io, ut64 offset, int whence) {
|
|||||||
io->off = ret;
|
io->off = ret;
|
||||||
// XXX this can be tricky.. better not to use this .. must be deprecated
|
// XXX this can be tricky.. better not to use this .. must be deprecated
|
||||||
// r_io_sundo_push (io);
|
// r_io_sundo_push (io);
|
||||||
ret = (io->va && !list_empty (&io->sections))?
|
ret = (!io->debug && io->va && !list_empty (&io->sections))?
|
||||||
r_io_section_offset_to_vaddr (io, io->off) : io->off;
|
r_io_section_offset_to_vaddr (io, io->off) : io->off;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -47,15 +47,14 @@ R_API void r_io_section_list(RIO *io, ut64 offset, int rad) {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
struct list_head *pos;
|
struct list_head *pos;
|
||||||
|
|
||||||
if (io->va)
|
if (io->va || io->debug)
|
||||||
offset = r_io_section_vaddr_to_offset (io, offset);
|
offset = r_io_section_vaddr_to_offset (io, offset);
|
||||||
list_for_each_prev(pos, &io->sections) {
|
list_for_each_prev(pos, &io->sections) {
|
||||||
RIOSection *s = (RIOSection *)list_entry(pos, RIOSection, list);
|
RIOSection *s = (RIOSection *)list_entry(pos, RIOSection, list);
|
||||||
ut64 ptr = (s->vaddr>=offset)?s->vaddr:s->offset;
|
|
||||||
if (rad) io->printf ("S 0x%08"PFMT64x" 0x%08"PFMT64x" 0x%08"PFMT64x" 0x%08"PFMT64x" %s %d\n",
|
if (rad) io->printf ("S 0x%08"PFMT64x" 0x%08"PFMT64x" 0x%08"PFMT64x" 0x%08"PFMT64x" %s %d\n",
|
||||||
s->offset, s->vaddr, s->size, s->vsize, s->name, s->rwx);
|
s->offset, s->vaddr, s->size, s->vsize, s->name, s->rwx);
|
||||||
else io->printf ("[%02d] %c 0x%08"PFMT64x" %s va=0x%08"PFMT64x" sz=0x%08"PFMT64x" vsz=%08"PFMT64x" %s\n",
|
else io->printf ("[%02d] %c 0x%08"PFMT64x" %s va=0x%08"PFMT64x" sz=0x%08"PFMT64x" vsz=%08"PFMT64x" %s\n",
|
||||||
i, (offset>=ptr && offset<ptr+s->size)?'*':'.',
|
i, (offset>=s->offset && offset<s->offset+s->size)?'*':'.',
|
||||||
s->offset, r_str_rwx_i (s->rwx), s->vaddr, s->size, s->vsize, s->name);
|
s->offset, r_str_rwx_i (s->rwx), s->vaddr, s->size, s->vsize, s->name);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -69,7 +68,7 @@ R_API void r_io_section_list_visual(RIO *io, ut64 seek, ut64 len) {
|
|||||||
ut64 mul;
|
ut64 mul;
|
||||||
int j, i, width = 50; //config.width-30;
|
int j, i, width = 50; //config.width-30;
|
||||||
|
|
||||||
seek = io->va ? r_io_section_vaddr_to_offset (io, seek) : seek;
|
seek = (io->va || io->debug) ? r_io_section_vaddr_to_offset (io, seek) : seek;
|
||||||
list_for_each (pos, &io->sections) {
|
list_for_each (pos, &io->sections) {
|
||||||
RIOSection *s = (RIOSection *)list_entry(pos, RIOSection, list);
|
RIOSection *s = (RIOSection *)list_entry(pos, RIOSection, list);
|
||||||
if (min == -1 || s->offset < min)
|
if (min == -1 || s->offset < min)
|
||||||
@ -83,8 +82,8 @@ R_API void r_io_section_list_visual(RIO *io, ut64 seek, ut64 len) {
|
|||||||
i = 0;
|
i = 0;
|
||||||
list_for_each_prev (pos, &io->sections) {
|
list_for_each_prev (pos, &io->sections) {
|
||||||
RIOSection *s = (RIOSection *)list_entry (pos, RIOSection, list);
|
RIOSection *s = (RIOSection *)list_entry (pos, RIOSection, list);
|
||||||
io->printf ("%02d%c 0x%08"PFMT64x" |",
|
io->printf ("%02d%c 0x%08"PFMT64x" |",
|
||||||
i, (s->offset==io->off)?'*':' ', s->offset);
|
i, (seek>=s->offset && seek<s->offset+s->size)?'*':' ', s->offset);
|
||||||
for (j=0; j<width; j++) {
|
for (j=0; j<width; j++) {
|
||||||
if ((j*mul)+min >= s->offset && (j*mul)+min <=s->offset+s->size)
|
if ((j*mul)+min >= s->offset && (j*mul)+min <=s->offset+s->size)
|
||||||
io->printf("#");
|
io->printf("#");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user