Refactor the logic of resolving source line info into helper class.

http://breakpad.appspot.com/459002/


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1068 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
SiyangXie@gmail.com 2012-10-10 21:41:52 +00:00
parent f72b9c6ff4
commit bab770045b
22 changed files with 813 additions and 926 deletions

View file

@ -43,13 +43,12 @@
namespace google_breakpad {
StackwalkerPPC::StackwalkerPPC(const SystemInfo *system_info,
const MDRawContextPPC *context,
MemoryRegion *memory,
const CodeModules *modules,
SymbolSupplier *supplier,
SourceLineResolverInterface *resolver)
: Stackwalker(system_info, memory, modules, supplier, resolver),
StackwalkerPPC::StackwalkerPPC(const SystemInfo* system_info,
const MDRawContextPPC* context,
MemoryRegion* memory,
const CodeModules* modules,
StackFrameSymbolizer* resolver_helper)
: Stackwalker(system_info, memory, modules, resolver_helper),
context_(context) {
if (memory_->GetBase() + memory_->GetSize() - 1 > 0xffffffff) {
// This implementation only covers 32-bit ppc CPUs. The limits of the
@ -69,7 +68,7 @@ StackFrame* StackwalkerPPC::GetContextFrame() {
return NULL;
}
StackFramePPC *frame = new StackFramePPC();
StackFramePPC* frame = new StackFramePPC();
// The instruction pointer is stored directly in a register, so pull it
// straight out of the CPU context structure.
@ -82,7 +81,7 @@ StackFrame* StackwalkerPPC::GetContextFrame() {
}
StackFrame* StackwalkerPPC::GetCallerFrame(const CallStack *stack) {
StackFrame* StackwalkerPPC::GetCallerFrame(const CallStack* stack) {
if (!memory_ || !stack) {
BPLOG(ERROR) << "Can't get caller frame without memory or stack";
return NULL;
@ -97,7 +96,7 @@ StackFrame* StackwalkerPPC::GetCallerFrame(const CallStack *stack) {
// frame pointer, and what is typically thought of as the frame pointer on
// an x86 is usually referred to as the stack pointer on a ppc.
StackFramePPC *last_frame = static_cast<StackFramePPC*>(
StackFramePPC* last_frame = static_cast<StackFramePPC*>(
stack->frames()->back());
// A caller frame must reside higher in memory than its callee frames.
@ -121,7 +120,7 @@ StackFrame* StackwalkerPPC::GetCallerFrame(const CallStack *stack) {
return NULL;
}
StackFramePPC *frame = new StackFramePPC();
StackFramePPC* frame = new StackFramePPC();
frame->context = last_frame->context;
frame->context.srr0 = instruction;