From b64d76a3b8a692f431d440f6a4416e7c70aad4ef Mon Sep 17 00:00:00 2001 From: jimblandy Date: Wed, 23 Dec 2009 22:32:14 +0000 Subject: [PATCH] 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 --- Makefile.am | 2 +- Makefile.in | 2 +- .../processor/basic_source_line_resolver.h | 2 +- .../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/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 +- ...tack_frame_info.h => windows_frame_info.h} | 20 +++++++------- 19 files changed, 55 insertions(+), 55 deletions(-) rename src/processor/{stack_frame_info.h => windows_frame_info.h} (89%) diff --git a/Makefile.am b/Makefile.am index deb33a90..e4e6a4a6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -91,7 +91,7 @@ src_libbreakpad_la_SOURCES = \ src/processor/scoped_ptr.h \ src/processor/simple_symbol_supplier.cc \ src/processor/simple_symbol_supplier.h \ - src/processor/stack_frame_info.h \ + src/processor/windows_frame_info.h \ src/processor/stackwalker.cc \ src/processor/stackwalker_amd64.cc \ src/processor/stackwalker_amd64.h \ diff --git a/Makefile.in b/Makefile.in index 8718b685..895122e1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -475,7 +475,7 @@ src_libbreakpad_la_SOURCES = \ src/processor/scoped_ptr.h \ src/processor/simple_symbol_supplier.cc \ src/processor/simple_symbol_supplier.h \ - src/processor/stack_frame_info.h \ + src/processor/windows_frame_info.h \ src/processor/stackwalker.cc \ src/processor/stackwalker_amd64.cc \ src/processor/stackwalker_amd64.h \ 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/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/stack_frame_info.h b/src/processor/windows_frame_info.h similarity index 89% rename from src/processor/stack_frame_info.h rename to src/processor/windows_frame_info.h index 052a9338..0665dcdf 100644 --- a/src/processor/stack_frame_info.h +++ b/src/processor/windows_frame_info.h @@ -27,7 +27,7 @@ // (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. +// 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. @@ -35,8 +35,8 @@ // Author: Mark Mentovai -#ifndef PROCESSOR_STACK_FRAME_INFO_H__ -#define PROCESSOR_STACK_FRAME_INFO_H__ +#ifndef PROCESSOR_WINDOWS_FRAME_INFO_H__ +#define PROCESSOR_WINDOWS_FRAME_INFO_H__ #include @@ -44,7 +44,7 @@ namespace google_breakpad { -struct StackFrameInfo { +struct WindowsFrameInfo { public: enum Validity { VALID_NONE = 0, @@ -52,7 +52,7 @@ struct StackFrameInfo { VALID_ALL = -1 }; - StackFrameInfo() : valid(VALID_NONE), + WindowsFrameInfo() : valid(VALID_NONE), prolog_size(0), epilog_size(0), parameter_size(0), @@ -62,7 +62,7 @@ struct StackFrameInfo { allocates_base_pointer(0), program_string() {} - StackFrameInfo(u_int32_t set_prolog_size, + 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, @@ -80,8 +80,8 @@ struct StackFrameInfo { 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) { + // 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; @@ -93,7 +93,7 @@ struct StackFrameInfo { program_string = that.program_string; } - // Clears the StackFrameInfo object so that users will see it as though + // Clears the WindowsFrameInfo object so that users will see it as though // it contains no information. void Clear() { valid = VALID_NONE; @@ -123,4 +123,4 @@ struct StackFrameInfo { } // namespace google_breakpad -#endif // PROCESSOR_STACK_FRAME_INFO_H__ +#endif // PROCESSOR_WINDOWS_FRAME_INFO_H__