aboutsummaryrefslogtreecommitdiff
path: root/src/processor/stackwalker.cc
diff options
context:
space:
mode:
authormmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-09-25 18:29:48 +0000
committermmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-09-25 18:29:48 +0000
commit960e5277ee489960c40c50c6222606200419302a (patch)
tree33a3b8a0ecba5cd6c961966d93f6270acc7a40d9 /src/processor/stackwalker.cc
parent3402cae5e58f7503adc4d9de6d9ea69e725ddcb2 (diff)
downloadgoogle-breakpad-960e5277ee489960c40c50c6222606200419302a.tar.gz
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
Diffstat (limited to 'src/processor/stackwalker.cc')
-rw-r--r--src/processor/stackwalker.cc42
1 files changed, 32 insertions, 10 deletions
diff --git a/src/processor/stackwalker.cc b/src/processor/stackwalker.cc
index a8b1a41f..5dc7d545 100644
--- a/src/processor/stackwalker.cc
+++ b/src/processor/stackwalker.cc
@@ -37,22 +37,20 @@
#include <memory>
#include "processor/stackwalker.h"
+#include "google/symbol_supplier.h"
#include "processor/minidump.h"
#include "processor/source_line_resolver.h"
-#include "google/symbol_supplier.h"
-
+#include "processor/stackwalker_ppc.h"
+#include "processor/stackwalker_x86.h"
namespace google_airbag {
-
using std::auto_ptr;
-Stackwalker::Stackwalker(MemoryRegion* memory, MinidumpModuleList* modules,
- SymbolSupplier* supplier)
- : memory_(memory),
- modules_(modules),
- supplier_(supplier) {
+Stackwalker::Stackwalker(MemoryRegion *memory, MinidumpModuleList *modules,
+ SymbolSupplier *supplier)
+ : memory_(memory), modules_(modules), supplier_(supplier) {
}
@@ -72,7 +70,7 @@ void Stackwalker::Walk(StackFrames *frames) {
// Resolve the module information, if a module map was provided.
if (modules_) {
- MinidumpModule* module =
+ MinidumpModule *module =
modules_->GetModuleForAddress(frame->instruction);
if (module) {
frame->module_name = *(module->GetName());
@@ -97,9 +95,33 @@ void Stackwalker::Walk(StackFrames *frames) {
frame.reset(new StackFrame());
// Get the next frame.
- valid = GetCallerFrame(frame.get());
+ valid = GetCallerFrame(frame.get(), frames);
}
}
+// static
+Stackwalker* Stackwalker::StackwalkerForCPU(MinidumpContext *context,
+ MemoryRegion *memory,
+ MinidumpModuleList *modules,
+ SymbolSupplier *supplier) {
+ Stackwalker *cpu_stackwalker = NULL;
+
+ u_int32_t cpu = context->GetContextCPU();
+ switch (cpu) {
+ case MD_CONTEXT_X86:
+ cpu_stackwalker = new StackwalkerX86(context->GetContextX86(),
+ memory, modules, supplier);
+ break;
+
+ case MD_CONTEXT_PPC:
+ cpu_stackwalker = new StackwalkerPPC(context->GetContextPPC(),
+ memory, modules, supplier);
+ break;
+ }
+
+ return cpu_stackwalker;
+}
+
+
} // namespace google_airbag