From abba1e82679a58a32a943cded58204d14a231ef6 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Tue, 11 Feb 2020 15:38:21 -0500 Subject: More fixes --- tools/idevicedebug.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c index c596213..ae6dd02 100644 --- a/tools/idevicedebug.c +++ b/tools/idevicedebug.c @@ -61,7 +61,7 @@ static void on_signal(int sig) quit_flag++; } -static void cancel_receive() +static int cancel_receive() { return quit_flag; } @@ -130,9 +130,11 @@ 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. */ + if (exit_status != NULL) { + /* "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') { printf("ERROR: %s\n", r + 1); @@ -141,8 +143,10 @@ static debugserver_error_t debugserver_client_handle_response(debugserver_client debugserver_decode_string(r + 1, strlen(r) - 1, &o); if (o != NULL) { printf("Exit %s: %u\n", (r[0] == 'W' ? "status" : "due to signal"), o[0]); + if (exit_status != NULL) { /* Use bash convention where signals cause an exit status of 128 + signal */ *exit_status = o[0] + (r[0] == 'W' ? 0 : 128); + } } else { debug_info("Unable to decode exit status from %s", r); dres = DEBUGSERVER_E_UNKNOWN_ERROR; -- cgit v1.1-32-gdbae