summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/idevicedebug.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c
index b0c439d..c30b90e 100644
--- a/tools/idevicedebug.c
+++ b/tools/idevicedebug.c
@@ -51,7 +51,8 @@ static int debug_level = 0;
51 51
52enum cmd_mode { 52enum cmd_mode {
53 CMD_NONE = 0, 53 CMD_NONE = 0,
54 CMD_RUN 54 CMD_RUN,
55 CMD_KILL
55}; 56};
56 57
57static int quit_flag = 0; 58static int quit_flag = 0;
@@ -185,6 +186,7 @@ static void print_usage(int argc, char **argv, int is_error)
185 "\n" \ 186 "\n" \
186 "Where COMMAND is one of:\n" \ 187 "Where COMMAND is one of:\n" \
187 " run BUNDLEID [ARGS...]\trun app with BUNDLEID and optional ARGS on device.\n" \ 188 " run BUNDLEID [ARGS...]\trun app with BUNDLEID and optional ARGS on device.\n" \
189 " kill BUNDLEID\tkill app with BUNDLEID\n" \
188 "\n" \ 190 "\n" \
189 "The following OPTIONS are accepted:\n" \ 191 "The following OPTIONS are accepted:\n" \
190 " -u, --udid UDID\ttarget specific device by UDID\n" \ 192 " -u, --udid UDID\ttarget specific device by UDID\n" \
@@ -247,7 +249,9 @@ int main(int argc, char *argv[])
247 switch (c) { 249 switch (c) {
248 case 'd': 250 case 'd':
249 debug_level++; 251 debug_level++;
250 idevice_set_debug_level(debug_level); 252 if (debug_level > 1) {
253 idevice_set_debug_level(debug_level-1);
254 }
251 break; 255 break;
252 case 'u': 256 case 'u':
253 if (!*optarg) { 257 if (!*optarg) {
@@ -311,6 +315,18 @@ int main(int argc, char *argv[])
311 /* read bundle identifier */ 315 /* read bundle identifier */
312 bundle_identifier = argv[1]; 316 bundle_identifier = argv[1];
313 i = 1; 317 i = 1;
318 } else if (!strcmp(argv[0], "kill")) {
319 cmd = CMD_KILL;
320 if (argc < 2) {
321 /* make sure at least the bundle identifier was provided */
322 fprintf(stderr, "ERROR: Please supply the bundle identifier of the app to run.\n");
323 print_usage(argc+optind, argv-optind, 1);
324 res = 2;
325 goto cleanup;
326 }
327 /* read bundle identifier */
328 bundle_identifier = argv[1];
329 i = 1;
314 } 330 }
315 331
316 /* verify options */ 332 /* verify options */
@@ -472,6 +488,13 @@ int main(int argc, char *argv[])
472 response = NULL; 488 response = NULL;
473 } 489 }
474 490
491 if (cmd == CMD_KILL) {
492 debugserver_command_new("k", 0, NULL, &command);
493 dres = debugserver_client_send_command(debugserver_client, command, &response, NULL);
494 debugserver_command_free(command);
495 command = NULL;
496 goto cleanup;
497 } else
475 if (cmd == CMD_RUN) { 498 if (cmd == CMD_RUN) {
476 if (detach_after_start) { 499 if (detach_after_start) {
477 log_debug("Detaching from app"); 500 log_debug("Detaching from app");