add controller command

This commit is contained in:
5ec1cff
2023-11-12 21:00:18 +08:00
parent 040643337d
commit 0ac9bb819b
3 changed files with 22 additions and 17 deletions
+11 -2
View File
@@ -20,8 +20,17 @@ int main(int argc, char **argv) {
auto pid = strtol(argv[2], 0, 0);
return !trace_zygote(pid);
} else if (argc >= 3 && argv[1] == "ctl"sv) {
// TODO
return 1;
if (argv[2] == "start"sv) {
send_control_command(START);
} else if (argv[2] == "stop"sv) {
send_control_command(STOP);
} else if (argv[2] == "exit"sv) {
send_control_command(EXIT);
} else {
printf("Usage: %s ctl start|stop|exit\n", argv[0]);
return 1;
}
return 0;
} else {
LOGE("usage: %s monitor | trace <pid> | ctl <command>", argv[0]);
return 1;