summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGravatar Ben Wagner2020-02-11 16:34:20 -0500
committerGravatar Nikias Bassen2022-03-29 12:15:09 +0200
commit310cf5e8173d82cfbafd35cb18755ea71a8b1447 (patch)
treeda61c6a2547fe891a82bcfca0db6d4171ab682ea /tools
parentabba1e82679a58a32a943cded58204d14a231ef6 (diff)
downloadlibimobiledevice-310cf5e8173d82cfbafd35cb18755ea71a8b1447.tar.gz
libimobiledevice-310cf5e8173d82cfbafd35cb18755ea71a8b1447.tar.bz2
Format
Diffstat (limited to 'tools')
-rw-r--r--tools/idevicedebug.c50
1 files changed, 28 insertions, 22 deletions
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;
}