mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-24 13:49:50 +00:00
Implement cfg.log and cmd.log
This commit is contained in:
parent
31468882cc
commit
d97c6fb7f5
@ -784,7 +784,9 @@ static int cb_timezone(void *user, void *data) {
|
||||
}
|
||||
|
||||
static int cb_cfglog(void *user, void *data) {
|
||||
// TODO do something here
|
||||
RCore *core = (RCore *) user;
|
||||
RConfigNode *node = (RConfigNode *) data;
|
||||
core->cfglog = node->i_value;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -837,6 +839,14 @@ static int cb_cfgsanbox(void *user, void *data) {
|
||||
return (!node->i_value && ret)? 0: 1;
|
||||
}
|
||||
|
||||
static int cb_cmdlog(void *user, void *data) {
|
||||
RCore *core = (RCore *) user;
|
||||
RConfigNode *node = (RConfigNode *) data;
|
||||
R_FREE (core->cmdlog);
|
||||
core->cmdlog = strdup (node->value);
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cb_cmdrepeat(void *user, void *data) {
|
||||
RCore *core = (RCore *) user;
|
||||
RConfigNode *node = (RConfigNode *) data;
|
||||
@ -2196,6 +2206,7 @@ R_API int r_core_config_init(RCore *core) {
|
||||
SETPREF ("cmd.gprompt", "", "Graph visual prompt commands");
|
||||
SETPREF ("cmd.hit", "", "Run when a search hit is found");
|
||||
SETPREF ("cmd.open", "", "Run when file is opened");
|
||||
SETCB ("cmd.log", "", &cb_cmdlog, "Every time a new T log is added run this command");
|
||||
SETPREF ("cmd.prompt", "", "Prompt commands");
|
||||
SETCB ("cmd.repeat", "false", &cb_cmdrepeat, "Empty command an alias for '..' (repeat last command)");
|
||||
SETPREF ("cmd.fcn.new", "", "Run when new function is analyzed");
|
||||
|
@ -59,8 +59,18 @@ R_API void r_core_log_free(RCoreLog *log) {
|
||||
}
|
||||
|
||||
R_API void r_core_log_add(RCore *core, const char *msg) {
|
||||
static bool inProcess = false;
|
||||
r_strpool_append (core->log->sp, msg);
|
||||
core->log->last++;
|
||||
if (core->cmdlog && *core->cmdlog) {
|
||||
if (inProcess) {
|
||||
// avoid infinite recursive calls
|
||||
return;
|
||||
}
|
||||
inProcess = true;
|
||||
r_core_cmd0 (core, core->cmdlog);
|
||||
inProcess = false;
|
||||
}
|
||||
}
|
||||
|
||||
R_API void r_core_log_del(RCore *core, int n) {
|
||||
|
@ -140,6 +140,8 @@ typedef struct r_core_t {
|
||||
RAGraph *graph;
|
||||
char *cmdqueue;
|
||||
char *lastcmd;
|
||||
char *cmdlog;
|
||||
bool cfglog;
|
||||
int cmdrepeat;
|
||||
ut64 inc;
|
||||
int rtr_n;
|
||||
|
Loading…
Reference in New Issue
Block a user