- Fix segfault in r_core
* r_bin
  - Minor fixup in r_bin_load
  - Move plugin pointers to r_bin.h
This commit is contained in:
Nibble 2010-05-27 19:58:54 +02:00
parent cbdfc5ec77
commit 083ebe4832
3 changed files with 13 additions and 12 deletions

View File

@ -12,16 +12,6 @@
#include <list.h>
#include "../config.h"
/* plugin pointers */
extern RBinPlugin r_bin_plugin_elf;
extern RBinPlugin r_bin_plugin_elf64;
extern RBinPlugin r_bin_plugin_pe;
extern RBinPlugin r_bin_plugin_pe64;
extern RBinPlugin r_bin_plugin_mach0;
extern RBinPlugin r_bin_plugin_mach064;
extern RBinPlugin r_bin_plugin_java;
extern RBinPlugin r_bin_plugin_dummy;
static RBinPlugin *bin_static_plugins[] = { R_BIN_STATIC_PLUGINS };
static RList* get_strings(RBin *bin, int min) {
@ -142,6 +132,7 @@ R_API int r_bin_load(RBin *bin, const char *file, const char *plugin_name) {
if (!bin || !file)
return R_FALSE;
bin->file = r_file_abspath (file);
bin->cur = NULL;
list_for_each (pos, &bin->bins) {
RBinPlugin *h = list_entry (pos, RBinPlugin, list);
if ((plugin_name && !strcmp (h->name, plugin_name)) ||

View File

@ -104,7 +104,6 @@ static int __lib_bin_dt(struct r_lib_plugin_t *pl, void *p, void *u) { return R_
R_API int r_core_loadlibs_init(struct r_core_t *core) {
/* initialize handlers */
core->lib = r_lib_new ("radare_plugin");
r_lib_add_handler (core->lib, R_LIB_TYPE_IO, "io plugins",
&__lib_io_cb, &__lib_io_dt, core);
r_lib_add_handler (core->lib, R_LIB_TYPE_CMD, "cmd plugins",
@ -130,6 +129,7 @@ R_API int r_core_loadlibs(struct r_core_t *core) {
/* TODO: all those default plugin paths should be defined in r_lib */
char *homeplugindir = r_str_home (".radare2/plugins");
static int singleton = R_TRUE;
core->lib = r_lib_new ("radare_plugin");
if (singleton) {
r_core_loadlibs_init (core);
singleton = R_FALSE;

View File

@ -169,6 +169,16 @@ R_API char *r_bin_meta_get_source_line(RBin *bin, ut64 addr);
R_API ut64 r_bin_wr_scn_resize(RBin *bin, const char *name, ut64 size);
R_API int r_bin_wr_rpath_del(RBin *bin);
R_API int r_bin_wr_output(RBin *bin, const char *filename);
#endif
/* plugin pointers */
extern RBinPlugin r_bin_plugin_elf;
extern RBinPlugin r_bin_plugin_elf64;
extern RBinPlugin r_bin_plugin_pe;
extern RBinPlugin r_bin_plugin_pe64;
extern RBinPlugin r_bin_plugin_mach0;
extern RBinPlugin r_bin_plugin_mach064;
extern RBinPlugin r_bin_plugin_java;
extern RBinPlugin r_bin_plugin_dummy;
#endif
#endif