mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 21:29:49 +00:00
Current cmd.depth depends on core, not on the global cons context now ##thread
* Fix a bunch of race conditions related to background analysis
This commit is contained in:
parent
5463d84733
commit
db20331b87
@ -2203,8 +2203,7 @@ static int analop64_esil(RArchSession *as, RAnalOp *op, ut64 addr, const ut8 *bu
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ARM64_INS_ADRP:
|
case ARM64_INS_ADRP:
|
||||||
r_strbuf_setf (&op->esil, "%"PFMT64d",%s,=",
|
r_strbuf_setf (&op->esil, "%"PFMT64d",%s,=", IMM64 (1), REG64 (0));
|
||||||
IMM64 (1), REG64 (0));
|
|
||||||
break;
|
break;
|
||||||
case ARM64_INS_EXTR:
|
case ARM64_INS_EXTR:
|
||||||
// from VEX
|
// from VEX
|
||||||
|
@ -131,7 +131,7 @@ static void cons_stack_load(RConsStack *data, bool free_current) {
|
|||||||
static void cons_context_init(RConsContext *context, R_NULLABLE RConsContext *parent) {
|
static void cons_context_init(RConsContext *context, R_NULLABLE RConsContext *parent) {
|
||||||
context->marks = r_list_newf ((RListFree)r_cons_mark_free);
|
context->marks = r_list_newf ((RListFree)r_cons_mark_free);
|
||||||
context->breaked = false;
|
context->breaked = false;
|
||||||
context->cmd_depth = R_CONS_CMD_DEPTH + 1;
|
// context->cmd_depth = R_CONS_CMD_DEPTH + 1;
|
||||||
context->buffer_sz = 0;
|
context->buffer_sz = 0;
|
||||||
context->lastEnabled = true;
|
context->lastEnabled = true;
|
||||||
context->buffer_len = 0;
|
context->buffer_len = 0;
|
||||||
|
@ -2274,7 +2274,7 @@ static bool cb_cmddepth(void *user, void *data) {
|
|||||||
RCore *core = (RCore *)user;
|
RCore *core = (RCore *)user;
|
||||||
int c = R_MAX (((RConfigNode*)data)->i_value, 0);
|
int c = R_MAX (((RConfigNode*)data)->i_value, 0);
|
||||||
core->max_cmd_depth = c;
|
core->max_cmd_depth = c;
|
||||||
core->cons->context->cmd_depth = c;
|
core->cur_cmd_depth = c;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,7 +526,7 @@ static void recursive_help(RCore *core, int detail, const char *cmd_prefix) {
|
|||||||
static bool lastcmd_repeat(RCore *core, int next) {
|
static bool lastcmd_repeat(RCore *core, int next) {
|
||||||
int res = -1;
|
int res = -1;
|
||||||
// Fix for backtickbug px`~`
|
// Fix for backtickbug px`~`
|
||||||
if (!core->lastcmd || core->cons->context->cmd_depth < 1) {
|
if (!core->lastcmd || core->cur_cmd_depth < 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (*core->lastcmd) {
|
switch (*core->lastcmd) {
|
||||||
@ -3760,7 +3760,7 @@ static int r_core_cmd_subst(RCore *core, char *cmd) {
|
|||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (core->max_cmd_depth - core->cons->context->cmd_depth == 1) {
|
if (core->max_cmd_depth - core->cur_cmd_depth == 1) {
|
||||||
core->prompt_offset = core->offset;
|
core->prompt_offset = core->offset;
|
||||||
}
|
}
|
||||||
cmd = (char *)r_str_trim_head_ro (icmd);
|
cmd = (char *)r_str_trim_head_ro (icmd);
|
||||||
@ -3825,7 +3825,7 @@ static int r_core_cmd_subst(RCore *core, char *cmd) {
|
|||||||
const char *cmdrep = r_str_get (core->cmdtimes);
|
const char *cmdrep = r_str_get (core->cmdtimes);
|
||||||
orep = rep;
|
orep = rep;
|
||||||
|
|
||||||
bool is_root_cmd = core->cons->context->cmd_depth + 1 == core->max_cmd_depth;
|
bool is_root_cmd = core->cur_cmd_depth + 1 == core->max_cmd_depth;
|
||||||
if (is_root_cmd) {
|
if (is_root_cmd) {
|
||||||
r_cons_break_clear ();
|
r_cons_break_clear ();
|
||||||
}
|
}
|
||||||
@ -5960,8 +5960,7 @@ out_finish:
|
|||||||
static int run_cmd_depth(RCore *core, char *cmd) {
|
static int run_cmd_depth(RCore *core, char *cmd) {
|
||||||
char *rcmd;
|
char *rcmd;
|
||||||
int ret = false;
|
int ret = false;
|
||||||
int *depth = R_UNWRAP4 (&core, cons, context, cmd_depth);
|
int *depth = &core->cur_cmd_depth;
|
||||||
|
|
||||||
if (depth) {
|
if (depth) {
|
||||||
if (*depth < 1) {
|
if (*depth < 1) {
|
||||||
R_LOG_ERROR ("That '%s' was too deep", cmd);
|
R_LOG_ERROR ("That '%s' was too deep", cmd);
|
||||||
|
@ -239,7 +239,7 @@ R_API RCoreTask *r_core_task_new(RCore *core, bool create_cons, const char *cmd,
|
|||||||
if (!task->cons_context) {
|
if (!task->cons_context) {
|
||||||
goto hell;
|
goto hell;
|
||||||
}
|
}
|
||||||
task->cons_context->cmd_depth = core->max_cmd_depth;
|
core->cur_cmd_depth = core->max_cmd_depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
task->id = core->tasks.task_id_next++;
|
task->id = core->tasks.task_id_next++;
|
||||||
|
@ -422,8 +422,8 @@ typedef struct r_cons_context_t {
|
|||||||
RStack *break_stack;
|
RStack *break_stack;
|
||||||
RConsEvent event_interrupt;
|
RConsEvent event_interrupt;
|
||||||
void *event_interrupt_data;
|
void *event_interrupt_data;
|
||||||
int cmd_depth;
|
// int cmd_depth;
|
||||||
int cmd_str_depth;
|
int cmd_str_depth; // wtf ?
|
||||||
bool noflush;
|
bool noflush;
|
||||||
|
|
||||||
// Used for per-task logging redirection
|
// Used for per-task logging redirection
|
||||||
|
@ -362,6 +362,7 @@ struct r_core_t {
|
|||||||
RList *scriptstack;
|
RList *scriptstack;
|
||||||
RCoreTaskScheduler tasks;
|
RCoreTaskScheduler tasks;
|
||||||
int max_cmd_depth;
|
int max_cmd_depth;
|
||||||
|
int cur_cmd_depth;
|
||||||
ut8 switch_file_view;
|
ut8 switch_file_view;
|
||||||
Sdb *sdb;
|
Sdb *sdb;
|
||||||
int incomment;
|
int incomment;
|
||||||
|
Loading…
Reference in New Issue
Block a user