Merge "liblogcat: avoid double close."
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp
index 8916c59..2270133 100644
--- a/bootstat/bootstat.cpp
+++ b/bootstat/bootstat.cpp
@@ -212,6 +212,17 @@
{"hard,hw_reset", 72},
{"shutdown,suspend", 73}, // Suspend to RAM
{"shutdown,hibernate", 74}, // Suspend to DISK
+ {"power_on_key", 75},
+ {"reboot_by_key", 76},
+ {"wdt_by_pass_pwk", 77},
+ {"reboot_longkey", 78},
+ {"powerkey", 79},
+ {"usb", 80},
+ {"wdt", 81},
+ {"tool_by_pass_pwk", 82},
+ {"2sec_reboot", 83},
+ {"reboot,by_key", 84},
+ {"reboot,longkey", 85},
};
// Converts a string value representing the reason the system booted to an
diff --git a/init/subcontext.cpp b/init/subcontext.cpp
index 927953d..84feeee 100644
--- a/init/subcontext.cpp
+++ b/init/subcontext.cpp
@@ -28,6 +28,7 @@
#include <selinux/android.h>
#include "action.h"
+#include "selinux.h"
#include "system/core/init/subcontext.pb.h"
#include "util.h"
@@ -165,6 +166,7 @@
auto context = std::string(argv[2]);
auto init_fd = std::atoi(argv[3]);
+ SelabelInitialize();
auto subcontext_process = SubcontextProcess(function_map, context, init_fd);
subcontext_process.MainLoop();
return 0;
diff --git a/libbacktrace/Backtrace.cpp b/libbacktrace/Backtrace.cpp
index 81f5e32..afe518c 100644
--- a/libbacktrace/Backtrace.cpp
+++ b/libbacktrace/Backtrace.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <assert.h>
#include <inttypes.h>
#include <stdint.h>
#include <stdlib.h>
@@ -30,9 +31,10 @@
#include <demangle.h>
#include "BacktraceLog.h"
-#include "thread_utils.h"
#include "UnwindCurrent.h"
#include "UnwindPtrace.h"
+#include "UnwindStack.h"
+#include "thread_utils.h"
using android::base::StringPrintf;
@@ -140,6 +142,34 @@
}
}
+Backtrace* Backtrace::CreateNew(pid_t pid, pid_t tid, BacktraceMap* map) {
+ if (pid == BACKTRACE_CURRENT_PROCESS) {
+ pid = getpid();
+ if (tid == BACKTRACE_CURRENT_THREAD) {
+ tid = gettid();
+ }
+ } else if (tid == BACKTRACE_CURRENT_THREAD) {
+ tid = pid;
+ }
+
+ if (map == nullptr) {
+// This would cause the wrong type of map object to be created, so disallow.
+#if defined(__ANDROID__)
+ __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__,
+ "Backtrace::CreateNew() must be called with a real map pointer.");
+#else
+ BACK_LOGE("Backtrace::CreateNew() must be called with a real map pointer.");
+ abort();
+#endif
+ }
+
+ if (pid == getpid()) {
+ return new UnwindStackCurrent(pid, tid, map);
+ } else {
+ return new UnwindStackPtrace(pid, tid, map);
+ }
+}
+
std::string Backtrace::GetErrorString(BacktraceUnwindError error) {
switch (error) {
case BACKTRACE_UNWIND_NO_ERROR:
diff --git a/libbacktrace/UnwindStack.cpp b/libbacktrace/UnwindStack.cpp
index 41153ce..73bfdec 100644
--- a/libbacktrace/UnwindStack.cpp
+++ b/libbacktrace/UnwindStack.cpp
@@ -15,7 +15,6 @@
*/
#define _GNU_SOURCE 1
-#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@@ -93,7 +92,7 @@
back_frame->pc = frame->pc;
back_frame->sp = frame->sp;
- back_frame->func_name = frame->function_name;
+ back_frame->func_name = demangle(frame->function_name.c_str());
back_frame->func_offset = frame->function_offset;
back_frame->map.name = frame->map_name;
@@ -149,31 +148,3 @@
error_ = BACKTRACE_UNWIND_NO_ERROR;
return ::Unwind(regs.get(), GetMap(), &frames_, num_ignore_frames);
}
-
-Backtrace* Backtrace::CreateNew(pid_t pid, pid_t tid, BacktraceMap* map) {
- if (pid == BACKTRACE_CURRENT_PROCESS) {
- pid = getpid();
- if (tid == BACKTRACE_CURRENT_THREAD) {
- tid = gettid();
- }
- } else if (tid == BACKTRACE_CURRENT_THREAD) {
- tid = pid;
- }
-
- if (map == nullptr) {
-// This would cause the wrong type of map object to be created, so disallow.
-#if defined(__ANDROID__)
- __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__,
- "Backtrace::CreateNew() must be called with a real map pointer.");
-#else
- BACK_LOGE("Backtrace::CreateNew() must be called with a real map pointer.");
- abort();
-#endif
- }
-
- if (pid == getpid()) {
- return new UnwindStackCurrent(pid, tid, map);
- } else {
- return new UnwindStackPtrace(pid, tid, map);
- }
-}