mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-24 05:40:10 +00:00
Clean a huge list of warnings
This commit is contained in:
parent
ed008f24ab
commit
377b5bb2fe
@ -162,7 +162,6 @@ static int fcn_recurse(RAnal *anal, RAnalFunction *fcn, ut64 addr, ut8 *buf, ut6
|
||||
RAnalOp op = {0};
|
||||
int oplen, idx = 0;
|
||||
int delay_cnt = 0, delay_idx = 0, delay_after = 0, delay_pending = 0, delay_adjust = 0, undelayed_idx = 0;
|
||||
int delay_fin = 0;
|
||||
// add basic block
|
||||
RAnalBlock *bb = NULL;
|
||||
RAnalBlock *bbg = NULL;
|
||||
@ -276,12 +275,15 @@ static int fcn_recurse(RAnal *anal, RAnalFunction *fcn, ut64 addr, ut8 *buf, ut6
|
||||
case R_ANAL_STACK_SET:
|
||||
if (op.ptr > 0) {
|
||||
varname = r_str_newf ("arg_%x", op.ptr);
|
||||
r_anal_var_add (anal, fcn->addr, op.addr, op.ptr,
|
||||
R_ANAL_VAR_SCOPE_ARG|R_ANAL_VAR_DIR_IN, NULL, varname, 1);
|
||||
r_anal_var_add (anal, fcn->addr, 0, op.ptr,
|
||||
'a', NULL, anal->bits/8, varname);
|
||||
// TODO: DIR_IN?
|
||||
//R_ANAL_VAR_SCOPE_ARG|R_ANAL_VAR_DIR_IN, NULL, varname, 1);
|
||||
} else {
|
||||
varname = r_str_newf ("local_%x", -op.ptr);
|
||||
r_anal_var_add (anal, fcn->addr, op.addr, -op.ptr,
|
||||
R_ANAL_VAR_SCOPE_LOCAL|R_ANAL_VAR_DIR_NONE, NULL, varname, 1);
|
||||
r_anal_var_add (anal, fcn->addr, 0, -op.ptr, 'v', NULL,
|
||||
anal->bits/8, varname);
|
||||
//R_ANAL_VAR_SCOPE_LOCAL|R_ANAL_VAR_DIR_NONE, NULL, varname, 1);
|
||||
}
|
||||
free (varname);
|
||||
break;
|
||||
@ -289,11 +291,13 @@ static int fcn_recurse(RAnal *anal, RAnalFunction *fcn, ut64 addr, ut8 *buf, ut6
|
||||
case R_ANAL_STACK_GET:
|
||||
if (op.ptr > 0) {
|
||||
varname = r_str_newf ("arg_%x", op.ptr);
|
||||
r_anal_var_add (anal, fcn, op.addr, op.ptr, 'a', NULL, varname, 0);
|
||||
r_anal_var_add (anal, fcn->addr, 1, op.ptr, 'v', NULL, anal->bits/8, varname);
|
||||
r_anal_var_access (anal, fcn->addr, 'a', 0, op.ptr, 0, op.addr); //, NULL, varname, 0);
|
||||
//R_ANAL_VAR_SCOPE_ARG|R_ANAL_VAR_DIR_IN, NULL, varname, 0);
|
||||
} else {
|
||||
varname = r_str_newf ("local_%x", -op.ptr);
|
||||
r_anal_var_add (anal, fcn, op.addr, -op.ptr, 'v', NULL, varname, 0);
|
||||
r_anal_var_add (anal, fcn->addr, 1, -op.ptr, 'v', NULL, anal->bits/8, varname);
|
||||
r_anal_var_access (anal, fcn->addr, 'v', 0, -op.ptr, 0, -op.addr); //, 'v', NULL, varname, 0);
|
||||
//R_ANAL_VAR_SCOPE_LOCAL|R_ANAL_VAR_DIR_NONE, NULL, varname, 0);
|
||||
}
|
||||
free (varname);
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <r_asm.h>
|
||||
#include <r_anal.h>
|
||||
#include <r_reg.h>
|
||||
#define GB_DIS_LEN_ONLY
|
||||
#include "../../asm/arch/gb/gbdis.c"
|
||||
#include "../arch/gb/meta_gb_cmt.c"
|
||||
#include "../arch/gb/gb_makros.h"
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <r_cons.h>
|
||||
|
||||
#undef R_API
|
||||
#define R_API static inline
|
||||
#define R_API
|
||||
#undef R_IPI
|
||||
#define R_IPI static
|
||||
|
||||
@ -599,18 +599,20 @@ static int analyze_from_code_attr (RAnal *anal, RAnalFunction *fcn, RBinJavaFiel
|
||||
|
||||
static int analyze_method(RAnal *anal, RAnalFunction *fcn, RAnalState *state) {
|
||||
ut64 bytes_consumed = 0;
|
||||
RList *bbs = NULL;
|
||||
// deallocate niceties
|
||||
r_list_free (fcn->bbs);
|
||||
fcn->bbs = r_anal_bb_list_new ();
|
||||
|
||||
IFDBG eprintf ("analyze_method: Parsing fcn %s @ 0x%08"PFMT64x", %d bytes\n", fcn->name, fcn->addr, fcn->size);
|
||||
IFDBG eprintf ("analyze_method: Parsing fcn %s @ 0x%08"PFMT64x", %d bytes\n",
|
||||
fcn->name, fcn->addr, fcn->size);
|
||||
java_new_method (fcn->addr);
|
||||
state->current_fcn = fcn;
|
||||
// Not a resource leak. Basic blocks should be stored in the state->fcn
|
||||
bbs = r_anal_ex_perform_analysis (anal, state, fcn->addr);
|
||||
// TODO: ? RList *bbs =
|
||||
r_anal_ex_perform_analysis (anal, state, fcn->addr);
|
||||
bytes_consumed = state->bytes_consumed;
|
||||
IFDBG eprintf ("analyze_method: Completed Parsing fcn %s @ 0x%08"PFMT64x", consumed %"PFMT64d" bytes\n", fcn->name, fcn->addr, bytes_consumed);
|
||||
IFDBG eprintf ("analyze_method: Completed Parsing fcn %s @ 0x%08"PFMT64x
|
||||
", consumed %"PFMT64d" bytes\n", fcn->name, fcn->addr, bytes_consumed);
|
||||
|
||||
return state->anal_ret_val;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef _UDIS86_ESIL_H
|
||||
#define _UDIS86_ESIL_H
|
||||
|
||||
#include "udis86/extern.h"
|
||||
/* This may be useful for other architectures */
|
||||
#define esilprintf(op, fmt, arg...) r_strbuf_setf (&op->esil, fmt, ##arg)
|
||||
|
||||
|
@ -105,7 +105,7 @@ R_API int r_anal_var_check_name(const char *name) {
|
||||
// avr 1,4 counter @ var_addr
|
||||
R_API int r_anal_var_rename (RAnal *a, ut64 var_addr, int scope, int delta, const char *new_name) {
|
||||
ut32 hash;
|
||||
char key[128], *old_name, val[128];
|
||||
char key[128], *old_name;
|
||||
if (!r_anal_var_check_name (new_name))
|
||||
return 0;
|
||||
if (scope>0) { // local
|
||||
|
@ -12,12 +12,14 @@ typedef struct{
|
||||
const int type;
|
||||
} gb_opcode;
|
||||
|
||||
#ifndef GB_DIS_LEN_ONLY
|
||||
static const char *cb_ops[]={ "rlc","rrc","rl","rr","sla","sra","swap","srl",
|
||||
"bit 0,","bit 1,","bit 2,","bit 3,","bit 4,","bit 5,","bit 6,","bit 7,",
|
||||
"res 0,","res 1,","res 2,","res 3,","res 4,","res 5,","res 6,","res 7,",
|
||||
"set 0,","set 1,","set 2,","set 3,","set 4,","set 5,","set 6,","set 7,"};
|
||||
|
||||
static const char *cb_regs[]={ "b","c","d","e","h","l","[hl]","a"};
|
||||
#endif
|
||||
|
||||
static gb_opcode gb_op[] = {
|
||||
{"nop" ,GB_8BIT}, //0x00
|
||||
|
@ -22,6 +22,7 @@ static int gbOpLength(int gboptype){
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef GB_DIS_LEN_ONLY
|
||||
static int gbDisass(RAsmOp *op, const ut8 *buf, int len){
|
||||
int foo = gbOpLength (gb_op[buf[0]].type);
|
||||
if (len<foo)
|
||||
@ -45,3 +46,4 @@ static int gbDisass(RAsmOp *op, const ut8 *buf, int len){
|
||||
}
|
||||
return foo;
|
||||
}
|
||||
#endif
|
||||
|
@ -6,9 +6,7 @@
|
||||
#include <r_asm.h>
|
||||
#include <r_core.h>
|
||||
|
||||
#undef R_API
|
||||
#undef R_IPI
|
||||
#define R_API static inline
|
||||
#define R_IPI static
|
||||
#include "../../shlr/java/ops.c"
|
||||
#include "../../shlr/java/class.c"
|
||||
|
@ -4,11 +4,9 @@
|
||||
#include <r_util.h>
|
||||
#include <r_lib.h>
|
||||
#include <r_bin.h>
|
||||
#undef R_API
|
||||
#define R_API static inline
|
||||
#undef R_IPI
|
||||
#define R_IPI static inline
|
||||
#include "../../shlr/java/class.c"
|
||||
#undef R_API
|
||||
#define R_API
|
||||
|
||||
#define IFDBG_BIN_JAVA if(0)
|
||||
|
||||
|
@ -31,6 +31,7 @@ R_API void r_flag_item_free (RFlagItem *item) {
|
||||
}
|
||||
|
||||
R_API RFlag *r_flag_free(RFlag *f) {
|
||||
#if 0
|
||||
RFlagItem *item;
|
||||
RListIter *iter;
|
||||
r_list_foreach (f->flags, iter, item) {
|
||||
@ -39,6 +40,7 @@ R_API RFlag *r_flag_free(RFlag *f) {
|
||||
list = r_hashtable64_lookup (f->ht_off, item->offset);
|
||||
// XXX: segfault sometimes wtf -- r_list_free (list);
|
||||
}
|
||||
#endif
|
||||
r_hashtable64_free (f->ht_off);
|
||||
r_hashtable64_free (f->ht_name);
|
||||
r_list_free (f->flags);
|
||||
|
@ -460,5 +460,3 @@ R_API int r_anal_ex_bb_address_comparator(RAnalBlock *a, RAnalBlock *b);
|
||||
#define R_ANAL_EX_LDST_STORE_PUT_FIELD_STR "load from_ref to_stack ref"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -292,6 +292,7 @@ R_API const ut8* r_io_get_raw (RIO *io, ut64 addr, int *len);
|
||||
R_API RBuffer *r_io_read_buf(RIO *io, ut64 addr, int len);
|
||||
R_API int r_io_vread (RIO *io, ut64 vaddr, ut8 *buf, int len);
|
||||
R_API int r_io_mread (RIO *io, int fd, ut64 maddr, ut8 *buf, int len);
|
||||
R_API int r_io_pread (RIO *io, ut64 paddr, ut8 *buf, int len);
|
||||
R_API int r_io_read(RIO *io, ut8 *buf, int len);
|
||||
R_API int r_io_read_at(RIO *io, ut64 addr, ut8 *buf, int len);
|
||||
R_API ut64 r_io_read_i(RIO *io, ut64 addr, int sz, int endian);
|
||||
|
@ -259,13 +259,9 @@ R_API ut64 r_io_map_select_current_fd(RIO *io, ut64 off, int fd) {
|
||||
ut64 paddr = off;
|
||||
RIOMap *im = NULL;
|
||||
RListIter *iter;
|
||||
ut64 prevfrom = 0LL;
|
||||
r_list_foreach (io->maps, iter, im) {
|
||||
if (im->fd != fd) continue;
|
||||
|
||||
if (off>=im->from) {
|
||||
prevfrom = im->from;
|
||||
}
|
||||
if (off >= im->from && off < im->to) {
|
||||
paddr = off - im->from + im->delta; //-im->from;
|
||||
done = 1;
|
||||
|
@ -45,9 +45,8 @@ read all sections via mread, resolve maps for unsectioned areas and fill the gap
|
||||
R_API int r_io_vread (RIO *io, ut64 vaddr, ut8 *buf, int len) {
|
||||
int tmp_len = len;
|
||||
ut8 *tmp_buf = buf;
|
||||
ut64 vendaddr, maddr, mendaddr, tmp_vaddr = vaddr;
|
||||
ut64 vendaddr, maddr, tmp_vaddr = vaddr;
|
||||
RIOMap *map;
|
||||
RIODesc *desc;
|
||||
RIOSection *section;
|
||||
RIORange *range;
|
||||
RList *sections, *ranges = NULL, *maps;
|
||||
@ -138,13 +137,13 @@ R_API int r_io_mread (RIO *io, int fd, ut64 maddr, ut8 *buf, int len) {
|
||||
}
|
||||
if (endaddr > map->to) { //check if endaddr is in the map
|
||||
if (maddr > map->to) //check segfault
|
||||
return NULL;
|
||||
return R_FAIL;
|
||||
endaddr = map->to; //adjust endaddr
|
||||
read_bytes = endaddr - maddr; //adjust read_bytes
|
||||
}
|
||||
if (maddr < map->from) { //adjusting things here will make vread very easy, because you can just get a list of fds in the range and the throw every fd on this function
|
||||
if (endaddr < map->from) //check segfaults
|
||||
return NULL;
|
||||
return R_FAIL;
|
||||
d = map->from - maddr; //get difference between maddr and start of the map
|
||||
if (read_bytes < d) //check if adjusting would cause segfaults
|
||||
return R_FAIL;
|
||||
@ -191,6 +190,9 @@ R_API int r_io_pread (RIO *io, ut64 paddr, ut8 *buf, int len) {
|
||||
read_from = "File";
|
||||
bytes_read = read (io->desc->fd, buf, len);
|
||||
}
|
||||
if (bytes_read<0) {
|
||||
eprintf ("pread error: %s\n", read_from);
|
||||
}
|
||||
return bytes_read;
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ R_API int r_search_bmh (const RSearchKeyword *kw, const ut64 from, const ut8 *bu
|
||||
R_API int r_search_mybinparse_update(void *_s, ut64 from, const ut8 *buf, int len) {
|
||||
RSearch *s = (RSearch*)_s;
|
||||
RListIter *iter;
|
||||
ut64 offset;
|
||||
//ut64 offset;
|
||||
int count = 0;
|
||||
|
||||
#if USE_BMH
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define IFDBG if(DO_THE_DBG)
|
||||
#define IFINT if(0)
|
||||
|
||||
static char * U(r_bin_java_unmangle_method)(const char *flags, const char *name, const char *params, const char *r_value);
|
||||
R_API char * U(r_bin_java_unmangle_method)(const char *flags, const char *name, const char *params, const char *r_value);
|
||||
static int r_bin_java_is_fm_type_private( RBinJavaField *fm_type);
|
||||
static int r_bin_java_is_fm_type_protected( RBinJavaField *fm_type);
|
||||
static ut32 U(r_bin_java_swap_uint)(ut32 x);
|
||||
@ -3265,7 +3265,7 @@ static RBinJavaAttrInfo* r_bin_java_line_number_table_attr_new (ut8 *buffer, ut6
|
||||
cur_location = buf_offset+offset;
|
||||
lnattr = R_NEW0(RBinJavaLineNumberAttribute);
|
||||
if (!lnattr) {
|
||||
eprintf ("Handling Local Variable Table Attributes :Unable to allocate memory (%lu bytes) for a new exception handler structure.\n", sizeof (RBinJavaLocalVariableAttribute));
|
||||
eprintf ("Handling Local Variable Table Attributes :Unable to allocate memory (%u bytes) for a new exception handler structure.\n", (int)sizeof (RBinJavaLocalVariableAttribute));
|
||||
break;
|
||||
}
|
||||
lnattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);
|
||||
@ -8124,7 +8124,7 @@ R_API ut8 * r_bin_java_cp_get_bytes(ut8 tag, ut32 *out_sz, const ut8 *buf, const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
R_API ut32 r_bin_java_cp_get_size(RBinJavaObj *bin, ut16 idx){
|
||||
R_API ut32 r_bin_java_cp_get_size(RBinJavaObj *bin, ut16 idx) {
|
||||
RBinJavaCPTypeObj* cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, idx);
|
||||
switch (cp_obj->tag) {
|
||||
case R_BIN_JAVA_CP_INTEGER:
|
||||
@ -8189,7 +8189,7 @@ static void U(r_bin_java_stack_frame_default_free) (void *s) {
|
||||
}
|
||||
static void U(r_bin_java_stack_frame_do_nothing_free) (void /*RBinJavaStackMapFrame*/ *stack_frame) {}
|
||||
static void U(r_bin_java_stack_frame_do_nothing_new) (RBinJavaObj *bin, RBinJavaStackMapFrame *stack_frame, ut64 offset) {}
|
||||
static RBinJavaCPTypeMetas* U(r_bin_java_get_cp_meta_from_tag)(ut8 tag) {
|
||||
static inline RBinJavaCPTypeMetas* U(r_bin_java_get_cp_meta_from_tag)(ut8 tag) {
|
||||
ut16 i = 0;
|
||||
// set default to unknown.
|
||||
RBinJavaCPTypeMetas *res = &R_BIN_JAVA_CP_METAS[2];
|
||||
@ -8202,7 +8202,7 @@ static RBinJavaCPTypeMetas* U(r_bin_java_get_cp_meta_from_tag)(ut8 tag) {
|
||||
return res;
|
||||
}
|
||||
|
||||
static ut8 * U(r_bin_java_cp_append_ref_cname_fname_ftype) (RBinJavaObj *bin, ut32 *out_sz, ut8 tag, const char *cname, const ut32 c_len, const char *fname, const ut32 f_len, const char *tname, const ut32 t_len ) {
|
||||
static inline ut8 * U(r_bin_java_cp_append_ref_cname_fname_ftype) (RBinJavaObj *bin, ut32 *out_sz, ut8 tag, const char *cname, const ut32 c_len, const char *fname, const ut32 f_len, const char *tname, const ut32 t_len ) {
|
||||
ut32 cn_len = 0, fn_len = 0, ft_len = 0;
|
||||
ut16 cn_idx = 0, fn_idx = 0, ft_idx = 0;
|
||||
ut8* bytes = NULL, *cn_bytes = NULL, *fn_bytes = NULL, *ft_bytes = NULL, *cref_bytes = NULL, *fref_bytes = NULL, *fnt_bytes = NULL;
|
||||
@ -8255,13 +8255,14 @@ static ut8 * U(r_bin_java_cp_append_ref_cname_fname_ftype) (RBinJavaObj *bin, ut
|
||||
free (cref_bytes);
|
||||
return bytes;
|
||||
}
|
||||
static ut8 * U(r_bin_java_cp_get_method_ref) (RBinJavaObj *bin, ut32 *out_sz, ut16 class_idx, ut16 name_and_type_idx ) {
|
||||
static inline ut8 * U(r_bin_java_cp_get_method_ref) (RBinJavaObj *bin, ut32 *out_sz, ut16 class_idx, ut16 name_and_type_idx ) {
|
||||
return r_bin_java_cp_get_fm_ref (bin, out_sz, R_BIN_JAVA_CP_METHODREF, class_idx, name_and_type_idx );
|
||||
}
|
||||
static ut8 * U(r_bin_java_cp_get_field_ref) (RBinJavaObj *bin, ut32 *out_sz, ut16 class_idx, ut16 name_and_type_idx ) {
|
||||
static inline ut8 * U(r_bin_java_cp_get_field_ref) (RBinJavaObj *bin, ut32 *out_sz, ut16 class_idx, ut16 name_and_type_idx ) {
|
||||
return r_bin_java_cp_get_fm_ref (bin, out_sz, R_BIN_JAVA_CP_FIELDREF, class_idx, name_and_type_idx );
|
||||
}
|
||||
R_IPI void U(deinit_java_type_null)() {
|
||||
|
||||
R_API void U(deinit_java_type_null)() {
|
||||
free (R_BIN_JAVA_NULL_TYPE.metas);
|
||||
}
|
||||
|
||||
|
@ -388,7 +388,6 @@ ST_FUNC int tcc_open(TCCState *s1, const char *filename)
|
||||
static int tcc_compile(TCCState *s1)
|
||||
{
|
||||
Sym *define_start;
|
||||
SValue *pvtop;
|
||||
|
||||
#ifdef INC_DEBUG
|
||||
printf("%s: **** new file\n", file->filename);
|
||||
@ -441,7 +440,7 @@ static int tcc_compile(TCCState *s1)
|
||||
ch = file->buf_ptr[0];
|
||||
tok_flags = TOK_FLAG_BOL | TOK_FLAG_BOF;
|
||||
parse_flags = PARSE_FLAG_PREPROCESS | PARSE_FLAG_TOK_NUM;
|
||||
pvtop = vtop;
|
||||
//pvtop = vtop;
|
||||
next();
|
||||
decl(VT_CONST);
|
||||
if (tok != TOK_EOF)
|
||||
|
Loading…
Reference in New Issue
Block a user