summaryrefslogtreecommitdiff
path: root/runtime/runtime_linux.cc
diff options
context:
space:
mode:
author Ian Rogers <irogers@google.com> 2014-10-21 23:31:19 -0700
committer Ian Rogers <irogers@google.com> 2014-10-22 12:06:23 -0700
commitc7dd295a4e0cc1d15c0c96088e55a85389bade74 (patch)
tree0c08a2236bc9ba5d9a4dc75d4dd0ed2d76f8f1c6 /runtime/runtime_linux.cc
parent94e5af8602150efa95bde35cc9be9891ddf30135 (diff)
Tidy up logging.
Move gVerboseMethods to CompilerOptions. Now "--verbose-methods=" option to dex2oat rather than runtime argument "-verbose-methods:". Move ToStr and Dumpable out of logging.h, move LogMessageData into logging.cc except for a forward declaration. Remove ConstDumpable as Dump methods are all const (and make this so if not currently true). Make LogSeverity an enum and improve compile time assertions and type checking. Remove log_severity.h that's only used in logging.h. With system headers gone from logging.h, go add to .cc files missing system header includes. Also, make operator new in ValueObject private for compile time instantiation checking. Change-Id: I3228f614500ccc9b14b49c72b9821c8b0db3d641
Diffstat (limited to 'runtime/runtime_linux.cc')
-rw-r--r--runtime/runtime_linux.cc22
1 files changed, 13 insertions, 9 deletions
diff --git a/runtime/runtime_linux.cc b/runtime/runtime_linux.cc
index 46ee27405f..1de035c0d5 100644
--- a/runtime/runtime_linux.cc
+++ b/runtime/runtime_linux.cc
@@ -21,6 +21,9 @@
#include <sys/utsname.h>
#include <inttypes.h>
+#include <sstream>
+
+#include "base/dumpable.h"
#include "base/logging.h"
#include "base/mutex.h"
#include "base/stringprintf.h"
@@ -32,13 +35,13 @@ namespace art {
static constexpr bool kDumpHeapObjectOnSigsevg = false;
struct Backtrace {
- void Dump(std::ostream& os) {
+ void Dump(std::ostream& os) const {
DumpNativeStack(os, GetTid(), "\t");
}
};
struct OsInfo {
- void Dump(std::ostream& os) {
+ void Dump(std::ostream& os) const {
utsname info;
uname(&info);
// Linux 2.6.38.8-gg784 (x86_64)
@@ -132,9 +135,11 @@ static const char* GetSignalCodeName(int signal_number, int signal_code) {
}
struct UContext {
- explicit UContext(void* raw_context) : context(reinterpret_cast<ucontext_t*>(raw_context)->uc_mcontext) {}
+ explicit UContext(void* raw_context) :
+ context(reinterpret_cast<ucontext_t*>(raw_context)->uc_mcontext) {
+ }
- void Dump(std::ostream& os) {
+ void Dump(std::ostream& os) const {
// TODO: support non-x86 hosts (not urgent because this code doesn't run on targets).
#if defined(__APPLE__) && defined(__i386__)
DumpRegister32(os, "eax", context->__ss.__eax);
@@ -228,15 +233,15 @@ struct UContext {
#endif
}
- void DumpRegister32(std::ostream& os, const char* name, uint32_t value) {
+ void DumpRegister32(std::ostream& os, const char* name, uint32_t value) const {
os << StringPrintf(" %6s: 0x%08x", name, value);
}
- void DumpRegister64(std::ostream& os, const char* name, uint64_t value) {
+ void DumpRegister64(std::ostream& os, const char* name, uint64_t value) const {
os << StringPrintf(" %6s: 0x%016" PRIx64, name, value);
}
- void DumpX86Flags(std::ostream& os, uint32_t flags) {
+ void DumpX86Flags(std::ostream& os, uint32_t flags) const {
os << " [";
if ((flags & (1 << 0)) != 0) {
os << " CF";
@@ -274,8 +279,7 @@ struct UContext {
void HandleUnexpectedSignal(int signal_number, siginfo_t* info, void* raw_context) {
static bool handlingUnexpectedSignal = false;
if (handlingUnexpectedSignal) {
- LogMessageData data(__FILE__, __LINE__, INTERNAL_FATAL, -1);
- LogMessage::LogLine(data, "HandleUnexpectedSignal reentered\n");
+ LogMessage::LogLine(__FILE__, __LINE__, INTERNAL_FATAL, "HandleUnexpectedSignal reentered\n");
_exit(1);
}
handlingUnexpectedSignal = true;