From b64d76a3b8a692f431d440f6a4416e7c70aad4ef Mon Sep 17 00:00:00 2001 From: jimblandy Date: Wed, 23 Dec 2009 22:32:14 +0000 Subject: Issue 49012: Breakpad Processor: Rename 'StackFrameInfo' structure to 'WindowsFrameInfo'. Also, rename stack_frame_info.h to windows_frame_info.h. If it seems odd to have functions like FillSourceLineInfo returning Windows-specific data structures... well, it is! This patch just makes it more obvious what's going on. a=jimblandy, r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@471 4c0a9323-5329-0410-9bdc-e9ce6186880e --- .../processor/basic_source_line_resolver.h | 2 +- .../processor/source_line_resolver_interface.h | 6 +- src/google_breakpad/processor/stackwalker.h | 4 +- src/processor/basic_source_line_resolver.cc | 26 ++--- .../basic_source_line_resolver_unittest.cc | 8 +- src/processor/stack_frame_info.h | 126 --------------------- src/processor/stackwalker.cc | 6 +- src/processor/stackwalker_amd64.cc | 2 +- src/processor/stackwalker_amd64.h | 2 +- src/processor/stackwalker_arm.cc | 2 +- src/processor/stackwalker_arm.h | 2 +- src/processor/stackwalker_ppc.cc | 2 +- src/processor/stackwalker_ppc.h | 2 +- src/processor/stackwalker_sparc.cc | 2 +- src/processor/stackwalker_sparc.h | 2 +- src/processor/stackwalker_x86.cc | 16 +-- src/processor/stackwalker_x86.h | 2 +- src/processor/windows_frame_info.h | 126 +++++++++++++++++++++ 18 files changed, 169 insertions(+), 169 deletions(-) delete mode 100644 src/processor/stack_frame_info.h create mode 100644 src/processor/windows_frame_info.h (limited to 'src') diff --git a/src/google_breakpad/processor/basic_source_line_resolver.h b/src/google_breakpad/processor/basic_source_line_resolver.h index c01cc685..55902248 100644 --- a/src/google_breakpad/processor/basic_source_line_resolver.h +++ b/src/google_breakpad/processor/basic_source_line_resolver.h @@ -63,7 +63,7 @@ class BasicSourceLineResolver : public SourceLineResolverInterface { virtual bool HasModule(const string &module_name) const; - virtual StackFrameInfo* FillSourceLineInfo(StackFrame *frame) const; + virtual WindowsFrameInfo* FillSourceLineInfo(StackFrame *frame) const; private: template class MemAddrMap; diff --git a/src/google_breakpad/processor/source_line_resolver_interface.h b/src/google_breakpad/processor/source_line_resolver_interface.h index 93ef85d2..a139cf07 100644 --- a/src/google_breakpad/processor/source_line_resolver_interface.h +++ b/src/google_breakpad/processor/source_line_resolver_interface.h @@ -40,7 +40,7 @@ namespace google_breakpad { using std::string; struct StackFrame; -struct StackFrameInfo; +struct WindowsFrameInfo; class SourceLineResolverInterface { public: @@ -68,9 +68,9 @@ class SourceLineResolverInterface { // module_name fields must already be filled in. Additional debugging // information, if available, is returned. If the information is not // available, returns NULL. A NULL return value does not indicate an - // error. The caller takes ownership of any returned StackFrameInfo + // error. The caller takes ownership of any returned WindowsFrameInfo // object. - virtual StackFrameInfo* FillSourceLineInfo(StackFrame *frame) const = 0; + virtual WindowsFrameInfo* FillSourceLineInfo(StackFrame *frame) const = 0; protected: // SourceLineResolverInterface cannot be instantiated except by subclasses diff --git a/src/google_breakpad/processor/stackwalker.h b/src/google_breakpad/processor/stackwalker.h index 90274aae..27085585 100644 --- a/src/google_breakpad/processor/stackwalker.h +++ b/src/google_breakpad/processor/stackwalker.h @@ -53,7 +53,7 @@ class MemoryRegion; class MinidumpContext; class SourceLineResolverInterface; struct StackFrame; -struct StackFrameInfo; +struct WindowsFrameInfo; class SymbolSupplier; class SystemInfo; @@ -135,7 +135,7 @@ class Stackwalker { // the caller. virtual StackFrame* GetCallerFrame( const CallStack *stack, - const vector< linked_ptr > &stack_frame_info) = 0; + const vector< linked_ptr > &stack_frame_info) = 0; // The optional SymbolSupplier for resolving source line info. SymbolSupplier *supplier_; diff --git a/src/processor/basic_source_line_resolver.cc b/src/processor/basic_source_line_resolver.cc index 63a94a3a..94a53dbe 100644 --- a/src/processor/basic_source_line_resolver.cc +++ b/src/processor/basic_source_line_resolver.cc @@ -46,7 +46,7 @@ #include "google_breakpad/processor/stack_frame.h" #include "processor/linked_ptr.h" #include "processor/scoped_ptr.h" -#include "processor/stack_frame_info.h" +#include "processor/windows_frame_info.h" using std::map; using std::vector; @@ -117,8 +117,8 @@ class BasicSourceLineResolver::Module { // with the result. Additional debugging information, if available, is // returned. If no additional information is available, returns NULL. // A NULL return value is not an error. The caller takes ownership of - // any returned StackFrameInfo object. - StackFrameInfo* LookupAddress(StackFrame *frame) const; + // any returned WindowsFrameInfo object. + WindowsFrameInfo* LookupAddress(StackFrame *frame) const; private: friend class BasicSourceLineResolver; @@ -175,7 +175,7 @@ class BasicSourceLineResolver::Module { // StackInfoTypes. These are split by type because there may be overlaps // between maps of different types, but some information is only available // as certain types. - ContainedRangeMap< MemAddr, linked_ptr > + ContainedRangeMap< MemAddr, linked_ptr > stack_info_[STACK_INFO_LAST]; }; @@ -236,7 +236,7 @@ bool BasicSourceLineResolver::HasModule(const string &module_name) const { return modules_->find(module_name) != modules_->end(); } -StackFrameInfo* BasicSourceLineResolver::FillSourceLineInfo( +WindowsFrameInfo* BasicSourceLineResolver::FillSourceLineInfo( StackFrame *frame) const { if (frame->module) { ModuleMap::const_iterator it = modules_->find(frame->module->code_file()); @@ -413,11 +413,11 @@ bool BasicSourceLineResolver::Module::LoadMap(const string &map_file) { return LoadMapFromBuffer(map_buffer); } -StackFrameInfo* BasicSourceLineResolver::Module::LookupAddress( +WindowsFrameInfo* BasicSourceLineResolver::Module::LookupAddress( StackFrame *frame) const { MemAddr address = frame->instruction - frame->module->base_address(); - linked_ptr retrieved_info; + linked_ptr retrieved_info; // Check for debugging info first, before any possible early returns. // // We only know about STACK_INFO_FRAME_DATA and STACK_INFO_FPO. Prefer @@ -429,9 +429,9 @@ StackFrameInfo* BasicSourceLineResolver::Module::LookupAddress( stack_info_[STACK_INFO_FPO].RetrieveRange(address, &retrieved_info); } - scoped_ptr frame_info; + scoped_ptr frame_info; if (retrieved_info.get()) { - frame_info.reset(new StackFrameInfo()); + frame_info.reset(new WindowsFrameInfo()); frame_info->CopyFrom(*retrieved_info.get()); } @@ -489,9 +489,9 @@ StackFrameInfo* BasicSourceLineResolver::Module::LookupAddress( // about how much space their parameters consume on the stack. Prefer // the STACK stuff (above), but if it's not present, take the // information from the FUNC or PUBLIC line. - frame_info.reset(new StackFrameInfo()); + frame_info.reset(new WindowsFrameInfo()); frame_info->parameter_size = parameter_size; - frame_info->valid |= StackFrameInfo::VALID_PARAMETER_SIZE; + frame_info->valid |= WindowsFrameInfo::VALID_PARAMETER_SIZE; } return frame_info.release(); @@ -681,8 +681,8 @@ bool BasicSourceLineResolver::Module::ParseStackInfo(char *stack_info_line) { // if ContainedRangeMap were modified to allow replacement of // already-stored values. - linked_ptr stack_frame_info( - new StackFrameInfo(prolog_size, + linked_ptr stack_frame_info( + new WindowsFrameInfo(prolog_size, epilog_size, parameter_size, saved_register_size, diff --git a/src/processor/basic_source_line_resolver_unittest.cc b/src/processor/basic_source_line_resolver_unittest.cc index cea98b84..688b0dfb 100644 --- a/src/processor/basic_source_line_resolver_unittest.cc +++ b/src/processor/basic_source_line_resolver_unittest.cc @@ -35,7 +35,7 @@ #include "processor/linked_ptr.h" #include "processor/logging.h" #include "processor/scoped_ptr.h" -#include "processor/stack_frame_info.h" +#include "processor/windows_frame_info.h" #define ASSERT_TRUE(cond) \ if (!(cond)) { \ @@ -55,7 +55,7 @@ using google_breakpad::CodeModule; using google_breakpad::linked_ptr; using google_breakpad::scoped_ptr; using google_breakpad::StackFrame; -using google_breakpad::StackFrameInfo; +using google_breakpad::WindowsFrameInfo; class TestCodeModule : public CodeModule { public: @@ -106,7 +106,7 @@ static bool RunTests() { StackFrame frame; frame.instruction = 0x1000; frame.module = NULL; - scoped_ptr frame_info(resolver.FillSourceLineInfo(&frame)); + scoped_ptr frame_info(resolver.FillSourceLineInfo(&frame)); ASSERT_FALSE(frame.module); ASSERT_TRUE(frame.function_name.empty()); ASSERT_EQ(frame.function_base, 0); @@ -173,7 +173,7 @@ static bool RunTests() { ASSERT_EQ(frame_info->prolog_size, 1); frame.instruction = 0x216f; - StackFrameInfo *s; + WindowsFrameInfo *s; s = resolver.FillSourceLineInfo(&frame); ASSERT_EQ(frame.function_name, "Public2_1"); delete s; diff --git a/src/processor/stack_frame_info.h b/src/processor/stack_frame_info.h deleted file mode 100644 index 052a9338..00000000 --- a/src/processor/stack_frame_info.h +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) 2006, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// stack_frame_info.h: Holds debugging information about a stack frame. -// -// This structure is specific to Windows debugging information obtained -// from pdb files using the DIA API. -// -// Author: Mark Mentovai - - -#ifndef PROCESSOR_STACK_FRAME_INFO_H__ -#define PROCESSOR_STACK_FRAME_INFO_H__ - -#include - -#include "google_breakpad/common/breakpad_types.h" - -namespace google_breakpad { - -struct StackFrameInfo { - public: - enum Validity { - VALID_NONE = 0, - VALID_PARAMETER_SIZE = 1, - VALID_ALL = -1 - }; - - StackFrameInfo() : valid(VALID_NONE), - prolog_size(0), - epilog_size(0), - parameter_size(0), - saved_register_size(0), - local_size(0), - max_stack_size(0), - allocates_base_pointer(0), - program_string() {} - - StackFrameInfo(u_int32_t set_prolog_size, - u_int32_t set_epilog_size, - u_int32_t set_parameter_size, - u_int32_t set_saved_register_size, - u_int32_t set_local_size, - u_int32_t set_max_stack_size, - int set_allocates_base_pointer, - const std::string set_program_string) - : valid(VALID_ALL), - prolog_size(set_prolog_size), - epilog_size(set_epilog_size), - parameter_size(set_parameter_size), - saved_register_size(set_saved_register_size), - local_size(set_local_size), - max_stack_size(set_max_stack_size), - allocates_base_pointer(set_allocates_base_pointer), - program_string(set_program_string) {} - - // CopyFrom makes "this" StackFrameInfo object identical to "that". - void CopyFrom(const StackFrameInfo &that) { - valid = that.valid; - prolog_size = that.prolog_size; - epilog_size = that.epilog_size; - parameter_size = that.parameter_size; - saved_register_size = that.saved_register_size; - local_size = that.local_size; - max_stack_size = that.max_stack_size; - allocates_base_pointer = that.allocates_base_pointer; - program_string = that.program_string; - } - - // Clears the StackFrameInfo object so that users will see it as though - // it contains no information. - void Clear() { - valid = VALID_NONE; - program_string.erase(); - } - - // Identifies which fields in the structure are valid. This is of - // type Validity, but it is defined as an int because it's not - // possible to OR values into an enumerated type. Users must check - // this field before using any other. - int valid; - - // These values come from IDiaFrameData. - u_int32_t prolog_size; - u_int32_t epilog_size; - u_int32_t parameter_size; - u_int32_t saved_register_size; - u_int32_t local_size; - u_int32_t max_stack_size; - - // Only one of allocates_base_pointer or program_string will be valid. - // If program_string is empty, use allocates_base_pointer. - bool allocates_base_pointer; - std::string program_string; -}; - -} // namespace google_breakpad - - -#endif // PROCESSOR_STACK_FRAME_INFO_H__ diff --git a/src/processor/stackwalker.cc b/src/processor/stackwalker.cc index c8f0da54..63fc1437 100644 --- a/src/processor/stackwalker.cc +++ b/src/processor/stackwalker.cc @@ -47,7 +47,7 @@ #include "processor/linked_ptr.h" #include "processor/logging.h" #include "processor/scoped_ptr.h" -#include "processor/stack_frame_info.h" +#include "processor/windows_frame_info.h" #include "processor/stackwalker_ppc.h" #include "processor/stackwalker_sparc.h" #include "processor/stackwalker_x86.h" @@ -78,7 +78,7 @@ bool Stackwalker::Walk(CallStack *stack) { // stack_frame_info parallels the CallStack. The vector is passed to the // GetCallerFrame function. It contains information that may be helpful // for stackwalking. - vector< linked_ptr > stack_frame_info; + vector< linked_ptr > stack_frame_info; // Begin with the context frame, and keep getting callers until there are // no more. @@ -91,7 +91,7 @@ bool Stackwalker::Walk(CallStack *stack) { // frame_pointer fields. The frame structure comes from either the // context frame (above) or a caller frame (below). - linked_ptr frame_info; + linked_ptr frame_info; // Resolve the module information, if a module map was provided. if (modules_) { diff --git a/src/processor/stackwalker_amd64.cc b/src/processor/stackwalker_amd64.cc index 7a413963..8b43933a 100644 --- a/src/processor/stackwalker_amd64.cc +++ b/src/processor/stackwalker_amd64.cc @@ -74,7 +74,7 @@ StackFrame* StackwalkerAMD64::GetContextFrame() { StackFrame* StackwalkerAMD64::GetCallerFrame( const CallStack *stack, - const vector< linked_ptr > &stack_frame_info) { + const vector< linked_ptr > &stack_frame_info) { if (!memory_ || !stack) { BPLOG(ERROR) << "Can't get caller frame without memory or stack"; return NULL; diff --git a/src/processor/stackwalker_amd64.h b/src/processor/stackwalker_amd64.h index a3e11358..4972d4fd 100644 --- a/src/processor/stackwalker_amd64.h +++ b/src/processor/stackwalker_amd64.h @@ -66,7 +66,7 @@ class StackwalkerAMD64 : public Stackwalker { virtual StackFrame* GetContextFrame(); virtual StackFrame* GetCallerFrame( const CallStack *stack, - const vector< linked_ptr > &stack_frame_info); + const vector< linked_ptr > &stack_frame_info); // Stores the CPU context corresponding to the innermost stack frame to // be returned by GetContextFrame. diff --git a/src/processor/stackwalker_arm.cc b/src/processor/stackwalker_arm.cc index cf241c86..484e75dc 100644 --- a/src/processor/stackwalker_arm.cc +++ b/src/processor/stackwalker_arm.cc @@ -74,7 +74,7 @@ StackFrame* StackwalkerARM::GetContextFrame() { StackFrame* StackwalkerARM::GetCallerFrame( const CallStack *stack, - const vector< linked_ptr > &stack_frame_info) { + const vector< linked_ptr > &stack_frame_info) { if (!memory_ || !stack) { BPLOG(ERROR) << "Can't get caller frame without memory or stack"; return NULL; diff --git a/src/processor/stackwalker_arm.h b/src/processor/stackwalker_arm.h index 4a4756b4..b9399dd7 100644 --- a/src/processor/stackwalker_arm.h +++ b/src/processor/stackwalker_arm.h @@ -66,7 +66,7 @@ class StackwalkerARM : public Stackwalker { virtual StackFrame* GetContextFrame(); virtual StackFrame* GetCallerFrame( const CallStack *stack, - const vector< linked_ptr > &stack_frame_info); + const vector< linked_ptr > &stack_frame_info); // Stores the CPU context corresponding to the innermost stack frame to // be returned by GetContextFrame. diff --git a/src/processor/stackwalker_ppc.cc b/src/processor/stackwalker_ppc.cc index 02a49b21..3e37012c 100644 --- a/src/processor/stackwalker_ppc.cc +++ b/src/processor/stackwalker_ppc.cc @@ -83,7 +83,7 @@ StackFrame* StackwalkerPPC::GetContextFrame() { StackFrame* StackwalkerPPC::GetCallerFrame( const CallStack *stack, - const vector< linked_ptr > &stack_frame_info) { + const vector< linked_ptr > &stack_frame_info) { if (!memory_ || !stack) { BPLOG(ERROR) << "Can't get caller frame without memory or stack"; return NULL; diff --git a/src/processor/stackwalker_ppc.h b/src/processor/stackwalker_ppc.h index 3d312419..5dea99fa 100644 --- a/src/processor/stackwalker_ppc.h +++ b/src/processor/stackwalker_ppc.h @@ -67,7 +67,7 @@ class StackwalkerPPC : public Stackwalker { virtual StackFrame* GetContextFrame(); virtual StackFrame* GetCallerFrame( const CallStack *stack, - const vector< linked_ptr > &stack_frame_info); + const vector< linked_ptr > &stack_frame_info); // Stores the CPU context corresponding to the innermost stack frame to // be returned by GetContextFrame. diff --git a/src/processor/stackwalker_sparc.cc b/src/processor/stackwalker_sparc.cc index b7b6f005..e0d5cfa3 100644 --- a/src/processor/stackwalker_sparc.cc +++ b/src/processor/stackwalker_sparc.cc @@ -74,7 +74,7 @@ StackFrame* StackwalkerSPARC::GetContextFrame() { StackFrame* StackwalkerSPARC::GetCallerFrame( const CallStack *stack, - const vector< linked_ptr > &stack_frame_info) { + const vector< linked_ptr > &stack_frame_info) { if (!memory_ || !stack) { BPLOG(ERROR) << "Can't get caller frame without memory or stack"; return NULL; diff --git a/src/processor/stackwalker_sparc.h b/src/processor/stackwalker_sparc.h index f051e5bb..2e5e1cee 100644 --- a/src/processor/stackwalker_sparc.h +++ b/src/processor/stackwalker_sparc.h @@ -72,7 +72,7 @@ class StackwalkerSPARC : public Stackwalker { virtual StackFrame* GetContextFrame(); virtual StackFrame* GetCallerFrame( const CallStack *stack, - const vector< linked_ptr > &stack_frame_info); + const vector< linked_ptr > &stack_frame_info); // Stores the CPU context corresponding to the innermost stack frame to // be returned by GetContextFrame. diff --git a/src/processor/stackwalker_x86.cc b/src/processor/stackwalker_x86.cc index aeb18a9f..49e25b3e 100644 --- a/src/processor/stackwalker_x86.cc +++ b/src/processor/stackwalker_x86.cc @@ -43,7 +43,7 @@ #include "google_breakpad/processor/stack_frame_cpu.h" #include "processor/linked_ptr.h" #include "processor/logging.h" -#include "processor/stack_frame_info.h" +#include "processor/windows_frame_info.h" namespace google_breakpad { @@ -88,7 +88,7 @@ StackFrame* StackwalkerX86::GetContextFrame() { StackFrame* StackwalkerX86::GetCallerFrame( const CallStack *stack, - const vector< linked_ptr > &stack_frame_info) { + const vector< linked_ptr > &stack_frame_info) { if (!memory_ || !stack) { BPLOG(ERROR) << "Can't get caller frame without memory or stack"; return NULL; @@ -96,7 +96,7 @@ StackFrame* StackwalkerX86::GetCallerFrame( StackFrameX86::FrameTrust trust = StackFrameX86::FRAME_TRUST_NONE; StackFrameX86 *last_frame = static_cast( stack->frames()->back()); - StackFrameInfo *last_frame_info = stack_frame_info.back().get(); + WindowsFrameInfo *last_frame_info = stack_frame_info.back().get(); // This stackwalker sets each frame's %esp to its value immediately prior // to the CALL into the callee. This means that %esp points to the last @@ -133,10 +133,10 @@ StackFrame* StackwalkerX86::GetCallerFrame( int frames_already_walked = stack_frame_info.size(); u_int32_t last_frame_callee_parameter_size = 0; if (frames_already_walked >= 2) { - StackFrameInfo *last_frame_callee_info = + WindowsFrameInfo *last_frame_callee_info = stack_frame_info[frames_already_walked - 2].get(); if (last_frame_callee_info && - last_frame_callee_info->valid & StackFrameInfo::VALID_PARAMETER_SIZE) { + last_frame_callee_info->valid & WindowsFrameInfo::VALID_PARAMETER_SIZE) { last_frame_callee_parameter_size = last_frame_callee_info->parameter_size; } @@ -153,7 +153,7 @@ StackFrame* StackwalkerX86::GetCallerFrame( dictionary["$esp"] = last_frame->context.esp; dictionary[".cbCalleeParams"] = last_frame_callee_parameter_size; - if (last_frame_info && last_frame_info->valid == StackFrameInfo::VALID_ALL) { + if (last_frame_info && last_frame_info->valid == WindowsFrameInfo::VALID_ALL) { // FPO debugging data is available. Initialize constants. dictionary[".cbSavedRegs"] = last_frame_info->saved_register_size; dictionary[".cbLocals"] = last_frame_info->local_size; @@ -163,7 +163,7 @@ StackFrame* StackwalkerX86::GetCallerFrame( last_frame_info->saved_register_size; } if (last_frame_info && - last_frame_info->valid & StackFrameInfo::VALID_PARAMETER_SIZE) { + last_frame_info->valid & WindowsFrameInfo::VALID_PARAMETER_SIZE) { // This is treated separately because it can either come from FPO data or // from other debugging data. dictionary[".cbParams"] = last_frame_info->parameter_size; @@ -181,7 +181,7 @@ StackFrame* StackwalkerX86::GetCallerFrame( string program_string; bool traditional_frame = true; bool recover_ebp = true; - if (last_frame_info && last_frame_info->valid == StackFrameInfo::VALID_ALL) { + if (last_frame_info && last_frame_info->valid == WindowsFrameInfo::VALID_ALL) { // FPO data available. traditional_frame = false; trust = StackFrameX86::FRAME_TRUST_CFI; diff --git a/src/processor/stackwalker_x86.h b/src/processor/stackwalker_x86.h index d4137ebf..bd6df1fa 100644 --- a/src/processor/stackwalker_x86.h +++ b/src/processor/stackwalker_x86.h @@ -68,7 +68,7 @@ class StackwalkerX86 : public Stackwalker { virtual StackFrame* GetContextFrame(); virtual StackFrame* GetCallerFrame( const CallStack *stack, - const vector< linked_ptr > &stack_frame_info); + const vector< linked_ptr > &stack_frame_info); // Scan the stack starting at location_start, looking for an address // that looks like a valid instruction pointer. Addresses must diff --git a/src/processor/windows_frame_info.h b/src/processor/windows_frame_info.h new file mode 100644 index 00000000..0665dcdf --- /dev/null +++ b/src/processor/windows_frame_info.h @@ -0,0 +1,126 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// windows_frame_info.h: Holds debugging information about a stack frame. +// +// This structure is specific to Windows debugging information obtained +// from pdb files using the DIA API. +// +// Author: Mark Mentovai + + +#ifndef PROCESSOR_WINDOWS_FRAME_INFO_H__ +#define PROCESSOR_WINDOWS_FRAME_INFO_H__ + +#include + +#include "google_breakpad/common/breakpad_types.h" + +namespace google_breakpad { + +struct WindowsFrameInfo { + public: + enum Validity { + VALID_NONE = 0, + VALID_PARAMETER_SIZE = 1, + VALID_ALL = -1 + }; + + WindowsFrameInfo() : valid(VALID_NONE), + prolog_size(0), + epilog_size(0), + parameter_size(0), + saved_register_size(0), + local_size(0), + max_stack_size(0), + allocates_base_pointer(0), + program_string() {} + + WindowsFrameInfo(u_int32_t set_prolog_size, + u_int32_t set_epilog_size, + u_int32_t set_parameter_size, + u_int32_t set_saved_register_size, + u_int32_t set_local_size, + u_int32_t set_max_stack_size, + int set_allocates_base_pointer, + const std::string set_program_string) + : valid(VALID_ALL), + prolog_size(set_prolog_size), + epilog_size(set_epilog_size), + parameter_size(set_parameter_size), + saved_register_size(set_saved_register_size), + local_size(set_local_size), + max_stack_size(set_max_stack_size), + allocates_base_pointer(set_allocates_base_pointer), + program_string(set_program_string) {} + + // CopyFrom makes "this" WindowsFrameInfo object identical to "that". + void CopyFrom(const WindowsFrameInfo &that) { + valid = that.valid; + prolog_size = that.prolog_size; + epilog_size = that.epilog_size; + parameter_size = that.parameter_size; + saved_register_size = that.saved_register_size; + local_size = that.local_size; + max_stack_size = that.max_stack_size; + allocates_base_pointer = that.allocates_base_pointer; + program_string = that.program_string; + } + + // Clears the WindowsFrameInfo object so that users will see it as though + // it contains no information. + void Clear() { + valid = VALID_NONE; + program_string.erase(); + } + + // Identifies which fields in the structure are valid. This is of + // type Validity, but it is defined as an int because it's not + // possible to OR values into an enumerated type. Users must check + // this field before using any other. + int valid; + + // These values come from IDiaFrameData. + u_int32_t prolog_size; + u_int32_t epilog_size; + u_int32_t parameter_size; + u_int32_t saved_register_size; + u_int32_t local_size; + u_int32_t max_stack_size; + + // Only one of allocates_base_pointer or program_string will be valid. + // If program_string is empty, use allocates_base_pointer. + bool allocates_base_pointer; + std::string program_string; +}; + +} // namespace google_breakpad + + +#endif // PROCESSOR_WINDOWS_FRAME_INFO_H__ -- cgit v1.2.1