diff options
author | jimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-03-16 16:28:32 +0000 |
---|---|---|
committer | jimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-03-16 16:28:32 +0000 |
commit | 6d3a825dbf5b924c2e754309b3008e462af1d8d2 (patch) | |
tree | cb3fe204a65015c308b7a6324b96e73e528e57c8 /src/google_breakpad/processor | |
parent | Breakpad processor: Unit tests for StackwalkerX86. (diff) | |
download | breakpad-6d3a825dbf5b924c2e754309b3008e462af1d8d2.tar.xz |
Breakpad: Add minidump processor support for DWARF Call Frame Information.
Add a CFIFrameInfo class (named for symmetry with WindowsFrameInfo) to
represent the set of STACK CFI rules in effect at a given instruction,
and apply them to a set of register values. Provide a SimpleCFIWalker
class template, to allow the essential CFI code to be shared amongst
the different architectures.
Teach BasicSourceLineResolver to partially parse 'STACK CFI' records,
and produce the set of rules in effect at a given instruction on
demand, by combining the initial rule set and the appropriate rule
deltas in a CFIFrameInfo object.
Adapt StackwalkerX86 and StackFrameX86 to retrieve, store, and apply
CFI stack walking information.
Add validity flags for all the general-purpose registers to
StackFrameX86::ContextValidity.
a=jimblandy, r=mmentovai
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@549 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/google_breakpad/processor')
3 files changed, 28 insertions, 12 deletions
diff --git a/src/google_breakpad/processor/basic_source_line_resolver.h b/src/google_breakpad/processor/basic_source_line_resolver.h index 8ac47e52..831556b5 100644 --- a/src/google_breakpad/processor/basic_source_line_resolver.h +++ b/src/google_breakpad/processor/basic_source_line_resolver.h @@ -60,12 +60,10 @@ class BasicSourceLineResolver : public SourceLineResolverInterface { virtual bool LoadModuleUsingMapBuffer(const string &module_name, const string &map_buffer); - virtual bool HasModule(const string &module_name) const; - virtual void FillSourceLineInfo(StackFrame *frame) const; - virtual WindowsFrameInfo *FindWindowsFrameInfo(const StackFrame *frame) const; + virtual CFIFrameInfo *FindCFIFrameInfo(const StackFrame *frame) const; private: template<class T> 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 99710376..a7ec9b7f 100644 --- a/src/google_breakpad/processor/source_line_resolver_interface.h +++ b/src/google_breakpad/processor/source_line_resolver_interface.h @@ -43,6 +43,7 @@ using std::string; struct StackFrame; struct WindowsFrameInfo; +struct CFIFrameInfo; class SourceLineResolverInterface { public: @@ -78,6 +79,12 @@ class SourceLineResolverInterface { virtual WindowsFrameInfo *FindWindowsFrameInfo(const StackFrame *frame) const = 0; + // If CFI stack walking information is available covering ADDRESS, + // return a CFIFrameInfo structure describing it. If the information + // is not available, return NULL. The caller takes ownership of any + // returned CFIFrameInfo object. + virtual CFIFrameInfo *FindCFIFrameInfo(const StackFrame *frame) const = 0; + protected: // SourceLineResolverInterface cannot be instantiated except by subclasses SourceLineResolverInterface() {} diff --git a/src/google_breakpad/processor/stack_frame_cpu.h b/src/google_breakpad/processor/stack_frame_cpu.h index 857f373e..8b88fdc6 100644 --- a/src/google_breakpad/processor/stack_frame_cpu.h +++ b/src/google_breakpad/processor/stack_frame_cpu.h @@ -1,3 +1,5 @@ +// -*- mode: c++ -*- + // Copyright (c) 2010 Google Inc. // All rights reserved. // @@ -45,18 +47,26 @@ namespace google_breakpad { struct WindowsFrameInfo; +struct CFIFrameInfo; struct StackFrameX86 : public StackFrame { - // ContextValidity has one entry for each relevant hardware pointer register - // (%eip and %esp) and one entry for each nonvolatile (callee-save) register. + // ContextValidity has one entry for each relevant hardware pointer + // register (%eip and %esp) and one entry for each general-purpose + // register. It's worthwhile having validity flags for caller-saves + // registers: they are valid in the youngest frame, and such a frame + // might save a callee-saves register in a caller-saves register, but + // SimpleCFIWalker won't touch registers unless they're marked as valid. enum ContextValidity { CONTEXT_VALID_NONE = 0, CONTEXT_VALID_EIP = 1 << 0, CONTEXT_VALID_ESP = 1 << 1, CONTEXT_VALID_EBP = 1 << 2, - CONTEXT_VALID_EBX = 1 << 3, - CONTEXT_VALID_ESI = 1 << 4, - CONTEXT_VALID_EDI = 1 << 5, + CONTEXT_VALID_EAX = 1 << 3, + CONTEXT_VALID_EBX = 1 << 4, + CONTEXT_VALID_ECX = 1 << 5, + CONTEXT_VALID_EDX = 1 << 6, + CONTEXT_VALID_ESI = 1 << 7, + CONTEXT_VALID_EDI = 1 << 8, CONTEXT_VALID_ALL = -1 }; @@ -77,7 +87,8 @@ struct StackFrameX86 : public StackFrame { : context(), context_validity(CONTEXT_VALID_NONE), trust(FRAME_TRUST_NONE), - windows_frame_info(NULL) {} + windows_frame_info(NULL), + cfi_frame_info(NULL) {} ~StackFrameX86(); // Register state. This is only fully valid for the topmost frame in a @@ -95,10 +106,10 @@ struct StackFrameX86 : public StackFrame { // of this frame. FrameTrust trust; - // Any stack walking information we found describing - // this.instruction. These may be NULL if we couldn't find the - // appropriate information. + // Any stack walking information we found describing this.instruction. + // These may be NULL if there is no such information for that address. WindowsFrameInfo *windows_frame_info; + CFIFrameInfo *cfi_frame_info; }; struct StackFramePPC : public StackFrame { |