Merge changes from topic "unwindstack_clone" into pi-dev
* changes:
libdebuggerd: clone registers before we Unwind with them.
libunwindstack: add Regs::Clone.
diff --git a/debuggerd/crash_dump.cpp b/debuggerd/crash_dump.cpp
index a1f0211..40cf6c3 100644
--- a/debuggerd/crash_dump.cpp
+++ b/debuggerd/crash_dump.cpp
@@ -190,6 +190,19 @@
static unique_fd g_tombstoned_socket;
static unique_fd g_output_fd;
+static void DefuseSignalHandlers() {
+ // Don't try to dump ourselves.
+ struct sigaction action = {};
+ action.sa_handler = SIG_DFL;
+ debuggerd_register_handlers(&action);
+
+ sigset_t mask;
+ sigemptyset(&mask);
+ if (sigprocmask(SIG_SETMASK, &mask, nullptr) != 0) {
+ PLOG(FATAL) << "failed to set signal mask";
+ }
+}
+
static void Initialize(char** argv) {
android::base::InitLogging(argv);
android::base::SetAborter([](const char* abort_msg) {
@@ -213,17 +226,6 @@
_exit(1);
});
-
- // Don't try to dump ourselves.
- struct sigaction action = {};
- action.sa_handler = SIG_DFL;
- debuggerd_register_handlers(&action);
-
- sigset_t mask;
- sigemptyset(&mask);
- if (sigprocmask(SIG_SETMASK, &mask, nullptr) != 0) {
- PLOG(FATAL) << "failed to set signal mask";
- }
}
static void ParseArgs(int argc, char** argv, pid_t* pseudothread_tid, DebuggerdDumpType* dump_type) {
@@ -321,6 +323,8 @@
}
int main(int argc, char** argv) {
+ DefuseSignalHandlers();
+
atrace_begin(ATRACE_TAG, "before reparent");
pid_t target_process = getppid();
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 5017ebd..e89586f 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -1856,25 +1856,20 @@
}
if (wants_wipe) {
- fprintf(stderr, "wiping userdata...\n");
- fb_queue_erase("userdata");
- if (set_fbe_marker) {
- fprintf(stderr, "setting FBE marker...\n");
- std::string initial_userdata_dir = create_fbemarker_tmpdir();
- if (initial_userdata_dir.empty()) {
- return 1;
+ std::vector<std::string> partitions = { "userdata", "cache", "metadata" };
+ for (const auto& partition : partitions) {
+ std::string partition_type;
+ if (!fb_getvar(transport, std::string{"partition-type:"} + partition, &partition_type)) continue;
+ if (partition_type.empty()) continue;
+ fb_queue_erase(partition);
+ if (partition == "userdata" && set_fbe_marker) {
+ fprintf(stderr, "setting FBE marker on initial userdata...\n");
+ std::string initial_userdata_dir = create_fbemarker_tmpdir();
+ fb_perform_format(transport, partition, 1, "", "", initial_userdata_dir);
+ delete_fbemarker_tmpdir(initial_userdata_dir);
+ } else {
+ fb_perform_format(transport, partition, 1, "", "", "");
}
- fb_perform_format(transport, "userdata", 1, "", "", initial_userdata_dir);
- delete_fbemarker_tmpdir(initial_userdata_dir);
- } else {
- fb_perform_format(transport, "userdata", 1, "", "", "");
- }
-
- std::string cache_type;
- if (fb_getvar(transport, "partition-type:cache", &cache_type) && !cache_type.empty()) {
- fprintf(stderr, "wiping cache...\n");
- fb_queue_erase("cache");
- fb_perform_format(transport, "cache", 1, "", "", "");
}
}
if (wants_set_active) {
diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp
index 7a7ac7d..ab980ac 100755
--- a/logd/LogKlog.cpp
+++ b/logd/LogKlog.cpp
@@ -825,7 +825,7 @@
(unsigned short)n);
// notify readers
- if (!rc) {
+ if (rc > 0) {
reader->notifyNewLog(static_cast<log_mask_t>(1 << LOG_ID_KERNEL));
}