Replace some instances of eprintf with R_LOG_

This commit is contained in:
Richard Patel 2022-06-28 02:49:42 +02:00 committed by GitHub
parent 8d88e1208d
commit 363df75c06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
123 changed files with 396 additions and 396 deletions

View File

@ -882,7 +882,7 @@ static bool mnem_jb(char const*const*arg, ut16 pc, ut8**out) {
static bool mnem_jbc(char const*const*arg, ut16 pc, ut8**out) {
ut8 cmp_addr;
if (!address_bit (arg[0], &cmp_addr)) {
eprintf ("error during the assembly: address bit not found\n");
R_LOG_ERROR ("error during the assembly: address bit not found");
return false;
}

View File

@ -428,7 +428,7 @@ static bool v850np_disassemble(v850np_inst *inst, int cpumodel, ut64 memaddr, co
bool invalid = false;
value = get_operand_value (operand, insn, buffer + 2, buffer_size - 2, &invalid);
if (invalid) {
// eprintf ("Warning: Cannot get operand value.\n");
// R_LOG_WARN ("Cannot get operand value.");
break;
}

View File

@ -273,7 +273,7 @@ static st32 parse_type(Context *ctx, const ut64 offset, RStrBuf *strbuf, ut64 *s
*visited = su;
}
if (visited && set_u_contains (*visited, offset)) {
eprintf ("Warning: anal.dwarf.parse_type: infinite recursion detected.\n");
R_LOG_WARN ("anal.dwarf.parse_type: infinite recursion detected.");
return -1;
}
set_u_add (*visited, offset);
@ -1039,7 +1039,7 @@ static const char *map_dwarf_reg_to_ppc64_reg(ut64 reg_num, VariableLocationKind
/* returns string literal register name!
TODO add more arches */
static const char *get_dwarf_reg_name(const char *arch, int reg_num, VariableLocationKind *kind, int bits) {
R_LOG_DEBUG ("get_dwarf_reg_name %s %d\n", arch, bits);
R_LOG_DEBUG ("get_dwarf_reg_name %s %d", arch, bits);
if (arch && !strcmp (arch, "x86")) {
if (bits == 64) {
return map_dwarf_reg_to_x86_64_reg (reg_num, kind);

View File

@ -441,15 +441,15 @@ static bool internal_esil_reg_write_no_null(RAnalEsil *esil, const char *regname
const char *bp = r_reg_get_name (esil->anal->reg, R_REG_NAME_BP);
if (!pc) {
eprintf ("Warning: RReg profile does not contain PC register\n");
R_LOG_WARN ("RReg profile does not contain PC register");
return false;
}
if (!sp) {
eprintf ("Warning: RReg profile does not contain SP register\n");
R_LOG_WARN ("RReg profile does not contain SP register");
return false;
}
if (!bp) {
eprintf ("Warning: RReg profile does not contain BP register\n");
R_LOG_WARN ("RReg profile does not contain BP register");
return false;
}
if (reg && reg->name && ((strcmp (reg->name , pc) && strcmp (reg->name, sp) && strcmp(reg->name, bp)) || num)) { //I trust k-maps
@ -3745,7 +3745,7 @@ R_API int r_anal_esil_condition(RAnalEsil *esil, const char *str) {
}
free (popped);
} else {
eprintf ("Warning: Cannot pop because The ESIL stack is empty\n");
R_LOG_WARN ("Cannot pop because The ESIL stack is empty");
return -1;
}
return ret;

View File

@ -62,7 +62,7 @@ R_API RAnalEsilTrace *r_anal_esil_trace_new(RAnalEsil *esil) {
}
return trace;
error:
eprintf ("error\n");
R_LOG_ERROR ("error");
r_anal_esil_trace_free (trace);
return NULL;
}
@ -88,7 +88,7 @@ static void add_reg_change(RAnalEsilTrace *trace, int idx, RRegItem *ri, ut64 da
if (!vreg) {
vreg = r_vector_new (sizeof (RAnalEsilRegChange), NULL, NULL);
if (!vreg) {
eprintf ("Error: creating a register vector.\n");
R_LOG_ERROR ("creating a register vector.");
return;
}
ht_up_insert (trace->registers, addr, vreg);
@ -103,7 +103,7 @@ static void add_mem_change(RAnalEsilTrace *trace, int idx, ut64 addr, ut8 data)
if (!vmem) {
vmem = r_vector_new (sizeof (RAnalEsilMemChange), NULL, NULL);
if (!vmem) {
eprintf ("Error: creating a memory vector.\n");
R_LOG_ERROR ("creating a memory vector.");
return;
}
ht_up_insert (trace->memory, addr, vmem);

View File

@ -667,7 +667,7 @@ static int fcn_recurse(RAnal *anal, RAnalFunction *fcn, ut64 addr, ut64 len, int
}
if ((maxlen - (addrbytes * idx)) > MAX_SCAN_SIZE) {
if (anal->verbose) {
eprintf ("Warning: Skipping large memory region.\n");
R_LOG_WARN ("Skipping large memory region.");
}
maxlen = 0;
}
@ -699,19 +699,19 @@ repeat:
ret = read_ahead (anal, at, buf, bytes_read);
if (ret < 0) {
eprintf ("Failed to read\n");
R_LOG_ERROR ("Failed to read");
break;
}
if (is_invalid_memory (anal, buf, bytes_read)) {
if (anal->verbose) {
eprintf ("Warning: FFFF opcode at 0x%08"PFMT64x "\n", at);
R_LOG_WARN ("FFFF opcode at 0x%08"PFMT64x, at);
}
gotoBeach (R_ANAL_RET_ERROR)
}
r_anal_op_fini (op);
if ((oplen = r_anal_op (anal, op, at, buf, bytes_read, R_ANAL_OP_MASK_ESIL | R_ANAL_OP_MASK_VAL | R_ANAL_OP_MASK_HINT)) < 1) {
if (anal->verbose) {
eprintf ("Invalid instruction at 0x%"PFMT64x" with %d bits\n", at, anal->config->bits);
R_LOG_WARN ("Invalid instruction at 0x%"PFMT64x" with %d bits", at, anal->config->bits);
}
// gotoBeach (R_ANAL_RET_ERROR);
// RET_END causes infinite loops somehow
@ -1690,12 +1690,12 @@ R_API RAnalFunction *r_anal_get_function_byname(RAnal *a, const char *name) {
R_API bool r_anal_function_add_bb(RAnal *a, RAnalFunction *fcn, ut64 addr, ut64 size, ut64 jump, ut64 fail, R_BORROW RAnalDiff *diff) {
D eprintf ("Add bb\n");
if (size == 0) { // empty basic blocks allowed?
eprintf ("Warning: empty basic block at 0x%08"PFMT64x" is not allowed. pending discussion.\n", addr);
R_LOG_WARN ("empty basic block at 0x%08"PFMT64x" is not allowed. pending discussion.", addr);
r_warn_if_reached ();
return false;
}
if (size > a->opt.bb_max_size) {
eprintf ("Warning: can't allocate such big bb of %"PFMT64d" bytes at 0x%08"PFMT64x"\n", (st64)size, addr);
R_LOG_WARN ("can't allocate such big bb of %"PFMT64d" bytes at 0x%08"PFMT64x, (st64)size, addr);
r_warn_if_reached ();
return false;
}
@ -1720,7 +1720,7 @@ R_API bool r_anal_function_add_bb(RAnal *a, RAnalFunction *fcn, ut64 addr, ut64
}
if (!block) {
D eprintf ("Warning: r_anal_function_add_bb failed in fcn 0x%08"PFMT64x" at 0x%08"PFMT64x"\n", fcn->addr, addr);
D R_LOG_WARN ("r_anal_function_add_bb failed in fcn 0x%08"PFMT64x" at 0x%08"PFMT64x, fcn->addr, addr);
return false;
}
@ -1775,7 +1775,7 @@ R_API int r_anal_function_complexity(RAnalFunction *fcn) {
r_list_foreach (fcn->bbs, iter, bb) {
N++; // nodes
if ((!anal || anal->verbose) && bb->jump == UT64_MAX && bb->fail != UT64_MAX) {
eprintf ("Warning: invalid bb jump/fail pair at 0x%08"PFMT64x" (fcn 0x%08"PFMT64x"\n", bb->addr, fcn->addr);
R_LOG_WARN ("invalid bb jump/fail pair at 0x%08"PFMT64x" (fcn 0x%08"PFMT64x, bb->addr, fcn->addr);
}
if (bb->jump == UT64_MAX && bb->fail == UT64_MAX) {
P++; // exit nodes
@ -1792,7 +1792,7 @@ R_API int r_anal_function_complexity(RAnalFunction *fcn) {
int result = E - N + (2 * P);
if (result < 1 && (!anal || anal->verbose)) {
eprintf ("Warning: CC = E(%d) - N(%d) + (2 * P(%d)) < 1 at 0x%08"PFMT64x"\n", E, N, P, fcn->addr);
R_LOG_WARN ("CC = E(%d) - N(%d) + (2 * P(%d)) < 1 at 0x%08"PFMT64x, E, N, P, fcn->addr);
}
// r_return_val_if_fail (result > 0, 0);
return result;

View File

@ -917,7 +917,7 @@ static ut8 parse_leaf(const RAnal *anal, RBuffer *b, RFlirtNode *node) {
}
#if DEBUG
if (crc_length == 0x00 && crc16 != 0x0000) {
eprintf ("Warning: non zero crc of zero length @ %04X\n",
R_LOG_WARN ("non zero crc of zero length @ %04X",
r_buf_tell (b) + header_size);
}
eprintf ("crc_len: %02X crc16: %04X\n", crc_length, crc16);
@ -1467,7 +1467,7 @@ R_API void r_sign_flirt_scan(RAnal *anal, const char *flirt_file) {
r_buf_free (flirt_buf);
if (node) {
if (!node_match_functions (anal, node)) {
eprintf ("Error while scanning the file %s\n", flirt_file);
R_LOG_ERROR ("Error while scanning the file %s", flirt_file);
}
node_free (node);
return;

View File

@ -141,7 +141,7 @@ R_API int r_anal_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int le
}
if (!op->mnemonic && (mask & R_ANAL_OP_MASK_DISASM)) {
if (anal->verbose) {
eprintf ("Warning: unhandled R_ANAL_OP_MASK_DISASM in r_anal_op\n");
R_LOG_WARN ("unhandled R_ANAL_OP_MASK_DISASM in r_anal_op");
}
}
if (mask & R_ANAL_OP_MASK_HINT) {

View File

@ -4465,7 +4465,7 @@ static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAn
cs_open (CS_ARCH_ARM, mode, &handle);
cs_option (handle, CS_OPT_DETAIL, CS_OPT_ON);
if (ret != CS_ERR_OK) {
R_LOG_ERROR ("Capstone failed: cs_open(CS_ARCH_ARM%s, %x, ...): %s\n",
R_LOG_ERROR ("Capstone failed: cs_open(CS_ARCH_ARM%s, %x, ...): %s",
(a->config->bits == 64) ? "64" : "",
mode,
cs_strerror (ret));

View File

@ -953,7 +953,7 @@ static void anop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len,
val = 0x8000000000000000;
break;
default:
eprintf ("Error: unknown operand size: %d\n", gop.insn->detail->x86.operands[0].size);
R_LOG_ERROR ("unknown operand size: %d", gop.insn->detail->x86.operands[0].size);
val = 256;
}
ut32 bitsize;

View File

@ -31,7 +31,7 @@ static csh init_capstone (RAnal *a) {
if (cs_handle == 0) {
int ret = cs_open (CSINC_ARCH, mode, &cs_handle);
if (ret != CS_ERR_OK) {
R_LOG_ERROR ("Capstone failed: cs_open(%#x, %#x): %s\n", CSINC_ARCH, mode, cs_strerror (ret));
R_LOG_ERROR ("Capstone failed: cs_open(%#x, %#x): %s", CSINC_ARCH, mode, cs_strerror (ret));
cs_handle = 0;
} else {
cs_option (cs_handle, CS_OPT_DETAIL, CS_OPT_ON);

View File

@ -196,7 +196,7 @@ static bool rtti_itanium_vmi_class_type_info_init(RVTableContext *context, ut64
}
at = at & 0xffffffff;
if (at < 1 || at > 0xfffff) {
eprintf ("Error reading vmi_base_count\n");
R_LOG_ERROR ("Error reading vmi_base_count");
return false;
}
vmi_cti->vmi_base_count = at;

View File

@ -169,7 +169,7 @@ static RList *rtti_msvc_read_base_class_array(RVTableContext *context, ut32 num_
if (num_base_classes > BASE_CLASSES_MAX) {
if (context->anal->verbose) {
eprintf ("Warning: Length of base class array at 0x%08"PFMT64x" exceeds %d.\n", addr, BASE_CLASSES_MAX);
R_LOG_WARN ("Length of base class array at 0x%08"PFMT64x" exceeds %d.", addr, BASE_CLASSES_MAX);
}
num_base_classes = BASE_CLASSES_MAX;
}
@ -769,7 +769,7 @@ RecoveryCompleteObjectLocator *recovery_anal_complete_object_locator(RRTTIMSVCAn
}
if (!td->valid) {
if (context->vt_context->anal->verbose) {
eprintf ("Warning: type descriptor of base is invalid.\n");
R_LOG_WARN ("type descriptor of base is invalid.");
}
continue;
}
@ -814,7 +814,7 @@ static char *unique_class_name(RAnal *anal, const char *original_name) {
char *name = NULL;
if (anal->verbose) {
eprintf ("Warning: class name %s already taken!\n", original_name);
R_LOG_WARN ("class name %s already taken!", original_name);
}
int i = 1;
@ -858,14 +858,14 @@ static void recovery_apply_bases(RRTTIMSVCAnalContext *context, const char *clas
r_vector_foreach (base_descs, base_desc) {
RecoveryTypeDescriptor *base_td = base_desc->td;
if (!base_td->valid) {
eprintf ("Warning Base td is invalid!\n");
R_LOG_WARN ("Warning Base td is invalid!");
continue;
}
const char *base_class_name;
if (!base_td->col) {
if (context->vt_context->anal->verbose) {
eprintf ("Warning: Base td %s has no col. Falling back to recovery from td only.\n", base_td->td.name);
R_LOG_WARN ("Base td %s has no col. Falling back to recovery from td only.", base_td->td.name);
}
base_class_name = recovery_apply_type_descriptor (context, base_td);
} else {
@ -896,7 +896,7 @@ static const char *recovery_apply_complete_object_locator(RRTTIMSVCAnalContext *
if (!col->td) {
if (context->vt_context->anal->verbose) {
eprintf ("Warning: no td for col at 0x%"PFMT64x"\n", col->addr);
R_LOG_WARN ("no td for col at 0x%"PFMT64x, col->addr);
}
return NULL;
}

View File

@ -201,7 +201,7 @@ static bool types_sig_valid(const char *types) {
#define DBL_VAL_FAIL(x,y) \
if (x) { \
eprintf ("Warning: Skipping signature with multiple %c signatures (%s)\n", y, k); \
R_LOG_WARN ("Skipping signature with multiple %c signatures (%s)", y, k); \
success = false; \
goto out; \
}
@ -219,12 +219,12 @@ R_API bool r_sign_deserialize(RAnal *a, RSignItem *it, const char *k, const char
// Deserialize key: zign|space|name
int n = r_str_split (k2, '|');
if (n != 3) {
eprintf ("Warning: Skipping signature with invalid key (%s)\n", k);
R_LOG_WARN ("Skipping signature with invalid key (%s)", k);
success = false;
goto out;
}
if (strcmp (r_str_word_get0 (k2, 0), "zign")) {
eprintf ("Warning: Skipping signature with invalid value (%s)\n", k);
R_LOG_WARN ("Skipping signature with invalid value (%s)", k);
success = false;
goto out;
}
@ -251,7 +251,7 @@ R_API bool r_sign_deserialize(RAnal *a, RSignItem *it, const char *k, const char
continue;
}
if (strlen (word) < 3 || word[1] != ':') {
eprintf ("Warning: Skipping signature with corrupted serialization (%s:%s)\n", k, word);
R_LOG_WARN ("Skipping signature with corrupted serialization (%s:%s)", k, word);
success = false;
goto out;
}
@ -699,12 +699,12 @@ static bool addBBHash(RAnal *a, RAnalFunction *fcn, const char *name) {
R_API bool r_sign_add_hash(RAnal *a, const char *name, int type, const char *val, int len) {
r_return_val_if_fail (a && name && type && val && len > 0, false);
if (type != R_SIGN_BBHASH) {
eprintf ("error: hash type unknown\n");
R_LOG_ERROR ("error: hash type unknown");
return false;
}
int digestsize = r_hash_size (R_ZIGN_HASH) * 2;
if (len != digestsize) {
eprintf ("error: invalid hash size: %d (%s digest size is %d)\n", len, ZIGN_HASH, digestsize);
R_LOG_ERROR ("error: invalid hash size: %d (%s digest size is %d)", len, ZIGN_HASH, digestsize);
return false;
}
return addHash (a, name, type, val);
@ -982,7 +982,7 @@ R_API bool r_sign_addto_item(RAnal *a, RSignItem *it, RAnalFunction *fcn, RSignT
}
break;
default:
eprintf ("Error: %s Can not handle type %c\n", __FUNCTION__, type);
R_LOG_ERROR ("%s Can not handle type %c", __FUNCTION__, type);
}
return false;
@ -2031,7 +2031,7 @@ static bool foreachCB(void *user, const char *k, const char *v) {
keep_going = ctx->cb (it, ctx->user);
}
} else {
eprintf ("error: cannot deserialize zign\n");
R_LOG_ERROR ("error: cannot deserialize zign");
}
if (ctx->freeit) {
r_sign_item_free (it);
@ -2873,7 +2873,7 @@ static bool loadCB(void *user, const char *k, const char *v) {
}
}
} else {
eprintf ("error: cannot deserialize zign\n");
R_LOG_ERROR ("error: cannot deserialize zign");
}
r_sign_item_free (it);
return true;
@ -2921,7 +2921,7 @@ R_API bool r_sign_load(RAnal *a, const char *file, bool merge) {
}
char *path = r_sign_path (a, file);
if (!r_file_exists (path)) {
eprintf ("error: file %s does not exist\n", file);
R_LOG_ERROR ("error: file %s does not exist", file);
free (path);
return false;
}
@ -2946,37 +2946,37 @@ R_API bool r_sign_load_gz(RAnal *a, const char *filename, bool merge) {
char *path = r_sign_path (a, filename);
if (!r_file_exists (path)) {
eprintf ("error: file %s does not exist\n", filename);
R_LOG_ERROR ("error: file %s does not exist", filename);
retval = false;
goto out;
}
if (!(buf = r_file_gzslurp (path, &size, 0))) {
eprintf ("error: cannot decompress file\n");
R_LOG_ERROR ("error: cannot decompress file");
retval = false;
goto out;
}
if (!(tmpfile = r_file_temp ("r2zign"))) {
eprintf ("error: cannot create temp file\n");
R_LOG_ERROR ("error: cannot create temp file");
retval = false;
goto out;
}
if (!r_file_dump (tmpfile, buf, size, 0)) {
eprintf ("error: cannot dump file\n");
R_LOG_ERROR ("error: cannot dump file");
retval = false;
goto out;
}
if (!r_sign_load (a, tmpfile, merge)) {
eprintf ("error: cannot load file\n");
R_LOG_ERROR ("error: cannot load file");
retval = false;
goto out;
}
if (!r_file_rm (tmpfile)) {
eprintf ("error: cannot delete temp file\n");
R_LOG_ERROR ("error: cannot delete temp file");
retval = false;
goto out;
}
@ -2993,7 +2993,7 @@ R_API bool r_sign_save(RAnal *a, const char *file) {
r_return_val_if_fail (a && file, false);
if (sdb_isempty (a->sdb_zigns)) {
eprintf ("Warning: no zignatures to save\n");
R_LOG_WARN ("no zignatures to save");
return false;
}

View File

@ -941,7 +941,7 @@ static void extract_arg(RAnal *anal, RAnalFunction *fcn, RAnalOp *op, const char
const char *rn = op->dst->reg ? op->dst->reg->name : NULL;
if (rn && ((bp && !strcmp (bp, rn)) || (sp && !strcmp (sp, rn)))) {
if (anal->verbose) {
eprintf ("Warning: Analysis didn't fill op->stackop for instruction that alters stack at 0x%" PFMT64x ".\n", op->addr);
R_LOG_WARN ("Analysis didn't fill op->stackop for instruction that alters stack at 0x%" PFMT64x ".", op->addr);
}
goto beach;
}
@ -969,7 +969,7 @@ static void extract_arg(RAnal *anal, RAnalFunction *fcn, RAnalOp *op, const char
}
if (anal->verbose && (!op->src[0] || !op->dst)) {
eprintf ("Warning: Analysis didn't fill op->src/dst at 0x%" PFMT64x ".\n", op->addr);
R_LOG_WARN ("Analysis didn't fill op->src/dst at 0x%" PFMT64x ".", op->addr);
}
int rw = (op->direction == R_ANAL_OP_DIR_WRITE) ? R_ANAL_VAR_ACCESS_TYPE_WRITE : R_ANAL_VAR_ACCESS_TYPE_READ;
@ -1158,7 +1158,7 @@ R_API void r_anal_extract_rarg(RAnal *anal, RAnalOp *op, RAnalFunction *fcn, int
const char *opdreg = op->dst ? get_regname (anal, op->dst) : NULL;
const int size = (fcn->bits ? fcn->bits : anal->config->bits) / 8;
if (!fcn->cc) {
R_LOG_DEBUG ("No calling convention for function '%s' to extract register arguments\n", fcn->name);
R_LOG_DEBUG ("No calling convention for function '%s' to extract register arguments", fcn->name);
return;
}
char *fname = r_type_func_guess (anal->sdb_types, fcn->name);

View File

@ -245,7 +245,7 @@ void (store_opN)(struct op_parameter par) {
def_op (.op_obj = par.op_obj, .op_name = par.op_name, .op_code = par.op_code, .pop = par.pop, .push = par.push);
break;
default:
eprintf ("Error in store_op in opcode.c, call function %u.\n", par.func);
R_LOG_ERROR ("Error in store_op in opcode.c, call function %u.", par.func);
return;
}
par.op_obj[par.op_code].type |= HASSTORE;
@ -294,6 +294,6 @@ void (rm_op)(struct op_parameter par) {
op_obj->op_name = r_str_newf ("<%u>", par.op_code);
op_obj->type = op_obj->op_pop = op_obj->op_push = 0;
} else {
eprintf ("Error in rm_op() while constructing opcodes for .pyc file: \n .op_code = %u, .op_name = %s", par.op_code, par.op_name);
R_LOG_ERROR ("Error in rm_op() while constructing opcodes for .pyc file: \n .op_code = %u, .op_name = %s", par.op_code, par.op_name);
}
}

View File

@ -122,7 +122,7 @@ static int riscv_rri(ut8 *b, int op, int rs, int rt, int imm) {
static int getreg(const char *p) {
int n;
if (!p || !*p) {
eprintf ("Missing argument\n");
R_LOG_ERROR ("Missing argument");
return -1;
}
/* check if it's a register */
@ -147,7 +147,7 @@ static int getreg(const char *p) {
if (n != 0 || p[0] == '0') {
return n;
}
eprintf ("Invalid reg name (%s) at pos %d\n", p, n);
R_LOG_ERROR ("Invalid reg name (%s) at pos %d", p, n);
return -1;
}
@ -216,7 +216,7 @@ R_IPI int riscv_assemble(const char *str, ut64 pc, ut8 *out) {
free (s);
return 4;
default:
eprintf ("Unknown type\n");
R_LOG_ERROR ("Unknown type");
break;
}
free (s);

View File

@ -43,7 +43,7 @@ static ut32 get_q_bits(ut32 val, const char *ins, ut32 ins_len, int *err_code) {
res = (val >> 10) & 1;
} else {
/* INVALID CONDITION */
eprintf ("Invalid token %s\n", ins);
R_LOG_ERROR ("Invalid token %s", ins);
*err_code = -1;
}
return res;
@ -74,7 +74,7 @@ static ut32 get_ins_bits(ut32 hash_code, ut32 ins_pos, const char *ins,
if (!aux) {
aux = strchr (op_str, ins[i]);
if (!aux) {
eprintf ("Invalid token %s\n", ins); *err_code = -1; return 0;
R_LOG_ERROR ("Invalid token %s", ins); *err_code = -1; return 0;
}
}
@ -101,7 +101,7 @@ static bool check_arg(ut32 ins_bits, int *err_code) {
} else if (ins_bits >= 32 && ins_bits <= 252) {
res = false;
} else {
eprintf ("Invalid arg: %u\n", ins_bits);
R_LOG_ERROR ("Invalid arg: %u", ins_bits);
*err_code = -1;
}
@ -122,7 +122,7 @@ static char *decode_regis(char *reg_arg, st32 hash_code, ut32 ins_bits,
break;
case 100:
if (r_str_ncasecmp (reg_arg, "d(ALLx", 6)) {
eprintf ("invalid register! %s\n", reg_arg);
R_LOG_ERROR ("invalid register! %s", reg_arg);
*err_code = -1;
return NULL;
}
@ -133,7 +133,7 @@ static char *decode_regis(char *reg_arg, st32 hash_code, ut32 ins_bits,
break;
case 41:
if (r_str_ncasecmp (reg_arg, ")ALLx", 5)) {
eprintf ("invalid register! %s\n", reg_arg);
R_LOG_ERROR ("invalid register! %s", reg_arg);
*err_code = -1;
return NULL;
}
@ -226,7 +226,7 @@ static char *decode_ins(st32 hash_code, ut32 ins_pos, ut32 ins_off, ut32 *ins_le
// get pseudo instruction
ins = ins_str[1 + 2 + hash_code * 4];
if (!ins /*|| ins_str[4 * hash_code] == 0*/) {
eprintf ("Invalid instruction /hash %x\n", hash_code);
R_LOG_ERROR ("Invalid instruction /hash %x", hash_code);
*err_code = -1;
return NULL;
}
@ -247,14 +247,14 @@ static char *decode_ins(st32 hash_code, ut32 ins_pos, ut32 ins_off, ut32 *ins_le
pos++;
aux = strchr (pos, '`');
if (!aux || pos == aux) {
eprintf ("Invalid instruction %s\n", ins);
R_LOG_ERROR ("Invalid instruction %s", ins);
free (res_decode);
*err_code = -1;
return NULL;
}
len = (ut32)(size_t)(aux-pos);
if (len >= 80) {
eprintf ("Invalid length token %d\n", len);
R_LOG_ERROR ("Invalid length token %d", len);
free (res_decode);
*err_code = -1;
return NULL;
@ -345,7 +345,7 @@ void set_magic_value(ut32 *magic_value, st32 hash_code, int *err_code) {
*magic_value |= 0x400;
break;
default:
eprintf ("invalid hash code 0x%x for magic value 0x%x\n", hash_code, *magic_value);
R_LOG_ERROR ("invalid hash code 0x%x for magic value 0x%x", hash_code, *magic_value);
*err_code = -1;
}
}
@ -830,7 +830,7 @@ static char* get_token_decoded(st32 hash_code, const char *ins_token, ut32 ins_t
} else if (!r_str_ncasecmp (ins_token, "q_LINR", 6)) {
res = ins_bits? ".lr": NULL;
} else {
eprintf ("Invalid instruction %s\n!", ins_token);
R_LOG_ERROR ("Invalid instruction %s!", ins_token);
*err_code = -1;
return NULL;
}

View File

@ -59,7 +59,7 @@ static int r_asm_pseudo_string(RAsmOp *op, char *input, int zero) {
static inline int r_asm_pseudo_arch(RAsm *a, const char *input) {
if (!r_asm_use (a, input)) {
eprintf ("Error: Unknown plugin\n");
R_LOG_ERROR ("Unknown plugin");
return -1;
}
return 0;
@ -67,7 +67,7 @@ static inline int r_asm_pseudo_arch(RAsm *a, const char *input) {
static inline int r_asm_pseudo_bits(RAsm *a, const char *input) {
if (!(r_asm_set_bits (a, r_num_math (NULL, input)))) {
eprintf ("Error: Unsupported value for .bits.\n");
R_LOG_ERROR ("Unsupported value for .bits.");
return -1;
}
return 0;
@ -84,7 +84,7 @@ static inline int r_asm_pseudo_intN(RAsm *a, RAsmOp *op, char *input, int n) {
long int l;
ut64 s64 = r_num_math (NULL, input);
if (n != 8 && s64 >> (n * 8)) {
eprintf ("int16 Out is out of range\n");
R_LOG_ERROR ("int16 Out is out of range");
return 0;
}
// XXX honor endian here
@ -144,8 +144,8 @@ static inline int r_asm_pseudo_fill(RAsmOp *op, const char *input) {
if (strchr (input, ',')) {
int res = sscanf (input, "%d,%d,%d", &repeat, &size, &value); // use r_num?
if (res != 3) {
eprintf ("Invalid usage of .fill repeat,size,value\n");
eprintf ("for example: .fill 1,0x100,0\n");
R_LOG_ERROR ("Invalid usage of .fill repeat,size,value");
R_LOG_ERROR ("for example: .fill 1,0x100,0");
return -1;
}
} else {
@ -179,7 +179,7 @@ static inline int r_asm_pseudo_incbin(RAsmOp *op, char *input) {
size_t count = (size_t)r_num_math (NULL,r_str_word_get0 (input, 2));
char *content = r_file_slurp (input, &bytes_read);
if (!content) {
eprintf ("Could not open '%s'.\n", input);
R_LOG_ERROR ("Could not open '%s'.", input);
return -1;
}
if (skip > 0) {
@ -415,7 +415,7 @@ R_API bool r_asm_use(RAsm *a, const char *name) {
if (a->analb.use (a->analb.anal, name)) {
load_asm_descriptions (a, NULL);
} else {
eprintf ("Cannot find arch plugin with this name. See rasm2 -L and rasm2 -LL\n");
R_LOG_ERROR ("Cannot find arch plugin with this name. See rasm2 -L and rasm2 -LL");
}
}
#if 0
@ -863,12 +863,12 @@ R_API RAsmCode *r_asm_massemble(RAsm *a, const char *assembly) {
const size_t new_tokens_size = tokens_size * 2;
if (sizeof (char*) * new_tokens_size <= sizeof (char*) * tokens_size) {
// overflow
eprintf ("Too many tokens\n");
R_LOG_ERROR ("Too many tokens");
goto fail;
}
char **new_tokens = realloc (tokens, sizeof (char*) * new_tokens_size);
if (!new_tokens) {
eprintf ("Too many tokens\n");
R_LOG_ERROR ("Too many tokens");
goto fail;
}
tokens_size = new_tokens_size;
@ -1057,7 +1057,7 @@ R_API RAsmCode *r_asm_massemble(RAsm *a, const char *assembly) {
} else if ((!strncmp (ptr, ".byte ", 6)) || (!strncmp (ptr, ".int8 ", 6))) {
ret = r_asm_pseudo_byte (&op, ptr + 6);
} else if (!strncmp (ptr, ".glob", 5)) { // .global .globl
// eprintf (".global directive not yet implemented\n");
// R_LOG_ERROR (".global directive not yet implemented");
ret = 0;
continue;
} else if (!strncmp (ptr, ".equ ", 5)) {
@ -1072,32 +1072,32 @@ R_API RAsmCode *r_asm_massemble(RAsm *a, const char *assembly) {
*ptr2 = '\0';
r_asm_code_set_equ (acode, ptr + 5, ptr2 + 1);
} else {
eprintf ("Invalid syntax for '.equ': Use '.equ <word> <word>'\n");
R_LOG_ERROR ("Invalid syntax for '.equ': Use '.equ <word> <word>'");
}
} else if (!strncmp (ptr, ".org ", 5)) {
ret = r_asm_pseudo_org (a, ptr + 5);
off = a->pc;
} else if (r_str_startswith (ptr, ".offset ")) {
eprintf ("Invalid use of the .offset directory. This directive is only supported in r2 -c 'waf'.\n");
R_LOG_ERROR ("Invalid use of the .offset directory. This directive is only supported in r2 -c 'waf'.");
} else if (!strncmp (ptr, ".text", 5)) {
acode->code_offset = a->pc;
} else if (!strncmp (ptr, ".data", 5)) {
acode->data_offset = a->pc;
} else if (!strncmp (ptr, ".incbin", 7)) {
if (ptr[7] != ' ') {
eprintf ("incbin missing filename\n");
R_LOG_ERROR ("incbin missing filename");
continue;
}
ret = r_asm_pseudo_incbin (&op, ptr + 8);
} else {
eprintf ("Unknown directive (%s)\n", ptr);
R_LOG_ERROR ("Unknown directive (%s)", ptr);
goto fail;
}
if (!ret) {
continue;
}
if (ret < 0) {
eprintf ("!!! Oops (%s)\n", ptr);
R_LOG_ERROR ("!!! Oops (%s)", ptr);
goto fail;
}
} else { /* Instruction */

View File

@ -243,7 +243,7 @@ static int assemble(RAsm *a, RAsmOp *op, const char *buf) {
} else {
opcode = armass_assemble (buf, a->pc, is_thumb);
if (bits != 32 && bits != 16) {
eprintf ("Error: ARM assembler only supports 16 or 32 bits\n");
R_LOG_ERROR ("ARM assembler only supports 16 or 32 bits");
return -1;
}
}

View File

@ -6,7 +6,7 @@
static int assemble(RAsm *a, RAsmOp *op, const char *buf) {
char *ipath, *opath;
if (a->config->syntax != R_ASM_SYNTAX_INTEL) {
eprintf ("asm.x86.nasm does not support non-intel syntax\n");
R_LOG_ERROR ("asm.x86.nasm does not support non-intel syntax");
return -1;
}
@ -38,7 +38,7 @@ static int assemble(RAsm *a, RAsmOp *op, const char *buf) {
op->size = read (ofd, buf, sizeof (buf));
r_asm_op_set_buf (op, buf, op->size);
} else {
eprintf ("Error running 'nasm'\n");
R_LOG_ERROR ("Error running 'nasm'");
}
close (ofd);

View File

@ -232,7 +232,7 @@ static int process_group_1(RAsm *a, ut8 *data, const Opcode *op) {
}
} else if (op->operands[0].type & OT_BYTE) {
if (op->operands[1].immediate > 255) {
eprintf ("Error: Immediate exceeds bounds\n");
R_LOG_ERROR ("Immediate exceeds bounds");
return -1;
}
data[l++] = 0x80;
@ -314,7 +314,7 @@ static int process_group_2(RAsm *a, ut8 *data, const Opcode *op) {
st32 immediate = op->operands[1].immediate * op->operands[1].sign;
if (immediate > 255 || immediate < -128) {
eprintf ("Error: Immediate exceeds bounds\n");
R_LOG_ERROR ("Immediate exceeds bounds");
return -1;
}
@ -406,7 +406,7 @@ static int process_1byte_op(RAsm *a, ut8 *data, const Opcode *op, int op1) {
&& op->operands[1].type & (OT_DWORD | OT_QWORD)) {
data[l++] = op1 + 0x1;
} else {
eprintf ("Error: mismatched operand sizes\n");
R_LOG_ERROR ("mismatched operand sizes");
return -1;
}
reg = op->operands[1].reg;
@ -434,7 +434,7 @@ static int process_1byte_op(RAsm *a, ut8 *data, const Opcode *op, int op1) {
&& op->operands[1].type & (OT_DWORD | OT_QWORD)) {
data[l++] = op1 + 0x3;
} else {
eprintf ("Error: mismatched operand sizes\n");
R_LOG_ERROR ("mismatched operand sizes");
return -1;
}
reg = op->operands[0].reg;
@ -999,7 +999,7 @@ static int opaam(RAsm *a, ut8 *data, const Opcode *op) {
static int opdec(RAsm *a, ut8 *data, const Opcode *op) {
if (op->operands[1].type) {
eprintf ("Error: Invalid operands\n");
R_LOG_ERROR ("Invalid operands");
return -1;
}
is_valid_registers (op);
@ -1231,7 +1231,7 @@ static int opimul(RAsm *a, ut8 *data, const Opcode *op) {
if ((op->operands[0].type & OT_GPREG) && !(op->operands[0].type & OT_MEMORY)) {
if (op->operands[1].type & OT_CONSTANT) {
if (op->operands[1].immediate == -1) {
eprintf ("Error: Immediate exceeds max\n");
R_LOG_ERROR ("Immediate exceeds max");
return -1;
}
immediate = op->operands[1].immediate * op->operands[1].sign;
@ -1414,7 +1414,7 @@ static int opclflush(RAsm *a, ut8 *data, const Opcode *op) {
static int opinc(RAsm *a, ut8 *data, const Opcode *op) {
if (op->operands[1].type) {
eprintf ("Error: Invalid operands\n");
R_LOG_ERROR ("Invalid operands");
return -1;
}
is_valid_registers (op);
@ -2446,7 +2446,7 @@ static int oppush(RAsm *a, ut8 *data, const Opcode *op) {
}
ut8 base = 0x50;
if (op->operands[0].reg == X86R_RIP) {
eprintf ("Invalid register\n");
R_LOG_ERROR ("Invalid register");
return -1;
}
data[l++] = base + op->operands[0].reg;
@ -2663,7 +2663,7 @@ static int optest(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
if (!op->operands[0].type || !op->operands[1].type) {
eprintf ("Error: Invalid operands\n");
R_LOG_ERROR ("Invalid operands");
return -1;
}
if (a->config->bits == 64) {
@ -4790,13 +4790,13 @@ static Register parseReg(RAsm *a, const char *str, size_t *pos, ut32 *type) {
// read number
// const int maxreg = (a->config->bits == 64) ? 15 : 7;
if (getToken (token, pos, &nextpos) != TT_NUMBER) {
eprintf ("Expected register number '%s'\n", str + *pos);
R_LOG_ERROR ("Expected register number '%s'", str + *pos);
return X86R_UNDEFINED;
}
reg = getnum (a, token + *pos);
// st and mm go up to 7, xmm up to 15
if ((reg > 15) || ((*type & (OT_FPUREG | OT_MMXREG) & ~OT_REGALL) && reg > 7)) {
eprintf ("Too large register index!\n");
R_LOG_ERROR ("Too large register index!");
return X86R_UNDEFINED;
}
*pos = nextpos;
@ -4895,7 +4895,7 @@ static int parseOperand(RAsm *a, const char *str, Operand *op, bool isrepop) {
bool first_reg = true;
while (str[pos] != ']') {
if (pos > nextpos) {
// eprintf ("Error parsing instruction\n");
// R_LOG_ERROR ("Error parsing instruction");
break;
}
pos = nextpos;

View File

@ -482,7 +482,7 @@ static void get_strings_range(RBinFile *bf, RList *list, int min, int raw, ut64
} else if (!strcmp (enc, "utf32le")) {
type = R_STRING_TYPE_WIDE32;
} else { // TODO utf16be, utf32be
eprintf ("ERROR: encoding %s not supported\n", enc);
R_LOG_ERROR ("ERROR: encoding %s not supported", enc);
return;
}
string_scan_range (list, bf, min, from, to, type, raw, section);
@ -937,7 +937,7 @@ R_API RList *r_bin_file_compute_hashes(RBin *bin, ut64 limit) {
// By SLURP_LIMIT normally cannot compute ...
if (buf_len > limit) {
if (bin->verbose) {
eprintf ("Warning: r_bin_file_hash: file exceeds bin.hashlimit\n");
R_LOG_WARN ("r_bin_file_hash: file exceeds bin.hashlimit");
}
return NULL;
}

View File

@ -646,7 +646,7 @@ R_API void r_bin_set_baddr(RBin *bin, ut64 baddr) {
}
}
} else {
eprintf ("Warning: This should be an assert probably.\n");
R_LOG_WARN ("This should be an assert probably.");
}
// XXX - update all the infos?
// maybe in RBinFile.rebase() ?
@ -1109,7 +1109,7 @@ R_API void r_bin_list_archs(RBin *bin, PJ *pj, int mode) {
"0x%08" PFMT64x ":%" PFMT64u ":%s:%d",
boffset, obj_size, "unk", 0);
} else {
eprintf ("Error: Invalid RBinFile.\n");
R_LOG_ERROR ("Invalid RBinFile.");
}
//sdb_array_push (binfile_sdb, ARCHS_KEY, archline, 0);
}

View File

@ -148,7 +148,7 @@ R_IPI RBinObject *r_bin_object_new(RBinFile *bf, RBinPlugin *plugin, ut64 basead
if (plugin && plugin->load_buffer) {
if (!plugin->load_buffer (bf, &bo->bin_obj, bf->buf, loadaddr, sdb)) {
if (bf->rbin->verbose) {
eprintf ("Error in r_bin_object_new: load_buffer failed for %s plugin\n", plugin->name);
R_LOG_ERROR ("Error in r_bin_object_new: load_buffer failed for %s plugin", plugin->name);
}
sdb_free (bo->kv);
free (bo);

View File

@ -2088,7 +2088,7 @@ static RBinDwarfDebugInfo *parse_info_raw(Sdb *sdb, RBinDwarfDebugAbbrev *da,
}
if (da->decls->count >= da->capacity) {
eprintf ("Warning: malformed dwarf have not enough buckets for decls.\n");
R_LOG_WARN ("malformed dwarf have not enough buckets for decls.");
}
r_warn_if_fail (da->count <= da->capacity);

View File

@ -22,17 +22,17 @@ static int bflt_init_hdr(struct r_bin_bflt_obj *bin) {
len = r_buf_read_at (bin->b, 0, bhdr, BFLT_HDR_SIZE);
if (len < 1) {
eprintf ("Warning: read bFLT hdr failed\n");
R_LOG_WARN ("read bFLT hdr failed");
goto fail;
}
if (strncmp ((const char *)bhdr, "bFLT", 4)) {
eprintf ("Warning: wrong magic number in bFLT file\n");
R_LOG_WARN ("wrong magic number in bFLT file");
goto fail;
}
p_hdr = R_NEW0 (struct bflt_hdr);
if (!p_hdr) {
eprintf ("Warning: couldn't allocate memory\n");
R_LOG_WARN ("couldn't allocate memory");
goto fail;
}
@ -49,7 +49,7 @@ static int bflt_init_hdr(struct r_bin_bflt_obj *bin) {
p_hdr->build_date = READ (bhdr, i);
if (p_hdr->rev != FLAT_VERSION) {
eprintf ("Warning: only v4 is supported!\n");
R_LOG_WARN ("only v4 is supported!");
R_FREE (p_hdr);
goto fail;
}

View File

@ -46,7 +46,7 @@ static char *getstr(RBinDexObj *bin, int idx) {
r_buf_read_at (bin->b, bin->strings[idx] + uleblen, ptr, len + 1);
ptr[len] = 0;
if (len != r_utf8_strlen (ptr)) {
// eprintf ("Warning: Invalid string for index %d\n", idx);
// R_LOG_WARN ("Invalid string for index %d", idx);
return NULL;
}
}

View File

@ -9,12 +9,12 @@ static int r_bin_dmp64_init_memory_runs(struct r_bin_dmp64_obj_t *obj) {
int i, j;
dmp64_p_memory_desc *mem_desc = &obj->header->PhysicalMemoryBlockBuffer;
if (!memcmp (mem_desc, DMP_UNUSED_MAGIC, 4)) {
eprintf ("Warning: Invalid PhysicalMemoryDescriptor\n");
R_LOG_WARN ("Invalid PhysicalMemoryDescriptor");
return false;
}
ut64 num_runs = mem_desc->NumberOfRuns;
if (num_runs * sizeof (dmp_p_memory_run) >= r_offsetof (dmp64_header, ContextRecord)) {
eprintf ("Warning: Invalid PhysicalMemoryDescriptor\n");
R_LOG_WARN ("Invalid PhysicalMemoryDescriptor");
return false;
}
obj->pages = r_list_newf (free);
@ -24,7 +24,7 @@ static int r_bin_dmp64_init_memory_runs(struct r_bin_dmp64_obj_t *obj) {
dmp_p_memory_run *runs = calloc (num_runs, sizeof (dmp_p_memory_run));
ut64 num_runs_offset = r_offsetof (dmp64_header, PhysicalMemoryBlockBuffer) + r_offsetof (dmp64_p_memory_desc, NumberOfRuns);
if (r_buf_read_at (obj->b, num_runs_offset, (ut8*)runs, num_runs * sizeof (dmp_p_memory_run)) < 0) {
eprintf ("Warning: read memory runs\n");
R_LOG_WARN ("read memory runs");
free (runs);
return false;
};
@ -46,7 +46,7 @@ static int r_bin_dmp64_init_memory_runs(struct r_bin_dmp64_obj_t *obj) {
}
}
if (mem_desc->NumberOfPages != num_page) {
eprintf ("Warning: Number of Pages not matches\n");
R_LOG_WARN ("Number of Pages not matches");
}
free (runs);
@ -59,7 +59,7 @@ static int r_bin_dmp64_init_header(struct r_bin_dmp64_obj_t *obj) {
return false;
}
if (r_buf_read_at (obj->b, 0, (ut8*)obj->header, sizeof (dmp64_header)) < 0) {
eprintf ("Warning: read header\n");
R_LOG_WARN ("read header");
return false;
}
obj->dtb = obj->header->DirectoryTableBase;
@ -96,7 +96,7 @@ static int r_bin_dmp64_init_bmp_pages(struct r_bin_dmp64_obj_t *obj) {
num_bitset++;
}
if (obj->bmp_header->TotalPresentPages != num_bitset) {
eprintf ("Warning: TotalPresentPages not matched\n");
R_LOG_WARN ("TotalPresentPages not matched");
return false;
}
@ -110,17 +110,17 @@ static int r_bin_dmp64_init_bmp_header(struct r_bin_dmp64_obj_t *obj) {
return false;
}
if (r_buf_read_at (obj->b, sizeof (dmp64_header), (ut8*)obj->bmp_header, offsetof (dmp_bmp_header, Bitmap)) < 0) {
eprintf ("Warning: read bmp_header\n");
R_LOG_WARN ("read bmp_header");
return false;
}
if (!!memcmp (obj->bmp_header, DMP_BMP_MAGIC, 8)) {
eprintf ("Warning: Invalid Bitmap Magic\n");
R_LOG_WARN ("Invalid Bitmap Magic");
return false;
}
ut64 bitmapsize = obj->bmp_header->Pages / 8;
obj->bitmap = calloc (1, bitmapsize);
if (r_buf_read_at (obj->b, sizeof (dmp64_header) + offsetof (dmp_bmp_header, Bitmap), obj->bitmap, bitmapsize) < 0) {
eprintf ("Warning: read bitmap\n");
R_LOG_WARN ("read bitmap");
return false;
}
@ -129,7 +129,7 @@ static int r_bin_dmp64_init_bmp_header(struct r_bin_dmp64_obj_t *obj) {
static int r_bin_dmp64_init(struct r_bin_dmp64_obj_t *obj) {
if (!r_bin_dmp64_init_header (obj)) {
eprintf ("Warning: Invalid Kernel Dump x64 Format\n");
R_LOG_WARN ("Invalid Kernel Dump x64 Format");
return false;
}
switch (obj->header->DumpType) {

View File

@ -1316,7 +1316,7 @@ static bool init_dynstr(ELFOBJ *bin) {
section_name = &bin->shstrtab[bin->shdr[i].sh_name];
if (bin->shdr[i].sh_type == SHT_STRTAB && !strcmp (section_name, ".dynstr")) {
if (!(bin->dynstr = (char*) calloc (bin->shdr[i].sh_size + 1, sizeof (char)))) {
R_LOG_ERROR ("Cannot allocate memory for dynamic strings\n");
R_LOG_ERROR ("Cannot allocate memory for dynamic strings");
return false;
}
if (bin->shdr[i].sh_offset > bin->size) {
@ -3763,7 +3763,7 @@ static RBinElfSymbol* Elf_(_r_bin_elf_get_symbols_imports)(ELFOBJ *bin, int type
}
ret[ret_ctr].size = tsize;
if (sym[k].st_name + 1 > strtab_section->sh_size) {
R_LOG_DEBUG ("index out of strtab range (%"PFMT64d" / %"PFMT64d")\n",
R_LOG_DEBUG ("index out of strtab range (%"PFMT64d" / %"PFMT64d")",
(ut64)sym[k].st_name, (ut64)strtab_section->sh_size);
continue;
}

View File

@ -205,7 +205,7 @@ bool Elf_(r_bin_elf_del_rpath)(RBinFile *bf) {
return false;
}
if (r_buf_read_at (bin->b, bin->phdr[i].p_offset, (ut8*)dyn, bin->phdr[i].p_filesz) == -1) {
eprintf ("Error: read (dyn)\n");
R_LOG_ERROR ("read (dyn)");
free (dyn);
return false;
}
@ -220,7 +220,7 @@ bool Elf_(r_bin_elf_del_rpath)(RBinFile *bf) {
if (dyn[j].d_tag == DT_RPATH || dyn[j].d_tag == DT_RUNPATH) {
if (r_buf_write_at (bin->b, stroff + dyn[j].d_un.d_val,
(ut8*)"", 1) == -1) {
eprintf ("Error: write (rpath)\n");
R_LOG_ERROR ("write (rpath)");
free (dyn);
return false;
}

View File

@ -457,7 +457,7 @@ RList *r_bin_le_get_relocs(r_bin_le_obj_t *bin) {
int ret = r_buf_read_at (bin->buf, offset, (ut8 *)&header, sizeof (header));
// XXX this is endiandy unsafe
if (ret < (int)sizeof (header)) {
eprintf ("Warning: oobread in LE header parsing relocs\n");
R_LOG_WARN ("oobread in LE header parsing relocs");
break;
}
offset += sizeof (header);

View File

@ -67,12 +67,12 @@ struct r_bin_dyldcache_lib_t *r_bin_dyldcache_extract(struct r_bin_dyldcache_obj
return NULL;
}
if (bin->hdr.startaddr > bin->size) {
eprintf ("corrupted dyldcache\n");
R_LOG_ERROR ("corrupted dyldcache");
goto ret_err;
}
if (bin->hdr.startaddr > bin->size || bin->hdr.baseaddroff > bin->size) {
eprintf ("corrupted dyldcache\n");
R_LOG_ERROR ("corrupted dyldcache");
goto ret_err;
}
int sz = bin->nlibs * sizeof (struct dyld_cache_image_info);
@ -84,13 +84,13 @@ struct r_bin_dyldcache_lib_t *r_bin_dyldcache_extract(struct r_bin_dyldcache_obj
dyld_vmbase = r_buf_read64le (bin->b, bin->hdr.baseaddroff);
liboff = image_infos[idx].address - dyld_vmbase;
if (liboff > bin->size) {
eprintf ("Corrupted file\n");
R_LOG_ERROR ("Corrupted file");
goto ret_err;
}
ret->offset = liboff;
int pfo = image_infos[idx].pathFileOffset;
if (pfo < 0 || pfo > bin->size) {
eprintf ("corrupted file: pathFileOffset > bin->size (%d)\n", pfo);
R_LOG_ERROR ("corrupted file: pathFileOffset > bin->size (%d)", pfo);
goto ret_err;
}
libname = r_buf_read_string (bin->b, pfo, 64);
@ -146,7 +146,7 @@ struct r_bin_dyldcache_lib_t *r_bin_dyldcache_extract(struct r_bin_dyldcache_obj
}
int t = seg.filesize;
if (seg.fileoff + seg.filesize > bin->size || seg.fileoff > bin->size) {
eprintf ("malformed dyldcache\n");
R_LOG_ERROR ("malformed dyldcache");
goto dbuf_err;
}
r_buf_append_buf_slice (dbuf, bin->b, seg.fileoff, t);

View File

@ -467,7 +467,7 @@ static bool parse_symtab(struct MACH0_(obj_t) *mo, ut64 off) {
}
int len = r_buf_read_at (mo->b, off, symt, sizeof (struct symtab_command));
if (len != sizeof (struct symtab_command)) {
Eprintf ("Error: read (symtab)\n");
R_LOG_ERROR ("read (symtab)");
return false;
}
st.cmd = r_read_ble32 (symt, be);
@ -2098,7 +2098,7 @@ static bool init(struct MACH0_(obj_t) *mo) {
return false;
}
if (!init_items (mo)) {
Eprintf ("Warning: Cannot initialize items\n");
R_LOG_WARN ("Cannot initialize items");
}
mo->baddr = MACH0_(get_baddr)(mo);
return true;

View File

@ -24,7 +24,7 @@ RBinAddr *r_bin_mz_get_entrypoint (const struct r_bin_mz_obj_t *bin) {
la = r_bin_mz_va_to_la (mz->cs, mz->ip);
la &= 0xfffff;
if (la >= bin->load_module_size) {
eprintf ("Error: entry point outside load module\n");
R_LOG_ERROR ("entry point outside load module");
return NULL;
}
entrypoint = R_NEW0 (RBinAddr);
@ -146,7 +146,7 @@ RList *r_bin_mz_get_segments(const struct r_bin_mz_obj_t *bin) {
return seg_list;
err_out:
eprintf ("Error: alloc (RBinSection)\n");
R_LOG_ERROR ("alloc (RBinSection)");
r_list_free (seg_list);
return NULL;
@ -159,7 +159,7 @@ struct r_bin_mz_reloc_t *r_bin_mz_get_relocs (const struct r_bin_mz_obj_t *bin)
struct r_bin_mz_reloc_t *relocs = calloc (num_relocs + 1, sizeof (*relocs));
if (!relocs) {
eprintf ("Error: calloc (struct r_bin_mz_reloc_t)\n");
R_LOG_ERROR ("calloc (struct r_bin_mz_reloc_t)");
return NULL;
}
for (i = 0, j = 0; i < num_relocs; i++) {
@ -200,7 +200,7 @@ static int r_bin_mz_init_hdr(struct r_bin_mz_obj_t *bin) {
bin->dos_header = mz;
// TODO: read field by field to avoid endian and alignment issues
if (r_buf_read_at (bin->b, 0, (ut8 *)mz, sizeof (*mz)) == -1) {
eprintf ("Error: read (MZ_image_dos_header)\n");
R_LOG_ERROR ("read (MZ_image_dos_header)");
return false;
}
// dos_header is not endian safe here in this point
@ -255,7 +255,7 @@ static int r_bin_mz_init_hdr(struct r_bin_mz_obj_t *bin) {
if (r_buf_read_at (bin->b, sizeof (MZ_image_dos_header),
(ut8 *)bin->dos_extended_header,
bin->dos_extended_header_size) == -1) {
eprintf ("Error: read (dos extended header)\n");
R_LOG_ERROR ("read (dos extended header)");
return false;
}
}
@ -267,7 +267,7 @@ static int r_bin_mz_init_hdr(struct r_bin_mz_obj_t *bin) {
}
if (r_buf_read_at (bin->b, bin->dos_header->reloc_table_offset,
(ut8 *)bin->relocation_entries, relocations_size) == -1) {
eprintf ("Error: read (dos relocation entries)\n");
R_LOG_ERROR ("read (dos relocation entries)");
R_FREE (bin->relocation_entries);
return false;
}
@ -281,7 +281,7 @@ static bool r_bin_mz_init(struct r_bin_mz_obj_t *bin) {
bin->relocation_entries = NULL;
bin->kv = sdb_new0 ();
if (!r_bin_mz_init_hdr (bin)) {
eprintf ("Warning: File is not MZ\n");
R_LOG_WARN ("File is not MZ");
return false;
}
return true;
@ -336,7 +336,7 @@ RBinAddr *r_bin_mz_get_main_vaddr (struct r_bin_mz_obj_t *bin) {
}
ZERO_FILL (b);
if (r_buf_read_at (bin->b, entry->paddr, b, sizeof (b)) < 0) {
eprintf ("Warning: Cannot read entry at 0x%16" PFMT64x "\n", (ut64)entry->paddr);
R_LOG_WARN ("Cannot read entry at 0x%16" PFMT64x, (ut64)entry->paddr);
free (entry);
return NULL;
}

View File

@ -291,7 +291,7 @@ static void get_ivar_list_t(mach0_ut p, RBinFile *bf, RBinClass *klass) {
if (offset_at != 0 && left >= sizeof (mach0_ut)) {
len = r_buf_read_at (bf->buf, offset_at, offs, sizeof (mach0_ut));
if (len != sizeof (mach0_ut)) {
eprintf ("Error reading\n");
R_LOG_ERROR ("Error reading");
goto error;
}
ivar_offset = r_read_ble (offs, bigendian, 8 * sizeof (mach0_ut));
@ -315,7 +315,7 @@ static void get_ivar_list_t(mach0_ut p, RBinFile *bf, RBinClass *klass) {
name = malloc (name_len + 1);
len = r_buf_read_at (bf->buf, r, (ut8 *)name, name_len);
if (len < 1) {
eprintf ("Error reading\n");
R_LOG_ERROR ("Error reading");
R_FREE (name);
goto error;
}

View File

@ -1234,7 +1234,7 @@ static bool bin_pe_init_metadata_hdr(RBinPEObj* pe) {
goto fail;
}
R_LOG_DEBUG ("Metadata Signature: 0x%"PFMT64x" 0x%"PFMT64x" %d\n",
R_LOG_DEBUG ("Metadata Signature: 0x%"PFMT64x" 0x%"PFMT64x" %d",
(ut64)metadata_directory, (ut64)metadata->Signature, (int)metadata->VersionStringLength);
// read the version string
@ -1252,7 +1252,7 @@ static bool bin_pe_init_metadata_hdr(RBinPEObj* pe) {
free (metadata);
return 0;
}
R_LOG_DEBUG (".NET Version: %s\n", metadata->VersionString);
R_LOG_DEBUG (".NET Version: %s", metadata->VersionString);
}
// read the header after the string
@ -1261,7 +1261,7 @@ static bool bin_pe_init_metadata_hdr(RBinPEObj* pe) {
if (rr < 1) {
goto fail;
}
R_LOG_DEBUG ("Number of Metadata Streams: %d\n", metadata->NumberOfStreams);
R_LOG_DEBUG ("Number of Metadata Streams: %d", metadata->NumberOfStreams);
pe->metadata_header = metadata;
// read metadata streams
@ -1305,7 +1305,7 @@ static bool bin_pe_init_metadata_hdr(RBinPEObj* pe) {
free (streams);
goto fail;
}
R_LOG_DEBUG ("Stream name: %s %d\n", stream_name, c);
R_LOG_DEBUG ("Stream name: %s %d", stream_name, c);
stream->Name = stream_name;
streams[count] = stream;
stream_addr += 8 + c;
@ -2973,7 +2973,7 @@ static void _parse_resource_directory(RBinPEObj *pe, Pe_image_resource_directory
break;
}
if (read_image_resource_directory_entry (pe->b, off, &entry) < 0) {
eprintf ("Warning: read resource entry\n");
R_LOG_WARN ("read resource entry");
break;
}
if (entry.u1.Name >> 31) {
@ -3004,7 +3004,7 @@ static void _parse_resource_directory(RBinPEObj *pe, Pe_image_resource_directory
off = rsrc_base + OffsetToDirectory;
int len = read_image_resource_directory (pe->b, off, &identEntry);
if (len < 1 || len != sizeof (Pe_image_resource_directory)) {
eprintf ("Warning: parsing resource directory\n");
R_LOG_WARN ("parsing resource directory");
}
_parse_resource_directory (pe, &identEntry, OffsetToDirectory, type, entry.u1.Name & 0xffff, dirs, resourceEntryName);
R_FREE (resourceEntryName);
@ -3022,7 +3022,7 @@ static void _parse_resource_directory(RBinPEObj *pe, Pe_image_resource_directory
break;
}
if (read_image_resource_data_entry (pe->b, off, data) != sizeof (*data)) {
eprintf ("Warning: read (resource data entry)\n");
R_LOG_WARN ("read (resource data entry)");
free (data);
break;
}
@ -3138,7 +3138,7 @@ R_API void PE_(bin_pe_parse_resource)(RBinPEObj *pe) {
curRes = rs_directory->NumberOfNamedEntries;
totalRes = curRes + rs_directory->NumberOfIdEntries;
if (totalRes > R_PE_MAX_RESOURCES) {
eprintf ("Error parsing resource directory\n");
R_LOG_ERROR ("Error parsing resource directory");
ht_uu_free (dirs);
return;
}
@ -3150,7 +3150,7 @@ R_API void PE_(bin_pe_parse_resource)(RBinPEObj *pe) {
break;
}
if (read_image_resource_directory_entry (pe->b, off, &typeEntry) < 0) {
eprintf ("Warning: read resource directory entry\n");
R_LOG_WARN ("read resource directory entry");
break;
}
if (typeEntry.u2.OffsetToData >> 31) {
@ -3159,7 +3159,7 @@ R_API void PE_(bin_pe_parse_resource)(RBinPEObj *pe) {
off = rsrc_base + OffsetToDirectory;
int len = read_image_resource_directory (pe->b, off, &identEntry);
if (len != sizeof (identEntry)) {
eprintf ("Warning: parsing resource directory\n");
R_LOG_WARN ("parsing resource directory");
}
(void)_parse_resource_directory (pe, &identEntry, OffsetToDirectory, typeEntry.u1.Name & 0xffff, 0, dirs, NULL);
}
@ -3276,11 +3276,11 @@ static int bin_pe_init(RBinPEObj* pe) {
pe->cms = NULL;
pe->spcinfo = NULL;
if (!bin_pe_init_hdr (pe)) {
eprintf ("Warning: File is not PE\n");
R_LOG_WARN ("File is not PE");
return false;
}
if (!bin_pe_init_sections (pe)) {
eprintf ("Warning: Cannot initialize sections\n");
R_LOG_WARN ("Cannot initialize sections");
return false;
}
pe->sections = PE_(r_bin_pe_get_sections) (pe);
@ -4148,7 +4148,7 @@ void PE_(r_bin_pe_check_sections)(RBinPEObj* pe, struct r_bin_pe_section_t* * se
if (addr_beg <= entry->vaddr || entry->vaddr < addr_end) {
if (!(sections[j].perm & PE_IMAGE_SCN_MEM_EXECUTE)) {
if (pe->verbose) {
eprintf ("Warning: Found entrypoint in non-executable section.\n");
R_LOG_WARN ("Found entrypoint in non-executable section.");
}
sections[j].perm |= PE_IMAGE_SCN_MEM_EXECUTE;
}

View File

@ -37,7 +37,7 @@ struct PE_(r_bin_pe_obj_t)* r_bin_pemixed_init_dos(RBinPEObj* pe) {
}
if ((r_buf_read_at (pe->b, 0, tmp_buf, pe_hdr_off)) == -1) {
eprintf ("Error reading to buffer\n");
R_LOG_ERROR ("Error reading to buffer");
return NULL;
}

View File

@ -72,7 +72,7 @@ ut64 r_bin_te_get_main_paddr(struct r_bin_te_obj_t *bin) {
return 0LL;
}
if (r_buf_read_at (bin->b, entry->paddr, buf, sizeof (buf)) == -1) {
eprintf ("Error: read (entry)\n");
R_LOG_ERROR ("read (entry)");
} else {
if (buf[367] == 0xe8) {
int delta = (buf[368] | buf[369]<<8 | buf[370]<<16 | buf[371]<<24);
@ -115,7 +115,7 @@ static int r_bin_te_init_sections(struct r_bin_te_obj_t* bin) {
}
if (r_buf_read_at (bin->b, sizeof(TE_image_file_header),
(ut8*)bin->section_header, sections_size) == -1) {
eprintf ("Error: read (sections headers)\n");
R_LOG_ERROR ("read (sections headers)");
return false;
}
return true;

View File

@ -463,7 +463,7 @@ static RBinWasmTypeEntry *parse_type_entry(RBinWasmObj *bin, ut64 bound, ut32 in
goto beach;
}
if (type->form != R_BIN_WASM_VALUETYPE_FUNC) {
R_LOG_WARN ("Halting types section parsing at invalid type 0x%02x at offset: 0x%" PFMTSZx "\n", type->form, type->file_offset);
R_LOG_WARN ("Halting types section parsing at invalid type 0x%02x at offset: 0x%" PFMTSZx, type->form, type->file_offset);
goto beach;
}
@ -762,7 +762,7 @@ static RBinWasmCustomNameEntry *parse_custom_name_entry(RBinWasmObj *bin, ut64 b
}
break;
default:
R_LOG_WARN ("[wasm] Halting custom name section parsing at unknown type 0x%x offset 0x%" PFMTSZx "\n", cust->type, start);
R_LOG_WARN ("[wasm] Halting custom name section parsing at unknown type 0x%x offset 0x%" PFMTSZx, cust->type, start);
cust->type = R_BIN_WASM_NAMETYPE_None;
goto beach;
}

View File

@ -87,7 +87,7 @@ static RBuffer* create(RBin* bin, const ut8 *code, int codelen, const ut8 *data,
if (data && datalen>0) {
//ut32 data_section = buf->length;
eprintf ("Warning: DATA section not support for ELF yet\n");
R_LOG_WARN ("DATA section not support for ELF yet");
B (data, datalen);
}
return buf;

View File

@ -262,12 +262,12 @@ static char *dex_get_proto(RBinDexObj *bin, int proto_id) {
// size of the list, in 16 bit entries
ut32 list_size = r_read_le32 (params_buf);
if (list_size >= ST32_MAX) {
eprintf ("Warning: function prototype contains too many parameters (> 2 million).\n");
R_LOG_WARN ("function prototype contains too many parameters (> 2 million).");
list_size = ST32_MAX;
}
size_t typeidx_bufsize = (list_size * sizeof (ut16));
if (params_off + typeidx_bufsize > bin->size) {
eprintf ("Warning: truncated typeidx buffer from %d to %d\n",
R_LOG_WARN ("truncated typeidx buffer from %d to %d",
(int)(params_off + typeidx_bufsize), (int)(bin->size - params_off));
typeidx_bufsize = bin->size - params_off;
// early return as this may result on so many trashy symbols that take too much time to load
@ -1152,19 +1152,19 @@ static void parse_dex_class_method(RBinFile *bf, RBinDexClass *c, RBinClass *cls
encoded_method_addr = r_buf_tell (bf->buf);
MI = peek_uleb (bf->buf, &err, &skip);
if (err) {
eprintf ("Error\n");
R_LOG_ERROR ("Error");
break;
}
MI += omi;
omi = MI;
MA = peek_uleb (bf->buf, &err, &skip);
if (err) {
eprintf ("Error\n");
R_LOG_ERROR ("Error");
break;
}
MC = peek_uleb (bf->buf, &err, &skip);
if (err) {
eprintf ("Error\n");
R_LOG_ERROR ("Error");
break;
}
// TODO: MOVE CHECKS OUTSIDE!
@ -1925,27 +1925,27 @@ static void add_segment(RList *ret, const char *name, Section s, int perm) {
static bool validate_section(const char *name, Section *pre, Section *cur, Section *nex, Section *all) {
r_return_val_if_fail (cur && all, false);
if (pre && cur->addr < (pre->addr + pre->size)) {
eprintf ("Warning: %s Section starts before the previous.\n", name);
R_LOG_WARN ("%s Section starts before the previous.", name);
}
if (cur->addr >= all->size) {
eprintf ("Warning: %s section starts beyond the end of the file.\n", name);
R_LOG_WARN ("%s section starts beyond the end of the file.", name);
return false;
}
if (cur->addr == UT64_MAX) {
eprintf ("Warning: %s invalid region size.\n", name);
R_LOG_WARN ("%s invalid region size.", name);
return false;
}
if ((cur->addr + cur->size) > all->size) {
eprintf ("Warning: %s truncated section because of file size.\n", name);
R_LOG_WARN ("%s truncated section because of file size.", name);
cur->size = all->size - cur->addr;
}
if (nex) {
if (cur->addr >= nex->addr) {
eprintf ("Warning: invalid %s section address.\n", name);
R_LOG_WARN ("invalid %s section address.", name);
return false;
}
if ((cur->addr + cur->size) > nex->addr) {
eprintf ("Warning: truncated %s with next section size.\n", name);
R_LOG_WARN ("truncated %s with next section size.", name);
cur->size = nex->addr - cur->addr;
}
}

View File

@ -1075,7 +1075,7 @@ static void carve_deps_at_address(RDyldCache *cache, cache_img_t *img, HtPU *pat
const char *key = (const char *) cursor + 24;
size_t dep_index = (size_t)ht_pu_find (path_to_idx, key, &found);
if (!found || dep_index >= cache->hdr->imagesCount) {
eprintf ("Warning: alien dep '%s'\n", key);
R_LOG_WARN ("alien dep '%s'", key);
continue;
}
deps[dep_index]++;
@ -1564,7 +1564,7 @@ static int dyldcache_io_read(RIO *io, RIODesc *fd, ut8 *buf, int count) {
result = R_MIN (count, internal_result);
memcpy (buf, internal_buf + page_offset, result);
} else {
eprintf ("ERROR rebasing\n");
R_LOG_ERROR ("ERROR rebasing");
result = cache->original_io_read (io, fd, buf, count);
}

View File

@ -118,7 +118,7 @@ static RBuffer* create(RBin* bin, const ut8 *code, int codelen, const ut8 *data,
if (data && datalen > 0) {
//ut32 data_section = buf->length;
eprintf ("Warning: DATA section not support for ELF yet\n");
R_LOG_WARN ("DATA section not support for ELF yet");
B (data, datalen);
}
return buf;

View File

@ -117,7 +117,7 @@ static RBuffer* create(RBin* bin, const ut8 *code, int codelen, const ut8 *data,
B (code, codelen);
if (data && datalen>0) {
eprintf ("Warning: DATA section not support for ELF yet\n");
R_LOG_WARN ("DATA section not support for ELF yet");
B (data, datalen);
}
return buf;

View File

@ -547,7 +547,7 @@ static bool _patch_reloc(struct MACH0_(obj_t) *bin, RIOBind *iob, struct reloc_t
ins_len = 5;
break;
default:
eprintf ("Warning: unsupported reloc type for X86_64 (%d), please file a bug.\n", reloc->type);
R_LOG_WARN ("unsupported reloc type for X86_64 (%d), please file a bug.", reloc->type);
return false;
}
break;
@ -560,7 +560,7 @@ static bool _patch_reloc(struct MACH0_(obj_t) *bin, RIOBind *iob, struct reloc_t
case CPU_TYPE_ARM:
break;
default:
eprintf ("Warning: unsupported architecture for patching relocs, please file a bug. %s\n", MACH0_(get_cputype_from_hdr)(&bin->hdr));
R_LOG_WARN ("unsupported architecture for patching relocs, please file a bug. %s", MACH0_(get_cputype_from_hdr)(&bin->hdr));
return false;
}
@ -619,7 +619,7 @@ static RList* patch_relocs(RBin *b) {
}
if (!io->cached) {
eprintf ("Warning: run r2 with -e bin.cache=true to fix relocations in disassembly\n");
R_LOG_WARN ("run r2 with -e bin.cache=true to fix relocations in disassembly");
goto beach;
}

View File

@ -97,7 +97,7 @@ static RBuffer* create(RBin* bin, const ut8 *code, int codelen, const ut8 *data,
if (data && datalen > 0) {
//ut32 data_section = buf->length;
eprintf ("Warning: DATA section not support for PE yet\n");
R_LOG_WARN ("DATA section not support for PE yet");
B (data, datalen);
}
return buf;

View File

@ -198,7 +198,7 @@ static RCoreSymCacheElement *parseDragons(RBinFile *bf, RBuffer *buf, int off, i
}
int available = r_buf_read_at (buf, off, b, size);
if (available != size) {
eprintf ("Warning: r_buf_read_at failed\n");
R_LOG_WARN ("r_buf_read_at failed");
return NULL;
}
#if 0
@ -235,7 +235,7 @@ static RCoreSymCacheElement *parseDragons(RBinFile *bf, RBuffer *buf, int off, i
// hack for C22F7494
available = r_buf_read_at (buf, off - 8, b, size);
if (available != size) {
eprintf ("Warning: r_buf_read_at failed\n");
R_LOG_WARN ("r_buf_read_at failed");
return NULL;
}
if (!memcmp ("\x1a\x2b\xb2\xa1", b, 4)) { // 0x130 ?

View File

@ -28,7 +28,7 @@ static MachoPointers findLastCommand(RBinFile *bf) {
//r_buf_seek (bin->b, off, R_BUF_SET);
int len = loadc[1]; // r_buf_read_le32 (loadc[1]); // bin->b); //
if (len < 1) {
eprintf ("Error: read (lc) at 0x%08"PFMT64x"\n", off);
R_LOG_ERROR ("read (lc) at 0x%08"PFMT64x, off);
break;
}
int size = r_read_ble32 (&loadc[1], bin->big_endian);
@ -59,7 +59,7 @@ static bool MACH0_(write_addlib)(RBinFile *bf, const char *lib) {
size_t lib_len = strlen (lib);
if (lib_len > 22) {
eprintf ("Warning: Adjusting cmdsize too long libname\n");
R_LOG_WARN ("Adjusting cmdsize too long libname");
size_of_lib += lib_len + 1 - 22;
size_of_lib += 8 - (size_of_lib % 8);
}

View File

@ -91,7 +91,7 @@ static int read_int_var(char *var_name, int *var, RPdb *pdb) {
}
int bytes_read = r_buf_read (pdb->buf, (ut8 *) var, 4);
if (bytes_read != 4) {
eprintf ("Error while reading from file '%s'\n", var_name);
R_LOG_ERROR ("Error while reading from file '%s'", var_name);
return 0;
}
return bytes_read;
@ -188,7 +188,7 @@ static int init_pdb7_root_stream(RPdb *pdb, int *root_page_list, int pages_amoun
if ((pos + num_pages) > tmp_data_max_size) {
R_FREE (data);
R_FREE (sizes);
eprintf ("Warning: looks like there is no correct values of stream size in PDB file.\n");
R_LOG_WARN ("looks like there is no correct values of stream size in PDB file.");
return 0;
}
@ -212,7 +212,7 @@ static int init_pdb7_root_stream(RPdb *pdb, int *root_page_list, int pages_amoun
// fclose(tmp_file);
page->stream_size = sizes[i];
if (sizes[i] == 0) {
//eprintf ("Warning: stream_size (%d) is 0\n", i);
//R_LOG_WARN ("stream_size (%d) is 0", i);
}
page->stream_pages = tmp;
page->num_pages = num_pages;
@ -220,7 +220,7 @@ static int init_pdb7_root_stream(RPdb *pdb, int *root_page_list, int pages_amoun
page->stream_size = 0;
page->stream_pages = 0;
page->num_pages = 0;
//eprintf ("Warning: stream_size (%d) is 0\n", i);
//R_LOG_WARN ("stream_size (%d) is 0", i);
free (tmp);
}
@ -349,7 +349,7 @@ static int pdb_read_root(RPdb *pdb) {
while (r_list_iter_next (it)) {
page = (SPage *) r_list_iter_get (it);
if (page->stream_pages == 0) {
//eprintf ("Warning: no stream pages. Skipping.\n");
//R_LOG_WARN ("no stream pages. Skipping.");
r_list_append (pList, NULL);
i++;
continue;
@ -438,7 +438,7 @@ static bool pdb7_parse(RPdb *pdb) {
bytes_read = r_buf_read (pdb->buf, (unsigned char *) signature, PDB7_SIGNATURE_LEN);
if (bytes_read != PDB7_SIGNATURE_LEN) {
//eprintf ("Error while reading PDB7_SIGNATURE.\n");
//R_LOG_ERROR ("Error while reading PDB7_SIGNATURE.");
goto error;
}
if (!read_int_var ("page_size", &page_size, pdb)) {
@ -465,14 +465,14 @@ static bool pdb7_parse(RPdb *pdb) {
num_root_index_pages = count_pages ((num_root_pages * 4), page_size);
root_index_pages = (int *) calloc (sizeof (int), R_MAX (num_root_index_pages, 1));
if (!root_index_pages) {
eprintf ("Error memory allocation.\n");
R_LOG_ERROR ("Error memory allocation.");
goto error;
}
bytes_read = r_buf_read (pdb->buf, (unsigned char *) root_index_pages, 4 * num_root_index_pages);
// fread(root_index_pages, 4, num_root_index_pages, pdb->fp);
if (bytes_read != 4 * num_root_index_pages) {
eprintf ("Error while reading root_index_pages.\n");
R_LOG_ERROR ("Error while reading root_index_pages.");
goto error;
}
if (page_size < 1 || num_root_index_pages < 1) {
@ -481,7 +481,7 @@ static bool pdb7_parse(RPdb *pdb) {
}
root_page_data = (int *) calloc (page_size, num_root_index_pages);
if (!root_page_data) {
eprintf ("Error: memory allocation of root_page_data.\n");
R_LOG_ERROR ("memory allocation of root_page_data.");
goto error;
}
p_tmp = root_page_data;
@ -496,7 +496,7 @@ static bool pdb7_parse(RPdb *pdb) {
}
root_page_list = (int *) calloc (sizeof(int), num_root_pages);
if (!root_page_list) {
eprintf ("Error: memory allocation of root page.\n");
R_LOG_ERROR ("memory allocation of root page.");
goto error;
}

View File

@ -2041,7 +2041,7 @@ static void get_nesttype_print_type(void *type, char **name) {
// this is possible because there is no support for
// parsing METHODLIST...
// need to investigate for this theme
//eprintf ("warning: strange for nesttype\n");
//R_LOG_WARN ("strange for nesttype");
}
}

View File

@ -174,8 +174,8 @@ static RBreakpointItem *r_bp_add(RBreakpoint *bp, const ut8 *obytes, ut64 addr,
eprintf ("base addr should not be larger than the breakpoint address.\n");
}
if (bp->bpinmaps && !r_bp_is_valid (bp, b)) {
eprintf ("Warning: Breakpoint won't be placed since it's not in a valid map.\n"
"You can bypass this check by setting dbg.bpinmaps to false.\n");
R_LOG_WARN ("Breakpoint won't be placed since it's not in a valid map.\n"
"You can bypass this check by setting dbg.bpinmaps to false.");
}
b->delta = addr - bp->baddr;
b->size = size;

View File

@ -88,7 +88,7 @@ static void parse_grep_expression(const char *str) {
len = 0;
}
if (len > R_CONS_GREP_BUFSIZE - 1) {
R_LOG_ERROR ("r_cons_grep: too long!\n");
R_LOG_ERROR ("r_cons_grep: too long!");
return;
}
if (len > 0 && str[len] == '?') {
@ -110,7 +110,7 @@ static void parse_grep_expression(const char *str) {
ptr = ptrs[ptrs_length];
ptrs_length++;
if (ptrs_length >= R_CONS_GREP_COUNT) {
R_LOG_ERROR ("to many nested greps\n");
R_LOG_ERROR ("too many nested greps");
return;
}
}
@ -354,12 +354,12 @@ static void parse_grep_expression(const char *str) {
continue;
}
if (wlen >= R_CONS_GREP_WORD_SIZE - 1) {
R_LOG_ERROR ("grep string too long\n");
R_LOG_ERROR ("grep string too long");
continue;
}
grep->nstrings++;
if (grep->nstrings > R_CONS_GREP_WORDS - 1) {
R_LOG_ERROR ("too many grep strings\n");
R_LOG_ERROR ("too many grep strings");
break;
}
r_str_ncpy (grep->strings[grep->nstrings - 1],
@ -894,7 +894,7 @@ R_API int r_cons_grep_line(char *buf, int len) {
}
outlen = outlen > 0? outlen - 1: 0;
if (outlen > len) { // should never happen
R_LOG_ERROR ("r_cons_grep_line: wtf, how you reach this?\n");
R_LOG_ERROR ("r_cons_grep_line: wtf, how you reach this?");
free (in);
free (out);
return -1;

View File

@ -116,7 +116,7 @@ R_API char *r_cons_html_filter(const char *ptr, int *newlen) {
if (esc == 1) {
// \x1b[2J
if (ptr[0] != '[') {
R_LOG_ERROR ("Oops invalid escape char\n");
R_LOG_ERROR ("Oops invalid escape char");
esc = 0;
str = ptr + 1;
continue;

View File

@ -454,7 +454,7 @@ R_API char *r_cons_hud_path(const char *path, int dir) {
}
r_list_free (files);
} else {
R_LOG_ERROR ("No files found\n");
R_LOG_ERROR ("No files found");
}
if (!ret) {
free (tmp);

View File

@ -196,7 +196,7 @@ static RCoreObjc *core_objc_new(RCore *core) {
}
o->word_size = (core->rasm->config->bits == 64)? 8: 4;
if (o->word_size != 8) {
eprintf ("Warning: aao experimental on 32bit binaries\n");
R_LOG_WARN ("aao experimental on 32bit binaries");
}
RBinSection *s;
@ -280,7 +280,7 @@ static bool objc_find_refs(RCore *core) {
}
if (classMethodsVA > to) {
eprintf ("Warning: Fuzzed binary or bug in here, checking next %"PFMT64x" !< %"PFMT64x"\n", classMethodsVA, to);
R_LOG_WARN ("Fuzzed binary or bug in here, checking next %"PFMT64x" !< %"PFMT64x, classMethodsVA, to);
break;
}
for (va = classMethodsVA; va < to; va += objc2ClassMethSize) {

View File

@ -308,7 +308,7 @@ static void type_match(RCore *core, char *fcn_name, ut64 addr, ut64 baddr, const
in_stack = true;
}
if (verbose && !strncmp (fcn_name, "sym.imp.", 8)) {
eprintf ("Warning: Missing function definition for '%s'\n", fcn_name + 8);
R_LOG_WARN ("Missing function definition for '%s'", fcn_name + 8);
}
if (!max) {
if (!in_stack) {
@ -583,7 +583,7 @@ repeat:
for (j = 0; j < bblist_size; j++) {
bb = r_anal_get_block_at (core->anal, bblist[j]);
if (!bb) {
eprintf ("Warning: basic block at 0x%08"PFMT64x" was removed during analysis.\n", bblist[j]);
R_LOG_WARN ("basic block at 0x%08"PFMT64x" was removed during analysis.", bblist[j]);
retries--;
free (bblist);
goto repeat;
@ -636,7 +636,7 @@ repeat:
if (i < bblist_size) {
bb = r_anal_get_block_at (core->anal, bb_addr);
if (!bb) {
eprintf ("Warning: basic block at 0x%08"PFMT64x" was removed during analysis.\n", bblist[i]);
R_LOG_WARN ("basic block at 0x%08"PFMT64x" was removed during analysis.", bblist[i]);
retries--;
free (bblist);
goto repeat;

View File

@ -38,7 +38,7 @@ static bool __is_data_block_cb(RAnalBlock *block, void *user) {
static int __isdata(RCore *core, ut64 addr) {
if (!r_io_is_valid_offset (core->io, addr, false)) {
// eprintf ("Warning: Invalid memory address at 0x%08"PFMT64x"\n", addr);
// R_LOG_WARN ("Invalid memory address at 0x%08"PFMT64x, addr);
return 4;
}

View File

@ -997,7 +997,7 @@ R_API RAnalOp* r_core_anal_op(RCore *core, ut64 addr, int mask) {
if (!op->mnemonic && mask & R_ANAL_OP_MASK_DISASM) {
RAsmOp asmop;
if (core->anal->verbose) {
eprintf ("Warning: Implement RAnalOp.MASK_DISASM for current anal.arch. Using the sluggish RAsmOp fallback for now.\n");
R_LOG_WARN ("Implement RAnalOp.MASK_DISASM for current anal.arch. Using the sluggish RAsmOp fallback for now.");
}
r_asm_set_pc (core->rasm, addr);
r_asm_op_init (&asmop);
@ -1967,7 +1967,7 @@ R_API bool r_core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int dep
if (core->io->va) {
if (!r_io_is_valid_offset (core->io, at, !core->anal->opt.noncode)) {
if (core->anal->verbose) {
eprintf ("Warning: Address not mapped or not executable at 0x%08"PFMT64x"\n", at);
R_LOG_WARN ("Address not mapped or not executable at 0x%08"PFMT64x, at);
}
return false;
}
@ -3990,7 +3990,7 @@ R_API int r_core_anal_search(RCore *core, ut64 from, ut64 to, ut64 ref, int mode
}
}
} else {
eprintf ("error: block size too small\n");
R_LOG_ERROR ("error: block size too small");
}
r_cons_break_pop ();
free (buf);
@ -4085,17 +4085,17 @@ R_API int r_core_anal_search_xrefs(RCore *core, ut64 from, ut64 to, PJ *pj, int
}
if (core->blocksize <= OPSZ) {
eprintf ("Error: block size too small\n");
R_LOG_ERROR ("block size too small");
return -1;
}
ut8 *buf = malloc (bsz);
if (!buf) {
eprintf ("Error: cannot allocate a block\n");
R_LOG_ERROR ("cannot allocate a block");
return -1;
}
ut8 *block = malloc (bsz);
if (!block) {
eprintf ("Error: cannot allocate a temp block\n");
R_LOG_ERROR ("cannot allocate a temp block");
free (buf);
return -1;
}
@ -4112,7 +4112,7 @@ R_API int r_core_anal_search_xrefs(RCore *core, ut64 from, ut64 to, PJ *pj, int
}
if (bsz < maxopsz) {
// wtf
eprintf ("Error: Something is really wrong deep inside\n");
R_LOG_ERROR ("Something is really wrong deep inside");
free (block);
return -1;
}
@ -4128,13 +4128,13 @@ R_API int r_core_anal_search_xrefs(RCore *core, ut64 from, ut64 to, PJ *pj, int
(void)r_io_read_at (core->io, at, buf, bsz);
memset (block, -1, bsz);
if (!memcmp (buf, block, bsz)) {
// eprintf ("Error: skipping uninitialized block \n");
// R_LOG_ERROR ("skipping uninitialized block ");
at += ret;
continue;
}
memset (block, 0, bsz);
if (!memcmp (buf, block, bsz)) {
// eprintf ("Error: skipping uninitialized block \n");
// R_LOG_ERROR ("skipping uninitialized block");
at += ret;
continue;
}
@ -5239,7 +5239,7 @@ R_API void r_core_anal_esil(RCore *core, const char *str, const char *target) {
return;
}
if (iend > MAX_SCAN_SIZE) {
eprintf ("Warning: Not going to analyze 0x%08"PFMT64x" bytes.\n", (ut64)iend);
R_LOG_WARN ("Not going to analyze 0x%08"PFMT64x" bytes.", (ut64)iend);
return;
}
buf = malloc ((size_t)iend + 2);
@ -5261,7 +5261,7 @@ R_API void r_core_anal_esil(RCore *core, const char *str, const char *target) {
}
const char *kspname = r_reg_get_name (core->anal->reg, R_REG_NAME_SP);
if (R_STR_ISEMPTY (kspname)) {
eprintf ("Error: No =SP defined in the reg profile.\n");
R_LOG_ERROR ("No =SP defined in the reg profile.");
return;
}
char *spname = strdup (kspname);
@ -5420,7 +5420,7 @@ R_API void r_core_anal_esil(RCore *core, const char *str, const char *target) {
}
const char *sn = r_reg_get_name (core->anal->reg, R_REG_NAME_SN);
if (!sn) {
eprintf ("Warning: No SN reg alias for current architecture.\n");
R_LOG_WARN ("No SN reg alias for current architecture.");
}
if (sn && op.type == R_ANAL_OP_TYPE_SWI) {
r_strf_buffer (64);
@ -5679,7 +5679,7 @@ R_IPI int r_core_search_value_in_range(RCore *core, bool relative, RInterval sea
ut32 v32;
ut16 v16;
if (from >= to) {
eprintf ("Error: from must be lower than to\n");
R_LOG_ERROR ("from must be lower than to");
return -1;
}
bool maybeThumb = false;
@ -5690,11 +5690,11 @@ R_IPI int r_core_search_value_in_range(RCore *core, bool relative, RInterval sea
}
if (vmin >= vmax) {
eprintf ("Error: vmin must be lower than vmax\n");
R_LOG_ERROR ("vmin must be lower than vmax");
return -1;
}
if (to == UT64_MAX) {
eprintf ("Error: Invalid destination boundary\n");
R_LOG_ERROR ("Invalid destination boundary");
return -1;
}
r_cons_break_push (NULL, NULL);
@ -5994,12 +5994,12 @@ R_API void r_core_anal_inflags(RCore *core, const char *glob) {
continue;
}
if (a0 > a1) {
eprintf ("Warning: unsorted flag list 0x%"PFMT64x" 0x%"PFMT64x"\n", a0, a1);
R_LOG_WARN ("unsorted flag list 0x%"PFMT64x" 0x%"PFMT64x, a0, a1);
continue;
}
st64 sz = a1 - a0;
if (sz < 1 || sz > core->anal->opt.bb_max_size) {
eprintf ("Warning: invalid flag range from 0x%08"PFMT64x" to 0x%08"PFMT64x"\n", a0, a1);
R_LOG_WARN ("invalid flag range from 0x%08"PFMT64x" to 0x%08"PFMT64x, a0, a1);
continue;
}
if (simple) {

View File

@ -90,12 +90,12 @@ R_API RList *r_core_asm_strsearch(RCore *core, const char *input, ut64 from, ut6
ut64 usrimm = r_num_math (core->num, inp);
ut64 usrimm2 = inp_arg? r_num_math (core->num, inp_arg): usrimm;
if (usrimm > usrimm2) {
eprintf ("Error: /ci : Invalid range\n");
R_LOG_ERROR ("/ci : Invalid range");
return NULL;
}
if (core->blocksize < 8) {
eprintf ("error: block size too small\n");
R_LOG_ERROR ("error: block size too small");
return NULL;
}
if (!(buf = (ut8 *)calloc (core->blocksize, 1))) {
@ -249,7 +249,7 @@ R_API RList *r_core_asm_strsearch(RCore *core, const char *input, ut64 from, ut6
if (maxhits) {
count++;
if (count >= maxhits) {
//eprintf ("Error: search.maxhits reached\n");
//R_LOG_ERROR ("search.maxhits reached");
goto beach;
}
}

View File

@ -260,7 +260,7 @@ R_API void r_core_bin_export_info(RCore *core, int mode) {
fmtsize, v, 0, NULL, NULL);
free (buf);
if (res < 0) {
eprintf ("Warning: Cannot register invalid format (%s)\n", v);
R_LOG_WARN ("Cannot register invalid format (%s)", v);
}
}
}
@ -781,11 +781,11 @@ R_API void r_core_anal_cc_init(RCore *core) {
char *s = r_reg_profile_to_cc (core->anal->reg);
if (s) {
if (!r_anal_cc_set (core->anal, s)) {
eprintf ("Warning: Invalid CC from reg profile.\n");
R_LOG_WARN ("Invalid CC from reg profile.");
}
free (s);
} else {
eprintf ("Warning: Cannot derive CC from reg profile.\n");
R_LOG_WARN ("Cannot derive CC from reg profile.");
}
}
#else
@ -808,11 +808,11 @@ R_API void r_core_anal_cc_init(RCore *core) {
char *s = r_reg_profile_to_cc (core->anal->reg);
if (s) {
if (!r_anal_cc_set (core->anal, s)) {
eprintf ("Warning: Invalid CC from reg profile.\n");
R_LOG_WARN ("Invalid CC from reg profile.");
}
free (s);
} else {
eprintf ("Warning: Cannot derive CC from reg profile.\n");
R_LOG_WARN ("Cannot derive CC from reg profile.");
}
}
R_FREE (cc->path);
@ -825,7 +825,7 @@ R_API void r_core_anal_cc_init(RCore *core) {
cc->path = strdup (dbpath);
}
if (anal_arch && sdb_isempty (core->anal->sdb_cc)) {
eprintf ("Warning: Missing calling conventions for '%s' %d. Deriving it from the regprofile.\n", anal_arch, bits);
R_LOG_WARN ("Missing calling conventions for '%s' %d. Deriving it from the regprofile.", anal_arch, bits);
}
free (anal_arch);
free (dbpath);
@ -1266,7 +1266,7 @@ R_API bool r_core_pdb_info(RCore *core, const char *file, PJ *pj, int mode) {
if (core->bin->cur && core->bin->cur->o && core->bin->cur->o->baddr) {
baddr = core->bin->cur->o->baddr;
} else if (baddr == UT64_MAX) {
eprintf ("Warning: Cannot find base address, flags will probably be misplaced\n");
R_LOG_WARN ("Cannot find base address, flags will probably be misplaced");
baddr = 0LL;
}
@ -3893,7 +3893,7 @@ static void bin_pe_versioninfo(RCore *r, PJ *pj, int mode) {
ut8 *val_utf8 = calloc (lenval * 2, 1);
if (r_str_utf16_to_utf8 (key_utf8, lenkey * 2, key_utf16, lenkey, true) < 0
|| r_str_utf16_to_utf8 (val_utf8, lenval * 2, val_utf16, lenval, true) < 0) {
eprintf ("Warning: Cannot decode utf16 to utf8\n");
R_LOG_WARN ("Cannot decode utf16 to utf8");
} else if (IS_MODE_JSON (mode)) {
pj_ks (pj, (char*)key_utf8, (char*)val_utf8);
} else {

View File

@ -1355,7 +1355,7 @@ static bool cb_cfgcharset(void *user, void *data) {
if (rc) {
r_sys_setenv ("RABIN2_CHARSET", cf);
} else {
eprintf ("Warning: Cannot load charset file '%s'.\n", cf);
R_LOG_WARN ("Cannot load charset file '%s'.", cf);
}
}
return rc;
@ -1746,7 +1746,7 @@ static bool cb_dbg_execs(void *user, void *data) {
}
#else
if (node->i_value) {
eprintf ("Warning: dbg.execs is not supported in this platform.\n");
R_LOG_WARN ("dbg.execs is not supported in this platform.");
}
#endif
return true;
@ -2287,7 +2287,7 @@ static bool cb_io_pava(void *user, void *data) {
RConfigNode *node = (RConfigNode *) data;
core->print->pava = node->i_value;
if (node->i_value && core->io->va) {
eprintf ("Warning: You may probably want to disable io.va too.\n");
R_LOG_WARN ("You may probably want to disable io.va too.");
}
return true;
}
@ -3182,7 +3182,7 @@ static bool cb_linesabs(void *user, void *data) {
ut64 to = r_num_math (core->num, (to_str && *to_str) ? to_str : "$s");
core->print->lines_cache_sz = r_core_lines_initcache (core, from, to);
if (core->print->lines_cache_sz == -1) {
eprintf ("ERROR: \"lines.from\" and \"lines.to\" must be set\n");
R_LOG_ERROR ("ERROR: \"lines.from\" and \"lines.to\" must be set");
} else {
eprintf ("Found %d lines\n", core->print->lines_cache_sz-1);
}

View File

@ -160,7 +160,7 @@ R_API bool r_core_file_reopen(RCore *core, const char *args, int perm, int loadb
ret = r_core_bin_load (core, obinfilepath, baddr);
r_core_bin_update_arch_bits (core);
if (!ret) {
eprintf ("Error: Failed to reload rbin for: %s\n", path);
R_LOG_ERROR ("Failed to reload rbin for: %s", path);
}
origoff = r_num_math (core->num, "entry0");
}

View File

@ -1208,7 +1208,7 @@ R_API bool r_core_run_script(RCore *core, const char *file) {
r_list_foreach (core->scriptstack, iter, name) {
if (!strcmp (file, name)) {
eprintf ("Warning: ignored nested source: %s\n", file);
R_LOG_WARN ("ignored nested source: %s", file);
return false;
}
}
@ -1344,14 +1344,14 @@ R_API bool r_core_run_script(RCore *core, const char *file) {
if (r_lang_use (core->lang, "qjs")) {
r_lang_run_file (core->lang, file);
} else {
eprintf ("Error: r2pm -ci rlang-qjs\n");
R_LOG_ERROR ("r2pm -ci rlang-qjs");
}
ret = 1;
} else if (!strcmp (ext, "wren")) {
if (r_lang_use (core->lang, "wren")) {
r_lang_run_file (core->lang, file);
} else {
eprintf ("Error: r2pm -ci rlang-wren\n");
R_LOG_ERROR ("r2pm -ci rlang-wren");
}
ret = 1;
} else if (!strcmp (ext, "pl")) {
@ -1674,7 +1674,7 @@ static void load_table_asciiart(RCore *core, RTable *t, RList *lines) {
RListIter *iter2;
ncols = 0;
if (r_list_length (t->cols) > 0) {
eprintf ("Warning: Not re-adding headers. Use ,- to reset the table.\n");
R_LOG_WARN ("Not re-adding headers. Use ,- to reset the table.");
continue;
}
r_list_foreach (args, iter2, arg) {
@ -2960,7 +2960,7 @@ static int cmd_system(void *data, const char *input) {
r_cons_write (out, olen);
free (out);
free (cmd);
} //else eprintf ("Error setting up system environment\n");
} //else R_LOG_ERROR ("Error setting up system environment");
} else {
eprintf ("History saved to "R2_HOME_HISTORY"\n");
r_line_hist_save (R2_HOME_HISTORY);
@ -2991,7 +2991,7 @@ static int cmd_system(void *data, const char *input) {
if (cmd) {
r_core_cmd0 (core, cmd);
}
//else eprintf ("Error setting up system environment\n");
//else R_LOG_ERROR ("Error setting up system environment");
} else {
char *cmd = r_core_sysenv_begin (core, input);
if (cmd) {
@ -3004,7 +3004,7 @@ static int cmd_system(void *data, const char *input) {
r_core_sysenv_end (core, input);
free (cmd);
} else {
eprintf ("Error setting up system environment\n");
R_LOG_ERROR ("Error setting up system environment");
}
}
break;
@ -4291,7 +4291,7 @@ repeat_arroba:
r_core_block_read (core);
}
} else {
eprintf ("Error: Invalid hexpairs for @x:\n");
R_LOG_ERROR ("Invalid hexpairs for @x:");
}
free (buf);
} else {

View File

@ -219,7 +219,7 @@ R_API int cmd_write_hexpair(RCore* core, const char* pairs) {
}
r_core_block_read (core);
} else {
R_LOG_ERROR ("Error: invalid hexpair string");
R_LOG_ERROR ("invalid hexpair string");
r_core_return_value (core, R_CMD_RC_FAILURE);
}
free (buf);

View File

@ -42,7 +42,7 @@ R_API bool r_core_plugin_init(RCmd *cmd) {
cmd->plist = r_list_newf (NULL); // memleak or dblfree
for (i = 0; cmd_static_plugins[i]; i++) {
if (!r_core_plugin_add (cmd, cmd_static_plugins[i])) {
eprintf ("Error loading cmd plugin\n");
R_LOG_ERROR ("Error loading cmd plugin");
return false;
}
}

View File

@ -10,7 +10,7 @@ static char *esil2c(RCore *core, RAnalEsil *esil, const char *expr) {
RStrBuf *sb = r_strbuf_new ("");
user->sb = sb;
if (!r_anal_esil_parse (esil, expr)) {
eprintf ("ERROR\n");
R_LOG_ERROR ("ERROR");
}
user->sb = NULL;
return r_strbuf_drain (sb);

View File

@ -446,9 +446,9 @@ static bool GH(r_resolve_main_arena)(RCore *core, GHT *m_arena) {
if (libc_addr_sta == GHT_MAX || libc_addr_end == GHT_MAX) {
if (r_config_get_b (core->config, "cfg.debug")) {
eprintf ("Warning: Can't find glibc mapped in memory (see dm)\n");
R_LOG_WARN ("Can't find glibc mapped in memory (see dm)");
} else {
eprintf ("Warning: Can't find arena mapped in memory (see om)\n");
R_LOG_WARN ("Can't find arena mapped in memory (see om)");
}
return false;
}
@ -487,7 +487,7 @@ static bool GH(r_resolve_main_arena)(RCore *core, GHT *m_arena) {
}
addr_srch += sizeof (GHT);
}
eprintf ("Warning: Can't find main_arena in mapped memory\n");
R_LOG_WARN ("Can't find main_arena in mapped memory");
free (ta);
return false;
}
@ -762,7 +762,7 @@ static void GH(print_heap_bin)(RCore *core, GHT m_arena, MallocState *main_arena
case 'g': // dmhbg [bin_num]
num_bin = r_num_get (NULL, input + j) - 1;
if (num_bin > NBINS - 2) {
eprintf ("Error: 0 < bin <= %d\n", NBINS - 1);
R_LOG_ERROR ("0 < bin <= %d", NBINS - 1);
break;
}
PRINTF_YA (" Bin %03"PFMT64u":\n", (ut64)num_bin + 1);
@ -889,7 +889,7 @@ void GH(print_heap_fastbin)(RCore *core, GHT m_arena, MallocState *main_arena, G
case ' ': // dmhf [bin_num]
num_bin = r_num_get (NULL, input) - 1;
if (num_bin >= NFASTBINS) {
eprintf ("Error: 0 < bin <= %d\n", NFASTBINS);
R_LOG_ERROR ("0 < bin <= %d", NFASTBINS);
break;
}
if (GH(print_single_linked_list_bin)(core, main_arena, m_arena, offset, num_bin, demangle)) {

View File

@ -109,14 +109,14 @@ static bool GH(r_resolve_jemalloc)(RCore *core, char *symname, ut64 *symbol) {
}
}
if (!path) {
eprintf ("Warning: cannot find jemalloc mapped in memory (see `dm`)\n");
R_LOG_WARN ("cannot find jemalloc mapped in memory (see `dm`)");
return false;
}
#if __linux__
bool is_debug_file = GH(je_matched)(path, "/usr/local/lib");
if (!is_debug_file) {
eprintf ("Warning: Cannot find libjemalloc.so.2 in /usr/local/lib\n");
R_LOG_WARN ("Cannot find libjemalloc.so.2 in /usr/local/lib");
return false;
}
if (r_file_exists (path)) {
@ -202,7 +202,7 @@ static void GH(jemalloc_get_chunks)(RCore *core, const char *input) {
extent_node_t *head = R_NEW0 (extent_node_t);
if (!node || !head) {
eprintf ("Error calling calloc\n");
R_LOG_ERROR ("Error calling calloc");
free (ar);
free (node);
free (head);
@ -367,7 +367,7 @@ static void GH(jemalloc_get_bins)(RCore *core, const char *input) {
break;
}
if (!GH(r_resolve_jemalloc)(core, "je_arena_bin_info", &bin_info)) {
eprintf ("Error resolving je_arena_bin_info\n");
R_LOG_ERROR ("Error resolving je_arena_bin_info");
R_FREE (b);
break;
}
@ -437,7 +437,7 @@ static void GH(jemalloc_get_runs)(RCore *core, const char *input) {
arena_chunk_t *c = R_NEW0 (arena_chunk_t);
if (!c) {
eprintf ("Error calling calloc\n");
R_LOG_ERROR ("Error calling calloc");
return;
}
@ -445,11 +445,11 @@ static void GH(jemalloc_get_runs)(RCore *core, const char *input) {
chunk = r_num_math (core->num, input);
if (!GH(r_resolve_jemalloc)(core, "je_chunk_npages", &npages)) {
eprintf ("Error resolving je_chunk_npages\n");
R_LOG_ERROR ("Error resolving je_chunk_npages");
return;
}
if (!GH(r_resolve_jemalloc)(core, "je_chunksize_mask", &chunksize_mask)) {
eprintf ("Error resolving je_chunksize_mask\n");
R_LOG_ERROR ("Error resolving je_chunksize_mask");
return;
}
if (!GH(r_resolve_jemalloc)(core, "je_map_bias", &map_bias)) {
@ -480,7 +480,7 @@ static void GH(jemalloc_get_runs)(RCore *core, const char *input) {
arena_run_t *r = R_NEW0 (arena_run_t);
if (!r) {
eprintf ("Error calling calloc\n");
R_LOG_ERROR ("Error calling calloc");
return;
}
for (pageind = map_bias; pageind < npages; pageind++) {

View File

@ -874,7 +874,7 @@ static int r_cmd_java_handle_replace_classname_value(RCore *core, const char *cm
core, obj, idx, addr,
(const ut8 *)result, res_len);
if (res == false) {
eprintf ("ERROR: r_cmd_java: Failed to write bytes or reload the binary.\n");
R_LOG_ERROR ("ERROR: r_cmd_java: Failed to write bytes or reload the binary.");
}
}
free (result);
@ -1739,7 +1739,7 @@ static int r_cmd_java_print_method_num_name(RBinJavaObj *obj) {
static int r_cmd_java_print_field_summary(RBinJavaObj *obj, ut16 idx) {
int res = r_bin_java_print_field_idx_summary (obj, idx);
if (res == false) {
eprintf ("Error: Field or Method @ index (%d) not found in the RBinJavaObj.\n", idx);
R_LOG_ERROR ("Field or Method @ index (%d) not found in the RBinJavaObj.", idx);
res = true;
}
return res;
@ -1757,7 +1757,7 @@ static int r_cmd_java_print_field_name(RBinJavaObj *obj, ut16 idx) {
if (res) {
r_cons_println (res);
} else {
eprintf ("Error: Field or Method @ index (%d) not found in the RBinJavaObj.\n", idx);
R_LOG_ERROR ("Field or Method @ index (%d) not found in the RBinJavaObj.", idx);
}
free (res);
return true;
@ -1766,7 +1766,7 @@ static int r_cmd_java_print_field_name(RBinJavaObj *obj, ut16 idx) {
static int r_cmd_java_print_method_summary(RBinJavaObj *obj, ut16 idx) {
int res = r_bin_java_print_method_idx_summary (obj, idx);
if (res == false) {
eprintf ("Error: Field or Method @ index (%d) not found in the RBinJavaObj.\n", idx);
R_LOG_ERROR ("Field or Method @ index (%d) not found in the RBinJavaObj.", idx);
res = true;
}
return res;
@ -1784,7 +1784,7 @@ static int r_cmd_java_print_method_name(RBinJavaObj *obj, ut16 idx) {
if (res) {
r_cons_println (res);
} else {
eprintf ("Error: Field or Method @ index (%d) not found in the RBinJavaObj.\n", idx);
R_LOG_ERROR ("Field or Method @ index (%d) not found in the RBinJavaObj.", idx);
}
free (res);
return true;

View File

@ -669,7 +669,7 @@ R_API bool r_core_project_save(RCore *core, const char *prj_name) {
char *prj_bin_file = r_str_newf ("%s" R_SYS_DIR "%s", prj_bin_dir, bin_filename);
r_sys_mkdirp (prj_bin_dir);
if (!r_file_copy (bin_file, prj_bin_file)) {
eprintf ("Warning: Cannot copy '%s' into '%s'\n", bin_file, prj_bin_file);
R_LOG_WARN ("Cannot copy '%s' into '%s'", bin_file, prj_bin_file);
}
free (prj_bin_file);
free (prj_bin_dir);

View File

@ -659,7 +659,7 @@ R_API void r_core_rtr_pushout(RCore *core, const char *input) {
}
}
if (!(cmd = strchr (input, ' '))) {
eprintf ("Error\n");
R_LOG_ERROR ("Error");
return;
}
} else {
@ -667,18 +667,18 @@ R_API void r_core_rtr_pushout(RCore *core, const char *input) {
}
if (!rtr_host[rtr_n].fd || !rtr_host[rtr_n].fd->fd) {
eprintf ("Error: Unknown host\n");
R_LOG_ERROR ("Unknown host");
return;
}
if (!(str = r_core_cmd_str (core, cmd))) {
eprintf ("Error: radare_cmd_str returned NULL\n");
R_LOG_ERROR ("radare_cmd_str returned NULL");
return;
}
switch (rtr_host[rtr_n].proto) {
case RTR_PROTOCOL_RAP:
eprintf ("Error: Cannot use '=<' to a rap connection.\n");
R_LOG_ERROR ("Cannot use '=<' to a rap connection.");
break;
case RTR_PROTOCOL_UNIX:
r_socket_write (rtr_host[rtr_n].fd, str, strlen (str));
@ -774,7 +774,7 @@ R_API void r_core_rtr_add(RCore *core, const char *_input) {
// it's fine to listen without serving a file
} else {
file = "cmd/";
eprintf ("Error: Missing '/'\n");
R_LOG_ERROR ("Missing '/'");
//c:wreturn;
}
}
@ -786,7 +786,7 @@ R_API void r_core_rtr_add(RCore *core, const char *_input) {
fd = r_socket_new (false);
if (!fd) {
eprintf ("Error: Cannot create new socket\n");
R_LOG_ERROR ("Cannot create new socket");
return;
}
switch (proto) {
@ -807,7 +807,7 @@ R_API void r_core_rtr_add(RCore *core, const char *_input) {
break;
case RTR_PROTOCOL_RAP:
if (!r_socket_connect_tcp (fd, host, port, timeout)) { //TODO: Use rap.ssl
eprintf ("Error: Cannot connect to '%s' (%s)\n", host, port);
R_LOG_ERROR ("Cannot connect to '%s' (%s)", host, port);
r_socket_free (fd);
return;
} else {
@ -818,7 +818,7 @@ R_API void r_core_rtr_add(RCore *core, const char *_input) {
case RTR_PROTOCOL_UNIX:
if (!r_socket_connect_unix (fd, host)) {
r_core_return_value (core, R_CMD_RC_FAILURE);
eprintf ("Error: Cannot connect to 'unix://%s'\n", host);
R_LOG_ERROR ("Cannot connect to 'unix://%s'", host);
r_socket_free (fd);
return;
}
@ -828,7 +828,7 @@ R_API void r_core_rtr_add(RCore *core, const char *_input) {
case RTR_PROTOCOL_TCP:
if (!r_socket_connect_tcp (fd, host, port, timeout)) { //TODO: Use rap.ssl
r_core_return_value (core, R_CMD_RC_FAILURE);
eprintf ("Error: Cannot connect to '%s' (%s)\n", host, port);
R_LOG_ERROR ("Cannot connect to '%s' (%s)", host, port);
r_socket_free (fd);
return;
}
@ -838,7 +838,7 @@ R_API void r_core_rtr_add(RCore *core, const char *_input) {
case RTR_PROTOCOL_UDP:
if (!r_socket_connect_udp (fd, host, port, timeout)) { //TODO: Use rap.ssl
r_core_return_value (core, R_CMD_RC_FAILURE);
eprintf ("Error: Cannot connect to '%s' (%s)\n", host, port);
R_LOG_ERROR ("Cannot connect to '%s' (%s)", host, port);
r_socket_free (fd);
return;
}
@ -1025,7 +1025,7 @@ R_API void r_core_rtr_cmd(RCore *core, const char *input) {
}
if (!rtr_host[rtr_n].fd) {
eprintf ("Error: Unknown host\n");
R_LOG_ERROR ("Unknown host");
r_core_return_value (core, R_CMD_RC_FAILURE);
return;
}
@ -1039,7 +1039,7 @@ R_API void r_core_rtr_cmd(RCore *core, const char *input) {
r_socket_close (s);
r_strf_var (portstr, 32, "%d", rh->port);
if (!r_socket_connect (s, rh->host, portstr, R_SOCKET_PROTO_TCP, 0)) {
eprintf ("Error: Cannot connect to '%s' (%d)\n", rh->host, rh->port);
R_LOG_ERROR ("Cannot connect to '%s' (%d)", rh->host, rh->port);
r_socket_free (s);
return;
}
@ -1048,7 +1048,7 @@ R_API void r_core_rtr_cmd(RCore *core, const char *input) {
int maxlen = 4096; // r_read_le32 (blen);
char *cmd_output = calloc (1, maxlen + 1);
if (!cmd_output) {
eprintf ("Error: Allocating cmd output\n");
R_LOG_ERROR ("Allocating cmd output");
return;
}
(void)r_socket_read_block (s, (ut8*)cmd_output, maxlen);
@ -1094,7 +1094,7 @@ R_API void r_core_rtr_cmd(RCore *core, const char *input) {
free (cmd_output);
return;
}
eprintf ("Error: Unknown protocol\n");
R_LOG_ERROR ("Unknown protocol");
}
// TODO: support len for binary data?
@ -1345,7 +1345,7 @@ R_API int r_core_rtr_cmds(RCore *core, const char *port) {
s->local = r_config_get_i (core->config, "tcp.islocal");
if (!r_socket_listen (s, port, NULL)) {
eprintf ("Error listening on port %s\n", port);
R_LOG_ERROR ("Error listening on port %s", port);
r_socket_free (s);
return false;
}

View File

@ -531,7 +531,7 @@ static RThreadFunctionRet r_core_rtr_http_thread(RThread *th) {
if (!ht || !ht->core) {
return false;
}
eprintf ("Warning: Background webserver requires http.sandbox=false to run properly\n");
R_LOG_WARN ("Background webserver requires http.sandbox=false to run properly");
int ret = r_core_rtr_http_run (ht->core, ht->launch, ht->browse, ht->path);
R_FREE (ht->path);
if (ret) {

View File

@ -134,7 +134,7 @@ static bool repo_exists(const char *path) {
break;
}
if (!r_file_is_directory (files[i]) && !r_file_exists (files[i])) {
eprintf ("Error: Corrupt repo: %s doesn't exist\n",
R_LOG_ERROR ("Corrupt repo: %s doesn't exist",
files[i]);
r = false;
break;

View File

@ -82,14 +82,14 @@ R_API void r_core_visual_asm(RCore *core, ut64 off) {
if (cva.acode && cva.acode->len > 0) {
if (r_cons_yesno ('y', "Save changes? (Y/n)")) {
if (!r_io_write_at (core->io, off, cva.acode->bytes, cva.acode->len)) {
eprintf ("ERROR: Cannot write in here, check map permissions or reopen the file with oo+\n");
R_LOG_ERROR ("ERROR: Cannot write in here, check map permissions or reopen the file with oo+");
r_cons_any_key (NULL);
}
// r_core_cmdf (core, "wx %s @ 0x%"PFMT64x, cva.acode->buf_hex, off);
}
#if 0
} else if (!cva.acode || cva.acode->len == 0) {
eprintf ("ERROR: Cannot assemble those instructions\n");
R_LOG_ERROR ("ERROR: Cannot assemble those instructions");
// r_cons_any_key (NULL);
#endif
}

View File

@ -4075,7 +4075,7 @@ onemoretime:
int rc = r_anal_op (core->anal, &op, off,
core->block + off - core->offset, 32, R_ANAL_OP_MASK_BASIC);
if (rc < 1) {
eprintf ("Error analyzing opcode at 0x%08"PFMT64x"\n", off);
R_LOG_ERROR ("Error analyzing opcode at 0x%08"PFMT64x, off);
} else {
tgt_addr = op.jump != UT64_MAX ? op.jump : op.ptr;
RAnalVar *var = r_anal_get_used_function_var (core->anal, op.addr);

View File

@ -419,13 +419,13 @@ R_API bool r_core_yank_file_ex(RCore *core, const char *input) {
adv = consume_chars (input, ' ');
len = r_num_math (core->num, input + adv);
if (len == 0) {
eprintf ("ERROR: Number of bytes read must be > 0\n");
R_LOG_ERROR ("ERROR: Number of bytes read must be > 0");
return res;
}
// get the addr/offset from in the file we want to read
adv += find_next_char (input + adv, ' ');
if (adv == 0) {
eprintf ("ERROR: Address must be specified\n");
R_LOG_ERROR ("ERROR: Address must be specified");
return res;
}
adv++;
@ -435,7 +435,7 @@ R_API bool r_core_yank_file_ex(RCore *core, const char *input) {
adv += find_next_char (input + adv, ' ');
if (adv == 0) {
eprintf ("ERROR: File must be specified\n");
R_LOG_ERROR ("ERROR: File must be specified");
return res;
}
adv++;

View File

@ -300,13 +300,13 @@ R_API RBreakpointItem *r_debug_bp_add(RDebug *dbg, ut64 addr, int hw, bool watch
}
perm = ((map->perm & 1) << 2) | (map->perm & 2) | ((map->perm & 4) >> 2);
if (!(perm & R_BP_PROT_EXEC)) {
eprintf ("Warning: setting bp within mapped memory without exec perm\n");
R_LOG_WARN ("setting bp within mapped memory without exec perm");
}
break;
}
}
if (!valid) {
eprintf ("Warning: module's base addr + delta is not a valid address\n");
R_LOG_WARN ("module's base addr + delta is not a valid address");
free (module_name);
return NULL;
}
@ -1140,7 +1140,7 @@ R_API int r_debug_step_over(RDebug *dbg, int steps) {
R_API bool r_debug_goto_cnum(RDebug *dbg, ut32 cnum) {
if (cnum > dbg->session->maxcnum) {
eprintf ("Error: out of cnum range\n");
R_LOG_ERROR ("out of cnum range");
return false;
}
dbg->session->cnum = cnum;

View File

@ -220,7 +220,7 @@ R_API bool r_debug_session_add_reg_change(RDebugSession *session, int arena, ut6
if (!vreg) {
vreg = r_vector_new (sizeof (RDebugChangeReg), NULL, NULL);
if (!vreg) {
eprintf ("Error: creating a register vector.\n");
R_LOG_ERROR ("creating a register vector.");
return false;
}
ht_up_insert (session->registers, offset | (arena << 16), vreg);
@ -235,7 +235,7 @@ R_API bool r_debug_session_add_mem_change(RDebugSession *session, ut64 addr, ut8
if (!vmem) {
vmem = r_vector_new (sizeof (RDebugChangeMem), NULL, NULL);
if (!vmem) {
eprintf ("Error: creating a memory vector.\n");
R_LOG_ERROR ("creating a memory vector.");
return false;
}
ht_up_insert (session->memory, addr, vmem);
@ -412,7 +412,7 @@ R_API void r_debug_session_serialize(RDebugSession *session, Sdb *db) {
static bool session_sdb_save(Sdb *db, const char *path) {
char *filename;
if (!r_file_is_directory (path)) {
eprintf ("Error: %s is not a directory\n", path);
R_LOG_ERROR ("%s is not a directory", path);
return false;
}
@ -481,7 +481,7 @@ static bool deserialize_memory_cb(void *user, const char *addr, const char *v) {
// Insert a new vector into `memory` HtUP at `addr`
RVector *vmem = r_vector_new (sizeof (RDebugChangeMem), NULL, NULL);
if (!vmem) {
eprintf ("Error: failed to allocate RVector vmem.\n");
R_LOG_ERROR ("failed to allocate RVector vmem.");
free (json_str);
r_json_free (reg_json);
return false;
@ -530,7 +530,7 @@ static bool deserialize_registers_cb(void *user, const char *addr, const char *v
HtUP *registers = user;
RVector *vreg = r_vector_new (sizeof (RDebugChangeReg), NULL, NULL);
if (!vreg) {
eprintf ("Error: failed to allocate RVector vreg.\n");
R_LOG_ERROR ("failed to allocate RVector vreg.");
r_json_free (reg_json);
free (json_str);
return true;
@ -639,7 +639,7 @@ static bool deserialize_checkpoints_cb(void *user, const char *cnum, const char
RDebugSnap *snap = R_NEW0 (RDebugSnap);
if (!snap) {
eprintf ("Error: failed to allocate RDebugSnap snap\n");
R_LOG_ERROR ("failed to allocate RDebugSnap snap");
continue;
}
snap->name = strdup (namej->str_value);
@ -667,7 +667,7 @@ static void deserialize_checkpoints(Sdb *db, RVector *checkpoints) {
static bool session_sdb_load_ns(Sdb *db, const char *nspath, const char *filename) {
Sdb *tmpdb = sdb_new0 ();
if (sdb_open (tmpdb, filename) == -1) {
eprintf ("Error: failed to load %s into sdb\n", filename);
R_LOG_ERROR ("failed to load %s into sdb", filename);
sdb_free (tmpdb);
return false;
}
@ -711,7 +711,7 @@ R_API void r_debug_session_deserialize(RDebugSession *session, Sdb *db) {
#define DESERIALIZE(ns, func) do { \
subdb = sdb_ns (db, ns, false); \
if (!subdb) { \
eprintf ("Error: missing " ns " namespace\n"); \
R_LOG_ERROR ("missing " ns " namespace"); \
return; \
} \
func; \

View File

@ -34,7 +34,7 @@ static bool is_io_bf(RDebug *dbg) {
return true;
}
}
eprintf ("error: the iodesc data is not brainfuck friendly\n");
R_LOG_ERROR ("error: the iodesc data is not brainfuck friendly");
return false;
}

View File

@ -24,7 +24,7 @@ static bool isBochs(RDebug *dbg) {
return true;
}
}
eprintf ("error: the iodesc data is not bochs friendly\n");
R_LOG_ERROR ("error: the iodesc data is not bochs friendly");
return false;
}

View File

@ -382,7 +382,7 @@ static bool r_debug_gdb_attach(RDebug *dbg, int pid) {
int bits = dbg->anal->config->bits;
gdbr_set_architecture (desc, arch, bits);
} else {
eprintf ("ERROR: Underlying IO descriptor is not a GDB one..\n");
R_LOG_ERROR ("ERROR: Underlying IO descriptor is not a GDB one..");
}
}
return true;

View File

@ -97,7 +97,7 @@ static int r_debug_handle_signals(RDebug *dbg) {
#if __KFBSD__
return bsd_handle_signals (dbg);
#else
eprintf ("Warning: signal handling is not supported on this platform\n");
R_LOG_WARN ("signal handling is not supported on this platform");
return 0;
#endif
}
@ -239,7 +239,7 @@ static bool r_debug_native_continue(RDebug *dbg, int pid, int tid, int sig) {
r_list_foreach (dbg->threads, it, th) {
ret = r_debug_ptrace (dbg, PTRACE_CONT, th->pid, 0, 0);
if (ret) {
eprintf ("Error: (%d) is running or dead.\n", th->pid);
R_LOG_ERROR ("(%d) is running or dead.", th->pid);
}
}
} else {
@ -301,7 +301,7 @@ static RDebugReasonType r_debug_native_wait(RDebug *dbg, int pid) {
RW32Dw *wrap = dbg->user;
if (pid == -1) {
eprintf ("ERROR: r_debug_native_wait called with pid -1\n");
R_LOG_ERROR ("ERROR: r_debug_native_wait called with pid -1");
return R_DEBUG_REASON_ERROR;
}
@ -428,7 +428,7 @@ static RDebugReasonType r_debug_native_wait(RDebug *dbg, int pid) {
RDebugReasonType reason = R_DEBUG_REASON_UNKNOWN;
if (pid == -1) {
eprintf ("ERROR: r_debug_native_wait called with pid -1\n");
R_LOG_ERROR ("ERROR: r_debug_native_wait called with pid -1");
return R_DEBUG_REASON_ERROR;
}
@ -441,7 +441,7 @@ static RDebugReasonType r_debug_native_wait(RDebug *dbg, int pid) {
RDebugReasonType reason = R_DEBUG_REASON_UNKNOWN;
if (pid == -1) {
eprintf ("ERROR: r_debug_native_wait called with pid -1\n");
R_LOG_ERROR ("ERROR: r_debug_native_wait called with pid -1");
return R_DEBUG_REASON_ERROR;
}
@ -1587,7 +1587,7 @@ static int r_debug_setup_ownership(int fd, RDebug *dbg) {
RDebugInfo *info = r_debug_info (dbg, NULL);
if (!info) {
eprintf ("Error while getting debug info.\n");
R_LOG_ERROR ("Error while getting debug info.");
return -1;
}
fchown (fd, info->uid, info->gid);

View File

@ -35,7 +35,7 @@ static bool __rap_attach(RDebug *dbg, int pid) {
if (!strcmp ("rap", d->plugin->name)) {
eprintf ("SUCCESS: rap attach with inferior rap rio worked\n");
} else {
eprintf ("ERROR: Underlying IO descriptor is not a rap one..\n");
R_LOG_ERROR ("ERROR: Underlying IO descriptor is not a rap one..");
}
}
return true;

View File

@ -822,7 +822,7 @@ static proc_per_process_t *get_proc_process_content(RDebug *dbg) {
}
if (!p->num_threads || p->num_threads < 1) {
free (p);
eprintf ("Warning: number of threads is < 1\n");
R_LOG_WARN ("number of threads is < 1");
return NULL;
}
file = r_strf ("/proc/%d/status", dbg->pid);

View File

@ -48,7 +48,7 @@ static PTHREAD_ITEM __r_debug_thread_add(RDebug *dbg, DWORD pid, DWORD tid, HAND
}
pthread = R_NEW0 (THREAD_ITEM);
if (!pthread) {
R_LOG_ERROR ("__r_debug_thread_add: Memory allocation failed.\n");
R_LOG_ERROR ("__r_debug_thread_add: Memory allocation failed.");
return NULL;
}
*pthread = th;

View File

@ -316,7 +316,7 @@ R_API void r_w32_identify_window(void) {
return;
}
if (!win) {
eprintf ("Error trying to get information from 0x%08"PFMT64x"\n", (ut64)hwnd);
R_LOG_ERROR ("Error trying to get information from 0x%08"PFMT64x, (ut64)hwnd);
return;
}
RTable *tbl = __create_window_table ();

View File

@ -8,7 +8,7 @@ static bool xnu_x86_hwstep_enable64(RDebug *dbg, bool enable) {
xnu_thread_t *th = get_xnu_thread (dbg, dbg->tid);
ret = xnu_thread_get_gpr (dbg, th);
if (!ret) {
eprintf ("error to get gpr registers in trace bit intel\n");
R_LOG_ERROR ("error to get gpr registers in trace bit intel");
return false;
}
state = (R_REG_T *)&th->gpr;
@ -23,7 +23,7 @@ static bool xnu_x86_hwstep_enable64(RDebug *dbg, bool enable) {
return false;
}
if (!xnu_thread_set_gpr (dbg, th)) {
eprintf ("error xnu_thread_set_gpr in modify_trace_bit intel\n");
R_LOG_ERROR ("error xnu_thread_set_gpr in modify_trace_bit intel");
return false;
}
return true;
@ -34,7 +34,7 @@ static bool xnu_x86_hwstep_enable32(RDebug *dbg, bool enable) {
xnu_thread_t *th = get_xnu_thread (dbg, dbg->tid);
int ret = xnu_thread_get_gpr (dbg, th);
if (!ret) {
eprintf ("error to get gpr registers in trace bit intel\n");
R_LOG_ERROR ("error to get gpr registers in trace bit intel");
return false;
}
state = (R_REG_T *)&th->gpr;
@ -46,7 +46,7 @@ static bool xnu_x86_hwstep_enable32(RDebug *dbg, bool enable) {
return false;
}
if (!xnu_thread_set_gpr (dbg, th)) {
eprintf ("error xnu_thread_set_gpr in modify_trace_bit intel\n");
R_LOG_ERROR ("error xnu_thread_set_gpr in modify_trace_bit intel");
return false;
}
return true;

View File

@ -209,7 +209,7 @@ bool xnu_attach(RDebug *dbg, int pid) {
}
#else
if (!xnu_create_exception_thread (dbg, pid)) {
eprintf ("error setting up exception thread\n");
R_LOG_ERROR ("error setting up exception thread");
return false;
}
dbg->pid = pid;
@ -310,7 +310,7 @@ bool xnu_continue(RDebug *dbg, int pid, int tid, int sig) {
//disable trace bit if enable
if (th->stepping) {
if (!clear_trace_bit (dbg, th)) {
eprintf ("error clearing trace bit in xnu_continue\n");
R_LOG_ERROR ("error clearing trace bit in xnu_continue");
return false;
}
}
@ -474,7 +474,7 @@ RDebugInfo *xnu_info(RDebug *dbg, const char *arg) {
}
int kinfo_proc_error = xnu_get_kinfo_proc(dbg->pid, &kp);
if (kinfo_proc_error) {
eprintf ("Error while querying the process info to sysctl\n");
R_LOG_ERROR ("Error while querying the process info to sysctl");
return NULL;
}
rdi->status = R_DBG_PROC_SLEEP; // TODO: Fix this w/o libproc ?

View File

@ -18,7 +18,7 @@ static bool modify_trace_bit(RDebug *dbg, xnu_thread_t *th, int enable) {
int ret;
ret = xnu_thread_get_gpr (dbg, th);
if (!ret) {
eprintf ("error to get gpr registers in trace bit intel\n");
R_LOG_ERROR ("error to get gpr registers in trace bit intel");
return false;
}
state = (R_REG_T *)&th->gpr;
@ -33,7 +33,7 @@ static bool modify_trace_bit(RDebug *dbg, xnu_thread_t *th, int enable) {
return false;
}
if (!xnu_thread_set_gpr (dbg, th)) {
eprintf ("error xnu_thread_set_gpr in modify_trace_bit intel\n");
R_LOG_ERROR ("error xnu_thread_set_gpr in modify_trace_bit intel");
return false;
}
return true;
@ -54,14 +54,14 @@ static bool modify_trace_bit(RDebug *dbg, xnu_thread *th, int enable) {
kr = thread_get_state (th->tid, R_REG_STATE_T,
(thread_state_t)&state, &state_count);
if (kr != KERN_SUCCESS) {
eprintf ("error modify_trace_bit\n");
R_LOG_ERROR ("error modify_trace_bit");
return false;
}
state.srr1 = (state.srr1 & ~0x400UL) | (enable ? 0x400UL : 0);
kr = thread_set_state (th->tid, R_REG_STATE_T,
(thread_state_t)&state, state_count);
if (kr != KERN_SUCCESS) {
eprintf ("Error to set thread state modificy_trace_bit ppc\n");
R_LOG_ERROR ("Error to set thread state modificy_trace_bit ppc");
return false;
}
return true;
@ -114,7 +114,7 @@ static bool is_thumb_32(ut16 op) {
static bool modify_trace_bit(RDebug *dbg, xnu_thread_t *th, int enable) {
int ret = xnu_thread_get_drx (dbg, th);
if (!ret) {
eprintf ("error to get drx registers modificy_trace_bit arm\n");
R_LOG_ERROR ("error to get drx registers modificy_trace_bit arm");
return false;
}
#if __arm64 || __arm64__ || __aarch64 || __aarch64__
@ -140,7 +140,7 @@ static bool modify_trace_bit(RDebug *dbg, xnu_thread_t *th, int enable) {
R_REG_T *regs;
ret = xnu_thread_get_gpr (dbg, th);
if (!ret) {
eprintf ("error to get gpr register modificy_trace_bit arm\n");
R_LOG_ERROR ("error to get gpr register modificy_trace_bit arm");
return false;
}
regs = (R_REG_T*)&th->gpr;
@ -203,7 +203,7 @@ static bool modify_trace_bit(RDebug *dbg, xnu_thread_t *th, int enable) {
}
//set state
if (!xnu_thread_set_drx (dbg, th)) {
eprintf ("error to set drx modificy_trace_bit arm\n");
R_LOG_ERROR ("error to set drx modificy_trace_bit arm");
return false;
}
return true;

View File

@ -44,7 +44,7 @@ R_API bool r_debug_use(RDebug *dbg, const char *str) {
r_reg_set_profile_string (dbg->reg, p);
free (p);
} else {
eprintf ("Cannot retrieve reg profile from debug plugin (%s)\n", dbg->h->name);
R_LOG_ERROR ("Cannot retrieve reg profile from debug plugin (%s)", dbg->h->name);
}
}
return (dbg && dbg->h);
@ -103,7 +103,7 @@ R_API bool r_debug_plugin_add(RDebug *dbg, RDebugPlugin *foo) {
R_API bool r_debug_plugin_set_reg_profile(RDebug *dbg, const char *profile) {
char *str = r_file_slurp (profile, NULL);
if (!str) {
eprintf ("r_debug_plugin_set_reg_profile: Cannot find '%s'\n", profile);
R_LOG_ERROR ("r_debug_plugin_set_reg_profile: Cannot find '%s'", profile);
return false;
}
if (dbg && dbg->h && dbg->h->set_reg_profile) {

View File

@ -14,14 +14,14 @@ R_API void r_debug_snap_free(RDebugSnap *snap) {
R_API RDebugSnap *r_debug_snap_map(RDebug *dbg, RDebugMap *map) {
r_return_val_if_fail (dbg && map, NULL);
if (map->size < 1) {
eprintf ("Invalid map size\n");
R_LOG_ERROR ("Invalid map size");
return NULL;
}
// TODO: Support streaming memory snapshots to avoid big allocations
if (map->size > dbg->maxsnapsize) {
char *us = r_num_units (NULL, 0, map->size);
const char *name = r_str_get (map->name);
eprintf ("Not snapping map %s (%s > dbg.maxsnapsize)\n", name, us);
R_LOG_ERROR ("Not snapping map %s (%s > dbg.maxsnapsize)", name, us);
free (us);
return NULL;
}
@ -44,7 +44,7 @@ R_API RDebugSnap *r_debug_snap_map(RDebug *dbg, RDebugMap *map) {
r_debug_snap_free (snap);
return NULL;
}
eprintf ("Reading %d byte(s) from 0x%08"PFMT64x "...\n", snap->size, snap->addr);
R_LOG_ERROR ("Reading %d byte(s) from 0x%08"PFMT64x "...", snap->size, snap->addr);
dbg->iob.read_at (dbg->iob.io, snap->addr, snap->data, snap->size);
return snap;

View File

@ -76,7 +76,7 @@ R_API bool r_debug_trace_ins_before(RDebug *dbg) {
break;
case R_ANAL_VAL_MEM:
if (val->memref > 32) {
eprintf ("Error: adding changes to %d bytes in memory.\n", val->memref);
R_LOG_ERROR ("adding changes to %d bytes in memory.", val->memref);
r_list_delete (dbg->cur_op->access, it);
break;
}
@ -122,7 +122,7 @@ R_API bool r_debug_trace_ins_after(RDebug *dbg) {
case R_ANAL_VAL_REG:
{
if (!val->reg) {
R_LOG_ERROR("invalid register, unable to trace register state\n");
R_LOG_ERROR ("invalid register, unable to trace register state");
continue;
}
ut64 data = r_reg_get_value (dbg->reg, val->reg);
@ -135,7 +135,7 @@ R_API bool r_debug_trace_ins_after(RDebug *dbg) {
{
ut8 buf[32] = {0};
if (!dbg->iob.read_at (dbg->iob.io, val->base, buf, val->memref)) {
eprintf ("Error reading memory at 0x%"PFMT64x"\n", val->base);
R_LOG_ERROR ("Error reading memory at 0x%"PFMT64x, val->base);
break;
}
@ -162,12 +162,12 @@ R_API int r_debug_trace_pc(RDebug *dbg, ut64 pc) {
ut8 buf[32];
RAnalOp op = {0};
if (!dbg->iob.is_valid_offset (dbg->iob.io, pc, 0)) {
eprintf ("trace_pc: cannot read memory at 0x%"PFMT64x"\n", pc);
R_LOG_ERROR ("trace_pc: cannot read memory at 0x%"PFMT64x, pc);
return false;
}
(void)dbg->iob.read_at (dbg->iob.io, pc, buf, sizeof (buf));
if (r_anal_op (dbg->anal, &op, pc, buf, sizeof (buf), R_ANAL_OP_MASK_ESIL) < 1) {
eprintf ("trace_pc: cannot get opcode size at 0x%"PFMT64x"\n", pc);
R_LOG_ERROR ("trace_pc: cannot get opcode size at 0x%"PFMT64x, pc);
return false;
}
r_debug_trace_op (dbg, &op);
@ -182,7 +182,7 @@ R_API void r_debug_trace_op(RDebug *dbg, RAnalOp *op) {
r_anal_esil_trace_op (dbg->anal->esil, op);
} else {
if (dbg->verbose) {
eprintf ("Run aeim to get dbg->anal->esil initialized\n");
R_LOG_ERROR ("Run aeim to get dbg->anal->esil initialized");
}
}
if (oldpc != UT64_MAX) {

View File

@ -372,7 +372,7 @@ R_API bool r_egg_compile(REgg *egg) {
for (; b; ) {
r_egg_lang_parsechar (egg, b);
if (egg->lang.elem_n >= sizeof (egg->lang.elem)) {
eprintf ("ERROR: elem too large.\n");
R_LOG_ERROR ("ERROR: elem too large.");
break;
}
size_t r = r_buf_read (egg->src, (ut8 *)&b, sizeof (b));
@ -382,7 +382,7 @@ R_API bool r_egg_compile(REgg *egg) {
// XXX: some parse fail errors are false positives :(
}
if (egg->context > 0) {
eprintf ("ERROR: expected '}' at the end of the file. %d left\n", egg->context);
R_LOG_ERROR ("ERROR: expected '}' at the end of the file. %d left", egg->context);
return false;
}
// TODO: handle errors here
@ -573,7 +573,7 @@ R_API void r_egg_finalize(REgg *egg) {
const ut8 *buf = r_buf_data (ep->b, &sz);
int r = r_buf_write_at (egg->bin, ep->off, buf, sz);
if (r < sz) {
eprintf ("Error during patch\n");
R_LOG_ERROR ("Error during patch");
return;
}
} else {

View File

@ -194,7 +194,7 @@ static struct cEnv_t* r_egg_cfile_set_cEnv(const char *arch, const char *os, int
cEnv->LDFLAGS = strdup (buffer);
if (r_egg_cfile_check_cEnv (cEnv)) {
eprintf ("Error with cEnv allocation!\n");
R_LOG_ERROR ("Error with cEnv allocation!");
goto fail;
}
@ -230,7 +230,7 @@ static bool r_egg_cfile_parseCompiled(const char *file) {
free (fileExt);
fileExt = r_str_newf ("%s.s", file);
if (!r_file_dump (fileExt, (const ut8*) buffer, strlen (buffer), true)) {
eprintf ("Error while opening %s.s\n", file);
R_LOG_ERROR ("Error while opening %s.s", file);
goto fail;
}
@ -268,7 +268,7 @@ R_API char* r_egg_cfile_parser(const char *file, const char *arch, const char *o
}
if (!r_file_dump (fileExt, (const ut8*) cEnv->SHDR, strlen (cEnv->SHDR), false)) {
eprintf ("Error while opening %s.s\n", file);
R_LOG_ERROR ("Error while opening %s.s", file);
goto fail;
}

View File

@ -585,7 +585,7 @@ R_API char *r_egg_mkvar(REgg *egg, char *out, const char *_str, int delta) {
str++;
len = strlen (str) - 1;
if (!egg->lang.stackfixed || egg->lang.stackfixed < len) {
eprintf ("Warning: No room in the static stackframe! (%d must be %d)\n",
R_LOG_WARN ("No room in the static stackframe! (%d must be %d)",
egg->lang.stackfixed, len);
}
str[len] = '\0';
@ -1020,7 +1020,7 @@ static void rcc_next(REgg *egg) {
if (!strcmp (str, "while")) {
char var[128];
if (egg->lang.lastctxdelta >= 0) {
eprintf ("ERROR: Unsupported while syntax\n");
R_LOG_ERROR ("ERROR: Unsupported while syntax");
return;
}
sprintf (var, "__begin_%d_%d_%d\n", egg->lang.nfunctions, CTX, egg->lang.nestedi[CTX - 1]);

View File

@ -146,7 +146,7 @@ static void emit_arg(REgg *egg, int xs, int num, const char *str) {
strncpy (lastargs[num - 1], str, sizeof(lastargs[0]) - 1);
} else {
if (!atoi (str)) {
eprintf ("Warning: probably a bug?\n");
R_LOG_WARN ("probably a bug?");
}
r_egg_printf (egg, " mov r0, %s\n", str);
snprintf (lastargs[num - 1], sizeof (lastargs[0]), "sp, %d", 8 + (num * 4));

View File

@ -111,7 +111,7 @@ static void emit_arg(REgg *egg, int xs, int num, const char *str) {
strncpy (lastargs[num - 1], str, sizeof(lastargs[0]) - 1);
} else {
if (!atoi (str)) {
eprintf ("Warning: probably a bug?\n");
R_LOG_WARN ("probably a bug?");
}
r_egg_printf (egg, " mov r0, %s\n", str);
snprintf (lastargs[num - 1], sizeof (lastargs[0]), "sp, %d", 8 + (num * 4));

View File

@ -358,7 +358,7 @@ static void emit_get_var(REgg *egg, int type, char *out, int idx) {
break;
case 1: /* argument */
// OMG WE CAN'T stuff found in relative address in stack in the stack
eprintf ("Warning: Using stack vars in naked functions\n");
R_LOG_WARN ("Using stack vars in naked functions");
idx = 8; // HACK to make arg0, arg4, ... work
if (idx > 0) {
sprintf (out, "[" R_SP "+%d]", idx);

View File

@ -46,7 +46,7 @@ R_API void r_io_cache_commit(RIO *io, ut64 from, ut64 to) {
if (r_io_write_at (io, r_itv_begin (c->itv), c->data, r_itv_size (c->itv))) {
c->written = true;
} else {
eprintf ("Error writing change at 0x%08"PFMT64x"\n", r_itv_begin (c->itv));
R_LOG_ERROR ("Error writing change at 0x%08"PFMT64x, r_itv_begin (c->itv));
}
io->cached = cached;
// break; // XXX old behavior, revisit this

Some files were not shown because too many files have changed in this diff Show More