Merge "Fix register dump and back trace after a crash."
This commit is contained in:
commit
21be143a0e
1 changed files with 14 additions and 2 deletions
|
|
@ -32,10 +32,22 @@
|
||||||
|
|
||||||
#define R(x) (static_cast<unsigned int>(x))
|
#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
|
// If configured to do so, dump memory around *all* registers
|
||||||
// for the crashing thread.
|
// for the crashing thread.
|
||||||
void dump_memory_and_code(log_t* log, pid_t tid, int scope_flags) {
|
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)) {
|
if (ptrace(PTRACE_GETREGS, tid, 0, &r)) {
|
||||||
return;
|
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) {
|
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)) {
|
if(ptrace(PTRACE_GETREGS, tid, 0, &r)) {
|
||||||
_LOG(log, scope_flags, "cannot get registers: %s\n", strerror(errno));
|
_LOG(log, scope_flags, "cannot get registers: %s\n", strerror(errno));
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue