summaryrefslogtreecommitdiffstats
path: root/tools/idevicedebug.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/idevicedebug.c')
-rw-r--r--tools/idevicedebug.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c
index 83a70a4..74ce069 100644
--- a/tools/idevicedebug.c
+++ b/tools/idevicedebug.c
@@ -197,6 +197,7 @@ static void print_usage(int argc, char **argv)
printf("The following OPTIONS are accepted:\n");
printf(" -u, --udid UDID\ttarget specific device by UDID\n");
printf(" -n, --network\t\tconnect to network device\n");
+ printf(" --detach\t\tdetach from app after launch, keeping it running\n");
printf(" -e, --env NAME=VALUE\tset environment variable NAME to VALUE\n");
printf(" -d, --debug\t\tenable communication debugging\n");
printf(" -h, --help\t\tprints usage information\n");
@@ -217,6 +218,7 @@ int main(int argc, char *argv[])
int cmd = CMD_NONE;
const char* udid = NULL;
int use_network = 0;
+ int detach_after_start = 0;
const char* bundle_identifier = NULL;
char* path = NULL;
char* working_directory = NULL;
@@ -254,6 +256,9 @@ int main(int argc, char *argv[])
} else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) {
use_network = 1;
continue;
+ } else if (!strcmp(argv[i], "--detach")) {
+ detach_after_start = 1;
+ continue;
} else if (!strcmp(argv[i], "-e") || !strcmp(argv[i], "--env")) {
i++;
if (!argv[i] || (strlen(argv[i]) <= 1) || strchr(argv[i], '=') == NULL) {
@@ -447,6 +452,17 @@ int main(int argc, char *argv[])
response = NULL;
}
+ if (detach_after_start) {
+ log_debug("Detaching from app");
+ debugserver_command_new("D", 0, NULL, &command);
+ dres = debugserver_client_send_command(debugserver_client, command, &response, NULL);
+ debugserver_command_free(command);
+ command = NULL;
+
+ res = (dres == DEBUGSERVER_E_SUCCESS) ? 0: -1;
+ break;
+ }
+
/* set thread */
log_debug("Setting thread...");
debugserver_command_new("Hc0", 0, NULL, &command);