mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 13:19:54 +00:00
Refactor a few eprintf 'Cannot …' to R_LOG_ERROR
This commit is contained in:
parent
34323f2c30
commit
b78855c38d
@ -116,13 +116,13 @@ R_API char *r_anal_cc_get(RAnal *anal, const char *name) {
|
||||
int i;
|
||||
// get cc by name and print the expr
|
||||
if (r_str_cmp (sdb_const_get (DB, name, 0), "cc", -1)) {
|
||||
eprintf ("This is not a valid calling convention name (%s)\n", name);
|
||||
R_LOG_ERROR ("This is not a valid calling convention name (%s)", name);
|
||||
return NULL;
|
||||
}
|
||||
r_strf_var (ccret, 128, "cc.%s.ret", name);
|
||||
const char *ret = sdb_const_get (DB, ccret, 0);
|
||||
if (!ret) {
|
||||
eprintf ("Cannot find return type for %s\n", name);
|
||||
R_LOG_ERROR ("Cannot find return type for %s", name);
|
||||
return NULL;
|
||||
}
|
||||
RStrBuf *sb = r_strbuf_new (NULL);
|
||||
|
@ -36,7 +36,7 @@ static inline ut64 genmask(int bits) {
|
||||
return m;
|
||||
}
|
||||
|
||||
#define ERR(x) if (esil->verbose) { eprintf ("%s\n", x); }
|
||||
#define ERR(...) if (esil->verbose) { R_LOG_ERROR (__VA_ARGS__); }
|
||||
|
||||
static bool isnum(RAnalEsil *esil, const char *str, ut64 *num) {
|
||||
if (!esil || !str) {
|
||||
@ -130,11 +130,10 @@ R_API bool r_anal_esil_set_op(RAnalEsil *esil, const char *op, RAnalEsilOpCb cod
|
||||
if (!eop) {
|
||||
eop = R_NEW (RAnalEsilOp);
|
||||
if (!eop) {
|
||||
eprintf ("Cannot allocate esil-operation %s\n", op);
|
||||
return false;
|
||||
}
|
||||
if (!ht_pp_insert (esil->ops, op, eop)) {
|
||||
eprintf ("Cannot set esil-operation %s\n", op);
|
||||
R_LOG_ERROR ("Cannot set esil-operation %s", op);
|
||||
free (eop);
|
||||
return false;
|
||||
}
|
||||
@ -819,9 +818,7 @@ static bool esil_eq(RAnalEsil *esil) {
|
||||
char *dst = r_anal_esil_pop (esil);
|
||||
char *src = r_anal_esil_pop (esil);
|
||||
if (!src || !dst) {
|
||||
if (esil->verbose) {
|
||||
eprintf ("Missing elements in the esil stack for '=' at 0x%08"PFMT64x"\n", esil->address);
|
||||
}
|
||||
ERR ("Missing elements in the esil stack for '=' at 0x%08"PFMT64x, esil->address);
|
||||
free (src);
|
||||
free (dst);
|
||||
return false;
|
||||
@ -2105,7 +2102,7 @@ static bool esil_poke_some(RAnalEsil *esil) {
|
||||
const int size_bytes = regsize / 8;
|
||||
const ut32 written = r_anal_esil_mem_write (esil, ptr, b, size_bytes);
|
||||
if (written != size_bytes) {
|
||||
//eprintf ("Cannot write at 0x%08" PFMT64x "\n", ptr);
|
||||
//R_LOG_ERROR ("Cannot write at 0x%08" PFMT64x, ptr);
|
||||
esil->trap = 1;
|
||||
}
|
||||
ptr += size_bytes;
|
||||
@ -2218,7 +2215,7 @@ static bool esil_peek_some(RAnalEsil *esil) {
|
||||
bool oks = r_anal_esil_mem_read (esil, ptr, a, 4);
|
||||
if (!oks) {
|
||||
if (esil->verbose) {
|
||||
eprintf ("Cannot peek from 0x%08" PFMT64x "\n", ptr);
|
||||
R_LOG_ERROR ("Cannot peek from 0x%08" PFMT64x, ptr);
|
||||
}
|
||||
free (dst);
|
||||
free (count);
|
||||
@ -3568,7 +3565,7 @@ static int evalWord(RAnalEsil *esil, const char *ostr, const char **str) {
|
||||
return 2;
|
||||
}
|
||||
if (esil->verbose) {
|
||||
eprintf ("Cannot find word %d\n", esil->parse_goto);
|
||||
R_LOG_ERROR ("Cannot find word %d", esil->parse_goto);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ void _handle_goto (EsilCfgGen *gen, ut32 idx) {
|
||||
EsilVal *v = r_stack_pop (gen->vals);
|
||||
if (!v || v->type != ESIL_VAL_CONST) {
|
||||
free (v);
|
||||
eprintf ("Cannot resolve GOTO dst :(\n");
|
||||
R_LOG_ERROR ("Cannot resolve GOTO dst :(");
|
||||
goto beach;
|
||||
}
|
||||
|
||||
|
@ -944,7 +944,7 @@ repeat:
|
||||
if ((buf[2] == 0xff || buf[2] == 0xfe) && buf[3] == 0xff) {
|
||||
leaddr_pair *pair = R_NEW (leaddr_pair);
|
||||
if (!pair) {
|
||||
eprintf ("Cannot create leaddr_pair\n");
|
||||
R_LOG_ERROR ("Cannot create leaddr_pair");
|
||||
gotoBeach (R_ANAL_RET_ERROR);
|
||||
}
|
||||
pair->op_addr = op->addr;
|
||||
@ -965,7 +965,7 @@ repeat:
|
||||
if (op->ptr != UT64_MAX) {
|
||||
leaddr_pair *pair = R_NEW (leaddr_pair);
|
||||
if (!pair) {
|
||||
eprintf ("Cannot create leaddr_pair\n");
|
||||
R_LOG_ERROR ("Cannot create leaddr_pair");
|
||||
gotoBeach (R_ANAL_RET_ERROR);
|
||||
}
|
||||
pair->op_addr = op->addr;
|
||||
|
@ -59,14 +59,14 @@ static inline void analyze_new_case(RAnal *anal, RAnalFunction *fcn, RAnalBlock
|
||||
if (block) {
|
||||
if (block->addr != ip) {
|
||||
st64 d = block->addr - ip;
|
||||
eprintf ("Cannot find basic block for switch case at 0x%08"PFMT64x" bbdelta = %d\n", ip, (int)R_ABS (d));
|
||||
R_LOG_ERROR ("Cannot find basic block for switch case at 0x%08"PFMT64x" bbdelta = %d", ip, (int)R_ABS (d));
|
||||
block = NULL;
|
||||
return;
|
||||
} else {
|
||||
eprintf ("Inconsistent basicblock storage issue at 0x%08"PFMT64x"\n", ip);
|
||||
R_LOG_ERROR ("Inconsistent basicblock storage issue at 0x%08"PFMT64x, ip);
|
||||
}
|
||||
} else {
|
||||
eprintf ("Major disaster at 0x%08"PFMT64x"\n", ip);
|
||||
R_LOG_ERROR ("Major disaster at 0x%08"PFMT64x, ip);
|
||||
return;
|
||||
}
|
||||
// analyze at given address
|
||||
|
@ -1887,7 +1887,6 @@ static bool avr_custom_spm_page_write(RAnalEsil *esil) {
|
||||
// perform writing
|
||||
//eprintf ("SPM_PAGE_WRITE %ld bytes @ 0x%08" PFMT64x ".\n", page_size, addr);
|
||||
if (!(t = malloc (1 << page_size_bits))) {
|
||||
eprintf ("Cannot alloc a buffer for copying the temporary page.\n");
|
||||
return false;
|
||||
}
|
||||
r_anal_esil_mem_read (esil, tmp_page, (ut8 *) t, 1 << page_size_bits);
|
||||
|
@ -1128,7 +1128,7 @@ R_API RAsmCode *r_asm_massemble(RAsm *a, const char *assembly) {
|
||||
}
|
||||
if (stage == STAGES - 1) {
|
||||
if (ret < 1) {
|
||||
eprintf ("Cannot assemble '%s' at line %d\n", ptr_start, linenum);
|
||||
R_LOG_ERROR ("Cannot assemble '%s' at line %d", ptr_start, linenum);
|
||||
goto fail;
|
||||
}
|
||||
acode->len = idx + ret;
|
||||
|
@ -167,8 +167,6 @@ static int string_scan_range(RList *list, RBinFile *bf, int min,
|
||||
len = res;
|
||||
free (buf);
|
||||
buf = out;
|
||||
} else {
|
||||
eprintf ("Cannot allocate\n");
|
||||
}
|
||||
} else {
|
||||
eprintf ("Invalid value for RABIN2_CHARSET.\n");
|
||||
@ -945,7 +943,6 @@ R_API RList *r_bin_file_compute_hashes(RBin *bin, ut64 limit) {
|
||||
const size_t blocksize = 64000;
|
||||
ut8 *buf = malloc (blocksize);
|
||||
if (!buf) {
|
||||
eprintf ("Cannot allocate computation buffer\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1073,7 +1070,7 @@ R_API RBinSymbol *r_bin_file_add_method(RBinFile *bf, const char *klass, const c
|
||||
|
||||
RBinClass *c = r_bin_file_add_class (bf, klass, NULL, 0);
|
||||
if (!c) {
|
||||
eprintf ("Cannot allocate class %s\n", klass);
|
||||
R_LOG_ERROR ("Cannot allocate class %s", klass);
|
||||
return NULL;
|
||||
}
|
||||
RBinSymbol *sym = __getMethod (bf, klass, method);
|
||||
|
@ -546,7 +546,7 @@ R_API bool r_bin_list_plugin(RBin *bin, const char* name, PJ *pj, int json) {
|
||||
return true;
|
||||
}
|
||||
|
||||
eprintf ("Cannot find plugin %s\n", name);
|
||||
R_LOG_ERROR ("Cannot find plugin %s", name);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -987,11 +987,11 @@ R_API void r_bin_list_archs(RBin *bin, PJ *pj, int mode) {
|
||||
}
|
||||
Sdb *binfile_sdb = binfile? binfile->sdb: NULL;
|
||||
if (!binfile_sdb) {
|
||||
// eprintf ("Cannot find SDB!\n");
|
||||
// R_LOG_ERROR ("Cannot find SDB!");
|
||||
return;
|
||||
}
|
||||
if (!binfile) {
|
||||
// eprintf ("Binary format not currently loaded!\n");
|
||||
// R_LOG_ERROR ("Binary format not currently loaded!");
|
||||
return;
|
||||
}
|
||||
sdb_unset (binfile_sdb, ARCHS_KEY, 0);
|
||||
@ -1176,7 +1176,7 @@ R_API RBuffer *r_bin_package(RBin *bin, const char *type, const char *file, RLis
|
||||
ut8 *num8 = (ut8*)#
|
||||
RBuffer *buf = r_buf_new_file (file, O_RDWR | O_CREAT, 0644);
|
||||
if (!buf) {
|
||||
eprintf ("Cannot open file %s - Permission Denied.\n", file);
|
||||
R_LOG_ERROR ("Cannot open file %s - Permission Denied", file);
|
||||
return NULL;
|
||||
}
|
||||
r_buf_write_at (buf, 0, (const ut8*)"\xca\xfe\xba\xbe", 4);
|
||||
@ -1193,7 +1193,7 @@ R_API RBuffer *r_bin_package(RBin *bin, const char *type, const char *file, RLis
|
||||
if (f_buf) {
|
||||
eprintf ("ADD %s %"PFMT64u"\n", f, (ut64)f_len);
|
||||
} else {
|
||||
eprintf ("Cannot open %s\n", f);
|
||||
R_LOG_ERROR ("Cannot open %s", f);
|
||||
free (f_buf);
|
||||
continue;
|
||||
}
|
||||
|
@ -221,8 +221,6 @@ static void filter_classes(RBinFile *bf, RList *list) {
|
||||
r_bin_filter_sym (bf, ht, sym->vaddr, sym);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
eprintf ("Cannot alloc %d byte(s)\n", namepad_len);
|
||||
}
|
||||
}
|
||||
ht_pu_free (db);
|
||||
|
@ -3563,7 +3563,7 @@ static RBinElfSymbol* parse_gnu_debugdata(ELFOBJ *bin, size_t *ret_size) {
|
||||
return NULL;
|
||||
}
|
||||
if (r_buf_read_at (bin->b, addr, data, size) == -1) {
|
||||
eprintf ("Cannot read%c\n", 10);
|
||||
R_LOG_ERROR ("Cannot read");
|
||||
}
|
||||
size_t osize;
|
||||
ut8 *odata = r_sys_unxz (data, size, &osize);
|
||||
@ -4092,7 +4092,7 @@ static bool get_nt_file_maps(ELFOBJ *bin, RList *core_maps) {
|
||||
bin->phdr[ph].p_offset + offset,
|
||||
elf_nhdr, elf_nhdr_size);
|
||||
if (ret != elf_nhdr_size) {
|
||||
eprintf ("Cannot read more NOTES header from CORE\n");
|
||||
R_LOG_ERROR ("Cannot read more NOTES header from CORE");
|
||||
free (elf_nhdr);
|
||||
goto fail;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ ut64 Elf_(r_bin_elf_resize_section)(RBinFile *bf, const char *name, ut64 size) {
|
||||
}
|
||||
|
||||
if (delta == 0) {
|
||||
eprintf ("Cannot find section\n");
|
||||
R_LOG_ERROR ("Cannot find section");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1172,7 +1172,7 @@ void MACH0_(get_class_t)(mach0_ut p, RBinFile *bf, RBinClass *klass, bool dupe,
|
||||
return;
|
||||
}
|
||||
if (left < size) {
|
||||
eprintf ("Cannot parse obj class info out of bounds\n");
|
||||
R_LOG_ERROR ("Cannot parse obj class info out of bounds");
|
||||
return;
|
||||
}
|
||||
len = r_buf_read_at (bf->buf, r, sc, size);
|
||||
@ -1253,7 +1253,7 @@ static SwiftType parse_type_entry(RBinFile *bf, ut64 typeaddr) {
|
||||
ut32 words[16] = {0};
|
||||
st32 *swords = (st32*)&words;
|
||||
if (r_buf_read_at (bf->buf, typeaddr, (ut8*)&words, sizeof (words)) < 1) {
|
||||
eprintf ("Invalid pointers.\n");
|
||||
R_LOG_ERROR ("Invalid pointers");
|
||||
return st;
|
||||
}
|
||||
#if 0
|
||||
@ -1461,7 +1461,7 @@ RList *MACH0_(parse_classes)(RBinFile *bf, objc_cache_opt_info *oi) {
|
||||
for (i = 0; i < s_size; i += sizeof (mach0_ut)) {
|
||||
left = s_size - i;
|
||||
if (left < sizeof (mach0_ut)) {
|
||||
eprintf ("Chopped classlist data\n");
|
||||
R_LOG_ERROR ("Chopped classlist data");
|
||||
break;
|
||||
}
|
||||
if (!(klass = R_NEW0 (RBinClass))) {
|
||||
@ -1613,7 +1613,7 @@ void MACH0_(get_category_t)(mach0_ut p, RBinFile *bf, RBinClass *klass, RSkipLis
|
||||
return;
|
||||
}
|
||||
if (left < size) {
|
||||
eprintf ("Cannot parse obj category info out of bounds\n");
|
||||
R_LOG_ERROR ("Cannot parse obj category info out of bounds");
|
||||
return;
|
||||
}
|
||||
len = r_buf_read_at (bf->buf, r, sc, size);
|
||||
|
@ -47,23 +47,21 @@ static RBinInfo* info(RBinFile *bf) {
|
||||
int reat = r_buf_read_at (bf->buf, 0x7FC0 + hdroffset,
|
||||
(ut8*)&sfchdr, SFC_HDR_SIZE);
|
||||
if (reat != SFC_HDR_SIZE) {
|
||||
eprintf ("Unable to read SFC/SNES header\n");
|
||||
R_LOG_ERROR ("Unable to read SFC/SNES header");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( (sfchdr.comp_check != (ut16)~(sfchdr.checksum)) || ((sfchdr.rom_setup & 0x1) != 0) ){
|
||||
|
||||
// if the fixed 0x33 byte or the LoROM indication are not found, then let's try interpreting the ROM as HiROM
|
||||
|
||||
reat = r_buf_read_at (bf->buf, 0xFFC0 + hdroffset, (ut8*)&sfchdr, SFC_HDR_SIZE);
|
||||
if (reat != SFC_HDR_SIZE) {
|
||||
eprintf ("Unable to read SFC/SNES header\n");
|
||||
R_LOG_ERROR ("Unable to read SFC/SNES header");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( (sfchdr.comp_check != (ut16)~(sfchdr.checksum)) || ((sfchdr.rom_setup & 0x1) != 1) ) {
|
||||
|
||||
eprintf ("Cannot determine if this is a LoROM or HiROM file\n");
|
||||
R_LOG_ERROR ("Cannot determine if this is a LoROM or HiROM file");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -128,7 +126,7 @@ static RList* sections(RBinFile *bf) {
|
||||
|
||||
int reat = r_buf_read_at (bf->buf, 0x7FC0 + hdroffset, (ut8*)&sfchdr, SFC_HDR_SIZE);
|
||||
if (reat != SFC_HDR_SIZE) {
|
||||
eprintf ("Unable to read SFC/SNES header\n");
|
||||
R_LOG_ERROR ("Unable to read SFC/SNES header");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -138,13 +136,12 @@ static RList* sections(RBinFile *bf) {
|
||||
|
||||
reat = r_buf_read_at (bf->buf, 0xFFC0 + hdroffset, (ut8*)&sfchdr, SFC_HDR_SIZE);
|
||||
if (reat != SFC_HDR_SIZE) {
|
||||
eprintf ("Unable to read SFC/SNES header\n");
|
||||
R_LOG_ERROR ("Unable to read SFC/SNES header");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( (sfchdr.comp_check != (ut16)~(sfchdr.checksum)) || ((sfchdr.rom_setup & 0x1) != 1) ) {
|
||||
|
||||
eprintf ("Cannot determine if this is a LoROM or HiROM file\n");
|
||||
R_LOG_ERROR ("Cannot determine if this is a LoROM or HiROM file");
|
||||
return NULL;
|
||||
}
|
||||
is_hirom = true;
|
||||
|
@ -73,7 +73,7 @@ static int download(struct SPDBDownloader *pd) {
|
||||
opt->dbg_file);
|
||||
|
||||
if (r_file_exists (abspath_to_file)) {
|
||||
eprintf ("File already downloaded.\n");
|
||||
R_LOG_ERROR ("File already downloaded");
|
||||
free (abspath_to_file);
|
||||
return 1;
|
||||
}
|
||||
@ -88,7 +88,7 @@ static int download(struct SPDBDownloader *pd) {
|
||||
opt->guid, R_SYS_DIR,
|
||||
archive_name);
|
||||
|
||||
eprintf ("Attempting to download compressed pdb in %s\n", abspath_to_archive);
|
||||
R_LOG_INFO ("Attempting to download compressed pdb in %s", abspath_to_archive);
|
||||
char *abs_arch_esc = r_str_escape_sh (abspath_to_archive);
|
||||
#if __WINDOWS__
|
||||
char *abs_file_esc = r_str_escape_sh (abspath_to_file);
|
||||
@ -113,7 +113,7 @@ static int download(struct SPDBDownloader *pd) {
|
||||
if (opt->extract > 0 && res) {
|
||||
eprintf ("Attempting to decompress pdb\n");
|
||||
if (res && ((cmd_ret = r_sys_cmd (extractor_cmd)) != 0)) {
|
||||
eprintf ("cab extractor exited with error %d\n", cmd_ret);
|
||||
R_LOG_ERROR ("cab extractor exited with error %d", cmd_ret);
|
||||
res = 0;
|
||||
}
|
||||
r_file_rm (abspath_to_archive);
|
||||
@ -135,7 +135,7 @@ void init_pdb_downloader(SPDBDownloaderOpt *opt, SPDBDownloader *pd) {
|
||||
pd->opt = R_NEW0 (SPDBDownloaderOpt);
|
||||
if (!pd->opt) {
|
||||
pd->download = 0;
|
||||
eprintf ("Cannot allocate memory for SPDBDownloaderOpt.\n");
|
||||
R_LOG_ERROR ("Cannot allocate memory for SPDBDownloaderOpt");
|
||||
return;
|
||||
}
|
||||
pd->opt->dbg_file = strdup (opt->dbg_file);
|
||||
@ -177,17 +177,17 @@ int r_bin_pdb_download(RCore *core, PJ *pj, int isradjson, SPDBOptions *options)
|
||||
RBinInfo *info = r_bin_get_info (core->bin);
|
||||
|
||||
if (!info || !info->debug_file_name) {
|
||||
eprintf ("Can't find debug filename\n");
|
||||
R_LOG_ERROR ("Can't find debug filename");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!is_valid_guid (info->guid)) {
|
||||
eprintf ("Invalid GUID for file\n");
|
||||
R_LOG_ERROR ("Invalid GUID for file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!options || !options->symbol_server || !options->user_agent) {
|
||||
eprintf ("Can't retrieve pdb configurations\n");
|
||||
R_LOG_ERROR ("Can't retrieve pdb configurations");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ R_API int r_bp_plugin_add(RBreakpoint *bp, RBreakpointPlugin *foo) {
|
||||
RListIter *iter;
|
||||
RBreakpointPlugin *h;
|
||||
if (!bp) {
|
||||
eprintf ("Cannot add plugin because dbg->bp is null and/or plugin is null\n");
|
||||
R_LOG_ERROR ("Cannot add plugin because dbg->bp is null and/or plugin is null");
|
||||
return false;
|
||||
}
|
||||
/* avoid dupped plugins */
|
||||
|
@ -1138,11 +1138,11 @@ R_API void r_cons_flush(void) {
|
||||
FILE *d = r_sandbox_fopen (tee, "a+");
|
||||
if (d) {
|
||||
if (C->buffer_len != fwrite (C->buffer, 1, C->buffer_len, d)) {
|
||||
eprintf ("r_cons_flush: fwrite: error (%s)\n", tee);
|
||||
R_LOG_ERROR ("r_cons_flush: fwrite: error (%s)", tee);
|
||||
}
|
||||
fclose (d);
|
||||
} else {
|
||||
eprintf ("Cannot write on '%s'\n", tee);
|
||||
R_LOG_ERROR ("Cannot write on '%s'", tee);
|
||||
}
|
||||
}
|
||||
r_cons_highlight (I->highlight);
|
||||
|
@ -4255,8 +4255,8 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
|
||||
h = 25;
|
||||
can = r_cons_canvas_new (w, h);
|
||||
if (!can) {
|
||||
eprintf ("Cannot create RCons.canvas context. Invalid screen "
|
||||
"size? See scr.columns + scr.rows\n");
|
||||
R_LOG_ERROR ("Cannot create RCons.canvas context. Invalid screen "
|
||||
"size? See scr.columns + scr.rows");
|
||||
r_config_hold_free (hc);
|
||||
return false;
|
||||
}
|
||||
@ -4598,7 +4598,7 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
|
||||
if (undo) {
|
||||
r_core_seek (core, undo->off, false);
|
||||
} else {
|
||||
eprintf ("Cannot undo\n");
|
||||
R_LOG_ERROR ("Cannot undo");
|
||||
}
|
||||
if (r_config_get_i (core->config, "graph.few")) {
|
||||
g->need_reload_nodes = true;
|
||||
@ -4611,7 +4611,7 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
|
||||
if (undo) {
|
||||
r_core_seek (core, undo->off, false);
|
||||
} else {
|
||||
eprintf ("Cannot redo\n");
|
||||
R_LOG_ERROR ("Cannot redo");
|
||||
}
|
||||
if (r_config_get_i (core->config, "graph.few")) {
|
||||
g->need_reload_nodes = true;
|
||||
|
@ -292,8 +292,8 @@ R_API bool core_anal_bbs(RCore *core, const char* input) {
|
||||
}
|
||||
|
||||
if (op->mnemonic[0] == '?') {
|
||||
eprintf ("? Bad op at: 0x%08"PFMT64x"\n", dst);
|
||||
eprintf ("Cannot analyze opcode at 0x%"PFMT64x"\n", dst);
|
||||
R_LOG_ERROR ("? Bad op at: 0x%08"PFMT64x, dst);
|
||||
R_LOG_ERROR ("Cannot analyze opcode at 0x%"PFMT64x, dst);
|
||||
block_score -= 10;
|
||||
cur++;
|
||||
continue;
|
||||
@ -579,8 +579,8 @@ R_API bool core_anal_bbs_range(RCore *core, const char* input) {
|
||||
}
|
||||
|
||||
if (op->mnemonic[0] == '?') {
|
||||
eprintf ("? Bad op at: 0x%08"PFMT64x"\n", cur + b_start);
|
||||
eprintf ("Cannot analyze opcode at %"PFMT64x"\n", b_start + cur);
|
||||
R_LOG_ERROR ("? Bad op at: 0x%08"PFMT64x, cur + b_start);
|
||||
R_LOG_ERROR ("Cannot analyze opcode at %"PFMT64x, b_start + cur);
|
||||
block_score -= 10;
|
||||
cur++;
|
||||
continue;
|
||||
|
@ -4405,7 +4405,6 @@ R_API RCoreAnalStats* r_core_anal_get_stats(RCore *core, ut64 from, ut64 to, ut6
|
||||
ut64 at;
|
||||
|
||||
if (from == to || from == UT64_MAX || to == UT64_MAX) {
|
||||
eprintf ("Cannot alloc for this range\n");
|
||||
return NULL;
|
||||
}
|
||||
as = R_NEW0 (RCoreAnalStats);
|
||||
@ -4683,11 +4682,11 @@ R_API void r_core_anal_fcn_merge(RCore *core, ut64 addr, ut64 addr2) {
|
||||
RAnalFunction *f1 = r_anal_get_function_at (core->anal, addr);
|
||||
RAnalFunction *f2 = r_anal_get_function_at (core->anal, addr2);
|
||||
if (!f1 || !f2) {
|
||||
eprintf ("Cannot find function\n");
|
||||
R_LOG_ERROR ("Cannot find function");
|
||||
return;
|
||||
}
|
||||
if (f1 == f2) {
|
||||
eprintf ("Cannot merge the same function\n");
|
||||
R_LOG_ERROR ("Cannot merge the same function");
|
||||
return;
|
||||
}
|
||||
// join all basic blocks from f1 into f2 if they are not
|
||||
@ -5280,7 +5279,7 @@ R_API void r_core_anal_esil(RCore *core, const char *str, const char *target) {
|
||||
// TODO: backup/restore register state before/after analysis
|
||||
const char *kpcname = r_reg_get_name (core->anal->reg, R_REG_NAME_PC);
|
||||
if (!kpcname || !*kpcname) {
|
||||
eprintf ("Cannot find program counter register in the current profile.\n");
|
||||
R_LOG_ERROR ("Cannot find program counter register in the current profile");
|
||||
return;
|
||||
}
|
||||
pcname = strdup (kpcname);
|
||||
@ -5904,11 +5903,11 @@ R_API void r_core_anal_paths(RCore *core, ut64 from, ut64 to, bool followCalls,
|
||||
RAnalBlock *b1 = r_anal_bb_from_offset (core->anal, to);
|
||||
PJ *pj = NULL;
|
||||
if (!b0) {
|
||||
eprintf ("Cannot find basic block for 0x%08"PFMT64x"\n", from);
|
||||
R_LOG_ERROR ("Cannot find basic block for 0x%08"PFMT64x, from);
|
||||
return;
|
||||
}
|
||||
if (!b1) {
|
||||
eprintf ("Cannot find basic block for 0x%08"PFMT64x"\n", to);
|
||||
R_LOG_ERROR ("Cannot find basic block for 0x%08"PFMT64x, to);
|
||||
return;
|
||||
}
|
||||
RCoreAnalPaths rcap = {{0}};
|
||||
@ -6035,7 +6034,7 @@ static bool analyze_noreturn_function(RCore *core, RAnalFunction *f) {
|
||||
// get last opcode
|
||||
RAnalOp *op = r_core_op_anal (core, opaddr, R_ANAL_OP_MASK_HINT);
|
||||
if (!op) {
|
||||
eprintf ("Cannot analyze opcode at 0x%08" PFMT64x "\n", opaddr);
|
||||
R_LOG_ERROR ("Cannot analyze opcode at 0x%08" PFMT64x, opaddr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -6100,7 +6099,7 @@ R_API void r_core_anal_propagate_noreturn(RCore *core, ut64 addr) {
|
||||
r_list_foreach (xrefs, iter, xref) {
|
||||
RAnalOp *xrefop = r_core_op_anal (core, xref->addr, R_ANAL_OP_MASK_ALL);
|
||||
if (!xrefop) {
|
||||
eprintf ("Cannot analyze opcode at 0x%08" PFMT64x "\n", xref->addr);
|
||||
R_LOG_ERROR ("Cannot analyze opcode at 0x%08" PFMT64x, xref->addr);
|
||||
continue;
|
||||
}
|
||||
ut64 call_addr = xref->addr;
|
||||
|
@ -276,7 +276,7 @@ R_API void r_core_bin_export_info(RCore *core, int mode) {
|
||||
if (fi) {
|
||||
fi->size = r_num_math (core->num, v);
|
||||
} else {
|
||||
eprintf ("Cannot find flag named '%s'\n", flagname);
|
||||
R_LOG_ERROR ("Cannot find flag named '%s'", flagname);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -302,7 +302,7 @@ R_API bool r_core_bin_load_structs(RCore *core, const char *file) {
|
||||
}
|
||||
}
|
||||
if (strchr (file, '\"')) { // TODO: escape "?
|
||||
eprintf ("Invalid char found in filename\n");
|
||||
R_LOG_ERROR ("Invalid char found in filename");
|
||||
return false;
|
||||
}
|
||||
RBinFileOptions opt = {0};
|
||||
@ -313,7 +313,7 @@ R_API bool r_core_bin_load_structs(RCore *core, const char *file) {
|
||||
r_bin_file_delete (core->bin, bf->id);
|
||||
return true;
|
||||
}
|
||||
eprintf ("Cannot open bin '%s'\n", file);
|
||||
R_LOG_ERROR ("Cannot open bin '%s'", file);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3051,11 +3051,11 @@ static int bin_sections(RCore *r, PJ *pj, int mode, ut64 laddr, int va, ut64 at,
|
||||
if (dl == datalen) {
|
||||
hashstr = build_hash_string (pj, mode, hashtypes, data, datalen);
|
||||
} else if (r->bin->verbose) {
|
||||
eprintf ("Cannot read section at 0x%08"PFMT64x"\n", section->paddr);
|
||||
R_LOG_ERROR ("Cannot read section at 0x%08"PFMT64x, section->paddr);
|
||||
}
|
||||
free (data);
|
||||
} else if (r->bin->verbose) {
|
||||
eprintf ("Section at 0x%08"PFMT64x" larger than bin.hashlimit\n", section->paddr);
|
||||
R_LOG_ERROR ("Section at 0x%08"PFMT64x" larger than bin.hashlimit", section->paddr);
|
||||
}
|
||||
}
|
||||
r_cons_printf ("0x%"PFMT64x" 0x%"PFMT64x" %s %s%s%s\n",
|
||||
@ -3083,11 +3083,11 @@ static int bin_sections(RCore *r, PJ *pj, int mode, ut64 laddr, int va, ut64 at,
|
||||
if (dl == datalen) {
|
||||
free (build_hash_string (pj, mode, hashtypes, data, datalen));
|
||||
} else if (r->bin->verbose) {
|
||||
eprintf ("Cannot read section at 0x%08"PFMT64x"\n", section->paddr);
|
||||
R_LOG_ERROR ("Cannot read section at 0x%08"PFMT64x, section->paddr);
|
||||
}
|
||||
free (data);
|
||||
} else if (r->bin->verbose) {
|
||||
eprintf ("Section at 0x%08"PFMT64x" larger than bin.hashlimit\n", section->paddr);
|
||||
R_LOG_ERROR ("Section at 0x%08"PFMT64x" larger than bin.hashlimit", section->paddr);
|
||||
}
|
||||
}
|
||||
pj_kN (pj, "paddr", section->paddr);
|
||||
@ -3107,11 +3107,11 @@ static int bin_sections(RCore *r, PJ *pj, int mode, ut64 laddr, int va, ut64 at,
|
||||
if (dl == datalen) {
|
||||
hashstr = build_hash_string (pj, mode, hashtypes, data, datalen);
|
||||
} else if (r->bin->verbose) {
|
||||
eprintf ("Cannot read section at 0x%08"PFMT64x"\n", section->paddr);
|
||||
R_LOG_ERROR ("Cannot read section at 0x%08"PFMT64x, section->paddr);
|
||||
}
|
||||
free (data);
|
||||
} else if (r->bin->verbose) {
|
||||
eprintf ("Section at 0x%08"PFMT64x" larger than bin.hashlimit\n", section->paddr);
|
||||
R_LOG_WARN ("Section at 0x%08"PFMT64x" larger than bin.hashlimit", section->paddr);
|
||||
}
|
||||
}
|
||||
if (section->arch || section->bits) {
|
||||
|
@ -797,7 +797,7 @@ static bool cb_asmarch(void *user, void *data) {
|
||||
const char *asmcpu = r_config_get (core->config, "asm.cpu");
|
||||
const char *asmos = r_config_get (core->config, "asm.os");
|
||||
if (!r_syscall_setup (core->anal->syscall, node->value, core->anal->config->bits, asmcpu, asmos)) {
|
||||
//eprintf ("asm.arch: Cannot setup syscall '%s/%s' from '%s'\n",
|
||||
//R_LOG_ERROR ("asm.arch: Cannot setup syscall '%s/%s' from '%s'",
|
||||
// node->value, asmos, R2_LIBDIR"/radare2/"R2_VERSION"/syscall");
|
||||
}
|
||||
}
|
||||
@ -876,13 +876,13 @@ static bool cb_asmbits(void *user, void *data) {
|
||||
if (!ret) {
|
||||
RAsmPlugin *h = core->rasm->cur;
|
||||
if (!h) {
|
||||
eprintf ("e asm.bits: Cannot set value, no plugins defined yet\n");
|
||||
R_LOG_ERROR ("e asm.bits: Cannot set value, no plugins defined yet");
|
||||
ret = true;
|
||||
}
|
||||
// else { eprintf ("Cannot set bits %d to '%s'\n", bits, h->name); }
|
||||
// else { R_LOG_ERROR ("Cannot set bits %d to '%s'", bits, h->name); }
|
||||
}
|
||||
if (!r_anal_set_bits (core->anal, bits)) {
|
||||
eprintf ("asm.arch: Cannot setup '%d' bits analysis engine\n", bits);
|
||||
R_LOG_ERROR ("asm.arch: Cannot setup '%d' bits analysis engine", bits);
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
@ -916,7 +916,7 @@ static bool cb_asmbits(void *user, void *data) {
|
||||
const char *asmcpu = r_config_get (core->config, "asm.cpu");
|
||||
if (core->anal) {
|
||||
if (!r_syscall_setup (core->anal->syscall, asmarch, bits, asmcpu, asmos)) {
|
||||
//eprintf ("asm.arch: Cannot setup syscall '%s/%s' from '%s'\n",
|
||||
//R_LOG_ERROR ("asm.arch: Cannot setup syscall '%s/%s' from '%s'",
|
||||
// node->value, asmos, R2_LIBDIR"/radare2/"R2_VERSION"/syscall");
|
||||
}
|
||||
__setsegoff (core->config, asmarch, core->anal->config->bits);
|
||||
@ -1158,7 +1158,7 @@ static bool cb_binstrenc(void *user, void *data) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
eprintf ("Unknown encoding: %s\n", node->value);
|
||||
R_LOG_ERROR ("Unknown encoding: %s", node->value);
|
||||
free (enc);
|
||||
return false;
|
||||
}
|
||||
@ -1475,7 +1475,7 @@ static bool cb_cfgsanbox(void *user, void *data) {
|
||||
RConfigNode *node = (RConfigNode*) data;
|
||||
int ret = r_sandbox_enable (node->i_value);
|
||||
if (node->i_value != ret) {
|
||||
eprintf ("Cannot disable sandbox\n");
|
||||
R_LOG_ERROR ("Cannot disable sandbox");
|
||||
}
|
||||
return (!node->i_value && ret)? 0: 1;
|
||||
}
|
||||
@ -1834,7 +1834,7 @@ static bool cb_gotolimit(void *user, void *data) {
|
||||
RCore *core = (RCore *) user;
|
||||
RConfigNode *node = (RConfigNode*) data;
|
||||
if (r_sandbox_enable (0)) {
|
||||
eprintf ("Cannot change gotolimit\n");
|
||||
R_LOG_ERROR ("Cannot change gotolimit");
|
||||
return false;
|
||||
}
|
||||
if (core->anal->esil) {
|
||||
@ -1855,7 +1855,7 @@ static bool cb_esilverbose(void *user, void *data) {
|
||||
static bool cb_esilstackdepth(void *user, void *data) {
|
||||
RConfigNode *node = (RConfigNode*) data;
|
||||
if (node->i_value < 3) {
|
||||
eprintf ("esil.stack.depth must be greater than 2\n");
|
||||
R_LOG_ERROR ("esil.stack.depth must be greater than 2");
|
||||
node->i_value = 32;
|
||||
}
|
||||
return true;
|
||||
@ -2764,7 +2764,7 @@ static bool cb_prjname(void *user, void *data) {
|
||||
if (r_project_rename (core->prj, prjname)) {
|
||||
return true;
|
||||
}
|
||||
eprintf ("Cannot rename project.\n");
|
||||
R_LOG_ERROR ("Cannot rename project");
|
||||
} else {
|
||||
r_project_close (core->prj);
|
||||
}
|
||||
@ -2773,7 +2773,7 @@ static bool cb_prjname(void *user, void *data) {
|
||||
if (r_project_open (core->prj, prjname, NULL)) {
|
||||
return true;
|
||||
}
|
||||
eprintf ("Cannot open project.\n");
|
||||
R_LOG_ERROR ("Cannot open project");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ static bool setbpint(RCore *r, const char *mode, const char *sym) {
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
eprintf ("Cannot set breakpoint at %s\n", sym);
|
||||
R_LOG_ERROR ("Cannot set breakpoint at %s", sym);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@ -735,7 +735,7 @@ R_API bool r_core_bin_load(RCore *r, const char *filenameuri, ut64 baddr) {
|
||||
RFlagItem *impsym = r_flag_get (r->flags, flagname);
|
||||
free (flagname);
|
||||
if (!impsym) {
|
||||
//eprintf ("Cannot find '%s' import in the PLT\n", imp->name);
|
||||
//R_LOG_ERROR ("Cannot find '%s' import in the PLT", imp->name);
|
||||
continue;
|
||||
}
|
||||
ut64 imp_addr = impsym->offset;
|
||||
|
@ -25,7 +25,7 @@ R_API int r_core_setup_debugger(RCore *r, const char *debugbackend, bool attach)
|
||||
r_core_cmdf (r, "dpa %d", pid);
|
||||
}
|
||||
} else {
|
||||
eprintf ("Cannot retrieve pid from io.\n");
|
||||
R_LOG_ERROR ("Cannot retrieve pid from io");
|
||||
}
|
||||
}
|
||||
//this makes to attach twice showing warnings in the output
|
||||
@ -77,7 +77,7 @@ R_API bool r_core_dump(RCore *core, const char *file, ut64 addr, ut64 size, int
|
||||
fd = r_sandbox_fopen (file, "wb");
|
||||
}
|
||||
if (!fd) {
|
||||
eprintf ("Cannot open '%s' for writing\n", file);
|
||||
R_LOG_ERROR ("Cannot open '%s' for writing", file);
|
||||
return false;
|
||||
}
|
||||
/* some io backends seems to be buggy in those cases */
|
||||
|
@ -16,7 +16,7 @@ R_API bool r_project_rename(RProject *p, const char *newname) {
|
||||
}
|
||||
char *newprjdir = r_file_new (p->path, "..", newname, NULL);
|
||||
if (r_file_exists (newprjdir)) {
|
||||
eprintf ("Cannot rename.\n");
|
||||
R_LOG_ERROR ("Cannot rename");
|
||||
free (newprjdir);
|
||||
return false;
|
||||
}
|
||||
|
@ -738,7 +738,7 @@ static RDisasmState *ds_init(RCore *core) {
|
||||
RIOMap *map = r_io_map_add (core->io, ds->stackFd, R_PERM_RW, 0LL, addr, size);
|
||||
if (!map) {
|
||||
r_io_fd_close (core->io, ds->stackFd);
|
||||
eprintf ("Cannot create map for tha stack, fd %d got closed again\n", ds->stackFd);
|
||||
R_LOG_ERROR ("Cannot create map for tha stack, fd %d got closed again", ds->stackFd);
|
||||
ds->stackFd = -1;
|
||||
} else {
|
||||
r_io_map_set_name (map, "fake.stack");
|
||||
@ -6288,7 +6288,7 @@ static bool handle_backwards_disasm(RCore *core, int *nb_opcodes, int *nb_bytes)
|
||||
if (core->blocksize == *nb_bytes) {
|
||||
r_io_read_at (core->io, core->offset, core->block, *nb_bytes);
|
||||
} else {
|
||||
eprintf ("Cannot read that much!\n");
|
||||
R_LOG_ERROR ("Cannot read that much!");
|
||||
r_core_block_size (core, obsz);
|
||||
return false;
|
||||
}
|
||||
|
@ -1138,7 +1138,7 @@ static void GH(print_heap_segment)(RCore *core, MallocState *main_arena,
|
||||
top_title = r_str_new ("");
|
||||
|
||||
if (!r_io_read_at (core->io, next_chunk, (ut8 *)cnk, sizeof (GH(RHeapChunk)))) {
|
||||
eprintf ("Cannot read\n");
|
||||
R_LOG_ERROR ("Cannot read");
|
||||
free (cnk);
|
||||
free (cnk_next);
|
||||
r_cons_canvas_free (can);
|
||||
|
@ -272,13 +272,13 @@ static void GH(jemalloc_print_narenas)(RCore *core, const char *input) {
|
||||
PRINTF_GA ("narenas : %"PFMT64d"\n", (ut64)narenas);
|
||||
}
|
||||
if (narenas == 0) {
|
||||
eprintf ("No arenas allocated.\n");
|
||||
R_LOG_ERROR ("No arenas allocated");
|
||||
free (stats);
|
||||
free (ar);
|
||||
return;
|
||||
}
|
||||
if (narenas == GHT_MAX) {
|
||||
eprintf ("Cannot find narenas_total\n");
|
||||
R_LOG_ERROR ("Cannot find narenas_total");
|
||||
free (stats);
|
||||
free (ar);
|
||||
return;
|
||||
|
@ -2366,7 +2366,7 @@ static void __init_all_dbs(RCore *core) {
|
||||
static RConsCanvas *__create_new_canvas(RCore *core, int w, int h) {
|
||||
RConsCanvas *can = r_cons_canvas_new (w, h);
|
||||
if (!can) {
|
||||
eprintf ("Cannot create RCons.canvas context\n");
|
||||
R_LOG_ERROR ("Cannot create RCons.canvas context");
|
||||
return false;
|
||||
}
|
||||
r_cons_canvas_fill (can, 0, 0, w, h, ' ');
|
||||
|
@ -587,23 +587,23 @@ static int r_core_rtr_gdb_run(RCore *core, int launch, const char *path) {
|
||||
}
|
||||
|
||||
if (!r_core_file_open (core, file, R_PERM_RX, 0)) {
|
||||
eprintf ("Cannot open file (%s)\n", file);
|
||||
R_LOG_ERROR ("Cannot open file (%s)", file);
|
||||
return -1;
|
||||
}
|
||||
r_core_file_reopen_debug (core, args);
|
||||
|
||||
if (!(sock = r_socket_new (false))) {
|
||||
eprintf ("gdbserver: Could not open socket for listening\n");
|
||||
R_LOG_ERROR ("gdbserver: Could not open socket for listening");
|
||||
return -1;
|
||||
}
|
||||
if (!r_socket_listen (sock, port, NULL)) {
|
||||
r_socket_free (sock);
|
||||
eprintf ("gdbserver: Cannot listen on port: %s\n", port);
|
||||
R_LOG_ERROR ("gdbserver: Cannot listen on port: %s", port);
|
||||
return -1;
|
||||
}
|
||||
if (!(g = R_NEW0 (libgdbr_t))) {
|
||||
r_socket_free (sock);
|
||||
eprintf ("gdbserver: Cannot alloc libgdbr instance\n");
|
||||
R_LOG_ERROR ("gdbserver: Cannot alloc libgdbr instance");
|
||||
return -1;
|
||||
}
|
||||
gdbr_init (g, true);
|
||||
@ -612,7 +612,7 @@ static int r_core_rtr_gdb_run(RCore *core, int launch, const char *path) {
|
||||
int bits = r_config_get_i (core->config, "asm.bits");
|
||||
gdbr_set_architecture (g, arch, bits);
|
||||
core->gdbserver_up = 1;
|
||||
eprintf ("gdbserver started on port: %s, file: %s\n", port, file);
|
||||
R_LOG_INFO ("gdbserver started on port: %s, file: %s", port, file);
|
||||
|
||||
for (;;) {
|
||||
if (!(g->sock = r_socket_accept (sock))) {
|
||||
@ -796,7 +796,7 @@ R_API void r_core_rtr_add(RCore *core, const char *_input) {
|
||||
char *uri = r_str_newf ("http://%s:%s/%s", host, port, file);
|
||||
char *str = r_socket_http_get (uri, NULL, &len);
|
||||
if (!str) {
|
||||
eprintf ("Cannot find peer\n");
|
||||
R_LOG_ERROR ("Cannot find peer");
|
||||
r_socket_free (fd);
|
||||
return;
|
||||
}
|
||||
@ -921,7 +921,7 @@ R_API void r_core_rtr_event(RCore *core, const char *input) {
|
||||
dup2 (ff, 2);
|
||||
errmsg_fd = ff;
|
||||
} else {
|
||||
eprintf ("Cannot open fifo: %s\n", f);
|
||||
R_LOG_ERROR ("Cannot open fifo: %s", f);
|
||||
}
|
||||
}
|
||||
// r_core_event (core, );
|
||||
@ -929,7 +929,7 @@ R_API void r_core_rtr_event(RCore *core, const char *input) {
|
||||
free (f);
|
||||
// TODO: those files are leaked when closing r_core_free() should be deleted
|
||||
#else
|
||||
eprintf ("Not supported for your platform.\n");
|
||||
R_LOG_ERROR ("Not supported for your platform");
|
||||
#endif
|
||||
} else {
|
||||
eprintf ("(%s)\n", input);
|
||||
@ -1069,7 +1069,7 @@ R_API void r_core_rtr_cmd(RCore *core, const char *input) {
|
||||
char *uri = r_str_newf ("http://%s:%d/cmd/%s", rh->host, rh->port, cmd);
|
||||
char *str = r_socket_http_get (uri, NULL, &len);
|
||||
if (!str) {
|
||||
eprintf ("Cannot find '%s'\n", uri);
|
||||
R_LOG_ERROR ("Cannot find '%s'", uri);
|
||||
return;
|
||||
}
|
||||
r_core_return_value (core, R_CMD_RC_SUCCESS);
|
||||
@ -1124,7 +1124,7 @@ R_API char *r_core_rtr_cmds_query(RCore *core, const char *host, const char *por
|
||||
rbuf = r_str_append (rbuf, (const char *)buf);
|
||||
}
|
||||
} else {
|
||||
eprintf ("Cannot connect\n");
|
||||
R_LOG_ERROR ("Cannot connect");
|
||||
}
|
||||
r_socket_free (s);
|
||||
return rbuf;
|
||||
|
@ -1116,7 +1116,7 @@ static void visual_search(RCore *core) {
|
||||
eprintf ("Found in offset 0x%08"PFMT64x" + %d\n", core->offset, core->print->cur);
|
||||
r_cons_any_key (NULL);
|
||||
} else {
|
||||
eprintf ("Cannot find bytes.\n");
|
||||
R_LOG_ERROR ("Cannot find bytes");
|
||||
r_cons_any_key (NULL);
|
||||
r_cons_clear00 ();
|
||||
}
|
||||
@ -3666,7 +3666,7 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
|
||||
r_core_visual_seek_animation (core, undo->off);
|
||||
core->print->cur = undo->cursor;
|
||||
} else {
|
||||
eprintf ("Cannot undo\n");
|
||||
R_LOG_ERROR ("Cannot undo");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -4396,7 +4396,7 @@ R_API int r_core_visual(RCore *core, const char *input) {
|
||||
splitPtr = UT64_MAX;
|
||||
|
||||
if (r_cons_get_size (&ch) < 1 || ch < 1) {
|
||||
eprintf ("Cannot create Visual context. Use scr.fix_{columns|rows}\n");
|
||||
R_LOG_ERROR ("Cannot create Visual context. Use scr.fix_{columns|rows}");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4378,7 +4378,7 @@ onemoretime:
|
||||
free (newname);
|
||||
}
|
||||
} else {
|
||||
eprintf ("Cannot find instruction with a variable\n");
|
||||
R_LOG_ERROR ("Cannot find instruction with a variable");
|
||||
r_cons_any_key (NULL);
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ R_API void r_core_visual_slides(RCore *core, const char *file) {
|
||||
}
|
||||
char *data = r_file_slurp (file, NULL);
|
||||
if (!data) {
|
||||
eprintf ("Cannot open file.\n");
|
||||
R_LOG_ERROR ("Cannot open file");
|
||||
return;
|
||||
}
|
||||
RList *list = r_str_split_list (data, "\n", 0);
|
||||
|
@ -124,7 +124,7 @@ static int r_debug_bp_hit(RDebug *dbg, RRegItem *pc_ri, ut64 pc, RBreakpointItem
|
||||
}
|
||||
|
||||
if (!dbg->pc_at_bp_set) {
|
||||
eprintf ("failed to determine position of pc after breakpoint\n");
|
||||
R_LOG_ERROR ("failed to determine position of pc after breakpoint");
|
||||
}
|
||||
|
||||
if (dbg->pc_at_bp) {
|
||||
@ -535,12 +535,12 @@ R_API bool r_debug_execute(RDebug *dbg, const ut8 *buf, int len, R_OUT ut64 *ret
|
||||
ri_sp = r_reg_get (dbg->reg, dbg->reg->name[R_REG_NAME_SP], R_REG_TYPE_GPR);
|
||||
|
||||
if (!ri_pc) {
|
||||
eprintf ("r_debug_execute: Cannot get program counter\n");
|
||||
R_LOG_ERROR ("r_debug_execute: Cannot get program counter");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (restore && !ignore_stack && !ri_sp) {
|
||||
eprintf ("r_debug_execute: Cannot get stack pointer\n");
|
||||
R_LOG_ERROR ("r_debug_execute: Cannot get stack pointer");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -548,7 +548,7 @@ R_API bool r_debug_execute(RDebug *dbg, const ut8 *buf, int len, R_OUT ut64 *ret
|
||||
reg_backup = r_reg_get_bytes (dbg->reg, R_REG_TYPE_ALL, ®_backup_sz);
|
||||
|
||||
if (!reg_backup) {
|
||||
eprintf ("Cannot get register arena bytes\n");
|
||||
R_LOG_ERROR ("Cannot get register arena bytes");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -643,7 +643,7 @@ R_API bool r_debug_select(RDebug *dbg, int pid, int tid) {
|
||||
#endif
|
||||
if (pid == -1 && tid == -1) {
|
||||
if (dbg->pid != -1) {
|
||||
eprintf ("Child %d is dead\n", dbg->pid);
|
||||
R_LOG_ERROR ("Child %d is dead", dbg->pid);
|
||||
}
|
||||
}
|
||||
if (pid < 0 || tid < 0) {
|
||||
@ -663,7 +663,7 @@ R_API bool r_debug_select(RDebug *dbg, int pid, int tid) {
|
||||
free (pidcmd);
|
||||
}
|
||||
} else {
|
||||
eprintf ("Cannot find pid for child %d\n", dbg->pid);
|
||||
R_LOG_ERROR ("Cannot find pid for child %d", dbg->pid);
|
||||
}
|
||||
|
||||
// Synchronize with the current thread's data
|
||||
@ -1021,7 +1021,7 @@ R_API int r_debug_step(RDebug *dbg, int steps) {
|
||||
dbg->session->maxcnum++;
|
||||
dbg->session->bp = 0;
|
||||
if (!r_debug_trace_ins_before (dbg)) {
|
||||
eprintf ("trace_ins_before: failed\n");
|
||||
R_LOG_ERROR ("trace_ins_before: failed");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1031,13 +1031,13 @@ R_API int r_debug_step(RDebug *dbg, int steps) {
|
||||
ret = r_debug_step_hard (dbg, &bp);
|
||||
}
|
||||
if (!ret) {
|
||||
eprintf ("Stepping failed!\n");
|
||||
R_LOG_ERROR ("Stepping failed!");
|
||||
return steps_taken;
|
||||
}
|
||||
|
||||
if (dbg->session && dbg->recoil_mode == R_DBG_RECOIL_NONE) {
|
||||
if (!r_debug_trace_ins_after (dbg)) {
|
||||
eprintf ("trace_ins_after: failed\n");
|
||||
R_LOG_ERROR ("trace_ins_after: failed");
|
||||
}
|
||||
dbg->session->reasontype = dbg->reason.type;
|
||||
dbg->session->bp = bp;
|
||||
@ -1125,7 +1125,7 @@ R_API int r_debug_step_over(RDebug *dbg, int steps) {
|
||||
return steps_taken;
|
||||
}
|
||||
} else if ((op.prefix & (R_ANAL_OP_PREFIX_REP | R_ANAL_OP_PREFIX_REPNE | R_ANAL_OP_PREFIX_LOCK))) {
|
||||
//eprintf ("REP: skip to next instruction...\n");
|
||||
//R_LOG_ERROR ("REP: skip to next instruction");
|
||||
if (!r_debug_continue_until (dbg, ins_size)) {
|
||||
R_LOG_ERROR ("step over failed over rep");
|
||||
return steps_taken;
|
||||
|
@ -537,18 +537,18 @@ static RDebugReasonType r_debug_native_wait(RDebug *dbg, int pid) {
|
||||
#endif
|
||||
} else if (status == 1) {
|
||||
/* XXX(jjd): does this actually happen? */
|
||||
eprintf ("EEK DEAD DEBUGEE!\n");
|
||||
R_LOG_ERROR ("EEK DEAD DEBUGEE!");
|
||||
reason = R_DEBUG_REASON_DEAD;
|
||||
} else if (status == 0) {
|
||||
/* XXX(jjd): does this actually happen? */
|
||||
eprintf ("STATUS=0?!?!?!?\n");
|
||||
R_LOG_ERROR ("STATUS=0?!?!?!?");
|
||||
reason = R_DEBUG_REASON_DEAD;
|
||||
} else {
|
||||
if (ret != pid) {
|
||||
reason = R_DEBUG_REASON_NEW_PID;
|
||||
} else {
|
||||
/* ugh. still don't know :-/ */
|
||||
eprintf ("CRAP. returning from wait without knowing why...\n");
|
||||
R_LOG_ERROR ("CRAP. returning from wait without knowing why");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -800,7 +800,7 @@ static bool linux_map_thp(RDebug *dbg, ut64 addr, int size) {
|
||||
const size_t thpsize = 1<<21;
|
||||
|
||||
if (size % thpsize) {
|
||||
eprintf ("size not a power of huge pages size\n");
|
||||
R_LOG_ERROR ("size not a power of huge pages size");
|
||||
return false;
|
||||
}
|
||||
#if __linux__
|
||||
@ -808,7 +808,7 @@ static bool linux_map_thp(RDebug *dbg, ut64 addr, int size) {
|
||||
// even though the address might not have the 'hg'
|
||||
// vmflags
|
||||
if (thp_mode () != 1) {
|
||||
eprintf ("transparent huge page mode is not in madvise mode\n");
|
||||
R_LOG_ERROR ("transparent huge page mode is not in madvise mode");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@ -823,11 +823,11 @@ static bool linux_map_thp(RDebug *dbg, ut64 addr, int size) {
|
||||
r_egg_setup (dbg->egg, dbg->arch, 8 * dbg->bits, 0, 0);
|
||||
r_egg_load (dbg->egg, code, 0);
|
||||
if (!r_egg_compile (dbg->egg)) {
|
||||
eprintf ("Cannot compile.\n");
|
||||
R_LOG_ERROR ("Cannot compile");
|
||||
goto err_linux_map_thp;
|
||||
}
|
||||
if (!r_egg_assemble_asm (dbg->egg, asm_list)) {
|
||||
eprintf ("r_egg_assemble: invalid assembly\n");
|
||||
R_LOG_ERROR ("r_egg_assemble: invalid assembly");
|
||||
goto err_linux_map_thp;
|
||||
}
|
||||
buf = r_egg_get_bin (dbg->egg);
|
||||
@ -880,11 +880,11 @@ static RDebugMap* linux_map_alloc(RDebug *dbg, ut64 addr, int size, bool thp) {
|
||||
r_egg_setup (dbg->egg, dbg->arch, 8 * dbg->bits, 0, 0);
|
||||
r_egg_load (dbg->egg, code, 0);
|
||||
if (!r_egg_compile (dbg->egg)) {
|
||||
eprintf ("Cannot compile.\n");
|
||||
R_LOG_ERROR ("Cannot compile");
|
||||
goto err_linux_map_alloc;
|
||||
}
|
||||
if (!r_egg_assemble_asm (dbg->egg, asm_list)) {
|
||||
eprintf ("r_egg_assemble: invalid assembly\n");
|
||||
R_LOG_ERROR ("r_egg_assemble: invalid assembly");
|
||||
goto err_linux_map_alloc;
|
||||
}
|
||||
buf = r_egg_get_bin (dbg->egg);
|
||||
@ -902,8 +902,7 @@ static RDebugMap* linux_map_alloc(RDebug *dbg, ut64 addr, int size, bool thp) {
|
||||
if (map_addr < UT64_MAX) {
|
||||
if (thp) {
|
||||
if (!linux_map_thp (dbg, map_addr, size)) {
|
||||
// Not overly dramatic
|
||||
eprintf ("map promotion to huge page failed\n");
|
||||
R_LOG_WARN ("map promotion to huge page failed");
|
||||
}
|
||||
}
|
||||
r_debug_map_sync (dbg);
|
||||
@ -934,11 +933,11 @@ static int linux_map_dealloc(RDebug *dbg, ut64 addr, int size) {
|
||||
r_egg_setup (dbg->egg, dbg->arch, 8 * dbg->bits, 0, 0);
|
||||
r_egg_load (dbg->egg, code, 0);
|
||||
if (!r_egg_compile (dbg->egg)) {
|
||||
eprintf ("Cannot compile.\n");
|
||||
R_LOG_ERROR ("Cannot compile");
|
||||
goto err_linux_map_dealloc;
|
||||
}
|
||||
if (!r_egg_assemble_asm (dbg->egg, asm_list)) {
|
||||
eprintf ("r_egg_assemble: invalid assembly\n");
|
||||
R_LOG_ERROR ("r_egg_assemble: invalid assembly");
|
||||
goto err_linux_map_dealloc;
|
||||
}
|
||||
buf = r_egg_get_bin (dbg->egg);
|
||||
@ -1552,11 +1551,11 @@ static int r_debug_native_map_protect(RDebug *dbg, ut64 addr, int size, int perm
|
||||
r_egg_setup(dbg->egg, dbg->arch, 8 * dbg->bits, 0, 0);
|
||||
r_egg_load (dbg->egg, code, 0);
|
||||
if (!r_egg_compile (dbg->egg)) {
|
||||
eprintf ("Cannot compile.\n");
|
||||
R_LOG_ERROR ("Cannot compile");
|
||||
return false;
|
||||
}
|
||||
if (!r_egg_assemble (dbg->egg)) {
|
||||
eprintf ("r_egg_assemble: invalid assembly\n");
|
||||
R_LOG_ERROR ("r_egg_assemble: invalid assembly");
|
||||
return false;
|
||||
}
|
||||
buf = r_egg_get_bin (dbg->egg);
|
||||
|
@ -57,13 +57,13 @@ static RList *backtrace_fuzzy(RDebug *dbg, ut64 at) {
|
||||
RReg *reg = dbg->reg;
|
||||
const char *spname = r_reg_get_name (reg, R_REG_NAME_SP);
|
||||
if (!spname) {
|
||||
eprintf ("Cannot find stack pointer register\n");
|
||||
R_LOG_ERROR ("Cannot find stack pointer register");
|
||||
free (stack);
|
||||
return NULL;
|
||||
}
|
||||
ri = r_reg_get (reg, spname, R_REG_TYPE_GPR);
|
||||
if (!ri) {
|
||||
eprintf ("Cannot find stack pointer register\n");
|
||||
R_LOG_ERROR ("Cannot find stack pointer register");
|
||||
free (stack);
|
||||
return NULL;
|
||||
}
|
||||
@ -86,7 +86,7 @@ static RList *backtrace_fuzzy(RDebug *dbg, ut64 at) {
|
||||
case 4: addr = *p32; break;
|
||||
case 2: addr = *p16; break;
|
||||
default:
|
||||
eprintf ("Invalid word size with asm.bits\n");
|
||||
R_LOG_ERROR ("Invalid word size with asm.bits");
|
||||
r_list_free (list);
|
||||
free (stack);
|
||||
return NULL;
|
||||
@ -97,7 +97,7 @@ static RList *backtrace_fuzzy(RDebug *dbg, ut64 at) {
|
||||
frame->size = cursp - oldsp;
|
||||
frame->sp = cursp;
|
||||
frame->bp = oldsp; //addr + (i * wordsize); // -4 || -8
|
||||
// eprintf ("--------------> 0x%llx (%d)\n", addr, frame->size);
|
||||
// R_LOG_DEBUG ("--------------> 0x%llx (%d)", addr, frame->size);
|
||||
r_list_append (list, frame);
|
||||
oldsp = cursp;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ static RList *ios_dbg_maps(RDebug *dbg) {
|
||||
#if 0
|
||||
if (dbg->pid == 0) {
|
||||
vm_address_t base = get_kernel_base (task);
|
||||
eprintf ("Kernel Base Address: 0x%"PFMT64x"\n", (ut64)base);
|
||||
R_LOG_INFO ("Kernel Base Address: 0x%"PFMT64x, (ut64)base);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
@ -106,7 +106,7 @@ static RList *ios_dbg_maps(RDebug *dbg) {
|
||||
kr = mach_vm_region_recurse (task, &address, &size, &depth,
|
||||
(vm_region_recurse_info_t) &info, &info_count);
|
||||
if (kr != KERN_SUCCESS) {
|
||||
//eprintf ("Cannot kern succ recurse\n");
|
||||
//R_LOG_ERROR ("Cannot kern succ recurse");
|
||||
break;
|
||||
}
|
||||
if (!list) {
|
||||
@ -154,7 +154,7 @@ static RList *ios_dbg_maps(RDebug *dbg) {
|
||||
mr = r_debug_map_new (buf, address, address+size,
|
||||
xwr2rwx (info.protection), 0);
|
||||
if (!mr) {
|
||||
eprintf ("Cannot create r_debug_map_new\n");
|
||||
R_LOG_ERROR ("Cannot create r_debug_map_new");
|
||||
break;
|
||||
}
|
||||
mr->file = strdup (module_name);
|
||||
@ -259,7 +259,7 @@ static RList *osx_dbg_maps(RDebug *dbg) {
|
||||
mr = r_debug_map_new (buf, prev_address, prev_address+prev_size,
|
||||
xwr2rwx (prev_info.protection), 0);
|
||||
if (!mr) {
|
||||
eprintf ("Cannot create r_debug_map_new\n");
|
||||
R_LOG_ERROR ("Cannot create r_debug_map_new");
|
||||
break;
|
||||
}
|
||||
mr->file = strdup (module_name);
|
||||
|
@ -1277,7 +1277,7 @@ static RList *xnu_dbg_modules(RDebug *dbg) {
|
||||
size = mach0_size (dbg, addr);
|
||||
mr = r_debug_map_new (file_path, addr, addr + size, 7, 7);
|
||||
if (!mr) {
|
||||
eprintf ("Cannot create r_debug_map_new\n");
|
||||
R_LOG_ERROR ("Cannot create r_debug_map_new");
|
||||
break;
|
||||
}
|
||||
mr->file = strdup (file_path);
|
||||
@ -1406,7 +1406,7 @@ RList *xnu_dbg_maps(RDebug *dbg, int only_modules) {
|
||||
"", info.is_submap ? "_submap": "",
|
||||
module_name, maxperm, depthstr);
|
||||
if (!(mr = r_debug_map_new (buf, address, address + size, xwr2rwx (info.protection), xwr2rwx (info.max_protection)))) {
|
||||
eprintf ("Cannot create r_debug_map_new\n");
|
||||
R_LOG_ERROR ("Cannot create r_debug_map_new");
|
||||
break;
|
||||
}
|
||||
RDebugMap *rdm = moduleAt (modules, address);
|
||||
|
@ -84,8 +84,8 @@ static struct cEnv_t* r_egg_cfile_set_cEnv(const char *arch, const char *os, int
|
||||
if (!cEnv->SFLIBPATH) {
|
||||
output = r_sys_cmd_strf ("r2 -hh | grep INCDIR | awk '{print $2}'");
|
||||
if (!output || (output[0] == '\0')) {
|
||||
eprintf ("Cannot find SFLIBPATH env var.\n"
|
||||
"Please define it, or fix r2 installation.\n");
|
||||
R_LOG_ERROR ("Cannot find SFLIBPATH env var");
|
||||
eprintf ("Please define $SFLIBPATH, or fix r2 installation\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -292,7 +292,7 @@ R_API char* r_egg_cfile_parser(const char *file, const char *arch, const char *o
|
||||
printf ("rabin2 -o '%s.text' -O d/S/'%s' '%s.o'\n", file, cEnv->TEXT, file);
|
||||
output = r_sys_cmd_strf ("rabin2 -o '%s.text' -O d/S/'%s' '%s'.o", file, cEnv->TEXT, file);
|
||||
if (!output) {
|
||||
eprintf ("Linkage failed!\n");
|
||||
R_LOG_ERROR ("Linkage failed!");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ R_API char* r_egg_cfile_parser(const char *file, const char *arch, const char *o
|
||||
}
|
||||
|
||||
if (!r_file_exists (fileExt)) {
|
||||
eprintf ("Cannot find %s.o\n", file);
|
||||
R_LOG_ERROR ("Cannot find %s.o", file);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -961,7 +961,7 @@ static void rcc_next(REgg *egg) {
|
||||
egg->lang.elem[egg->lang.elem_n - 1] = 0;
|
||||
path = find_include (egg->lang.includedir, egg->lang.includefile);
|
||||
if (!path) {
|
||||
eprintf ("Cannot find include file '%s'\n", egg->lang.elem);
|
||||
R_LOG_ERROR ("Cannot find include file '%s'", egg->lang.elem);
|
||||
return;
|
||||
}
|
||||
R_FREE (egg->lang.includefile);
|
||||
@ -979,7 +979,7 @@ static void rcc_next(REgg *egg) {
|
||||
free (q);
|
||||
egg->lang.line = oline;
|
||||
} else {
|
||||
eprintf ("Cannot find '%s'\n", path);
|
||||
R_LOG_ERROR ("Cannot find '%s'", path);
|
||||
}
|
||||
free (path);
|
||||
return;
|
||||
@ -988,7 +988,7 @@ static void rcc_next(REgg *egg) {
|
||||
if (egg->lang.callname) {
|
||||
if (!strcmp (egg->lang.callname, "goto")) {
|
||||
if (egg->lang.nargs != 1) {
|
||||
eprintf ("Invalid number of arguments for goto()\n");
|
||||
R_LOG_ERROR ("Invalid number of arguments for goto()");
|
||||
return;
|
||||
}
|
||||
e->jmp (egg, egg->lang.ctxpush[CTX], 0);
|
||||
@ -1011,7 +1011,7 @@ static void rcc_next(REgg *egg) {
|
||||
}
|
||||
str = r_egg_mkvar (egg, buf, ocn, 0);
|
||||
if (!str) {
|
||||
eprintf ("Cannot mkvar\n");
|
||||
R_LOG_ERROR ("Cannot mkvar");
|
||||
return;
|
||||
}
|
||||
if (*ocn == '.') {
|
||||
@ -1065,7 +1065,7 @@ static void rcc_next(REgg *egg) {
|
||||
}
|
||||
free (s);
|
||||
} else {
|
||||
eprintf ("Cannot get @syscall payload\n");
|
||||
R_LOG_ERROR ("Cannot get @syscall payload");
|
||||
}
|
||||
}
|
||||
egg->lang.docall = 0;
|
||||
@ -1119,7 +1119,7 @@ static void rcc_next(REgg *egg) {
|
||||
free (str);
|
||||
str = r_egg_mkvar (egg, buf, egg->lang.dstvar, 0);
|
||||
if (*buf == 0) {
|
||||
eprintf ("Cannot resolve variable '%s'\n", egg->lang.dstvar);
|
||||
R_LOG_ERROR ("Cannot resolve variable '%s'", egg->lang.dstvar);
|
||||
} else {
|
||||
e->get_result (egg, buf);
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ static void emit_syscall_args(REgg *egg, int nargs) {
|
||||
k = j * R_SZ;
|
||||
const char *reg = getreg (j + 1);
|
||||
if (!reg) {
|
||||
eprintf ("Cannot find gpr %d\n", j + 1);
|
||||
R_LOG_ERROR ("Cannot find gpr %d", j + 1);
|
||||
break;
|
||||
}
|
||||
if (attsyntax) {
|
||||
|
@ -165,14 +165,14 @@ static RBuffer *build(REgg *egg) {
|
||||
}
|
||||
break;
|
||||
case R_EGG_OS_LINUX:
|
||||
if (suid) eprintf ("no suid for this platform\n");
|
||||
if (suid) R_LOG_WARN ("no suid for this platform");
|
||||
suid = 0;
|
||||
switch (egg->arch) {
|
||||
case R_SYS_ARCH_X86:
|
||||
switch (egg->bits) {
|
||||
case 32: sc = x86_linux_binsh; break;
|
||||
case 64: sc = x86_64_linux_binsh; break;
|
||||
default: eprintf ("Unsupportted\n");
|
||||
default: R_LOG_ERROR ("Unsupported");
|
||||
}
|
||||
break;
|
||||
case R_SYS_ARCH_ARM:
|
||||
@ -181,14 +181,17 @@ static RBuffer *build(REgg *egg) {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
eprintf ("unsupported os %x\n", egg->os);
|
||||
R_LOG_ERROR ("unsupported os %x", egg->os);
|
||||
break;
|
||||
}
|
||||
if (sc) {
|
||||
r_buf_set_bytes (buf, sc, strlen ((const char *)sc));
|
||||
if (shell && *shell) {
|
||||
if (cd) r_buf_write_at (buf, cd, (const ut8*)shell, strlen (shell)+1);
|
||||
else eprintf ("Cannot set shell\n");
|
||||
if (cd) {
|
||||
r_buf_write_at (buf, cd, (const ut8*)shell, strlen (shell)+1);
|
||||
} else {
|
||||
R_LOG_ERROR ("Cannot set shell");
|
||||
}
|
||||
}
|
||||
}
|
||||
free (suid);
|
||||
|
@ -85,7 +85,7 @@ static RBuffer *build(REgg *egg) {
|
||||
break;
|
||||
case R_EGG_OS_LINUX:
|
||||
if (suid) {
|
||||
eprintf ("no suid for this platform\n");
|
||||
R_LOG_WARN ("no suid for this platform");
|
||||
}
|
||||
suid = 0;
|
||||
switch (egg->arch) {
|
||||
@ -100,7 +100,7 @@ static RBuffer *build(REgg *egg) {
|
||||
int len = strlen (shell);
|
||||
if (len > sizeof (st64) - 1) {
|
||||
*shell = 0;
|
||||
eprintf ("Unsupported CMD length\n");
|
||||
R_LOG_ERROR ("Unsupported CMD length");
|
||||
break;
|
||||
}
|
||||
st64 b = 0;
|
||||
@ -119,7 +119,7 @@ static RBuffer *build(REgg *egg) {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
eprintf ("Unsupported arch %d bits\n", egg->bits);
|
||||
R_LOG_ERROR ("Unsupported arch %d bits", egg->bits);
|
||||
}
|
||||
break;
|
||||
case R_SYS_ARCH_ARM:
|
||||
@ -131,13 +131,13 @@ static RBuffer *build(REgg *egg) {
|
||||
sc = arm_linux_binsh;
|
||||
break;
|
||||
default:
|
||||
eprintf ("Unsupported arch %d bits\n", egg->bits);
|
||||
R_LOG_ERROR ("Unsupported arch %d bits", egg->bits);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
eprintf ("Unsupported os %x\n", egg->os);
|
||||
R_LOG_ERROR ("Unsupported os %x", egg->os);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ static RBuffer *build(REgg *egg) {
|
||||
if (cd) {
|
||||
r_buf_write_at (buf, cd, (const ut8 *)shell, strlen (shell) + 1);
|
||||
} else {
|
||||
eprintf ("Cannot set shell\n");
|
||||
R_LOG_ERROR ("Cannot set shell");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,20 +48,23 @@ static RBuffer *build(REgg *egg) {
|
||||
case R_SYS_ARCH_X86:
|
||||
switch (egg->bits) {
|
||||
case 32: sc = x86_freebsd_reverse; break;
|
||||
default: eprintf ("Unsupportted\n");
|
||||
default: R_LOG_ERROR ("Unsupported");
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
eprintf ("unsupported os %x\n", egg->os);
|
||||
R_LOG_ERROR ("unsupported os %x", egg->os);
|
||||
break;
|
||||
}
|
||||
if (sc) {
|
||||
r_buf_set_bytes (buf, sc, strlen ((const char *)sc));
|
||||
if (shell && *shell) {
|
||||
if (cd) r_buf_write_at (buf, cd, (const ut8*)shell, strlen (shell)+1);
|
||||
else eprintf ("Cannot set shell\n");
|
||||
if (cd) {
|
||||
r_buf_write_at (buf, cd, (const ut8*)shell, strlen (shell)+1);
|
||||
} else {
|
||||
R_LOG_ERROR ("Cannot set shell");
|
||||
}
|
||||
}
|
||||
}
|
||||
free (suid);
|
||||
|
@ -50,12 +50,12 @@ static int __write(RIO *io, RIODesc *fd, const ut8 *buf, int count) {
|
||||
pathname = fd->name + 7;
|
||||
out = r_sandbox_fopen (pathname, "w");
|
||||
if (!out) {
|
||||
eprintf ("Cannot open '%s' for writing\n", pathname);
|
||||
R_LOG_ERROR ("Cannot open '%s' for writing", pathname);
|
||||
return -1;
|
||||
}
|
||||
/* mem write */
|
||||
if (r_buf_write_at (rih->rbuf, io->off, buf, count) != count) {
|
||||
eprintf ("ihex:write(): sparse write failed\n");
|
||||
R_LOG_ERROR ("ihex:write(): sparse write failed");
|
||||
fclose (out);
|
||||
return -1;
|
||||
}
|
||||
@ -277,11 +277,11 @@ static bool ihex_parse(RBuffer *rbuf, char *str) {
|
||||
ut32 tmp = 0;
|
||||
r_buf_read_at (rbuf, at, (ut8*)&tmp, 4);
|
||||
if (tmp && tmp != UT32_MAX) {
|
||||
eprintf ("Cannot write%c", 10);
|
||||
R_LOG_ERROR ("Cannot write");
|
||||
return true;
|
||||
}
|
||||
if (r_buf_write_at (rbuf, at, sec_tmp, sec_size) != sec_size) {
|
||||
eprintf ("sparse buffer problem, giving up\n");
|
||||
R_LOG_ERROR ("sparse buffer problem, giving up");
|
||||
goto fail;
|
||||
}
|
||||
//}
|
||||
@ -296,13 +296,13 @@ static bool ihex_parse(RBuffer *rbuf, char *str) {
|
||||
if (eol) {
|
||||
// checksum
|
||||
if (sscanf (str + 9 + (i * 2), "%02x", &byte) !=1) {
|
||||
eprintf("unparsable data !\n");
|
||||
R_LOG_ERROR("unparsable data!");
|
||||
goto fail;
|
||||
}
|
||||
cksum += byte;
|
||||
if (cksum != 0) {
|
||||
ut8 fixedcksum = 0-(cksum-byte);
|
||||
eprintf ("Checksum failed %02x (got %02x expected %02x)\n",
|
||||
R_LOG_ERROR ("Checksum failed %02x (got %02x expected %02x)",
|
||||
cksum, byte, fixedcksum);
|
||||
goto fail;
|
||||
}
|
||||
@ -313,7 +313,7 @@ static bool ihex_parse(RBuffer *rbuf, char *str) {
|
||||
case 1: // EOF. we don't validate checksum here
|
||||
if (at && sec_size) {
|
||||
if (r_buf_write_at (rbuf, at, sec_tmp, sec_size) != sec_size) {
|
||||
eprintf ("sparse buffer problem, giving up. ssiz=%X, sstart=%X\n", sec_size, sec_start);
|
||||
R_LOG_ERROR ("sparse buffer problem, giving up. ssiz=%X, sstart=%X", sec_size, sec_start);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
@ -334,12 +334,12 @@ static bool ihex_parse(RBuffer *rbuf, char *str) {
|
||||
cksum += addr_tmp;
|
||||
cksum += type;
|
||||
if ((bc != 2) || (addr_tmp != 0)) {
|
||||
eprintf ("invalid type 02/04 record!\n");
|
||||
R_LOG_ERROR ("invalid type 02/04 record!");
|
||||
goto fail;
|
||||
}
|
||||
if ((sscanf (str + 9 + 0, "%02x", &extH) !=1) ||
|
||||
(sscanf (str + 9 + 2, "%02x", &extL) !=1)) {
|
||||
eprintf ("unparsable data !\n");
|
||||
R_LOG_ERROR ("unparsable data!");
|
||||
goto fail;
|
||||
}
|
||||
extH &= 0xff;
|
||||
@ -362,7 +362,7 @@ static bool ihex_parse(RBuffer *rbuf, char *str) {
|
||||
cksum += byte;
|
||||
if (cksum != 0) {
|
||||
ut8 fixedcksum = 0-(cksum-byte);
|
||||
eprintf ("Checksum failed %02x (got %02x expected %02x)\n",
|
||||
R_LOG_ERROR ("Checksum failed %02x (got %02x expected %02x)",
|
||||
cksum, byte, fixedcksum);
|
||||
goto fail;
|
||||
}
|
||||
@ -404,7 +404,7 @@ static RIODesc *__open(RIO *io, const char *pathname, int rw, int mode) {
|
||||
return NULL;
|
||||
}
|
||||
if (!ihex_parse (mal->rbuf, str)) {
|
||||
eprintf ("ihex: failed to parse file\n");
|
||||
R_LOG_ERROR ("ihex: failed to parse file");
|
||||
free (str);
|
||||
r_buf_free (mal->rbuf);
|
||||
free (mal);
|
||||
|
@ -123,16 +123,16 @@ static RIODesc *__rap_open(RIO *io, const char *pathname, int rw, int mode) {
|
||||
}
|
||||
RSocket *s = r_socket_new (is_ssl);
|
||||
if (!s) {
|
||||
eprintf ("Cannot create new socket\n");
|
||||
R_LOG_ERROR ("Cannot create new socket");
|
||||
return NULL;
|
||||
}
|
||||
eprintf ("Connecting to %s, port %s\n", host, port);
|
||||
R_LOG_INFO ("Connecting to %s, port %s", host, port);
|
||||
if (!r_socket_connect (s, host, port, R_SOCKET_PROTO_TCP, 0)) {
|
||||
eprintf ("Cannot connect to '%s' (%d)\n", host, p);
|
||||
R_LOG_ERROR ("Cannot connect to '%s' (%d)", host, p);
|
||||
r_socket_free (s);
|
||||
return NULL;
|
||||
}
|
||||
eprintf ("Connected to: %s at port %s\n", host, port);
|
||||
R_LOG_INFO ("Connected to: %s at port %s", host, port);
|
||||
RIORap *rior = R_NEW0 (RIORap);
|
||||
if (!rior) {
|
||||
r_socket_free (s);
|
||||
|
@ -120,10 +120,10 @@ static RIODesc *shm__open(RIO *io, const char *pathname, int rw, int mode) {
|
||||
}
|
||||
shm->size = SHMATSZ;
|
||||
if (shm->fd != -1) {
|
||||
eprintf ("Connected to shared memory 0x%08x\n", shm->id);
|
||||
R_LOG_INFO ("Connected to shared memory 0x%08x", shm->id);
|
||||
return r_io_desc_new (io, &r_io_plugin_shm, pathname, rw, mode, shm);
|
||||
}
|
||||
eprintf ("Cannot connect to shared memory (%d)\n", shm->id);
|
||||
R_LOG_ERROR ("Cannot connect to shared memory (%d)", shm->id);
|
||||
free (shm);
|
||||
}
|
||||
return NULL;
|
||||
|
@ -127,7 +127,7 @@ static RIODesc *__open(RIO *io, const char *pathname, int rw, int mode) {
|
||||
/* listen and wait for connection */
|
||||
data->sc = r_socket_new (false);
|
||||
if (!r_socket_connect (data->sc, host, port, R_SOCKET_PROTO_TCP, 0)) {
|
||||
eprintf ("Cannot connect\n");
|
||||
R_LOG_ERROR ("Cannot connect");
|
||||
free (host);
|
||||
free_socketdata (data);
|
||||
return NULL;
|
||||
|
@ -20,7 +20,7 @@ static ut8 *tcpme(const char *pathname, int *code, int *len) {
|
||||
/* listen and wait for connection */
|
||||
RSocket *sl = r_socket_new (false);
|
||||
if (!r_socket_listen (sl, pathname + 1, NULL)) {
|
||||
eprintf ("Cannot listen\n");
|
||||
R_LOG_ERROR ("Cannot listen");
|
||||
r_socket_free (sl);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ static char *__system(RIO *io, RIODesc *fd, const char *cmd) {
|
||||
if (ht) {
|
||||
wrap->pi.hThread = ht;
|
||||
} else {
|
||||
eprintf ("Cannot attach to %d (%s)\n", pid, cmd);
|
||||
R_LOG_ERROR ("Cannot attach to %d (%s)", pid, cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ static int lang_c_file(RLang *lang, const char *file) {
|
||||
strcpy (name, file);
|
||||
}
|
||||
if (!r_file_exists (name)) {
|
||||
eprintf ("file not found (%s)\n", name);
|
||||
R_LOG_ERROR ("file not found (%s)", name);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -76,11 +76,11 @@ static int lang_c_file(RLang *lang, const char *file) {
|
||||
ac = 0;
|
||||
av = NULL;
|
||||
} else {
|
||||
eprintf ("Cannot find 'entry' symbol in library\n");
|
||||
R_LOG_ERROR ("Cannot find 'entry' symbol in library");
|
||||
}
|
||||
r_lib_dl_close (lib);
|
||||
} else {
|
||||
eprintf ("Cannot open library\n");
|
||||
R_LOG_ERROR ("Cannot open library");
|
||||
}
|
||||
r_file_rm (buf); // remove lib
|
||||
free (buf);
|
||||
@ -95,7 +95,7 @@ static int lang_c_init(void *user) {
|
||||
static bool lang_c_run(RLang *lang, const char *code, int len) {
|
||||
FILE *fd = r_sandbox_fopen (".tmp.c", "w");
|
||||
if (!fd) {
|
||||
eprintf ("Cannot open .tmp.c\n");
|
||||
R_LOG_ERROR ("Cannot open .tmp.c");
|
||||
return false;
|
||||
}
|
||||
fputs ("#include <r_core.h>\n\nvoid entry(RCore *core, int argc, const char **argv) {\n", fd);
|
||||
|
@ -74,7 +74,7 @@ static int lang_cpipe_init(void *user) {
|
||||
static bool lang_cpipe_run(RLang *lang, const char *code, int len) {
|
||||
FILE *fd = r_sandbox_fopen (".tmp.c", "w");
|
||||
if (!fd) {
|
||||
eprintf ("Cannot open .tmp.c\n");
|
||||
R_LOG_ERROR ("Cannot open .tmp.c");
|
||||
return false;
|
||||
}
|
||||
fputs ("#include <r_socket.h>\n\n"
|
||||
|
@ -77,14 +77,14 @@ static void gorunlib(void *user, const char *lib) {
|
||||
if (fcn) {
|
||||
fcn (user, 0, NULL);
|
||||
} else {
|
||||
eprintf ("Cannot find '%s' symbol in library.\n", r2go_sym);
|
||||
R_LOG_ERROR ("Cannot find '%s' symbol in library", r2go_sym);
|
||||
}
|
||||
// dlclosing causes a crash, this is a know issue by Golang
|
||||
// https://github.com/golang/go/issues/32497
|
||||
// https://github.com/golang/go/issues/11100
|
||||
// r_lib_dl_close (vl);
|
||||
} else {
|
||||
eprintf ("Cannot open '%s' library.\n", lib);
|
||||
R_LOG_ERROR ("Cannot open '%s' library", lib);
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ static bool __gorun(RLang *lang, const char *code, int len) {
|
||||
gocode_fini (&gocode);
|
||||
return true;
|
||||
}
|
||||
eprintf ("Cannot open tmp.go\n");
|
||||
R_LOG_ERROR ("Cannot open tmp.go");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ static bool lang_lib_file_run(RLang *user, const char *file) {
|
||||
if (fcn) {
|
||||
fcn (user->user);
|
||||
} else {
|
||||
eprintf ("Cannot find 'entry' symbol in library\n");
|
||||
R_LOG_ERROR ("Cannot find 'entry' symbol in library");
|
||||
}
|
||||
r_lib_dl_close (lib);
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ static bool lang_pipe_run(RLang *lang, const char *code, int len) {
|
||||
if (safe_in != -1) {
|
||||
dup2 (safe_in, 0);
|
||||
} else {
|
||||
eprintf ("Cannot open ttyname(0) %s\n", term_in);
|
||||
R_LOG_ERROR ("Cannot open ttyname(0) %s", term_in);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,11 +54,14 @@ static int lang_rust_file(RLang *lang, const char *file) {
|
||||
if (lib!= NULL) {
|
||||
void (*fcn)(RCore *);
|
||||
fcn = r_lib_dl_sym (lib, "entry");
|
||||
if (fcn) fcn (lang->user);
|
||||
else eprintf ("Cannot find 'entry' symbol in library\n");
|
||||
if (fcn) {
|
||||
fcn (lang->user);
|
||||
} else {
|
||||
R_LOG_ERROR ("Cannot find 'entry' symbol in library");
|
||||
}
|
||||
r_lib_dl_close (lib);
|
||||
} else {
|
||||
eprintf ("Cannot open library\n");
|
||||
R_LOG_ERROR ("Cannot open library");
|
||||
}
|
||||
r_file_rm (path); // remove lib
|
||||
free (path);
|
||||
@ -73,7 +76,7 @@ static int lang_rust_init(void *user) {
|
||||
static bool lang_rust_run(RLang *lang, const char *code, int len) {
|
||||
FILE *fd = r_sandbox_fopen ("_tmp.rs", "w");
|
||||
if (!fd) {
|
||||
eprintf ("Cannot open _tmp.rs\n");
|
||||
R_LOG_ERROR ("Cannot open _tmp.rs");
|
||||
return false;
|
||||
}
|
||||
const char *rust_header = \
|
||||
|
@ -100,11 +100,11 @@ static void runlib(void *user, const char *lib) {
|
||||
if (fcn) {
|
||||
fcn (user, 0, NULL);
|
||||
} else {
|
||||
eprintf ("Cannot find '%s' symbol in library\n", r2v_sym);
|
||||
R_LOG_ERROR ("Cannot find '%s' symbol in library", r2v_sym);
|
||||
}
|
||||
r_lib_dl_close (vl);
|
||||
} else {
|
||||
eprintf ("Cannot open '%s' library\n", lib);
|
||||
R_LOG_ERROR ("Cannot open '%s' library", lib);
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ static bool __run(RLang *lang, const char *code, int len) {
|
||||
vcode_fini (&vcode);
|
||||
return true;
|
||||
}
|
||||
eprintf ("Cannot open .tmp.v\n");
|
||||
R_LOG_ERROR ("Cannot open .tmp.v");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,11 @@ static bool lang_zig_file(RLang *lang, const char *file) {
|
||||
if (fcn) {
|
||||
fcn (lang->user);
|
||||
} else {
|
||||
eprintf ("Cannot find 'entry' symbol in library\n");
|
||||
R_LOG_ERROR ("Cannot find 'entry' symbol in library");
|
||||
}
|
||||
r_lib_dl_close (lib);
|
||||
} else {
|
||||
eprintf ("Cannot open library\n");
|
||||
R_LOG_ERROR ("Cannot open library");
|
||||
free (name);
|
||||
free (path);
|
||||
free (cc);
|
||||
@ -97,7 +97,7 @@ static bool lang_zig_run(RLang *lang, const char *code, int len) {
|
||||
lang_zig_file (lang, file);
|
||||
r_file_rm (file);
|
||||
} else {
|
||||
eprintf ("Cannot open %s\n", file);
|
||||
R_LOG_ERROR ("Cannot open %s", file);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ R_IPI int search_regex_read(RSearch *s, ut64 from, ut64 to) {
|
||||
}
|
||||
|
||||
if (r_regex_init (&rx, (char *)kw->bin_keyword, reflags)) {
|
||||
eprintf ("Cannot compile '%s' regexp\n", kw->bin_keyword);
|
||||
R_LOG_ERROR ("Cannot compile '%s' regexp", kw->bin_keyword);
|
||||
ret = -1;
|
||||
goto beach;
|
||||
}
|
||||
@ -111,7 +111,7 @@ R_IPI int search_regexp_update(RSearch *s, ut64 from, const ut8 *buf, int len) {
|
||||
}
|
||||
|
||||
if (r_regex_init (&rx, (char *)kw->bin_keyword, reflags)) {
|
||||
eprintf ("Cannot compile '%s' regexp\n", kw->bin_keyword);
|
||||
R_LOG_ERROR ("Cannot compile '%s' regexp", kw->bin_keyword);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ R_API RSearch *r_search_new(int mode) {
|
||||
}
|
||||
if (!r_search_set_mode (s, mode)) {
|
||||
free (s);
|
||||
eprintf ("Cannot init search for mode %d\n", mode);
|
||||
R_LOG_ERROR ("Cannot init search for mode %d", mode);
|
||||
return false;
|
||||
}
|
||||
s->inverse = false;
|
||||
@ -633,7 +633,7 @@ R_API void r_search_string_prepare_backward(RSearch *s) {
|
||||
R_API void r_search_reset(RSearch *s, int mode) {
|
||||
s->nhits = 0;
|
||||
if (!r_search_set_mode (s, mode)) {
|
||||
eprintf ("Cannot init search for mode %d\n", mode);
|
||||
R_LOG_ERROR ("Cannot init search for mode %d", mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ R_API void r_socket_http_free(RSocketHTTPRequest *rs) {
|
||||
int main() {
|
||||
RSocket *s = r_socket_new (false);
|
||||
if (!r_socket_listen (s, "8080", NULL)) {
|
||||
eprintf ("Cannot listen here\n");
|
||||
R_LOG_ERROR ("Cannot listen here");
|
||||
return 1;
|
||||
}
|
||||
for (;;) {
|
||||
|
@ -45,10 +45,10 @@ R_API int r_socket_rap_client_open(RSocket *s, const char *file, int rw) {
|
||||
if (buf[0] == (char)(RAP_PACKET_OPEN | RAP_PACKET_REPLY)) {
|
||||
fd = r_read_at_be32 (buf + 1, 1);
|
||||
} else {
|
||||
eprintf ("RapClientOpen: Bad packet 0x%02x\n", buf[0]);
|
||||
R_LOG_ERROR ("RapClientOpen: Bad packet 0x%02x", buf[0]);
|
||||
}
|
||||
} else {
|
||||
eprintf ("Cannot read 5 bytes from server\n");
|
||||
R_LOG_ERROR ("Cannot read 5 bytes from server");
|
||||
}
|
||||
free (buf);
|
||||
return fd;
|
||||
|
@ -747,7 +747,7 @@ R_API bool r_file_hexdump(const char *file, const ut8 *buf, int len, int append)
|
||||
fd = r_sandbox_fopen (file, "wb");
|
||||
}
|
||||
if (!fd) {
|
||||
eprintf ("Cannot open '%s' for writing\n", file);
|
||||
R_LOG_ERROR ("Cannot open '%s' for writing", file);
|
||||
return false;
|
||||
}
|
||||
for (i = 0; i < len; i += 16) {
|
||||
@ -787,7 +787,7 @@ R_API bool r_file_dump(const char *file, const ut8 *buf, int len, bool append) {
|
||||
fd = r_sandbox_fopen (file, "wb");
|
||||
}
|
||||
if (!fd) {
|
||||
eprintf ("Cannot open '%s' for writing\n", file);
|
||||
R_LOG_ERROR ("Cannot open '%s' for writing", file);
|
||||
return false;
|
||||
}
|
||||
if (buf) {
|
||||
@ -1292,7 +1292,7 @@ R_API char *r_file_tmpdir(void) {
|
||||
if (!r_file_is_directory (path)) {
|
||||
free (path);
|
||||
return NULL;
|
||||
//eprintf ("Cannot find dir.tmp '%s'\n", path);
|
||||
//R_LOG_ERROR ("Cannot find dir.tmp '%s'", path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
@ -1300,7 +1300,7 @@ R_API char *r_file_tmpdir(void) {
|
||||
R_API bool r_file_copy(const char *src, const char *dst) {
|
||||
r_return_val_if_fail (R_STR_ISNOTEMPTY (src) && R_STR_ISNOTEMPTY (dst), false);
|
||||
if (!strcmp (src, dst)) {
|
||||
eprintf ("Cannot copy file '%s' to itself.\n", src);
|
||||
R_LOG_ERROR ("Cannot copy file '%s' to itself", src);
|
||||
return false;
|
||||
}
|
||||
/* TODO: implement in C */
|
||||
|
@ -1792,14 +1792,14 @@ R_API int r_print_format_struct_size(RPrint *p, const char *f, int mode, int n)
|
||||
format_owned = true;
|
||||
}
|
||||
if (!format) {
|
||||
eprintf ("Cannot find format for struct `%s'\n", structname + 1);
|
||||
R_LOG_ERROR ("Cannot find format for struct `%s'", structname + 1);
|
||||
free (structname);
|
||||
free (o);
|
||||
return 0;
|
||||
}
|
||||
int newsize = r_print_format_struct_size (p, format, mode, n + 1);
|
||||
if (newsize < 1) {
|
||||
eprintf ("Cannot find size for `%s'\n", format);
|
||||
R_LOG_ERROR ("Cannot find size for `%s'", format);
|
||||
free (structname);
|
||||
free (o);
|
||||
return 0;
|
||||
|
@ -192,7 +192,7 @@ R_API int r_lib_run_handler(RLib *lib, RLibPlugin *plugin, RLibStruct *symbol) {
|
||||
IFDBG eprintf ("PLUGIN LOADED %p fcn %p\n", h, h->constructor);
|
||||
return h->constructor (plugin, h->user, symbol->data);
|
||||
}
|
||||
IFDBG eprintf ("Cannot find plugin constructor\n");
|
||||
IFDBG R_LOG_ERROR ("Cannot find plugin constructor");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ R_API int r_lib_open(RLib *lib, const char *file) {
|
||||
|
||||
void *handler = r_lib_dl_open (file);
|
||||
if (!handler) {
|
||||
IFDBG eprintf ("Cannot open library: '%s'\n", file);
|
||||
IFDBG R_LOG_ERROR ("Cannot open library: '%s'", file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -288,7 +288,7 @@ R_API int r_lib_open(RLib *lib, const char *file) {
|
||||
stru = (RLibStruct *) r_lib_dl_sym (handler, lib->symname);
|
||||
}
|
||||
if (!stru) {
|
||||
IFDBG eprintf ("Cannot find symbol '%s' in library '%s'\n",
|
||||
IFDBG R_LOG_ERROR ("Cannot find symbol '%s' in library '%s'",
|
||||
lib->symname, file);
|
||||
r_lib_dl_close (handler);
|
||||
return -1;
|
||||
@ -388,7 +388,7 @@ R_API bool r_lib_opendir(RLib *lib, const char *path) {
|
||||
swprintf (directory, _countof (directory), L"%ls\\*.*", wcpath);
|
||||
fh = FindFirstFileW (directory, &dir);
|
||||
if (fh == INVALID_HANDLE_VALUE) {
|
||||
IFDBG eprintf ("Cannot open directory %ls\n", wcpath);
|
||||
IFDBG R_LOG_ERROR ("Cannot open directory %ls", wcpath);
|
||||
free (wcpath);
|
||||
return false;
|
||||
}
|
||||
@ -399,7 +399,7 @@ R_API bool r_lib_opendir(RLib *lib, const char *path) {
|
||||
if (__lib_dl_check_filename (wctocbuff)) {
|
||||
r_lib_open (lib, wctocbuff);
|
||||
} else {
|
||||
IFDBG eprintf ("Cannot open %ls\n", dir.cFileName);
|
||||
IFDBG R_LOG_ERROR ("Cannot open %ls", dir.cFileName);
|
||||
}
|
||||
free (wctocbuff);
|
||||
}
|
||||
@ -409,7 +409,7 @@ R_API bool r_lib_opendir(RLib *lib, const char *path) {
|
||||
#else
|
||||
dh = opendir (path);
|
||||
if (!dh) {
|
||||
IFDBG eprintf ("Cannot open directory '%s'\n", path);
|
||||
IFDBG R_LOG_ERROR ("Cannot open directory '%s'", path);
|
||||
return false;
|
||||
}
|
||||
while ((de = (struct dirent *)readdir (dh))) {
|
||||
@ -418,10 +418,10 @@ R_API bool r_lib_opendir(RLib *lib, const char *path) {
|
||||
}
|
||||
snprintf (file, sizeof (file), "%s/%s", path, de->d_name);
|
||||
if (__lib_dl_check_filename (file)) {
|
||||
IFDBG eprintf ("Loading %s\n", file);
|
||||
IFDBG R_LOG_INFO ("Loading %s", file);
|
||||
r_lib_open (lib, file);
|
||||
} else {
|
||||
IFDBG eprintf ("Cannot open %s\n", file);
|
||||
IFDBG R_LOG_ERROR ("Cannot open %s", file);
|
||||
}
|
||||
}
|
||||
closedir (dh);
|
||||
|
@ -274,7 +274,7 @@ R_API int r_sandbox_system(const char *x, int n) {
|
||||
if (argv) {
|
||||
char *argv0 = r_file_path (argv[0]);
|
||||
if (!argv0) {
|
||||
eprintf ("Cannot find '%s'\n", argv[0]);
|
||||
R_LOG_ERROR ("Cannot find '%s'", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
pid = 0;
|
||||
|
@ -259,7 +259,7 @@ R_API RList *r_sys_dir(const char *path) {
|
||||
char *cfname;
|
||||
HANDLE fh = r_sandbox_opendir (path, &entry);
|
||||
if (fh == INVALID_HANDLE_VALUE) {
|
||||
//IFDGB eprintf ("Cannot open directory %ls\n", wcpath);
|
||||
//IFDGB R_LOG_ERROR ("Cannot open directory %ls", wcpath);
|
||||
return list;
|
||||
}
|
||||
list = r_list_newf (free);
|
||||
|
@ -454,7 +454,7 @@ static char *fmt_struct_union(Sdb *TDB, char *var, bool is_typedef) {
|
||||
vars = r_str_append (vars, " ");
|
||||
}
|
||||
} else {
|
||||
eprintf ("Cannot resolve type '%s'\n", var3);
|
||||
R_LOG_ERROR ("Cannot resolve type '%s'", var3);
|
||||
}
|
||||
free (type);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ static inline HANDLE w32_loadlib(const char *name, const char *libname) {
|
||||
if (!lib) {
|
||||
lib = LoadLibrary (TEXT (libname));
|
||||
if (!lib) {
|
||||
eprintf ("Cannot load %s to resolve %s. Aborting\n", libname, name);
|
||||
R_LOG_ERROR ("Cannot load %s to resolve %s. Aborting", libname, name);
|
||||
return (HANDLE)(size_t)0;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,9 @@
|
||||
(git grep -n -i 'R_LOG_ERROR ("ERROR' | grep -v sys) && exit 1
|
||||
(git grep -n ^R_API libr shlr | grep ' (') && exit 1
|
||||
(git grep -n ^R_API libr shlr | grep '( ') && exit 1
|
||||
(git grep -n -e 'eprintf ("Could' -e 'eprintf ("Failed' libr | grep -v -e ^libr/core/cmd_ -e ^libr/main/) && exit 1
|
||||
(git grep -n -e 'eprintf ("Could' -e 'eprintf ("Failed' -e 'eprintf ("Cannot' libr \
|
||||
| grep -v -e ^libr/core/cmd -e ^libr/main/ -e ^libr/util/syscmd \
|
||||
| grep -v -e r_cons_eprintf -e alloc) && exit 1
|
||||
|
||||
# pending cleanups
|
||||
# ( git grep 'desc = "[A-Z]' ) && exit 1
|
||||
@ -27,6 +29,5 @@
|
||||
# (git grep 'strncmp' libr) # && exit 1 # use r_str_startswith()
|
||||
# (git grep 'eprintf' libr | grep 'Warning:') # && exit 1
|
||||
# (git grep 'eprintf' | grep 'Usage:' | grep -v sys/) # && exit 1
|
||||
# (git grep -n 'eprintf ("Cannot' libr | grep -v -e ^libr/core/cmd_ -e ^libr/main/) && exit 1
|
||||
|
||||
exit 0
|
||||
|
@ -38,7 +38,7 @@ pa out 256,AL
|
||||
EOF
|
||||
EXPECT=
|
||||
EXPECT_ERR=<<EOF
|
||||
Cannot assemble 'out 256,AL' at line 3
|
||||
ERROR: Cannot assemble 'out 256,AL' at line 3
|
||||
EOF
|
||||
RUN
|
||||
|
||||
@ -51,7 +51,7 @@ pa push 0x3311223311222222
|
||||
EOF
|
||||
EXPECT=
|
||||
EXPECT_ERR=<<EOF
|
||||
Cannot assemble 'push 0x3311223311222222' at line 3
|
||||
ERROR: Cannot assemble 'push 0x3311223311222222' at line 3
|
||||
EOF
|
||||
RUN
|
||||
|
||||
@ -64,6 +64,6 @@ pa mov eax, 0x3311223311222222
|
||||
EOF
|
||||
EXPECT=
|
||||
EXPECT_ERR=<<EOF
|
||||
Cannot assemble 'mov eax, 0x3311223311222222' at line 3
|
||||
ERROR: Cannot assemble 'mov eax, 0x3311223311222222' at line 3
|
||||
EOF
|
||||
RUN
|
||||
|
@ -1062,8 +1062,8 @@ utf32le
|
||||
utf32le
|
||||
EOF
|
||||
EXPECT_ERR=<<EOF
|
||||
Unknown encoding: cat_sat_on_keyboard
|
||||
Unknown encoding: CAT_SAT_ON_KEYBOARD
|
||||
ERROR: Unknown encoding: cat_sat_on_keyboard
|
||||
ERROR: Unknown encoding: CAT_SAT_ON_KEYBOARD
|
||||
EOF
|
||||
RUN
|
||||
|
||||
|
@ -190,7 +190,7 @@ CMDS=!rasm2 -a x86 -b 32 "mov hello, eax"
|
||||
EXPECT=<<EOF
|
||||
EOF
|
||||
EXPECT_ERR=<<EOF
|
||||
Cannot assemble 'mov hello, eax' at line 3
|
||||
ERROR: Cannot assemble 'mov hello, eax' at line 3
|
||||
invalid
|
||||
EOF
|
||||
RUN
|
||||
@ -201,7 +201,7 @@ CMDS=!rasm2 -a x86 -b 32 "mov 33, eax"
|
||||
EXPECT=<<EOF
|
||||
EOF
|
||||
EXPECT_ERR=<<EOF
|
||||
Cannot assemble 'mov 33, eax' at line 3
|
||||
ERROR: Cannot assemble 'mov 33, eax' at line 3
|
||||
invalid
|
||||
EOF
|
||||
RUN
|
||||
@ -212,7 +212,7 @@ CMDS=!rasm2 -a x86 -b 32 "mov eax, hello"
|
||||
EXPECT=<<EOF
|
||||
EOF
|
||||
EXPECT_ERR=<<EOF
|
||||
Cannot assemble 'mov eax, hello' at line 3
|
||||
ERROR: Cannot assemble 'mov eax, hello' at line 3
|
||||
invalid
|
||||
EOF
|
||||
RUN
|
||||
@ -222,7 +222,7 @@ FILE=-
|
||||
CMDS=!rasm2 -a x86 -b 32 "mov eax, 0x1122334455"
|
||||
EXPECT=
|
||||
EXPECT_ERR=<<EOF
|
||||
Cannot assemble 'mov eax, 0x1122334455' at line 3
|
||||
ERROR: Cannot assemble 'mov eax, 0x1122334455' at line 3
|
||||
invalid
|
||||
EOF
|
||||
RUN
|
||||
@ -235,9 +235,9 @@ CMDS=<<EOF
|
||||
EOF
|
||||
EXPECT=
|
||||
EXPECT_ERR=<<EOF
|
||||
Cannot assemble 'mov rax, 0x112233445566778899' at line 3
|
||||
ERROR: Cannot assemble 'mov rax, 0x112233445566778899' at line 3
|
||||
invalid
|
||||
Cannot assemble 'mov eax, 0x1122334455' at line 3
|
||||
ERROR: Cannot assemble 'mov eax, 0x1122334455' at line 3
|
||||
invalid
|
||||
EOF
|
||||
RUN
|
||||
|
Loading…
Reference in New Issue
Block a user