summaryrefslogtreecommitdiffstats
path: root/debuggerd
diff options
context:
space:
mode:
authorDouglas Leung <douglas@mips.com>2014-05-21 11:46:01 -0700
committerElliott Hughes <enh@google.com>2014-05-21 16:41:20 -0700
commit6254f32f21a976b61cb13c7ee9caf17e6b675403 (patch)
treefcfe6d7389485b361572f93835ec51c881270709 /debuggerd
parent5b7bb03ee84185bd83a594569264cc3841b80749 (diff)
downloadsystem_core-6254f32f21a976b61cb13c7ee9caf17e6b675403.tar.gz
system_core-6254f32f21a976b61cb13c7ee9caf17e6b675403.tar.bz2
system_core-6254f32f21a976b61cb13c7ee9caf17e6b675403.zip
Fix register dump and back trace after a crash.
Change-Id: Ie5f6624b9dcf81d84769b9cdaf9d8a301c8826f7 Signed-off-by: Douglas Leung <douglas@mips.com>
Diffstat (limited to 'debuggerd')
-rw-r--r--debuggerd/mips/machine.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/debuggerd/mips/machine.cpp b/debuggerd/mips/machine.cpp
index ab34182ea..5c82d4dbe 100644
--- a/debuggerd/mips/machine.cpp
+++ b/debuggerd/mips/machine.cpp
@@ -32,10 +32,22 @@
#define R(x) (static_cast<unsigned int>(x))
+// The MIPS uapi ptrace.h has the wrong definition for pt_regs. PTRACE_GETREGS
+// writes 64-bit quantities even though the public struct uses 32-bit ones.
+struct pt_regs_mips_t {
+ uint64_t regs[32];
+ uint64_t lo;
+ uint64_t hi;
+ uint64_t cp0_epc;
+ uint64_t cp0_badvaddr;
+ uint64_t cp0_status;
+ uint64_t cp0_cause;
+};
+
// If configured to do so, dump memory around *all* registers
// for the crashing thread.
void dump_memory_and_code(log_t* log, pid_t tid, int scope_flags) {
- pt_regs r;
+ pt_regs_mips_t r;
if (ptrace(PTRACE_GETREGS, tid, 0, &r)) {
return;
}
@@ -78,7 +90,7 @@ void dump_memory_and_code(log_t* log, pid_t tid, int scope_flags) {
}
void dump_registers(log_t* log, pid_t tid, int scope_flags) {
- pt_regs r;
+ pt_regs_mips_t r;
if(ptrace(PTRACE_GETREGS, tid, 0, &r)) {
_LOG(log, scope_flags, "cannot get registers: %s\n", strerror(errno));
return;