diff options
Diffstat (limited to 'src/google_breakpad/processor/stackwalker.h')
-rw-r--r-- | src/google_breakpad/processor/stackwalker.h | 69 |
1 files changed, 28 insertions, 41 deletions
diff --git a/src/google_breakpad/processor/stackwalker.h b/src/google_breakpad/processor/stackwalker.h index 6a0c3e72..2979fef8 100644 --- a/src/google_breakpad/processor/stackwalker.h +++ b/src/google_breakpad/processor/stackwalker.h @@ -48,19 +48,16 @@ #include "google_breakpad/common/breakpad_types.h" #include "google_breakpad/processor/code_modules.h" #include "google_breakpad/processor/memory_region.h" +#include "google_breakpad/processor/stack_frame_symbolizer.h" namespace google_breakpad { class CallStack; class MinidumpContext; -class SourceLineResolverInterface; -struct StackFrame; -class SymbolSupplier; -struct SystemInfo; +class StackFrameSymbolizer; using std::set; - class Stackwalker { public: virtual ~Stackwalker() {} @@ -69,17 +66,17 @@ class Stackwalker { // GetCallerFrame. The frames are further processed to fill all available // data. Returns true if the stackwalk completed, or false if it was // interrupted by SymbolSupplier::GetSymbolFile(). - bool Walk(CallStack *stack); + bool Walk(CallStack* stack); // Returns a new concrete subclass suitable for the CPU that a stack was // generated on, according to the CPU type indicated by the context // argument. If no suitable concrete subclass exists, returns NULL. - static Stackwalker* StackwalkerForCPU(const SystemInfo *system_info, - MinidumpContext *context, - MemoryRegion *memory, - const CodeModules *modules, - SymbolSupplier *supplier, - SourceLineResolverInterface *resolver); + static Stackwalker* StackwalkerForCPU( + const SystemInfo* system_info, + MinidumpContext* context, + MemoryRegion* memory, + const CodeModules* modules, + StackFrameSymbolizer* resolver_helper); static void set_max_frames(u_int32_t max_frames) { max_frames_ = max_frames; } static u_int32_t max_frames() { return max_frames_; } @@ -89,16 +86,15 @@ class Stackwalker { // memory identifies a MemoryRegion that provides the stack memory // for the stack to walk. modules, if non-NULL, is a CodeModules // object that is used to look up which code module each stack frame is - // associated with. supplier is an optional caller-supplied SymbolSupplier - // implementation. If supplier is NULL, source line info will not be - // resolved. resolver is an instance of SourceLineResolverInterface - // (see source_line_resolver_interface.h and basic_source_line_resolver.h). - // If resolver is NULL, source line info will not be resolved. - Stackwalker(const SystemInfo *system_info, - MemoryRegion *memory, - const CodeModules *modules, - SymbolSupplier *supplier, - SourceLineResolverInterface *resolver); + // associated with. frame_symbolizer is a StackFrameSymbolizer object that + // encapsulates the logic of how source line resolver interacts with symbol + // supplier to symbolize stack frame and look up caller frame information + // (see stack_frame_symbolizer.h). + // frame_symbolizer MUST NOT be NULL (asserted). + Stackwalker(const SystemInfo* system_info, + MemoryRegion* memory, + const CodeModules* modules, + StackFrameSymbolizer* frame_symbolizer); // This can be used to filter out potential return addresses when // the stack walker resorts to stack scanning. @@ -112,8 +108,8 @@ class Stackwalker { template<typename InstructionType> bool ScanForReturnAddress(InstructionType location_start, - InstructionType *location_found, - InstructionType *ip_found) { + InstructionType* location_found, + InstructionType* ip_found) { const int kRASearchWords = 30; return ScanForReturnAddress(location_start, location_found, ip_found, kRASearchWords); @@ -130,8 +126,8 @@ class Stackwalker { // location in memory. template<typename InstructionType> bool ScanForReturnAddress(InstructionType location_start, - InstructionType *location_found, - InstructionType *ip_found, + InstructionType* location_found, + InstructionType* ip_found, int searchwords) { for (InstructionType location = location_start; location <= location_start + searchwords * sizeof(InstructionType); @@ -142,7 +138,6 @@ class Stackwalker { if (modules_ && modules_->GetModuleForAddress(ip) && InstructionAddressSeemsValid(ip)) { - *ip_found = ip; *location_found = location; return true; @@ -154,19 +149,19 @@ class Stackwalker { // Information about the system that produced the minidump. Subclasses // and the SymbolSupplier may find this information useful. - const SystemInfo *system_info_; + const SystemInfo* system_info_; // The stack memory to walk. Subclasses will require this region to // get information from the stack. - MemoryRegion *memory_; + MemoryRegion* memory_; // A list of modules, for populating each StackFrame's module information. // This field is optional and may be NULL. - const CodeModules *modules_; + const CodeModules* modules_; protected: - // The SourceLineResolver implementation. - SourceLineResolverInterface *resolver_; + // The StackFrameSymbolizer implementation. + StackFrameSymbolizer* frame_symbolizer_; private: // Obtains the context frame, the innermost called procedure in a stack @@ -183,15 +178,7 @@ class Stackwalker { // the end of the stack has been reached). GetCallerFrame allocates a new // StackFrame (or StackFrame subclass), ownership of which is taken by // the caller. - virtual StackFrame* GetCallerFrame(const CallStack *stack) = 0; - - // The optional SymbolSupplier for resolving source line info. - SymbolSupplier *supplier_; - - // A list of modules that we haven't found symbols for. We track - // this in order to avoid repeatedly looking them up again within - // one minidump. - set<string> no_symbol_modules_; + virtual StackFrame* GetCallerFrame(const CallStack* stack) = 0; // The maximum number of frames Stackwalker will walk through. // This defaults to 1024 to prevent infinite loops. |