mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-02 03:32:04 +00:00
Update r_io_read_at and ad r_io_alprint
This commit is contained in:
parent
32c2bcc0cd
commit
ab25e7119c
@ -2900,7 +2900,7 @@ repeat:
|
||||
}
|
||||
}
|
||||
if (!r_io_read_at (core->io, addr, code, sizeof (code))) {
|
||||
goto out_return_zero;
|
||||
eprintf ("read errno\n");
|
||||
}
|
||||
// TODO: sometimes this is dupe
|
||||
ret = r_anal_op (core->anal, &op, addr, code, sizeof (code));
|
||||
|
@ -45,7 +45,7 @@ R_API int r_debug_trace_tag (RDebug *dbg, int tag) {
|
||||
/*
|
||||
* something happened at the given pc that we need to trace
|
||||
*/
|
||||
R_API int r_debug_trace_pc (RDebug *dbg, ut64 pc) {
|
||||
R_API int r_debug_trace_pc(RDebug *dbg, ut64 pc) {
|
||||
ut8 buf[32];
|
||||
RAnalOp op = {0};
|
||||
static ut64 oldpc = UT64_MAX; // Must trace the previously traced instruction
|
||||
|
@ -287,6 +287,7 @@ R_API bool r_io_vwrite_at (RIO *io, ut64 vaddr, const ut8 *buf, int len);
|
||||
R_API bool r_io_read_at (RIO *io, ut64 addr, ut8 *buf, int len);
|
||||
R_API RList *r_io_alvread_at (RIO *io, ut64 vaddr, ut8 *buf, int len, bool *allocation_failed);
|
||||
R_API RList *r_io_alvwrite_at (RIO *io, ut64 vaddr, const ut8 *buf, int len, bool *allocation_failed);
|
||||
R_API void r_io_alprint(RList *ls);
|
||||
R_API bool r_io_write_at (RIO *io, ut64 addr, const ut8 *buf, int len);
|
||||
R_API bool r_io_read (RIO *io, ut8 *buf, int len);
|
||||
R_API bool r_io_write (RIO *io, ut8 *buf, int len);
|
||||
|
16
libr/io/io.c
16
libr/io/io.c
@ -511,6 +511,18 @@ R_API RList *r_io_alvwrite_at (RIO *io, ut64 vaddr, const ut8 *buf, int len, boo
|
||||
return log;
|
||||
}
|
||||
|
||||
R_API void r_io_alprint(RList/*<RIOAccessLog>*/ *ls) {
|
||||
RListIter *iter;
|
||||
RIOAccessLog *al;
|
||||
eprintf ("==============\n");
|
||||
r_list_foreach (ls, iter, al) {
|
||||
eprintf ("vaddr: 0x%08" PFMT64x " paddr: 0x%08" PFMT64x
|
||||
" -- expect_len: %d, len: %d, fd: %d, mapid: %d\n",
|
||||
al->vaddr, al->paddr, al->expect_len, al->len, al->fd,
|
||||
al->mapid);
|
||||
}
|
||||
}
|
||||
|
||||
R_API bool r_io_read_at(RIO* io, ut64 addr, ut8* buf, int len) {
|
||||
bool ret;
|
||||
if (!io || !buf || len < 1) {
|
||||
@ -525,7 +537,9 @@ R_API bool r_io_read_at(RIO* io, ut64 addr, ut8* buf, int len) {
|
||||
ret = !!r_io_pread_at (io, addr, buf, len) > 0;
|
||||
}
|
||||
if (io->cached_read) {
|
||||
ret &= !!r_io_cache_read (io, addr, buf, len);
|
||||
//ignore cache read since if there is nothing on the cache
|
||||
//the return value is false but that is not wrong read
|
||||
r_io_cache_read (io, addr, buf, len);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user