From 611c2c3404a8b27bc1584cc63f232dbfb316f78a Mon Sep 17 00:00:00 2001 From: Dmitry Petrochenko Date: Mon, 10 Feb 2014 14:48:12 +0700 Subject: art: 64-bit support in UContext::Dump Dump the register contents for x86_64 host. Change-Id: I6ca5c2a013ab313ac0bfae23775f7e3552c55aeb Signed-off-by: Dmitry Petrochenko --- runtime/runtime_linux.cc | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'runtime/runtime_linux.cc') 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 #include #include +#include #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) { -- cgit v1.2.3