tombstoned: Add a shared library version of libtombstoned_client...
.. for ART and the frameworks to link against. In the new stack dumping
scheme (see related bug), the Java runtime will communicate with
tombstoned in order to obtain a FD to which it can write its traces.
Also move things around to separate headers that are private
implementation details from headers that constitute the public debuggerd
API. There are currently only three such headers :
- tombstoned/tombstoned.h
- debuggerd/client.h
- debuggerd/handler.h
Bug: 32064548
Test: make
Change-Id: If1b8578550e373d84828b180bbe585f1088d1aa3
diff --git a/debuggerd/Android.bp b/debuggerd/Android.bp
index 37d54d7..3a80b50 100644
--- a/debuggerd/Android.bp
+++ b/debuggerd/Android.bp
@@ -11,12 +11,32 @@
local_include_dirs: ["include"],
}
-// Utility library to tombstoned and get an output fd.
-cc_library_static {
+cc_library_shared {
name: "libtombstoned_client",
defaults: ["debuggerd_defaults"],
srcs: [
- "tombstoned_client.cpp",
+ "tombstoned/tombstoned_client.cpp",
+ "util.cpp",
+ ],
+
+ static_libs: [
+ "libasync_safe"
+ ],
+
+ shared_libs: [
+ "libcutils",
+ "libbase",
+ ],
+
+ export_include_dirs: ["tombstoned/include"]
+}
+
+// Utility library to tombstoned and get an output fd.
+cc_library_static {
+ name: "libtombstoned_client_static",
+ defaults: ["debuggerd_defaults"],
+ srcs: [
+ "tombstoned/tombstoned_client.cpp",
"util.cpp",
],
@@ -25,6 +45,8 @@
"libcutils",
"libbase",
],
+
+ export_include_dirs: ["tombstoned/include"]
}
// Core implementation, linked into libdebuggerd_handler and the dynamic linker.
@@ -64,7 +86,7 @@
whole_static_libs: [
"libdebuggerd_handler_core",
- "libtombstoned_client",
+ "libtombstoned_client_static",
"libasync_safe",
"libbase",
"libdebuggerd",
@@ -159,10 +181,8 @@
srcs: [
"client/debuggerd_client_test.cpp",
"debuggerd_test.cpp",
- "tombstoned_client.cpp",
- "util.cpp"
],
- static_libs: ["libasync_safe"],
+ static_libs: ["libasync_safe", "libtombstoned_client_static"],
},
},
@@ -171,6 +191,7 @@
"libbase",
"libcutils",
"libdebuggerd_client",
+ "liblog"
],
static_libs: [
@@ -211,7 +232,7 @@
},
static_libs: [
- "libtombstoned_client",
+ "libtombstoned_client_static",
"libdebuggerd",
"libcutils",
],
diff --git a/debuggerd/client/debuggerd_client.cpp b/debuggerd/client/debuggerd_client.cpp
index 2be13c6..4ce038c 100644
--- a/debuggerd/client/debuggerd_client.cpp
+++ b/debuggerd/client/debuggerd_client.cpp
@@ -31,9 +31,10 @@
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
#include <cutils/sockets.h>
-#include <debuggerd/handler.h>
-#include <debuggerd/protocol.h>
-#include <debuggerd/util.h>
+
+#include "debuggerd/handler.h"
+#include "protocol.h"
+#include "util.h"
using namespace std::chrono_literals;
diff --git a/debuggerd/client/debuggerd_client_test.cpp b/debuggerd/client/debuggerd_client_test.cpp
index aff03e5..8f97db1 100644
--- a/debuggerd/client/debuggerd_client_test.cpp
+++ b/debuggerd/client/debuggerd_client_test.cpp
@@ -31,7 +31,7 @@
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
-#include <debuggerd/util.h>
+#include "util.h"
using namespace std::chrono_literals;
using android::base::unique_fd;
diff --git a/debuggerd/crash_dump.cpp b/debuggerd/crash_dump.cpp
index d2a4239..be28079 100644
--- a/debuggerd/crash_dump.cpp
+++ b/debuggerd/crash_dump.cpp
@@ -48,9 +48,9 @@
#include "utility.h"
#include "debuggerd/handler.h"
-#include "debuggerd/protocol.h"
-#include "debuggerd/tombstoned.h"
-#include "debuggerd/util.h"
+#include "protocol.h"
+#include "tombstoned/tombstoned.h"
+#include "util.h"
using android::base::unique_fd;
using android::base::ReadFileToString;
diff --git a/debuggerd/debuggerd.cpp b/debuggerd/debuggerd.cpp
index 492e9f0..4997dd6 100644
--- a/debuggerd/debuggerd.cpp
+++ b/debuggerd/debuggerd.cpp
@@ -27,8 +27,8 @@
#include <android-base/parseint.h>
#include <android-base/unique_fd.h>
#include <debuggerd/client.h>
-#include <debuggerd/util.h>
#include <selinux/selinux.h>
+#include "util.h"
using android::base::unique_fd;
diff --git a/debuggerd/debuggerd_test.cpp b/debuggerd/debuggerd_test.cpp
index 0b4bbfb..f17724a 100644
--- a/debuggerd/debuggerd_test.cpp
+++ b/debuggerd/debuggerd_test.cpp
@@ -35,12 +35,13 @@
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
#include <cutils/sockets.h>
-#include <debuggerd/handler.h>
-#include <debuggerd/protocol.h>
-#include <debuggerd/tombstoned.h>
-#include <debuggerd/util.h>
#include <gtest/gtest.h>
+#include "debuggerd/handler.h"
+#include "protocol.h"
+#include "tombstoned/tombstoned.h"
+#include "util.h"
+
using namespace std::chrono_literals;
using android::base::unique_fd;
diff --git a/debuggerd/handler/debuggerd_fallback.cpp b/debuggerd/handler/debuggerd_fallback.cpp
index 47c98d1..a9c9862 100644
--- a/debuggerd/handler/debuggerd_fallback.cpp
+++ b/debuggerd/handler/debuggerd_fallback.cpp
@@ -42,8 +42,8 @@
#include <async_safe/log.h>
#include "debuggerd/handler.h"
-#include "debuggerd/tombstoned.h"
-#include "debuggerd/util.h"
+#include "tombstoned/tombstoned.h"
+#include "util.h"
#include "backtrace.h"
#include "tombstone.h"
diff --git a/debuggerd/include/debuggerd/protocol.h b/debuggerd/protocol.h
similarity index 100%
rename from debuggerd/include/debuggerd/protocol.h
rename to debuggerd/protocol.h
diff --git a/debuggerd/include/debuggerd/tombstoned.h b/debuggerd/tombstoned/include/tombstoned/tombstoned.h
similarity index 100%
rename from debuggerd/include/debuggerd/tombstoned.h
rename to debuggerd/tombstoned/include/tombstoned/tombstoned.h
diff --git a/debuggerd/tombstoned/intercept_manager.cpp b/debuggerd/tombstoned/intercept_manager.cpp
index dff942c..4d4eb9e 100644
--- a/debuggerd/tombstoned/intercept_manager.cpp
+++ b/debuggerd/tombstoned/intercept_manager.cpp
@@ -28,8 +28,8 @@
#include <android-base/unique_fd.h>
#include <cutils/sockets.h>
-#include "debuggerd/protocol.h"
-#include "debuggerd/util.h"
+#include "protocol.h"
+#include "util.h"
using android::base::unique_fd;
diff --git a/debuggerd/tombstoned/tombstoned.cpp b/debuggerd/tombstoned/tombstoned.cpp
index 80dbef5..05df9f2 100644
--- a/debuggerd/tombstoned/tombstoned.cpp
+++ b/debuggerd/tombstoned/tombstoned.cpp
@@ -35,8 +35,8 @@
#include <cutils/sockets.h>
#include "debuggerd/handler.h"
-#include "debuggerd/protocol.h"
-#include "debuggerd/util.h"
+#include "protocol.h"
+#include "util.h"
#include "intercept_manager.h"
diff --git a/debuggerd/tombstoned_client.cpp b/debuggerd/tombstoned/tombstoned_client.cpp
similarity index 96%
rename from debuggerd/tombstoned_client.cpp
rename to debuggerd/tombstoned/tombstoned_client.cpp
index e878b6a..39dc6eb 100644
--- a/debuggerd/tombstoned_client.cpp
+++ b/debuggerd/tombstoned/tombstoned_client.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "debuggerd/tombstoned.h"
+#include "tombstoned/tombstoned.h"
#include <fcntl.h>
#include <unistd.h>
@@ -25,8 +25,8 @@
#include <async_safe/log.h>
#include <cutils/sockets.h>
-#include "debuggerd/protocol.h"
-#include "debuggerd/util.h"
+#include "protocol.h"
+#include "util.h"
using android::base::unique_fd;
diff --git a/debuggerd/util.cpp b/debuggerd/util.cpp
index 32d2f18..c6a997b 100644
--- a/debuggerd/util.cpp
+++ b/debuggerd/util.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "debuggerd/util.h"
+#include "util.h"
#include <sys/socket.h>
@@ -22,7 +22,7 @@
#include <android-base/unique_fd.h>
#include <cutils/sockets.h>
-#include <debuggerd/protocol.h>
+#include "protocol.h"
using android::base::unique_fd;
diff --git a/debuggerd/include/debuggerd/util.h b/debuggerd/util.h
similarity index 100%
rename from debuggerd/include/debuggerd/util.h
rename to debuggerd/util.h