Fix build and some scary warnings in RCoreFile->fd

This commit is contained in:
pancake 2014-06-14 02:09:41 +02:00
parent 148733b7a1
commit 5d22331b78
4 changed files with 16 additions and 10 deletions

View File

@ -1,5 +1,7 @@
/* radare - LGPL - Copyright 2009-2014 - pancake */
static int checkbpcallback(RCore *core);
static void cmd_debug_cont_syscall (RCore *core, const char *_str) {
// TODO : handle more than one stopping syscall
if (_str[0]==' ') {
@ -19,12 +21,14 @@ static void cmd_debug_cont_syscall (RCore *core, const char *_str) {
return;
}
syscalls[i] = sig;
}
}
eprintf ("Running child until syscall %d\n", sig);
eprintf ("Running child until syscalls:");
for (i=0;i<count;i++)
eprintf ("%d ", syscalls[i]);
eprintf ("\n");
r_reg_arena_swap (core->dbg->reg, R_TRUE);
r_debug_continue_syscall (core->dbg, sig);
r_debug_continue_syscalls (core->dbg, syscalls, count);
checkbpcallback (core);
free (syscalls);
free (str);
@ -940,7 +944,7 @@ static void r_core_debug_kill (RCore *core, const char *input) {
static int cmd_debug(void *data, const char *input) {
RCore *core = (RCore *)data;
int i, times, sig, follow=0;
int i, times, follow=0;
ut64 addr;
char *ptr;

View File

@ -566,7 +566,7 @@ R_API int r_core_init(RCore *core) {
core->assembler->num = core->num;
r_asm_set_user_ptr (core->assembler, core);
core->anal = r_anal_new ();
core->debug->syscall = \
core->dbg->syscall = \
core->assembler->syscall = \
core->anal->syscall; // BIND syscall anal/asm
r_anal_set_user_ptr (core->anal, core);

View File

@ -283,7 +283,7 @@ R_API int r_core_write_at(RCore *core, ut64 addr, const ut8 *buf, int size) {
int ret;
if (!core->io || !core->file || size<1)
return R_FALSE;
ret = r_io_use_fd (core->io, core->file->desc->fd);
ret = r_io_use_desc (core->io, core->file->desc);
if (ret != -1) {
ret = r_io_write_at (core->io, addr, buf, size);
if (addr >= core->offset && addr <= core->offset+core->blocksize)
@ -297,7 +297,8 @@ R_API int r_core_extend_at(RCore *core, ut64 addr, int size) {
int ret;
if (!core->io || !core->file || size<1)
return R_FALSE;
ret = r_io_use_fd (core->io, core->file->desc->fd);
//ret = r_io_use_fd (core->io, core->file->desc->fd);
ret = r_io_use_desc (core->io, core->file->desc);
if (ret != -1) {
ret = r_io_extend_at (core->io, addr, size);
if (addr >= core->offset && addr <= core->offset+core->blocksize)
@ -309,12 +310,12 @@ R_API int r_core_extend_at(RCore *core, ut64 addr, int size) {
R_API int r_core_shift_block(RCore *core, ut64 addr, ut64 b_size, st64 dist) {
// bstart - block start, fstart file start
ut64 fend = 0, fstart = 0, bstart = 0, file_sz = 0, cur_offset = core->offset;
ut64 fend = 0, fstart = 0, bstart = 0, file_sz = 0;
ut8 * shift_buf = NULL;
int res = R_FALSE;
if (b_size == 0 || b_size == (ut64) -1) {
res = r_io_use_fd (core->io, core->file->desc->fd);
res = r_io_use_desc (core->io, core->file->desc);
file_sz = r_io_size (core->io);
bstart = r_io_seek (core->io, addr, R_IO_SEEK_SET);
fend = r_io_seek (core->io, 0, R_IO_SEEK_END);
@ -348,7 +349,7 @@ R_API int r_core_shift_block(RCore *core, ut64 addr, ut64 b_size, st64 dist) {
else if ( (addr) + dist > fend) {
res = R_FALSE;
} else {
res = r_io_use_fd (core->io, core->file->desc->fd);
res = r_io_use_desc (core->io, core->file->desc);
r_io_read_at (core->io, addr, shift_buf, b_size);
r_io_write_at (core->io, addr+dist, shift_buf, b_size);
res = R_TRUE;

View File

@ -255,6 +255,7 @@ R_API int r_debug_continue_until(RDebug *dbg, ut64 addr);
R_API int r_debug_continue_until_optype(RDebug *dbg, int type, int over);
R_API int r_debug_continue_until_nontraced(RDebug *dbg);
R_API int r_debug_continue_syscall(RDebug *dbg, int sc);
R_API int r_debug_continue_syscalls(RDebug *dbg, int *sc, int n_sc);
//R_API int r_debug_pid_add(RDebug *dbg);
//R_API int r_debug_pid_add_thread(RDebug *dbg);
//R_API int r_debug_pid_del(RDebug *dbg);