Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 7800f979cc84c48395581b7106627f7f23563ee2
Author: Adam Pridgen <[email protected]>
Date:   Wed Sep 4 21:58:35 2013 -0500

    - Added visibility field to structures RBinField, RBinMethod, RBinBind, RBinReloc, and RBinImport
    - Added handling for listing java classes

commit 1e7014342d16094fe21ddcb9b6b1991c5e3908b1
Author: Adam Pridgen <[email protected]>
Date:   Wed Sep 4 18:41:00 2013 -0500

    -- Added mappings for access flags

commit cb8e4f0af99fc77f04263ddf292442835e128cff
Author: Adam Pridgen <[email protected]>
Date:   Wed Sep 4 17:53:04 2013 -0500

    -- Updated the get sections command.
  • Loading branch information
deeso authored and radare committed Sep 6, 2013
1 parent 38420cb commit da5bf8d
Show file tree
Hide file tree
Showing 4 changed files with 426 additions and 165 deletions.
46 changes: 9 additions & 37 deletions libr/bin/p/bin_java.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static ut64 baddr(RBinArch *arch) {
}

static RList* classes(RBinArch *arch) {
char *p;
/*char *p;
RBinClass *c;
RList *ret = r_list_new ();
if (!ret) return NULL;
Expand All @@ -48,8 +48,9 @@ static RList* classes(RBinArch *arch) {
p = (char*)r_str_lchr (c->name, '/');
if (p) strcpy (c->name, p+1);
c->super = strdup ("Object"); //XXX
r_list_append (ret, c);

r_list_append (ret, c);*/
RList *ret;
ret = r_bin_java_get_classes((struct r_bin_java_obj_t*)arch->bin_obj);
return ret;
}

Expand Down Expand Up @@ -150,41 +151,12 @@ static RList* lines(RBinArch *arch) {
}

static RList* sections(RBinArch *arch) {
RList *ret = NULL;
RBinSection *ptr = NULL;
struct r_bin_java_sym_t *s = NULL;
RBinJavaObj *b = arch->bin_obj;

if (!(ret = r_list_new ()))
return NULL;
ret->free = free;
if ((s = r_bin_java_get_symbols (arch->bin_obj))) {
if ((ptr = R_NEW0 (RBinSection))) {
strcpy (ptr->name, "code");
ptr->size = ptr->vsize = b->fsymsz;
ptr->offset = ptr->rva = b->fsym;
ptr->srwx = 4|1;
r_list_append (ret, ptr);
}
if ((ptr = R_NEW0 (RBinSection))) {
strcpy (ptr->name, "constpool");
ptr->size = ptr->vsize = b->fsym;
ptr->offset = ptr->rva = 0;
ptr->srwx = 4;
r_list_append (ret, ptr);
}
if ((ptr = R_NEW0 (RBinSection))) {
strcpy (ptr->name, "data");
ptr->offset = ptr->rva = b->fsymsz+b->fsym;
ptr->size = ptr->vsize = arch->buf->length - ptr->rva;
ptr->srwx = 4|2;
r_list_append (ret, ptr);
}
free (s);
}
return ret;
return r_bin_java_get_sections (arch->bin_obj);
}

static RList* fields(RBinArch *arch) {
return r_bin_java_get_fields (arch->bin_obj);
}
struct r_bin_plugin_t r_bin_plugin_java = {
.name = "java",
.desc = "java bin plugin",
Expand All @@ -201,7 +173,7 @@ struct r_bin_plugin_t r_bin_plugin_java = {
.imports = NULL,
.strings = &strings,
.info = &info,
.fields = NULL,
.fields = fields,
.libs = NULL,
.relocs = NULL,
.meta = NULL,
Expand Down
5 changes: 5 additions & 0 deletions libr/include/r_bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,15 @@ typedef struct r_bin_symbol_t {
ut64 offset;
ut64 size;
ut64 ordinal;
ut32 visibility;
} RBinSymbol;

typedef struct r_bin_import_t {
char name[R_BIN_SIZEOF_STRINGS];
char bind[R_BIN_SIZEOF_STRINGS];
char type[R_BIN_SIZEOF_STRINGS];
ut64 ordinal;
ut32 visibility;
} RBinImport;

typedef struct r_bin_reloc_t {
Expand All @@ -232,6 +234,7 @@ typedef struct r_bin_reloc_t {
st64 addend;
ut64 rva;
ut64 offset;
ut32 visibility;
} RBinReloc;

typedef struct r_bin_string_t {
Expand All @@ -247,6 +250,7 @@ typedef struct r_bin_field_t {
char name[R_BIN_SIZEOF_STRINGS];
ut64 rva;
ut64 offset;
ut32 visibility;
} RBinField;

typedef struct r_bin_meta_t {
Expand All @@ -268,6 +272,7 @@ typedef struct r_bin_bind_t {
RBin *bin;
RBinGetOffset get_offset;
RBinGetName get_name;
ut32 visibility;
} RBinBind;

#ifdef R_API
Expand Down
Loading

0 comments on commit da5bf8d

Please sign in to comment.