diff options
author | Dmitry Petrochenko <dmitry.petrochenko@intel.com> | 2014-02-10 14:48:12 +0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2014-02-11 08:46:59 -0800 |
commit | 611c2c3404a8b27bc1584cc63f232dbfb316f78a (patch) | |
tree | fa6b32061aa2151d6c2b7f699b97ab1403816df3 /runtime/runtime_linux.cc | |
parent | abaf927f29f6feceb3df3e6ced7d01970ba0dbe9 (diff) | |
download | art-611c2c3404a8b27bc1584cc63f232dbfb316f78a.tar.gz art-611c2c3404a8b27bc1584cc63f232dbfb316f78a.tar.bz2 art-611c2c3404a8b27bc1584cc63f232dbfb316f78a.zip |
art: 64-bit support in UContext::Dump
Dump the register contents for x86_64 host.
Change-Id: I6ca5c2a013ab313ac0bfae23775f7e3552c55aeb
Signed-off-by: Dmitry Petrochenko <dmitry.petrochenko@intel.com>
Diffstat (limited to 'runtime/runtime_linux.cc')
-rw-r--r-- | runtime/runtime_linux.cc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/runtime/runtime_linux.cc b/runtime/runtime_linux.cc index d8f408ab6c..73ac034633 100644 --- a/runtime/runtime_linux.cc +++ b/runtime/runtime_linux.cc @@ -19,6 +19,7 @@ #include <signal.h> #include <string.h> #include <sys/utsname.h> +#include <inttypes.h> #include "base/logging.h" #include "base/mutex.h" @@ -185,6 +186,41 @@ struct UContext { os << '\n'; DumpRegister32(os, "gs", context.gregs[REG_GS]); DumpRegister32(os, "ss", context.gregs[REG_SS]); +#elif defined(__linux__) && defined(__x86_64__) + DumpRegister64(os, "rax", context.gregs[REG_RAX]); + DumpRegister64(os, "rbx", context.gregs[REG_RBX]); + DumpRegister64(os, "rcx", context.gregs[REG_RCX]); + DumpRegister64(os, "rdx", context.gregs[REG_RDX]); + os << '\n'; + + DumpRegister64(os, "rdi", context.gregs[REG_RDI]); + DumpRegister64(os, "rsi", context.gregs[REG_RSI]); + DumpRegister64(os, "rbp", context.gregs[REG_RBP]); + DumpRegister64(os, "rsp", context.gregs[REG_RSP]); + os << '\n'; + + DumpRegister64(os, "r8 ", context.gregs[REG_R8]); + DumpRegister64(os, "r9 ", context.gregs[REG_R9]); + DumpRegister64(os, "r10", context.gregs[REG_R10]); + DumpRegister64(os, "r11", context.gregs[REG_R11]); + os << '\n'; + + DumpRegister64(os, "r12", context.gregs[REG_R12]); + DumpRegister64(os, "r13", context.gregs[REG_R13]); + DumpRegister64(os, "r14", context.gregs[REG_R14]); + DumpRegister64(os, "r15", context.gregs[REG_R15]); + os << '\n'; + + DumpRegister64(os, "rip", context.gregs[REG_RIP]); + os << " "; + DumpRegister32(os, "eflags", context.gregs[REG_EFL]); + DumpX86Flags(os, context.gregs[REG_EFL]); + os << '\n'; + + DumpRegister32(os, "cs", (context.gregs[REG_CSGSFS]) & 0x0FFFF); + DumpRegister32(os, "gs", (context.gregs[REG_CSGSFS] >> 16) & 0x0FFFF); + DumpRegister32(os, "fs", (context.gregs[REG_CSGSFS] >> 32) & 0x0FFFF); + os << '\n'; #else os << "Unknown architecture/word size/OS in ucontext dump"; #endif @@ -194,6 +230,10 @@ struct UContext { os << StringPrintf(" %6s: 0x%08x", name, value); } + void DumpRegister64(std::ostream& os, const char* name, uint64_t value) { + os << StringPrintf(" %6s: 0x%016" PRIx64, name, value); + } + void DumpX86Flags(std::ostream& os, uint32_t flags) { os << " ["; if ((flags & (1 << 0)) != 0) { |