mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-29 08:01:04 +00:00
Moving the bin binding to the appropriate locations
This commit is contained in:
parent
b1349f8b14
commit
0c3add7ee0
@ -452,7 +452,6 @@ R_API int r_core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int dept
|
||||
|
||||
if (core->anal->cur && core->anal->cur->analyze_fns) {
|
||||
int result = R_ANAL_RET_ERROR;
|
||||
r_bin_bind (core->bin, &(core->anal->binb));
|
||||
result = core->anal->cur->analyze_fns (core->anal, at, from, reftype, depth);
|
||||
// do this to prevent stale usage and catch others who are using it
|
||||
//memset(&core->anal->binb, 0, sizeof(RBinBind));
|
||||
|
@ -3,12 +3,12 @@
|
||||
#include <r_core.h>
|
||||
|
||||
// XXX - this may lead to conflicts with set by name
|
||||
static int r_core_bin_bind (RCore *core, RBinFile *binfile);
|
||||
static int r_core_bin_set_cur (RCore *core, RBinFile *binfile);
|
||||
//static int r_core_bin_set_env (RCore *r, RBinFile *binfile);
|
||||
|
||||
R_API int r_core_bin_set_by_fd (RCore *core, ut64 bin_fd) {
|
||||
if (r_bin_file_set_cur_by_fd (core->bin, bin_fd)) {
|
||||
r_core_bin_bind (core, r_core_bin_cur(core));
|
||||
r_core_bin_set_cur (core, r_core_bin_cur(core));
|
||||
return R_TRUE;
|
||||
}
|
||||
return R_FALSE;
|
||||
@ -16,7 +16,7 @@ R_API int r_core_bin_set_by_fd (RCore *core, ut64 bin_fd) {
|
||||
|
||||
R_API int r_core_bin_set_by_name (RCore *core, const char * name) {
|
||||
if (r_bin_file_set_cur_by_name (core->bin, name)) {
|
||||
r_core_bin_bind (core, r_core_bin_cur (core));
|
||||
r_core_bin_set_cur (core, r_core_bin_cur (core));
|
||||
return R_TRUE;
|
||||
}
|
||||
return R_FALSE;
|
||||
@ -39,13 +39,13 @@ R_API int r_core_bin_set_env (RCore *r, RBinFile *binfile) {
|
||||
r_config_set (r->config, "anal.cpu", arch);
|
||||
r_asm_use (r->assembler, arch);
|
||||
r_core_bin_info (r, R_CORE_BIN_ACC_ALL, R_CORE_BIN_SET, va, NULL, baseaddr);
|
||||
r_core_bin_bind (r, binfile);
|
||||
r_core_bin_set_cur (r, binfile);
|
||||
return R_TRUE;
|
||||
}
|
||||
return R_FALSE;
|
||||
}
|
||||
|
||||
R_API int r_core_bin_bind (RCore *core, RBinFile *binfile) {
|
||||
R_API int r_core_bin_set_cur (RCore *core, RBinFile *binfile) {
|
||||
RBinInfo *info = NULL;
|
||||
|
||||
if (!core->bin) return R_FALSE;
|
||||
@ -56,9 +56,6 @@ R_API int r_core_bin_bind (RCore *core, RBinFile *binfile) {
|
||||
if (!binfile) return R_FALSE;
|
||||
}
|
||||
r_bin_file_set_cur_binfile (core->bin, binfile);
|
||||
r_bin_bind (core->bin, &(core->anal->binb));
|
||||
r_bin_bind (core->bin, &(core->assembler->binb));
|
||||
r_bin_bind (core->bin, &(core->file->binb));
|
||||
return R_TRUE;
|
||||
}
|
||||
|
||||
@ -1171,7 +1168,7 @@ R_API int r_core_bin_set_arch_bits (RCore *r, const char *name, const char * arc
|
||||
|
||||
if (nbinfile && nbinfile != binfile) {
|
||||
RBinObject *binobj = NULL;
|
||||
r_core_bin_bind (r, nbinfile);
|
||||
r_core_bin_set_cur (r, nbinfile);
|
||||
if (r_asm_is_valid (r->assembler, arch) ) {
|
||||
return r_core_bin_set_env (r, nbinfile);
|
||||
}
|
||||
|
@ -573,6 +573,9 @@ R_API int r_core_init(RCore *core) {
|
||||
r_io_undo_enable (core->io, 1, 0); // TODO: configurable via eval
|
||||
core->fs = r_fs_new ();
|
||||
r_bin_bind (core->bin, &(core->assembler->binb));
|
||||
r_bin_bind (core->bin, &(core->anal->binb));
|
||||
r_bin_bind (core->bin, &(core->anal->binb));
|
||||
|
||||
r_io_bind (core->io, &(core->search->iob));
|
||||
r_io_bind (core->io, &(core->print->iob));
|
||||
r_io_bind (core->io, &(core->anal->iob));
|
||||
|
@ -537,6 +537,7 @@ R_API RCoreFile *r_core_file_open_many(RCore *r, const char *file, int mode, ut6
|
||||
// check load addr to make sure its still valid
|
||||
loadaddr = top_file->map->from;
|
||||
}
|
||||
r_bin_bind (r->bin, &(fh->binb));
|
||||
r_list_append (r->files, fh);
|
||||
r_core_bin_load (r, fh->filename, fh->map->from);
|
||||
}
|
||||
@ -614,6 +615,7 @@ R_API RCoreFile *r_core_file_open(RCore *r, const char *file, int mode, ut64 loa
|
||||
return NULL;
|
||||
}
|
||||
// check load addr to make sure its still valid
|
||||
r_bin_bind (r->bin, &(fh->binb));
|
||||
r_list_append (r->files, fh);
|
||||
r_core_file_set_by_file (r, fh);
|
||||
r_config_set_i (r->config, "zoom.to", fh->map->from+fh->size);
|
||||
|
Loading…
Reference in New Issue
Block a user