Fix stackwalker_selftest following #89 (#95). r=bryner

http://groups.google.com/group/airbag-dev/browse_thread/thread/d6d6a83ec41f4e0f


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@84 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
mmentovai 2006-12-12 21:51:36 +00:00
parent fd38d48e6d
commit fb35cf79e2

View File

@ -56,12 +56,14 @@
#include "google_airbag/common/airbag_types.h" #include "google_airbag/common/airbag_types.h"
#include "google_airbag/common/minidump_format.h" #include "google_airbag/common/minidump_format.h"
#include "google_airbag/processor/basic_source_line_resolver.h"
#include "google_airbag/processor/call_stack.h" #include "google_airbag/processor/call_stack.h"
#include "google_airbag/processor/memory_region.h" #include "google_airbag/processor/memory_region.h"
#include "google_airbag/processor/stack_frame.h" #include "google_airbag/processor/stack_frame.h"
#include "google_airbag/processor/stack_frame_cpu.h" #include "google_airbag/processor/stack_frame_cpu.h"
#include "processor/scoped_ptr.h" #include "processor/scoped_ptr.h"
using google_airbag::BasicSourceLineResolver;
using google_airbag::CallStack; using google_airbag::CallStack;
using google_airbag::MemoryRegion; using google_airbag::MemoryRegion;
using google_airbag::scoped_ptr; using google_airbag::scoped_ptr;
@ -236,14 +238,15 @@ static unsigned int CountCallerFrames() {
&resolver); &resolver);
#endif // __i386__ || __ppc__ #endif // __i386__ || __ppc__
scoped_ptr<CallStack> stack(stackwalker.Walk()); CallStack stack;
stackwalker.Walk(&stack);
#ifdef PRINT_STACKS #ifdef PRINT_STACKS
printf("\n"); printf("\n");
for (unsigned int frame_index = 0; for (unsigned int frame_index = 0;
frame_index < stack->frames()->size(); frame_index < stack.frames()->size();
++frame_index) { ++frame_index) {
StackFrame *frame = stack->frames()->at(frame_index); StackFrame *frame = stack.frames()->at(frame_index);
printf("frame %-3d instruction = 0x%08llx", printf("frame %-3d instruction = 0x%08llx",
frame_index, frame->instruction); frame_index, frame->instruction);
#if defined(__i386__) #if defined(__i386__)
@ -259,8 +262,8 @@ static unsigned int CountCallerFrames() {
// Subtract 1 because the caller wants the number of frames beneath // Subtract 1 because the caller wants the number of frames beneath
// itself. Because the caller called us, subract two for our frame and its // itself. Because the caller called us, subract two for our frame and its
// frame, which are included in stack->size(). // frame, which are included in stack.size().
return stack->frames()->size() - 2; return stack.frames()->size() - 2;
} }