exit a loop if read() returns 0 because socket might be closed

related to http://hipbyte.myjetbrains.com/youtrack/issue/RM-309

This will fix a freeze when terminate lldb with "quit" command
This commit is contained in:
Watson
2013-11-07 12:55:05 +09:00
parent 45cfdfc2b4
commit eb6572a9c5

View File

@@ -898,12 +898,18 @@ start_debug_server(am_device_t dev)
if (len > 0) {
write(gdb_fd, buf, len);
}
else {
break;
}
}
if (FD_ISSET(gdb_fd, &read_fds)) {
len = read(gdb_fd, buf, sizeof buf);
if (len > 0) {
write(lldb_socket, buf, len);
}
else {
break;
}
}
}
}