Merge "Set parent namespace for linker-namespaces"
diff --git a/adb/Android.mk b/adb/Android.mk
index 71d5aaf..6188184 100644
--- a/adb/Android.mk
+++ b/adb/Android.mk
@@ -208,24 +208,6 @@
include $(BUILD_HOST_NATIVE_TEST)
-# adb device tracker (used by ddms) test tool
-# =========================================================
-
-ifeq ($(HOST_OS),linux)
-include $(CLEAR_VARS)
-LOCAL_MODULE := adb_device_tracker_test
-LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
-LOCAL_CFLAGS_windows := $(LIBADB_windows_CFLAGS)
-LOCAL_CFLAGS_linux := $(LIBADB_linux_CFLAGS)
-LOCAL_CFLAGS_darwin := $(LIBADB_darwin_CFLAGS)
-LOCAL_SRC_FILES := test_track_devices.cpp
-LOCAL_SANITIZE := $(adb_host_sanitize)
-LOCAL_SHARED_LIBRARIES := libbase
-LOCAL_STATIC_LIBRARIES := libadb libcrypto_utils_static libcrypto_static libcutils
-LOCAL_LDLIBS += -lrt -ldl -lpthread
-include $(BUILD_HOST_EXECUTABLE)
-endif
-
# adb host tool
# =========================================================
include $(CLEAR_VARS)
diff --git a/adb/adb.cpp b/adb/adb.cpp
index 11e9c68..3f14f1a 100644
--- a/adb/adb.cpp
+++ b/adb/adb.cpp
@@ -65,21 +65,34 @@
void fatal(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
- fprintf(stderr, "error: ");
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, "\n");
+ char buf[1024];
+ vsnprintf(buf, sizeof(buf), fmt, ap);
+
+#if ADB_HOST
+ fprintf(stderr, "error: %s\n", buf);
+#else
+ LOG(ERROR) << "error: " << buf;
+#endif
+
va_end(ap);
- exit(-1);
+ abort();
}
void fatal_errno(const char* fmt, ...) {
+ int err = errno;
va_list ap;
va_start(ap, fmt);
- fprintf(stderr, "error: %s: ", strerror(errno));
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, "\n");
+ char buf[1024];
+ vsnprintf(buf, sizeof(buf), fmt, ap);
+
+#if ADB_HOST
+ fprintf(stderr, "error: %s: %s\n", buf, strerror(err));
+#else
+ LOG(ERROR) << "error: " << buf << ": " << strerror(err);
+#endif
+
va_end(ap);
- exit(-1);
+ abort();
}
apacket* get_apacket(void)
diff --git a/adb/commandline.cpp b/adb/commandline.cpp
index 28dbb78..868470c 100644
--- a/adb/commandline.cpp
+++ b/adb/commandline.cpp
@@ -1902,6 +1902,14 @@
else if (!strcmp(argv[0], "jdwp")) {
return adb_connect_command("jdwp");
}
+ else if (!strcmp(argv[0], "track-jdwp")) {
+ return adb_connect_command("track-jdwp");
+ }
+ else if (!strcmp(argv[0], "track-devices")) {
+ return adb_connect_command("host:track-devices");
+ }
+
+
/* "adb /?" is a common idiom under Windows */
else if (!strcmp(argv[0], "help") || !strcmp(argv[0], "/?")) {
help();
diff --git a/adb/shell_service.cpp b/adb/shell_service.cpp
index 3eeed34..374b468 100644
--- a/adb/shell_service.cpp
+++ b/adb/shell_service.cpp
@@ -412,7 +412,7 @@
for (const char* message : messages) {
WriteFdExactly(error_sfd->fd(), message);
}
- exit(-1);
+ abort();
}
if (make_pty_raw_) {
@@ -421,7 +421,7 @@
int saved_errno = errno;
WriteFdExactly(error_sfd->fd(), "tcgetattr failed: ");
WriteFdExactly(error_sfd->fd(), strerror(saved_errno));
- exit(-1);
+ abort();
}
cfmakeraw(&tattr);
@@ -429,7 +429,7 @@
int saved_errno = errno;
WriteFdExactly(error_sfd->fd(), "tcsetattr failed: ");
WriteFdExactly(error_sfd->fd(), strerror(saved_errno));
- exit(-1);
+ abort();
}
}
diff --git a/adb/test_track_devices.cpp b/adb/test_track_devices.cpp
deleted file mode 100644
index b10f8ee..0000000
--- a/adb/test_track_devices.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-// TODO: replace this with a shell/python script.
-
-/* a simple test program, connects to ADB server, and opens a track-devices session */
-#include <errno.h>
-#include <memory.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/socket.h>
-#include <unistd.h>
-
-#include <android-base/file.h>
-
-static void
-panic( const char* msg )
-{
- fprintf(stderr, "PANIC: %s: %s\n", msg, strerror(errno));
- exit(1);
-}
-
-int main(int argc, char* argv[]) {
- const char* request = "host:track-devices";
-
- if (argv[1] && strcmp(argv[1], "--jdwp") == 0) {
- request = "track-jdwp";
- }
-
- int ret;
- struct sockaddr_in server;
- char buffer[1024];
-
- memset( &server, 0, sizeof(server) );
- server.sin_family = AF_INET;
- server.sin_port = htons(5037);
- server.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-
- int s = socket( PF_INET, SOCK_STREAM, 0 );
- ret = connect( s, (struct sockaddr*) &server, sizeof(server) );
- if (ret < 0) panic( "could not connect to server" );
-
- /* send the request */
- int len = snprintf(buffer, sizeof(buffer), "%04zx%s", strlen(request), request);
- if (!android::base::WriteFully(s, buffer, len))
- panic( "could not send request" );
-
- /* read the OKAY answer */
- if (!android::base::ReadFully(s, buffer, 4))
- panic( "could not read request" );
-
- printf( "server answer: %.*s\n", 4, buffer );
-
- /* now loop */
- while (true) {
- char head[5] = "0000";
-
- if (!android::base::ReadFully(s, head, 4))
- panic("could not read length");
-
- int len;
- if (sscanf(head, "%04x", &len) != 1 )
- panic("could not decode length");
-
- if (!android::base::ReadFully(s, buffer, len))
- panic("could not read data");
-
- printf( "received header %.*s (%d bytes):\n%.*s----\n", 4, head, len, len, buffer );
- }
- close(s);
-}
diff --git a/libpixelflinger/scanline.cpp b/libpixelflinger/scanline.cpp
index f48e1d0..aa18360 100644
--- a/libpixelflinger/scanline.cpp
+++ b/libpixelflinger/scanline.cpp
@@ -26,10 +26,6 @@
#include <cutils/memory.h>
#include <cutils/log.h>
-#ifdef __arm__
-#include <machine/cpu-features.h>
-#endif
-
#include "buffer.h"
#include "scanline.h"