Convert dcs to the rzshell (#3403)

This commit is contained in:
Anton Kochkov 2023-02-28 14:24:55 +08:00 committed by GitHub
parent 121e28a742
commit d010892648
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 26 deletions

View file

@ -24,14 +24,6 @@
} \
} while (0)
static const char *help_msg_dcs[] = {
"Usage:", "dcs", " Continue until syscall",
"dcs", "", "Continue until next syscall",
"dcs [str]", "", "Continue until next call to the 'str' syscall",
"dcs", "*", "Trace all syscalls, a la strace",
NULL
};
static const char *help_msg_dcu[] = {
"Usage:", "dcu", " Continue until address",
"dcu.", "", "Alias for dcu $$ (continue until current address",
@ -2520,24 +2512,17 @@ RZ_IPI RzCmdStatus rz_cmd_debug_continue_traptrace_handler(RzCore *core, int arg
}
// dcs
RZ_IPI int rz_cmd_debug_continue_syscall(void *data, const char *input) {
RzCore *core = (RzCore *)data;
RZ_IPI RzCmdStatus rz_cmd_debug_continue_syscall_handler(RzCore *core, int argc, const char **argv) {
CMD_CHECK_DEBUG_DEAD(core);
rz_cons_break_push(rz_core_static_debug_stop, core->dbg);
switch (input[0]) {
case '*':
cmd_debug_cont_syscall(core, "-1");
break;
case ' ':
cmd_debug_cont_syscall(core, input + 2);
break;
case '\0':
if (argc > 1) {
if (!strcmp(argv[1], "*")) {
cmd_debug_cont_syscall(core, "-1");
} else {
cmd_debug_cont_syscall(core, argv[1]);
}
} else {
cmd_debug_cont_syscall(core, NULL);
break;
default:
case '?':
rz_core_cmd_help(core, help_msg_dcs);
break;
}
rz_cons_break_pop();
rz_core_dbg_follow_seek_register(core);

View file

@ -300,7 +300,10 @@ commands:
- name: dcs
summary: Continue until syscall
cname: cmd_debug_continue_syscall
type: RZ_CMD_DESC_TYPE_OLDINPUT
args:
- name: syscall
type: RZ_CMD_ARG_TYPE_STRING
optional: true
- name: dct
summary: Traptrace from curseek to len, no argument to list
cname: cmd_debug_continue_traptrace

View file

@ -313,6 +313,7 @@ static const RzCmdDescArg cmd_debug_add_watchpoint_args[2];
static const RzCmdDescArg cmd_debug_set_cond_bp_win_args[3];
static const RzCmdDescArg cmd_debug_continue_execution_args[2];
static const RzCmdDescArg cmd_debug_continue_send_signal_args[3];
static const RzCmdDescArg cmd_debug_continue_syscall_args[2];
static const RzCmdDescArg cmd_debug_continue_traptrace_args[2];
static const RzCmdDescArg cmd_debug_descriptor_open_args[2];
static const RzCmdDescArg cmd_debug_descriptor_close_args[2];
@ -6994,8 +6995,19 @@ static const RzCmdDescHelp cmd_debug_continue_ret_help = {
.args = cmd_debug_continue_ret_args,
};
static const RzCmdDescArg cmd_debug_continue_syscall_args[] = {
{
.name = "syscall",
.type = RZ_CMD_ARG_TYPE_STRING,
.flags = RZ_CMD_ARG_FLAG_LAST,
.optional = true,
},
{ 0 },
};
static const RzCmdDescHelp cmd_debug_continue_syscall_help = {
.summary = "Continue until syscall",
.args = cmd_debug_continue_syscall_args,
};
static const RzCmdDescArg cmd_debug_continue_traptrace_args[] = {
@ -18654,7 +18666,7 @@ RZ_IPI void rzshell_cmddescs_init(RzCore *core) {
RzCmdDesc *cmd_debug_continue_ret_cd = rz_cmd_desc_argv_new(core->rcmd, dc_cd, "dcr", rz_cmd_debug_continue_ret_handler, &cmd_debug_continue_ret_help);
rz_warn_if_fail(cmd_debug_continue_ret_cd);
RzCmdDesc *cmd_debug_continue_syscall_cd = rz_cmd_desc_oldinput_new(core->rcmd, dc_cd, "dcs", rz_cmd_debug_continue_syscall, &cmd_debug_continue_syscall_help);
RzCmdDesc *cmd_debug_continue_syscall_cd = rz_cmd_desc_argv_new(core->rcmd, dc_cd, "dcs", rz_cmd_debug_continue_syscall_handler, &cmd_debug_continue_syscall_help);
rz_warn_if_fail(cmd_debug_continue_syscall_cd);
RzCmdDesc *cmd_debug_continue_traptrace_cd = rz_cmd_desc_argv_new(core->rcmd, dc_cd, "dct", rz_cmd_debug_continue_traptrace_handler, &cmd_debug_continue_traptrace_help);

View file

@ -925,7 +925,7 @@ RZ_IPI RzCmdStatus rz_cmd_debug_continue_mapped_io_handler(RzCore *core, int arg
// "dcr"
RZ_IPI RzCmdStatus rz_cmd_debug_continue_ret_handler(RzCore *core, int argc, const char **argv);
// "dcs"
RZ_IPI int rz_cmd_debug_continue_syscall(void *data, const char *input);
RZ_IPI RzCmdStatus rz_cmd_debug_continue_syscall_handler(RzCore *core, int argc, const char **argv);
// "dct"
RZ_IPI RzCmdStatus rz_cmd_debug_continue_traptrace_handler(RzCore *core, int argc, const char **argv);
// "dcu"