diff options
Diffstat (limited to 'src/google_airbag/processor')
-rw-r--r-- | src/google_airbag/processor/call_stack.h | 7 | ||||
-rw-r--r-- | src/google_airbag/processor/minidump_processor.h | 14 | ||||
-rw-r--r-- | src/google_airbag/processor/process_state.h | 9 | ||||
-rw-r--r-- | src/google_airbag/processor/stackwalker.h | 7 | ||||
-rw-r--r-- | src/google_airbag/processor/symbol_supplier.h | 18 |
5 files changed, 38 insertions, 17 deletions
diff --git a/src/google_airbag/processor/call_stack.h b/src/google_airbag/processor/call_stack.h index 580d4927..d938944e 100644 --- a/src/google_airbag/processor/call_stack.h +++ b/src/google_airbag/processor/call_stack.h @@ -56,17 +56,18 @@ template<typename T> class linked_ptr; class CallStack { public: + CallStack() { Clear(); } ~CallStack(); + // Resets the CallStack to its initial empty state + void Clear(); + const vector<StackFrame*>* frames() const { return &frames_; } private: // Stackwalker is responsible for building the frames_ vector. friend class Stackwalker; - // Disallow instantiation other than by friends. - CallStack() : frames_() {} - // Storage for pushed frames. vector<StackFrame*> frames_; }; diff --git a/src/google_airbag/processor/minidump_processor.h b/src/google_airbag/processor/minidump_processor.h index 06c185ff..604eae45 100644 --- a/src/google_airbag/processor/minidump_processor.h +++ b/src/google_airbag/processor/minidump_processor.h @@ -42,15 +42,21 @@ class SymbolSupplier; class MinidumpProcessor { public: + // Return type for Process() + enum ProcessResult { + PROCESS_OK, // the minidump was processed successfully + PROCESS_ERROR, // there was an error processing the minidump + PROCESS_INTERRUPTED, // processing was interrupted by the SymbolSupplier + }; + // Initializes this MinidumpProcessor. supplier should be an // implementation of the SymbolSupplier abstract base class. explicit MinidumpProcessor(SymbolSupplier *supplier); ~MinidumpProcessor(); - // Returns a new ProcessState object produced by processing the minidump - // file. The caller takes ownership of the ProcessState. Returns NULL on - // failure. - ProcessState* Process(const string &minidump_file); + // Processes the minidump file and fills process_state with the result. + ProcessResult Process(const string &minidump_file, + ProcessState *process_state); // Returns a textual representation of the base CPU type that the minidump // in dump was produced on. Returns an empty string if this information diff --git a/src/google_airbag/processor/process_state.h b/src/google_airbag/processor/process_state.h index 69005e2b..6fe12155 100644 --- a/src/google_airbag/processor/process_state.h +++ b/src/google_airbag/processor/process_state.h @@ -47,8 +47,12 @@ class CodeModules; class ProcessState { public: + ProcessState() : modules_(NULL) { Clear(); } ~ProcessState(); + // Resets the ProcessState to its default values + void Clear(); + // Accessors. See the data declarations below. u_int32_t time_date_stamp() const { return time_date_stamp_; } bool crashed() const { return crashed_; } @@ -66,11 +70,6 @@ class ProcessState { // MinidumpProcessor is responsible for building ProcessState objects. friend class MinidumpProcessor; - // Disallow instantiation other than by friends. - ProcessState() : time_date_stamp_(0), crashed_(false), crash_reason_(), - crash_address_(0), requesting_thread_(-1), threads_(), - os_(), os_version_(), cpu_(), cpu_info_(), modules_(NULL) {} - // The time-date stamp of the minidump (time_t format) u_int32_t time_date_stamp_; diff --git a/src/google_airbag/processor/stackwalker.h b/src/google_airbag/processor/stackwalker.h index b3f2333e..70da125e 100644 --- a/src/google_airbag/processor/stackwalker.h +++ b/src/google_airbag/processor/stackwalker.h @@ -61,10 +61,11 @@ class Stackwalker { public: virtual ~Stackwalker() {} - // Creates a new CallStack and populates it by calling GetContextFrame and + // Populates the given CallStack by calling GetContextFrame and // GetCallerFrame. The frames are further processed to fill all available - // data. The caller takes ownership of the CallStack returned by Walk. - CallStack* Walk(); + // data. Returns true if the stackwalk completed, or false if it was + // interrupted by SymbolSupplier::GetSymbolFile(). + 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 diff --git a/src/google_airbag/processor/symbol_supplier.h b/src/google_airbag/processor/symbol_supplier.h index 47a2be08..d456174b 100644 --- a/src/google_airbag/processor/symbol_supplier.h +++ b/src/google_airbag/processor/symbol_supplier.h @@ -42,10 +42,24 @@ class CodeModule; class SymbolSupplier { public: + // Result type for GetSymbolFile + enum SymbolResult { + // no symbols were found, but continue processing + NOT_FOUND, + + // symbols were found, and the path has been placed in symbol_file + FOUND, + + // stops processing the minidump immediately + INTERRUPT, + }; + virtual ~SymbolSupplier() {} - // Returns the path to the symbol file for the given module. - virtual string GetSymbolFile(const CodeModule *module) = 0; + // Retrieves the symbol file for the given CodeModule, placing the + // path in symbol_file if successful. + virtual SymbolResult GetSymbolFile(const CodeModule *module, + string *symbol_file) = 0; }; } // namespace google_airbag |