mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-03-07 13:06:28 +00:00
Add a GetInstructionPointer method to MinidumpException
R=mark at https://breakpad.appspot.com/444003/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1039 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
@@ -714,6 +714,41 @@ u_int32_t MinidumpContext::GetContextCPU() const {
|
||||
return context_flags_ & MD_CONTEXT_CPU_MASK;
|
||||
}
|
||||
|
||||
bool MinidumpContext::GetInstructionPointer(u_int64_t* ip) const {
|
||||
BPLOG_IF(ERROR, !ip) << "MinidumpContext::GetInstructionPointer "
|
||||
"requires |ip|";
|
||||
assert(ip);
|
||||
*ip = 0;
|
||||
|
||||
if (!valid_) {
|
||||
BPLOG(ERROR) << "Invalid MinidumpContext for GetInstructionPointer";
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (context_flags_ & MD_CONTEXT_CPU_MASK) {
|
||||
case MD_CONTEXT_AMD64:
|
||||
*ip = context_.amd64->rip;
|
||||
break;
|
||||
case MD_CONTEXT_ARM:
|
||||
*ip = context_.arm->iregs[MD_CONTEXT_ARM_REG_PC];
|
||||
break;
|
||||
case MD_CONTEXT_PPC:
|
||||
*ip = context_.ppc->srr0;
|
||||
break;
|
||||
case MD_CONTEXT_SPARC:
|
||||
*ip = context_.ctx_sparc->pc;
|
||||
break;
|
||||
case MD_CONTEXT_X86:
|
||||
*ip = context_.x86->eip;
|
||||
break;
|
||||
default:
|
||||
// This should never happen.
|
||||
BPLOG(ERROR) << "Unknown CPU architecture in GetInstructionPointer";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const MDRawContextX86* MinidumpContext::GetContextX86() const {
|
||||
if (GetContextCPU() != MD_CONTEXT_X86) {
|
||||
|
||||
Reference in New Issue
Block a user