mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-01-03 13:14:45 +01:00
ppc stackwalker (#30). r=bryner
- Implementation of PowerPC stackwalker. Tested using stackwalker_selftest (#18). - Hook up processor-side multi-CPU support in MinidumpProcessor and minidump_stackwalk using the new Stackwalker::StackwalkerForCPU method. http://groups.google.com/group/airbag-dev/browse_thread/thread/1c2fa7c5182a77a9 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@34 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
3402cae5e5
commit
960e5277ee
11 changed files with 335 additions and 73 deletions
|
|
@ -35,17 +35,28 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "processor/minidump.h"
|
||||
#include "processor/stackwalker_x86.h"
|
||||
|
||||
|
||||
using std::auto_ptr;
|
||||
using std::string;
|
||||
using namespace google_airbag;
|
||||
using google_airbag::MemoryRegion;
|
||||
using google_airbag::Minidump;
|
||||
using google_airbag::MinidumpContext;
|
||||
using google_airbag::MinidumpException;
|
||||
using google_airbag::MinidumpModuleList;
|
||||
using google_airbag::MinidumpThread;
|
||||
using google_airbag::MinidumpThreadList;
|
||||
using google_airbag::StackFrame;
|
||||
using google_airbag::StackFrames;
|
||||
using google_airbag::Stackwalker;
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int main(int argc, char **argv) {
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "usage: %s <file>\n", argv[0]);
|
||||
exit(1);
|
||||
|
|
@ -57,48 +68,52 @@ int main(int argc, char** argv) {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
MinidumpException* exception = minidump.GetException();
|
||||
MinidumpException *exception = minidump.GetException();
|
||||
if (!exception) {
|
||||
fprintf(stderr, "minidump.GetException() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
MinidumpThreadList* thread_list = minidump.GetThreadList();
|
||||
MinidumpThreadList *thread_list = minidump.GetThreadList();
|
||||
if (!thread_list) {
|
||||
fprintf(stderr, "minidump.GetThreadList() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
MinidumpThread* exception_thread =
|
||||
MinidumpThread *exception_thread =
|
||||
thread_list->GetThreadByID(exception->GetThreadID());
|
||||
if (!exception_thread) {
|
||||
fprintf(stderr, "thread_list->GetThreadByID() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
MemoryRegion* stack_memory = exception_thread->GetMemory();
|
||||
MemoryRegion *stack_memory = exception_thread->GetMemory();
|
||||
if (!stack_memory) {
|
||||
fprintf(stderr, "exception_thread->GetStackMemory() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
MinidumpContext* context = exception->GetContext();
|
||||
MinidumpContext *context = exception->GetContext();
|
||||
if (!context) {
|
||||
fprintf(stderr, "exception->GetContext() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
MinidumpModuleList* modules = minidump.GetModuleList();
|
||||
MinidumpModuleList *modules = minidump.GetModuleList();
|
||||
if (!modules) {
|
||||
fprintf(stderr, "minidump.GetModuleList() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
StackwalkerX86 stackwalker = StackwalkerX86(context, stack_memory,
|
||||
modules, NULL);
|
||||
auto_ptr<Stackwalker> stackwalker(
|
||||
Stackwalker::StackwalkerForCPU(context, stack_memory, modules, NULL));
|
||||
if (!stackwalker.get()) {
|
||||
fprintf(stderr, "Stackwalker::StackwalkerForCPU failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
StackFrames stack;
|
||||
stackwalker.Walk(&stack);
|
||||
stackwalker->Walk(&stack);
|
||||
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < stack.size() ; index++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue