Fix static link

This commit is contained in:
pancake 2014-03-18 01:36:54 +01:00
parent b1b02fba8e
commit 6a835f159d
22 changed files with 91 additions and 572 deletions

View File

@ -58,7 +58,7 @@ static ut64 is_pointer(RIOBind *iob, const ut8 *buf, int endian, int size) {
// optimization to ignore very low and very high pointers
// this makes disasm 5x faster, but can result in some false positives
if (n<0x1000) return 0; // probably wrong
if (n>0xffffffffffff) return 0; // probably wrong
if (n>0xffffffffffffLL) return 0; // probably wrong
ret = iob->read_at (iob->io, n, buf2, size);
if (ret != size) return 0;

View File

@ -86,6 +86,7 @@ static int r_anal_esil (RAnalEsil *c, const char *str) {
return c->iterate (c, buf, tkns);
}
#if 0
static int iterate (RAnalEsil *c, char *buf, int *tkns) {
char *str;
int i, type;
@ -101,6 +102,7 @@ static int iterate (RAnalEsil *c, char *buf, int *tkns) {
}
return 0;
}
#endif
#define TOKEN_IS(x,y,z) (x[i]==y && !strcmp (x[i+1]==z))
#define TOKEN_GET(x,y) x=tkns[i]; y=buf+tkns[i+1]
@ -195,7 +197,7 @@ eprintf (";; -> this means that we have to resolve before accessing memory %d\n"
static int emulate (RAnalEsil *c, char *buf, int *tkns) {
ut64 num = 0;
char *op = NULL;
char *str;
char *str = NULL;
int i, type;
c->opstack = r_list_new ();
c->stack = r_list_new ();

View File

@ -10,9 +10,17 @@
#include <r_anal_ex.h>
#include <r_cons.h>
#undef R_API
#define R_API static
#undef R_IPI
#define R_IPI static
#include "../../../shlr/java/code.h"
#include "../../../shlr/java/class.h"
//#include "../../../shlr/java/ssa_java.h"
#undef R_API
#define R_API
#undef R_IPI
#define R_IPI
#define IFDBG if(0)
#define IFINT if(0)

View File

@ -1,7 +1,7 @@
OBJ_JAVA=anal_java.o
SHARED_JAVA+=../../shlr/java/ops.o
SHARED_JAVA+=../../shlr/java/code.o
SHARED_JAVA+=../../shlr/java/class.o
##SHARED_JAVA+=../../shlr/java/ops.o
#SHARED_JAVA+=../../shlr/java/code.o
#SHARED_JAVA+=../../shlr/java/class.o
SHARED2_JAVA=$(addprefix ../,${SHARED_JAVA})
OBJ_JAVA+=${SHARED2_JAVA}

View File

@ -1,10 +0,0 @@
OBJS = cmd.c plugin.c macro.c ;
OBJS += p/cmd_dummy.c p/cmd_java.c ;
lib r_cmd : $(OBJS) : <include>../include
<library>../util
<library>../lib
<library>../cons
<library>../core
<library>../anal
;

View File

@ -1,19 +0,0 @@
NAME=r_cmd
OBJS=cmd.o plugin.o macro.o
DEPS=r_util r_cons #r_anal r_core
include ../config.mk
CFLAGS+=-DCORELIB
foo:
for a in ${LIBSO} ${LIBAR} plugins ; do ${MAKE} $$a ; done
include ${STATIC_CMD_PLUGINS}
STATIC_OBJS=$(subst ..,p/..,$(subst cmd_,p/cmd_,$(STATIC_OBJ)))
OBJS+=${STATIC_OBJS}
plugins:
cd p && ${MAKE} all
include ../rules.mk

View File

@ -1,434 +0,0 @@
/* radare - LGPL - Copyright 2008-2013 - pancake */
#include <stdio.h>
#include <r_cons.h>
#include <r_cmd.h>
#include <r_util.h>
static int value = 0;
R_API void r_cmd_macro_init(RCmdMacro *mac) {
mac->counter = 0;
mac->_brk_value = 0;
mac->brk_value = &mac->_brk_value;
mac->printf = (void*)printf;
mac->num = NULL;
mac->user = NULL;
mac->cmd = NULL;
mac->macros = r_list_new ();
}
// XXX add support single line function definitions
// XXX add support for single name multiple nargs macros
R_API int r_cmd_macro_add(RCmdMacro *mac, const char *oname) {
struct r_cmd_macro_item_t *macro;
char *name, *args = NULL;
//char buf[R_CMD_MAXLEN];
RCmdMacroItem *m;
int macro_update;
RListIter *iter;
char *pbody;
// char *bufp;
char *ptr;
int lidx;
if (!*oname) {
r_cmd_macro_list (mac);
return 0;
}
name = strdup (oname);
if (name == NULL) {
perror ("strdup");
return 0;
}
pbody = strchr (name, ',');
if (pbody) {
*pbody = '\0';
pbody++;
} else {
eprintf ("Invalid macro body\n");
free (name);
return R_FALSE;
}
if (name[strlen (name)-1]==')') {
eprintf ("r_cmd_macro_add: missing macro body?\n");
free (name);
return -1;
}
macro = NULL;
ptr = strchr (name, ' ');
if (ptr) {
*ptr='\0';
args = ptr +1;
}
macro_update = 0;
r_list_foreach (mac->macros, iter, m) {
if (!strcmp (name, m->name)) {
macro = m;
// free (macro->name);
free (macro->code);
free (macro->args);
macro_update = 1;
break;
}
}
if (ptr)
*ptr = ' ';
if (macro == NULL) {
macro = (struct r_cmd_macro_item_t *)malloc (
sizeof (struct r_cmd_macro_item_t));
macro->name = strdup (name);
}
macro->codelen = (pbody)? strlen (pbody)+2 : 4096;
macro->code = (char *)malloc (macro->codelen);
*macro->code = '\0';
macro->nargs = 0;
if (args == NULL)
args = "";
macro->args = strdup (args);
ptr = strchr (macro->name, ' ');
if (ptr != NULL) {
*ptr = '\0';
macro->nargs = r_str_word_set0 (ptr+1);
}
if (pbody) {
for (lidx=0; pbody[lidx]; lidx++) {
if (pbody[lidx]==',')
pbody[lidx]='\n';
else
if (pbody[lidx]==')' && pbody[lidx-1]=='\n')
pbody[lidx]='\0';
}
strncpy (macro->code, pbody, macro->codelen);
macro->code[macro->codelen] = 0;
//strcat (macro->code, ",");
#if 0
} else {
int lbufp, codelen = 0, nl = 0;
eprintf ("Reading macro from stdin:\n");
for (;codelen<R_CMD_MAXLEN;) { // XXX input from mac->fd
#if 0
if (stdin == r_cons_stdin_fd) {
mac->printf(".. ");
fflush(stdout);
}
fgets(buf, 1023, r_cons_stdin_fd);
#endif
fgets (buf, sizeof (buf)-1, stdin);
if (*buf=='\n' && nl)
break;
nl = (*buf == '\n')?1:0;
if (*buf==')')
break;
for (bufp=buf;*bufp==' '||*bufp=='\t';bufp++);
lidx = strlen (buf)-2;
lbufp = strlen (bufp);
if (buf[lidx]==')' && buf[lidx-1]!='(') {
buf[lidx]='\0';
memcpy (macro->code+codelen, bufp, lbufp+1);
break;
}
if (*buf != '\n') {
memcpy (macro->code+codelen, bufp, lbufp+1);
codelen += lbufp;
}
}
#endif
}
if (macro_update == 0)
r_list_append (mac->macros, macro);
free (name);
return 0;
}
R_API int r_cmd_macro_rm(RCmdMacro *mac, const char *_name) {
RListIter *iter;
RCmdMacroItem *m;
char *name = strdup (_name);
char *ptr = strchr (name, ')');
if (ptr) *ptr='\0';
r_list_foreach (mac->macros, iter, m) {
if (!strcmp (m->name, name)) {
r_list_delete (mac->macros, iter);
eprintf ("Macro '%s' removed.\n", name);
free (m->name);
free (m->code);
free (m);
free (name);
return R_TRUE;
}
}
free (name);
return R_FALSE;
}
// TODO: use mac->printf which is r_cons_printf at the end
R_API void r_cmd_macro_list(RCmdMacro *mac) {
RCmdMacroItem *m;
int j, idx = 0;
RListIter *iter;
r_list_foreach (mac->macros, iter, m) {
mac->printf ("%d (%s %s, ", idx, m->name, m->args);
for (j=0; m->code[j]; j++) {
if (m->code[j]=='\n')
mac->printf (", ");
else mac->printf ("%c", m->code[j]);
}
mac->printf (")\n");
idx++;
}
}
#if 0
(define name value
f $0 @ $1)
(define loop cmd
loop:
? $0 == 0
?? .loop:
)
.(define patata 3)
#endif
R_API int r_cmd_macro_cmd_args(RCmdMacro *mac, const char *ptr, const char *args, int nargs) {
int i, j;
char *pcmd, cmd[R_CMD_MAXLEN];
const char *arg = args;
for (*cmd=i=j=0; ptr[j] && j<R_CMD_MAXLEN; i++,j++) {
if (ptr[j]=='$') {
if (ptr[j+1]>='0' && ptr[j+1]<='9') {
int wordlen;
int w = ptr[j+1]-'0';
const char *word = r_str_word_get0 (arg, w);
if (word && *word) {
wordlen = strlen (word);
if ((i+wordlen+1) >= sizeof (cmd))
return -1;
memcpy (cmd+i, word, wordlen+1);
i += wordlen-1;
j++;
} else eprintf ("Undefined argument %d\n", w);
} else
if (ptr[j+1]=='@') {
char off[32];
int offlen;
offlen = snprintf (off, sizeof (off), "%d",
mac->counter);
if ((i+offlen+1) >= sizeof (cmd))
return -1;
memcpy (cmd+i, off, offlen+1);
i += offlen-1;
j++;
} else {
cmd[i] = ptr[j];
cmd[i+1] = '\0';
}
} else {
cmd[i] = ptr[j];
cmd[i+1] = '\0';
}
}
for (pcmd = cmd; *pcmd && (*pcmd==' ' || *pcmd == '\t'); pcmd++);
//eprintf ("-pre %d\n", (int)mac->num->value);
int xx = (*pcmd==')')? 0: mac->cmd (mac->user, pcmd);
//eprintf ("-pos %p %d\n", mac->num, (int)mac->num->value);
return xx;
}
R_API char *r_cmd_macro_label_process(RCmdMacro *mac, RCmdMacroLabel *labels, int *labels_n, char *ptr) {
int i;
for (; *ptr==' '; ptr++);
if (ptr[strlen (ptr)-1]==':' && !strchr (ptr, ' ')) {
/* label detected */
if (ptr[0]=='.') {
// eprintf("---> GOTO '%s'\n", ptr+1);
/* goto */
for (i=0;i<*labels_n;i++) {
// eprintf("---| chk '%s'\n", labels[i].name);
if (!strcmp (ptr+1, labels[i].name)) {
return labels[i].ptr;
}
}
return NULL;
} else
/* conditional goto */
if (ptr[0]=='?' && ptr[1]=='!' && ptr[2] != '?') {
if (mac->num && mac->num->value != 0) {
char *label = ptr + 3;
for (; *label==' '||*label=='.'; label++);
// eprintf("===> GOTO %s\n", label);
/* goto label ptr+3 */
for (i=0;i<*labels_n;i++) {
if (!strcmp (label, labels[i].name))
return labels[i].ptr;
}
return NULL;
}
} else
/* conditional goto */
if (ptr[0]=='?' && ptr[1]=='?' && ptr[2] != '?') {
if (mac->num->value == 0) {
char *label = ptr + 3;
for (;label[0]==' '||label[0]=='.'; label++);
// eprintf("===> GOTO %s\n", label);
/* goto label ptr+3 */
for (i=0; i<*labels_n; i++) {
if (!strcmp (label, labels[i].name))
return labels[i].ptr;
}
return NULL;
}
} else {
for (i=0; i<*labels_n; i++) {
// eprintf("---| chk '%s'\n", labels[i].name);
if (!strcmp (ptr+1, labels[i].name)) {
i = 0;
break;
}
}
/* Add label */
// eprintf("===> ADD LABEL(%s)\n", ptr);
if (i == 0) {
strncpy (labels[*labels_n].name, ptr, 64);
labels[*labels_n].ptr = ptr+strlen (ptr)+1;
*labels_n = *labels_n + 1;
}
}
return ptr + strlen (ptr)+1;
}
return ptr;
}
/* TODO: add support for spaced arguments */
R_API int r_cmd_macro_call(RCmdMacro *mac, const char *name) {
RCons *cons;
char *args;
int nargs = 0;
char *str, *ptr, *ptr2;
RListIter *iter;
static int macro_level = 0;
RCmdMacroItem *m;
/* labels */
int labels_n = 0;
struct r_cmd_macro_label_t labels[MACRO_LABELS];
str = strdup (name);
if (str == NULL) {
perror ("strdup");
return R_FALSE;
}
ptr = strchr (str, ')');
if (ptr == NULL) {
eprintf ("Missing end ')' parenthesis.\n");
free (str);
return R_FALSE;
} else *ptr='\0';
args = strchr (str, ' ');
if (args) {
*args = '\0';
args++;
nargs = r_str_word_set0 (args);
}
macro_level++;
if (macro_level > MACRO_LIMIT) {
eprintf ("Maximum macro recursivity reached.\n");
macro_level--;
free (str);
return 0;
}
ptr = strchr (str, ',');
if (ptr) *ptr =0;
cons = r_cons_singleton ();
r_cons_break (NULL, NULL);
r_list_foreach (mac->macros, iter, m) {
if (!strcmp (str, m->name)) {
char *ptr = m->code;
char *end = strchr (ptr, '\n');
if (m->nargs != 0 && nargs != m->nargs) {
eprintf ("Macro '%s' expects %d args, not %d\n",
m->name, m->nargs, nargs);
macro_level --;
free (str);
return R_FALSE;
}
mac->brk = 0;
do {
if (end) *end = '\0';
if (cons->breaked) {
eprintf ("Interrupted at (%s)\n", ptr);
if (end) *end = '\n';
free (str);
return R_FALSE;
}
r_cons_flush ();
/* Label handling */
ptr2 = r_cmd_macro_label_process (mac, &(labels[0]), &labels_n, ptr);
if (ptr2 == NULL) {
eprintf ("Oops. invalid label name\n");
break;
} else
if (ptr != ptr2) { // && end) {
ptr = ptr2;
if (end) *end ='\n';
end = strchr (ptr, '\n');
continue;
}
/* Command execution */
if (*ptr) {
mac->num->value = value;
int r = r_cmd_macro_cmd_args (mac, ptr, args, nargs);
// TODO: handle quit? r == 0??
// quit, exits the macro. like a break
value = mac->num->value;
if (r<0)
return r;
}
if (end) {
*end = '\n';
ptr = end + 1;
} else {
macro_level --;
free (str);
return R_TRUE;
}
/* Fetch next command */
end = strchr (ptr, '\n');
} while (!mac->brk);
if (mac->brk) {
macro_level--;
free (str);
return R_TRUE;
}
}
}
eprintf ("No macro named '%s'\n", str);
macro_level--;
free (str);
return R_TRUE;
}
R_API int r_cmd_macro_break(RCmdMacro *mac, const char *value) {
mac->brk = 1;
mac->brk_value = NULL;
mac->_brk_value = (ut64)r_num_math (mac->num, value);
if (value && *value)
mac->brk_value = &mac->_brk_value;
return 0;
}

View File

@ -1,25 +0,0 @@
/* radare - LGPL - Copyright 2010 pancake<@nopcode.org> */
#include <r_types.h>
#include <r_lib.h>
#include <r_cmd.h>
static int call(void *user, const char *cmd) {
if (strcmp (cmd, "**dummy**"))
return R_FALSE;
eprintf ("Dummy call executed\n");
return R_TRUE;
}
struct r_cmd_plugin_t r_cmd_plugin_dummy = {
.name = "dummy",
.desc = "test plugin. use **dummy** to execute",
.call = call,
};
#ifndef CORELIB
struct r_lib_struct_t radare_plugin = {
.type = R_LIB_TYPE_CMD,
.data = &r_cmd_plugin_dummy
};
#endif

View File

@ -1,9 +0,0 @@
OBJ_DUMMY+=cmd_dummy.o
STATIC_OBJ+=${OBJ_DUMMY}
TARGET_DUMMY=cmd_dummy.${EXT_SO}
ALL_TARGETS+=${TARGET_DUMMY}
${TARGET_DUMMY}: ${OBJ_DUMMY}
${CC} $(call libname,cmd_dummy) ${CFLAGS} -o ${TARGET_DUMMY} ${OBJ_DUMMY}

View File

@ -1,5 +0,0 @@
BIN=test
OBJ=test.o
BINDEPS=r_cmd r_util
include ../../rules.mk

View File

@ -1,40 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <r_cmd.h>
int cmd_quit(void *data, const char *input) {
printf("quit\n");
// exit(1);
return 0;
}
int cmd_echo(void *data, const char *input) {
const char *arg = strchr(input, ' ');
if (arg == NULL)
arg = input;
printf("%s\n", arg+1);
return 0;
}
int main()
{
struct r_cmd_t *cmd;
cmd = r_cmd_new();
r_cmd_add(cmd, "e", "echo message", &cmd_echo);
r_cmd_add(cmd, "q", "quit program", &cmd_quit);
r_cmd_add_long(cmd, "echo", "e", "echo message");
r_cmd_add_long(cmd, "exit", "q", "quit program");
r_cmd_call(cmd, "e hello world short");
r_cmd_call_long(cmd, "echo hello world long");
r_cmd_call_long(cmd, "exit");
if (!r_cmd_call(cmd, "**dummy**"))
eprintf ("==> Cannot call **dummy**\n");
else eprintf ("==> **dummy** called\n");
r_cmd_call(cmd, "quit");
return 0;
}

View File

@ -634,3 +634,42 @@ R_API int r_cmd_macro_break(RCmdMacro *mac, const char *value) {
mac->brk_value = &mac->_brk_value;
return 0;
}
#if 0
int cmd_quit(void *data, const char *input) {
printf("quit\n");
// exit(1);
return 0;
}
int cmd_echo(void *data, const char *input) {
const char *arg = strchr(input, ' ');
if (arg == NULL)
arg = input;
printf("%s\n", arg+1);
return 0;
}
int main()
{
struct r_cmd_t *cmd;
cmd = r_cmd_new();
r_cmd_add(cmd, "e", "echo message", &cmd_echo);
r_cmd_add(cmd, "q", "quit program", &cmd_quit);
r_cmd_add_long(cmd, "echo", "e", "echo message");
r_cmd_add_long(cmd, "exit", "q", "quit program");
r_cmd_call(cmd, "e hello world short");
r_cmd_call_long(cmd, "echo hello world long");
r_cmd_call_long(cmd, "exit");
if (!r_cmd_call(cmd, "**dummy**"))
eprintf ("==> Cannot call **dummy**\n");
else eprintf ("==> **dummy** called\n");
r_cmd_call(cmd, "quit");
return 0;
}
#endif

View File

@ -840,7 +840,7 @@ static int cmd_print(void *data, const char *input) {
ut64 use_blocksize = core->blocksize;
int segoff, old_bits, pos = 0;
ut8 settings_changed = R_FALSE, bw_disassemble = R_FALSE;
char *new_arch, *old_arch;
char *new_arch = NULL, *old_arch = NULL;
ut32 pd_result = R_FALSE, processed_cmd = R_FALSE;
old_arch = strdup (r_config_get (core->config, "asm.arch"));
segoff = r_config_get_i (core->config, "asm.segoff");

View File

@ -9,12 +9,17 @@
#undef R_API
#define R_API static
#undef R_IPI
#define R_IPI static
#include "../../../shlr/java/ops.c"
#include "../../../shlr/java/code.c"
#include "../../../shlr/java/class.c"
//#include "../../../shlr/java/class.h"
#undef R_API
#define R_API
#undef R_IPI
#define R_IPI
#define DO_THE_DBG 0
#define IFDBG if (DO_THE_DBG)

View File

@ -1,8 +1,8 @@
CORE_OBJ_JAVA=core_java.o
CORE_SHARED_JAVA=../../shlr/java/code.o
CORE_SHARED_JAVA+=../../shlr/java/class.o
CORE_SHARED_JAVA+=../../shlr/java/ops.o
#CORE_SHARED_JAVA=../../shlr/java/code.o
#CORE_SHARED_JAVA+=../../shlr/java/class.o
#CORE_SHARED_JAVA+=../../shlr/java/ops.o
CORE_SHARED2_JAVA=$(addprefix ../,${CORE_SHARED_JAVA})
CORE_OBJ_JAVA+=${CORE_SHARED2_JAVA}

View File

@ -117,6 +117,10 @@ typedef void (*PrintfCallback)(const char *str, ...);
#define CTI(x,y,z) (*((size_t*)(CTA(x,y,z))))
#define CTS(x,y,z,t,v) {t* _=(t*)CTA(x,y,z);*_=v;}
#ifdef R_IPI
#undef R_IPI
#endif
#ifdef R_API
#undef R_API
#endif

View File

@ -7,5 +7,5 @@ Name: libr
Description: radare framework libraries
Version: 0.1
Requires:
Libs: -L${libdir} -lr_core -lr_lang -lr_search -lr_cmd -lr_asm -lr_util -lr_reg
Libs: -L${libdir} -lr_core -lr_lang -lr_search -lr_asm -lr_util -lr_reg
Cflags: -I${includedir}/libr

View File

@ -7,5 +7,5 @@ Name: r_core
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_core -lr_config -lr_cons -lr_io -lr_cmd -lr_util -lr_flags -lr_asm -lr_db -lr_debug -lr_hash -lr_bin -lr_lang -lr_io -lr_anal -lr_parse -lr_bp -lr_egg -lr_reg -lr_search -lr_syscall -lr_diff -lr_socket -lr_fs @LIBMAGIC@
Libs: -L${libdir} -lr_core -lr_config -lr_cons -lr_io -lr_util -lr_flags -lr_asm -lr_db -lr_debug -lr_hash -lr_bin -lr_lang -lr_io -lr_anal -lr_parse -lr_bp -lr_egg -lr_reg -lr_search -lr_syscall -lr_diff -lr_socket -lr_fs @LIBMAGIC@
Cflags: -I${includedir}/libr

View File

@ -7,13 +7,13 @@
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include "class.h"
#include <r_types.h>
#include <r_util.h>
#include <r_bin.h>
#include <r_cons.h>
#include <math.h>
#include <sdb.h>
#include "class.h"
#ifdef IFDBG
#undef IFDBG
@ -1386,7 +1386,7 @@ R_API char * r_bin_java_build_obj_key (RBinJavaObj *bin) {
return jvcname;
}
int sdb_iterate_build_list(void *user, const char *k, const char *v) {
R_IPI int sdb_iterate_build_list(void *user, const char *k, const char *v) {
RList *bin_objs_list = (RList *) user;
size_t value = (size_t) sdb_atoi (v);
RBinJavaObj *bin_obj = NULL;
@ -1441,7 +1441,7 @@ static RBinJavaCPTypeMetas* r_bin_java_get_cp_meta_from_tag(ut8 tag) {
return res;
}
void deinit_java_type_null() {
R_IPI void deinit_java_type_null() {
free (R_BIN_JAVA_NULL_TYPE.metas);
}
@ -1485,7 +1485,7 @@ R_API double my_pow(ut64 base, int exp) {
return (1.0/res);
}
double rbin_java_raw_to_double(ut8* raw, ut64 offset) {
R_IPI double rbin_java_raw_to_double(ut8* raw, ut64 offset) {
ut64 bits = RBIN_JAVA_LONG(raw, offset);
int s = ((bits >> 63) == 0) ? 1 : -1;
int e = (int)((bits >> 52) & 0x7ffL);
@ -2177,7 +2177,7 @@ static RBinJavaAttrInfo* r_bin_java_default_attr_new(ut8* buffer, ut64 sz, ut64
return attr;
}
RBinJavaAttrMetas* r_bin_java_get_attr_type_by_name(const char *name) {
R_API RBinJavaAttrMetas* r_bin_java_get_attr_type_by_name(const char *name) {
RBinJavaAttrMetas* res = &RBIN_JAVA_ATTRS_METAS[R_BIN_JAVA_ATTR_TYPE_UNKNOWN_ATTR];
ut32 i = 0;
for (i = 0; i < RBIN_JAVA_ATTRS_METAS_SZ; i++) {
@ -2243,7 +2243,7 @@ static RBinJavaAttrInfo* r_bin_java_read_next_attr_from_buffer (ut8 *buffer, ut6
return attr;
}
RBinJavaClass2* r_bin_java_read_class_file2(RBinJavaObj *bin, ut64 offset) {
R_API RBinJavaClass2* r_bin_java_read_class_file2(RBinJavaObj *bin, ut64 offset) {
ut8 buf[6];
RBinJavaClass2 *cf2 = (RBinJavaClass2 *) malloc (sizeof (RBinJavaClass2));
@ -2530,10 +2530,9 @@ R_API ut64 r_bin_java_get_class_entrypoint(RBinJavaObj* bin) {
return 0;
}
RBinSymbol* r_bin_java_allocate_symbol() {
R_API RBinSymbol* r_bin_java_allocate_symbol() {
RBinSymbol* t = (RBinSymbol *) malloc (sizeof (RBinSymbol));
if (t)
memset (t, 0, sizeof (RBinSymbol));
if (t) memset (t, 0, sizeof (RBinSymbol));
return t;
}
@ -2579,7 +2578,7 @@ R_API ut64 r_bin_java_get_method_code_offset(RBinJavaField *fm_type) {
return offset;
}
RBinField* r_bin_java_allocate_rbinfield() {
R_API RBinField* r_bin_java_allocate_rbinfield() {
RBinField* t = (RBinField *) malloc (sizeof (RBinField));
if (t)
memset (t, 0, sizeof (RBinField));
@ -4414,7 +4413,7 @@ R_API RBinJavaStackMapFrameMetas* r_bin_java_determine_stack_frame_type(ut8 tag)
return &R_BIN_JAVA_STACK_MAP_FRAME_METAS[type_value];
}
void copy_type_info_to_stack_frame_list (RList *type_list, RList *sf_list) {
static void copy_type_info_to_stack_frame_list (RList *type_list, RList *sf_list) {
RListIter *iter, *iter_tmp;
RBinJavaVerificationObj *ver_obj, *new_ver_obj;
if (type_list == NULL)
@ -4432,7 +4431,8 @@ void copy_type_info_to_stack_frame_list (RList *type_list, RList *sf_list) {
}
}
void copy_type_info_to_stack_frame_list_up_to_idx (RList *type_list, RList *sf_list, ut64 idx) {
static void copy_type_info_to_stack_frame_list_up_to_idx (RList *type_list, RList *sf_list, ut64 idx) {
RListIter *iter, *iter_tmp;
RBinJavaVerificationObj *ver_obj, *new_ver_obj;
ut32 pos = 0;

View File

@ -25,8 +25,11 @@
//#define R_BIN_JAVA_SWAPUSHORT(x) ((ut16)((x<<8)|((x>>8)&0x00FF)))
// Intentionally not R_API
void copy_type_info_to_stack_frame_list(RList *type_list, RList *sf_list);
void copy_type_info_to_stack_frame_list_up_to_idx(RList *type_list, RList *sf_list, ut64 idx);
#ifndef R_IPI
#define R_IPI static
#endif
R_IPI void copy_type_info_to_stack_frame_list(RList *type_list, RList *sf_list);
R_IPI void copy_type_info_to_stack_frame_list_up_to_idx(RList *type_list, RList *sf_list, ut64 idx);
#define R_BIN_JAVA_DOUBLE(x,y) rbin_java_raw_to_double(x, y)

View File

@ -31,7 +31,7 @@ typedef struct current_table_switch_t {
} CurrentTableSwitch;
static CurrentTableSwitch SWITCH_OP;
ut64 BYTES_CONSUMED = 0;
static ut64 BYTES_CONSUMED = 0;
//static RBinJavaObj *BIN_OBJ = NULL;
static void init_switch_op () {
@ -74,7 +74,7 @@ static int handle_switch_op (ut64 addr, const ut8 * bytes, char *output, int out
}
int java_print_opcode(RBinJavaObj *obj, ut64 addr, int idx, const ut8 *bytes, char *output, int outlen) {
R_IPI int java_print_opcode(RBinJavaObj *obj, ut64 addr, int idx, const ut8 *bytes, char *output, int outlen) {
char *arg = NULL; //(char *) malloc (1024);
ut32 val_one = 0,

View File

@ -13,10 +13,10 @@ typedef struct java_op {
extern struct java_op JAVA_OPS[];
int java_print_opcode(RBinJavaObj *obj, ut64 addr, int idx, const ut8 *bytes, char *output, int outlen);
unsigned short read_short(FILE *fd);
R_IPI int java_print_opcode(RBinJavaObj *obj, ut64 addr, int idx, const ut8 *bytes, char *output, int outlen);
R_IPI unsigned short read_short(FILE *fd);
int java_classdump(const char *file, int verbose);
R_IPI int java_classdump(const char *file, int verbose);
R_API int r_java_disasm(RBinJavaObj *obj, ut64 addr, const ut8 *bytes, char *output, int len);
R_API int r_java_assemble(ut8 *bytes, const char *string);