summaryrefslogtreecommitdiffstats
path: root/tools/idevicedebug.c
diff options
context:
space:
mode:
authorGravatar Ben Wagner2020-02-11 15:33:21 -0500
committerGravatar Nikias Bassen2022-03-29 12:12:28 +0200
commit468de4021cff4005211bb0a440f8caeecbc723e7 (patch)
treed976ea863438079b3964c4b9c683ca5d37e5ad29 /tools/idevicedebug.c
parent8e29efecd01262236a22168cc17638a13412abf0 (diff)
downloadlibimobiledevice-468de4021cff4005211bb0a440f8caeecbc723e7.tar.gz
libimobiledevice-468de4021cff4005211bb0a440f8caeecbc723e7.tar.bz2
Handle abort
Diffstat (limited to 'tools/idevicedebug.c')
-rw-r--r--tools/idevicedebug.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c
index 27eaa4e..c596213 100644
--- a/tools/idevicedebug.c
+++ b/tools/idevicedebug.c
@@ -130,6 +130,8 @@ static debugserver_error_t debugserver_client_handle_response(debugserver_client
} else if (r[0] == 'T') {
/* thread stopped information */
log_debug("Thread stopped. Details:\n%s", r + 1);
+ /* "Thread stopped" seems to happen when assert() fails. Use bash convention where signals cause an exit status of 128 + signal */
+ *exit_status = 128 + SIGABRT;
/* Break out of the loop. */
dres = DEBUGSERVER_E_UNKNOWN_ERROR;
} else if (r[0] == 'E') {
@@ -487,6 +489,10 @@ int main(int argc, char *argv[])
log_debug("response: %s", response);
if (strncmp(response, "OK", 2)) {
dres = debugserver_client_handle_response(debugserver_client, &response, &res);
+ if (dres != DEBUGSERVER_E_SUCCESS) {
+ debug_info("failed to process response; error %d; %s", dres, response);
+ break;
+ }
}
}
if (res >= 0) {
@@ -511,7 +517,9 @@ int main(int argc, char *argv[])
response = NULL;
}
- res = (dres == DEBUGSERVER_E_SUCCESS) ? 0: -1;
+ if (res < 0) {
+ res = (dres == DEBUGSERVER_E_SUCCESS) ? 0: -1;
+ }
break;
}