Breakpad processor: Support AMD64 stack unwinding driven by DWARF CFI.

This adds support for 'STACK CFI' records (DWARF CFI) to the AMD64
stack walker. This is necessary for the stack trace to include any
frames other than the youngest. Unit tests are included.

a=jimblandy, r=mmentovai


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@554 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
jimblandy 2010-03-16 16:49:53 +00:00
parent c609f474a9
commit e7e1e1ebf5
7 changed files with 631 additions and 53 deletions

View file

@ -42,6 +42,8 @@
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/common/minidump_format.h"
#include "google_breakpad/processor/stackwalker.h"
#include "google_breakpad/processor/stack_frame_cpu.h"
#include "processor/cfi_frame_info.h"
namespace google_breakpad {
@ -61,14 +63,29 @@ class StackwalkerAMD64 : public Stackwalker {
SourceLineResolverInterface *resolver);
private:
// A STACK CFI-driven frame walker for the AMD64
typedef SimpleCFIWalker<u_int64_t, MDRawContextAMD64> CFIWalker;
// Implementation of Stackwalker, using amd64 context (stack pointer in %rsp,
// stack base in %rbp) and stack conventions (saved stack pointer at 0(%rbp))
virtual StackFrame* GetContextFrame();
virtual StackFrame* GetCallerFrame(const CallStack *stack);
// Use cfi_frame_info (derived from STACK CFI records) to construct
// the frame that called frames.back(). The caller takes ownership
// of the returned frame. Return NULL on failure.
StackFrameAMD64 *GetCallerByCFIFrameInfo(const vector<StackFrame *> &frames,
CFIFrameInfo *cfi_frame_info);
// Stores the CPU context corresponding to the innermost stack frame to
// be returned by GetContextFrame.
const MDRawContextAMD64 *context_;
// Our register map, for cfi_walker_.
static const CFIWalker::RegisterSet cfi_register_map_[];
// Our CFI frame walker.
const CFIWalker cfi_walker_;
};