Task cmd Adjustments

This commit is contained in:
Florian Märkl 2018-06-16 10:51:02 +02:00 committed by radare
parent 6730a93e9c
commit 721a615457
2 changed files with 21 additions and 44 deletions

View File

@ -1268,16 +1268,7 @@ static int cmd_thread(void *data, const char *input) {
case 'j':
r_core_task_list (core, *input);
break;
#if 0
case 't':
r_cons_break_push (NULL, NULL);
while (!r_cons_is_breaked ()) {
r_sys_sleep(1);
}
r_cons_break_pop ();
break;
#endif
case 't': {
case 't': { // "&t"
int usecs = 0;
if (input[1] == ' ') {
usecs = (int) r_num_math (core->num, input + 1);
@ -1285,28 +1276,25 @@ static int cmd_thread(void *data, const char *input) {
task_test (core, usecs);
break;
}
case '&':
case '&': { // "&&"
if (r_sandbox_enable (0)) {
eprintf ("This command is disabled in sandbox mode\n");
return 0;
}
if (input[1] == '&') {
// wait until ^C
} else {
int tid = r_num_math (core->num, input + 1);
if (tid) {
RCoreTask *task = r_core_task_get (core, tid);
if (task) {
r_core_task_join (core, task);
} else {
eprintf ("Cannot find task\n");
}
int tid = r_num_math (core->num, input + 1);
if (tid) {
RCoreTask *task = r_core_task_get (core, tid);
if (task) {
r_core_task_join (core, task);
} else {
//r_core_task_run (core, NULL);
eprintf ("Cannot find task\n");
}
} else {
//r_core_task_run (core, NULL);
}
break;
case '=': {
}
case '=': { // "&="
// r_core_task_list (core, '=');
int tid = r_num_math (core->num, input + 1);
if (tid) {
@ -1324,13 +1312,6 @@ static int cmd_thread(void *data, const char *input) {
r_core_task_list (core, 1);
}}
break;
case '+':
if (r_sandbox_enable (0)) {
eprintf ("This command is disabled in sandbox mode\n");
return 0;
}
//r_core_task_add (core, r_core_task_new (core, input + 1, (RCoreTaskCallback)task_finished, core));
break;
case '-':
if (r_sandbox_enable (0)) {
eprintf ("This command is disabled in sandbox mode\n");

View File

@ -12,21 +12,17 @@
#define PF_USAGE_STR "pf[.k[.f[=v]]|[v]]|[n]|[0|cnt][fmt] [a0 a1 ...]"
static const char *help_msg_amper[] = {
"Usage:", "&[-|<cmd>]", "Manage tasks ( XXX broken because of mutex in r_core_cmd )",
"&", "", "list all running threads",
"&=", "", "show output of all tasks",
"Usage:", "&[-|<cmd>]", "Manage tasks (WARNING: Experimental. Use with caution!)",
"&", " <cmd>", "run <cmd> in a new background task",
"&", "", "list all tasks",
"&j", "", "list all tasks (in JSON)",
"&=", " 3", "show output of task 3",
"&j", "", "list all running threads (in JSON)",
"&?", "", "show this help",
"&+", " aa", "push to the task list",
"&=", "", "show output of all tasks",
"&-", " 1", "delete task #1",
"&", "-*", "delete all threads",
"&", " aa", "run analysis in background",
"&", " &&", "run all tasks in background",
"&&", "", "run all pendings tasks (and join threads)",
"&&&", "", "run all pendings tasks until ^C",
"", "", "TODO: last command should honor asm.bits",
"", "", "WARN: this feature is very experimental. Use it with caution",
"&", "-*", "delete all done tasks",
"&?", "", "show this help",
"&&", " 3", "wait until task 3 is finished",
"&&", "", "wait until all tasks are finished",
NULL
};