Merge "Make toolbox top a little more like everyone else's."
diff --git a/adb/transport_local.cpp b/adb/transport_local.cpp
index e6e699b..372bedf 100644
--- a/adb/transport_local.cpp
+++ b/adb/transport_local.cpp
@@ -225,7 +225,7 @@
static const char _ok_resp[] = "ok";
const int port = (int) (uintptr_t) arg;
- int res, fd;
+ int fd;
char tmp[256];
char con_name[32];
@@ -251,19 +251,19 @@
*/
/* Send the 'accept' request. */
- res = adb_write(fd, _accept_req, strlen(_accept_req));
- if ((size_t)res == strlen(_accept_req)) {
+ if (WriteFdExactly(fd, _accept_req, strlen(_accept_req))) {
/* Wait for the response. In the response we expect 'ok' on success,
* or 'ko' on failure. */
- res = adb_read(fd, tmp, sizeof(tmp));
- if (res != 2 || memcmp(tmp, _ok_resp, 2)) {
+ if (!ReadFdExactly(fd, tmp, 2) || memcmp(tmp, _ok_resp, 2)) {
D("Accepting ADB host connection has failed.");
adb_close(fd);
} else {
/* Host is connected. Register the transport, and start the
* exchange. */
register_socket_transport(fd, "host", port, 1);
- adb_write(fd, _start_req, strlen(_start_req));
+ if (!WriteFdExactly(fd, _start_req, strlen(_start_req))) {
+ adb_close(fd);
+ }
}
/* Prepare for accepting of the next ADB host connection. */
diff --git a/libbacktrace/UnwindCurrent.cpp b/libbacktrace/UnwindCurrent.cpp
index 67e583f..f985f52 100644
--- a/libbacktrace/UnwindCurrent.cpp
+++ b/libbacktrace/UnwindCurrent.cpp
@@ -23,6 +23,7 @@
#define UNW_LOCAL_ONLY
#include <libunwind.h>
+#include <android-base/strings.h>
#include <backtrace/Backtrace.h>
#include "BacktraceLog.h"
@@ -124,6 +125,16 @@
num_ignore_frames--;
}
}
+
+ // For now, do not attempt to do local unwinds through .dex, or .oat
+ // maps. We can only unwind through these if there is a compressed
+ // section available, almost all local unwinds are done by ART
+ // which will dump the Java frames separately.
+ // TODO: Come up with a flag to control this.
+ if (android::base::EndsWith(frame->map.name, ".dex")
+ || android::base::EndsWith(frame->map.name, ".oat")) {
+ break;
+ }
ret = unw_step (cursor.get());
} while (ret > 0 && num_frames < MAX_BACKTRACE_FRAMES);