mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-26 09:06:02 +00:00
Honor cfg.log for analysis metadata (CC, ...)
This commit is contained in:
parent
c4b6da3eaa
commit
e0ea16c394
@ -113,6 +113,11 @@ R_API int r_meta_set_string(RAnal *a, int type, ut64 addr, const char *s) {
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
if (a->log) {
|
||||
char *msg = r_str_newf (":C%c %s @ 0x%"PFMT64x, type, s, addr);
|
||||
a->log (a, msg);
|
||||
free (msg);
|
||||
}
|
||||
e_str = sdb_encode ((const void*)s, -1);
|
||||
snprintf (val, sizeof (val)-1, "%d,%d,%s", (int)size, space_idx, e_str);
|
||||
sdb_set (DB, key, val, 0);
|
||||
|
@ -1520,6 +1520,14 @@ static int mywrite(const ut8 *buf, int len) {
|
||||
return r_cons_memcat ((const char *)buf, len);
|
||||
}
|
||||
|
||||
static bool r_core_anal_log(struct r_anal_t *anal, const char *msg) {
|
||||
RCore *core = anal->user;
|
||||
if (core->cfglog) {
|
||||
r_core_log_add (core, msg);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
R_API bool r_core_init(RCore *core) {
|
||||
core->blocksize = R_CORE_BLOCKSIZE;
|
||||
core->block = (ut8*)calloc (R_CORE_BLOCKSIZE + 1, 1);
|
||||
@ -1606,7 +1614,7 @@ R_API bool r_core_init(RCore *core) {
|
||||
core->assembler->num = core->num;
|
||||
r_asm_set_user_ptr (core->assembler, core);
|
||||
core->anal = r_anal_new ();
|
||||
|
||||
core->anal->log = r_core_anal_log;
|
||||
core->anal->meta_spaces.cb_printf = r_cons_printf;
|
||||
core->anal->cb.on_fcn_new = on_fcn_new;
|
||||
core->anal->cb.on_fcn_delete = on_fcn_delete;
|
||||
|
@ -651,6 +651,7 @@ typedef struct r_anal_t {
|
||||
RList /*RAnalRange*/ *bits_ranges;
|
||||
RListComparator columnSort;
|
||||
int stackptr;
|
||||
bool (*log)(struct r_anal_t *anal, const char *msg);
|
||||
} RAnal;
|
||||
|
||||
typedef RAnalFunction *(* RAnalGetFcnIn)(RAnal *anal, ut64 addr, int type);
|
||||
|
Loading…
x
Reference in New Issue
Block a user