From 310cf5e8173d82cfbafd35cb18755ea71a8b1447 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Tue, 11 Feb 2020 16:34:20 -0500 Subject: Format --- tools/idevicedebug.c | 50 ++++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-) (limited to 'tools') diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c index ae6dd02..67ef938 100644 --- a/tools/idevicedebug.c +++ b/tools/idevicedebug.c @@ -119,8 +119,9 @@ static debugserver_error_t debugserver_client_handle_response(debugserver_client char* o = NULL; char* r = *response; - /* Documentation of response codes can be found here: - https://github.com/llvm/llvm-project/blob/4fe839ef3a51e0ea2e72ea2f8e209790489407a2/lldb/docs/lldb-gdb-remote.txt#L1269 */ + /* Documentation of response codes can be found here: + https://github.com/llvm/llvm-project/blob/4fe839ef3a51e0ea2e72ea2f8e209790489407a2/lldb/docs/lldb-gdb-remote.txt#L1269 + */ if (r[0] == 'O') { /* stdout/stderr */ @@ -130,8 +131,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); - if (exit_status != NULL) { - /* "Thread stopped" seems to happen when assert() fails. Use bash convention where signals cause an exit status of 128 + signal */ + 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. */ @@ -143,13 +147,15 @@ 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); - } + 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; + debug_info("Unable to decode exit status from %s", r); + dres = DEBUGSERVER_E_UNKNOWN_ERROR; } } else if (r && strlen(r) == 0) { log_debug("empty response"); @@ -157,13 +163,13 @@ static debugserver_error_t debugserver_client_handle_response(debugserver_client log_debug("ERROR: unhandled response '%s'", r); } - if (o != NULL) { - free(o); - o = NULL; - } + if (o != NULL) { + free(o); + o = NULL; + } - free(*response); - *response = NULL; + free(*response); + *response = NULL; return dres; } @@ -351,8 +357,8 @@ int main(int argc, char *argv[]) goto cleanup; } - /* set receive params */ - if (debugserver_client_set_receive_params(debugserver_client, cancel_receive, 250) != DEBUGSERVER_E_SUCCESS) { + /* set receive params */ + if (debugserver_client_set_receive_params(debugserver_client, cancel_receive, 250) != DEBUGSERVER_E_SUCCESS) { fprintf(stderr, "Error in debugserver_client_set_receive_params\n"); goto cleanup; } @@ -494,7 +500,7 @@ int main(int argc, char *argv[]) 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); + log_debug("failed to process response; error %d; %s", dres, response); break; } } @@ -521,9 +527,9 @@ int main(int argc, char *argv[]) response = NULL; } - if (res < 0) { - res = (dres == DEBUGSERVER_E_SUCCESS) ? 0: -1; - } + if (res < 0) { + res = (dres == DEBUGSERVER_E_SUCCESS) ? 0: -1; + } break; } -- cgit v1.1-32-gdbae