Finally remove the void*debug pointer from RIOPlugin (use bool isdbg)

This commit is contained in:
pancake 2014-11-21 11:36:51 +01:00
parent ee429365a7
commit 9a0d62da22
12 changed files with 12 additions and 21 deletions

View File

@ -157,7 +157,7 @@ static void list_io_plugins(RIO *io) {
// read, write, debug, proxy
str[0] = 'r';
str[1] = il->plugin->write? 'w': '_';
str[2] = il->plugin->debug? 'd': '_';
str[2] = il->plugin->isdbg? 'd': '_';
str[3] = 0;
printf ("%s %-11s %s (%s)\n", str, il->plugin->name,
il->plugin->desc, il->plugin->license);
@ -611,7 +611,7 @@ int main(int argc, char **argv, char **envp) {
(void)r_core_bin_update_arch_bits (&r);
debug = r.file && r.file->desc && r.file->desc->plugin && \
r.file->desc->plugin->debug != NULL;
r.file->desc->plugin->isdbg;
if (debug) {
r_core_setup_debugger (&r, debugbackend);
}

View File

@ -441,7 +441,7 @@ R_API int r_bin_reload(RBin *bin, RIODesc *desc, ut64 baseaddr) {
buf_bytes = NULL;
sz = iob->desc_size (io, desc);
if (sz == UT64_MAX && desc->plugin && desc->plugin->debug ) {
if (sz == UT64_MAX && desc->plugin && desc->plugin->isdbg) {
// attempt a local open and read
// This happens when a plugin like debugger does not have a fixed size.
// if there is no fixed size or its MAXED, there is no way to definitively
@ -501,7 +501,7 @@ R_API int r_bin_load_io_at_offset_as_sz(RBin *bin, RIODesc *desc, ut64 baseaddr,
RBinXtrPlugin *xtr;
ut64 file_sz = UT64_MAX;
RBinFile *binfile = NULL;
ut8 is_debugger = desc && desc->plugin && desc->plugin->debug;
ut8 is_debugger = desc && desc->plugin && desc->plugin->isdbg;
if (!io || !desc) return R_FALSE;

View File

@ -463,7 +463,7 @@ R_API int r_core_bin_load(RCore *r, const char *filenameuri, ut64 baddr) {
// TODO? necessary to restore the desc back?
// RIODesc *oldesc = desc;
// Fix to select pid before trying to load the binary
if ( (desc->plugin && desc->plugin->debug) \
if ( (desc->plugin && desc->plugin->isdbg) \
|| r_config_get_i (r->config, "cfg.debug")) {
r_core_file_do_load_for_debug (r, loadaddr, filenameuri);
} else {

View File

@ -156,7 +156,7 @@ typedef struct r_io_plugin_t {
int (*listener)(RIODesc *io);
int (*init)();
RIOUndo undo;
struct r_debug_t *debug;
int isdbg;
int (*is_file_opened)(RIO *io, RIODesc *fd, const char *);
int (*system)(RIO *io, RIODesc *fd, const char *);
RIODesc* (*open)(RIO *io, const char *, int rw, int mode);

View File

@ -284,7 +284,7 @@ RIOPlugin r_io_plugin_debug = {
.plugin_open = __plugin_open,
.lseek = NULL,
.system = NULL,
.debug = (void *)(size_t)1,
.isdbg = R_TRUE,
//void *widget;
/*
struct debug_t *debug;

View File

@ -122,6 +122,6 @@ RIOPlugin r_io_plugin_gdb = {
.plugin_open = __plugin_open,
.lseek = __lseek,
.system = __system,
.debug = (void *)(size_t)1,
.isdbg = R_TRUE
};

View File

@ -135,7 +135,7 @@ RIOPlugin r_io_plugin_haret = {
.lseek = haret__lseek,
.write = haret__write,
.close = haret__close,
.plugin_open = haret__plugin_open,
.plugin_open = haret__plugin_open
};
#ifndef CORELIB

View File

@ -300,7 +300,7 @@ RIOPlugin r_io_plugin_mach = {
.lseek = __lseek,
.system = __system,
.write = __write,
.debug = (void*)(size_t)1
.isdbg = R_TRUE
};
#else

View File

@ -34,7 +34,6 @@ static int __write(RIO *io, RIODesc *fd, const ut8 *buf, int count) {
return -1;
}
static int __resize(RIO *io, RIODesc *fd, ut64 count) {
ut8 * new_buf = NULL;
if (fd == NULL || fd->data == NULL || count == 0)

View File

@ -282,7 +282,7 @@ RIOPlugin r_io_plugin_ptrace = {
.lseek = __lseek,
.system = __system,
.write = __write,
.debug = (void*)(size_t)1
.isdbg = R_TRUE
};
#else
struct r_io_plugin_t r_io_plugin_ptrace = {

View File

@ -120,13 +120,7 @@ RIOPlugin r_io_plugin_w32dbg = {
.system = __system,
.init = __init,
.write = __write,
.debug = (void*)(size_t)1
//void *widget;
/*
struct debug_t *debug;
ut32 (*write)(int fd, const ut8 *buf, ut32 count);
int fds[R_IO_NFDS];
*/
.isdbg = R_TRUE
};
#else
struct r_io_plugin_t r_io_plugin_w32dbg = {

View File

@ -625,8 +625,6 @@ RIOPlugin r_io_plugin_zip = {
.lseek = r_io_zip_lseek,
.plugin_open = r_io_zip_plugin_open,
.resize = r_io_zip_resize,
.system = NULL,
.debug = NULL,
.init = r_io_zip_init
};