Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(630)

Unified Diff: src/processor/dump_context.cc

Issue 1210943005: Use general instruction/stack pointer convenience method instead of manually (Closed) Base URL: http://google-breakpad.googlecode.com/svn/trunk/
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/google_breakpad/processor/dump_context.h ('k') | src/processor/exploitability_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/processor/dump_context.cc
===================================================================
--- src/processor/dump_context.cc (revision 1466)
+++ src/processor/dump_context.cc (working copy)
@@ -185,6 +185,49 @@
return true;
}
+bool DumpContext::GetStackPointer(uint64_t* sp) const {
+ BPLOG_IF(ERROR, !sp) << "DumpContext::GetStackPointer requires |sp|";
+ assert(sp);
+ *sp = 0;
+
+ if (!valid_) {
+ BPLOG(ERROR) << "Invalid DumpContext for GetStackPointer";
+ return false;
+ }
+
+ switch (GetContextCPU()) {
+ case MD_CONTEXT_AMD64:
+ *sp = GetContextAMD64()->rsp;
+ break;
+ case MD_CONTEXT_ARM:
+ *sp = GetContextARM()->iregs[MD_CONTEXT_ARM_REG_SP];
+ break;
+ case MD_CONTEXT_ARM64:
+ *sp = GetContextARM64()->iregs[MD_CONTEXT_ARM64_REG_SP];
+ break;
+ case MD_CONTEXT_PPC:
+ *sp = GetContextPPC()->gpr[MD_CONTEXT_PPC_REG_SP];
+ break;
+ case MD_CONTEXT_PPC64:
+ *sp = GetContextPPC64()->gpr[MD_CONTEXT_PPC64_REG_SP];
+ break;
+ case MD_CONTEXT_SPARC:
+ *sp = GetContextSPARC()->g_r[MD_CONTEXT_SPARC_REG_SP];
+ break;
+ case MD_CONTEXT_X86:
+ *sp = GetContextX86()->esp;
+ break;
+ case MD_CONTEXT_MIPS:
+ *sp = GetContextMIPS()->iregs[MD_CONTEXT_MIPS_REG_SP];
+ break;
+ default:
+ // This should never happen.
+ BPLOG(ERROR) << "Unknown CPU architecture in GetStackPointer";
+ return false;
+ }
+ return true;
+}
+
void DumpContext::SetContextFlags(uint32_t context_flags) {
context_flags_ = context_flags;
}
« no previous file with comments | « src/google_breakpad/processor/dump_context.h ('k') | src/processor/exploitability_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698