toolkit/crashreporter/google-breakpad/src/processor/stackwalker_arm.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/crashreporter/google-breakpad/src/processor/stackwalker_arm.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,107 @@
     1.4 +// -*- mode: C++ -*-
     1.5 +
     1.6 +// Copyright (c) 2010 Google Inc.
     1.7 +// All rights reserved.
     1.8 +//
     1.9 +// Redistribution and use in source and binary forms, with or without
    1.10 +// modification, are permitted provided that the following conditions are
    1.11 +// met:
    1.12 +//
    1.13 +//     * Redistributions of source code must retain the above copyright
    1.14 +// notice, this list of conditions and the following disclaimer.
    1.15 +//     * Redistributions in binary form must reproduce the above
    1.16 +// copyright notice, this list of conditions and the following disclaimer
    1.17 +// in the documentation and/or other materials provided with the
    1.18 +// distribution.
    1.19 +//     * Neither the name of Google Inc. nor the names of its
    1.20 +// contributors may be used to endorse or promote products derived from
    1.21 +// this software without specific prior written permission.
    1.22 +//
    1.23 +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1.24 +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    1.25 +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    1.26 +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    1.27 +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.28 +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.29 +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    1.30 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    1.31 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    1.32 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    1.33 +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.34 +
    1.35 +// stackwalker_arm.h: arm-specific stackwalker.
    1.36 +//
    1.37 +// Provides stack frames given arm register context and a memory region
    1.38 +// corresponding to an arm stack.
    1.39 +//
    1.40 +// Author: Mark Mentovai, Ted Mielczarek
    1.41 +
    1.42 +
    1.43 +#ifndef PROCESSOR_STACKWALKER_ARM_H__
    1.44 +#define PROCESSOR_STACKWALKER_ARM_H__
    1.45 +
    1.46 +#include "google_breakpad/common/breakpad_types.h"
    1.47 +#include "google_breakpad/common/minidump_format.h"
    1.48 +#include "google_breakpad/processor/stackwalker.h"
    1.49 +
    1.50 +namespace google_breakpad {
    1.51 +
    1.52 +class CodeModules;
    1.53 +
    1.54 +class StackwalkerARM : public Stackwalker {
    1.55 + public:
    1.56 +  // context is an arm context object that gives access to arm-specific
    1.57 +  // register state corresponding to the innermost called frame to be
    1.58 +  // included in the stack.  The other arguments are passed directly through
    1.59 +  // to the base Stackwalker constructor.
    1.60 +  StackwalkerARM(const SystemInfo* system_info,
    1.61 +                 const MDRawContextARM* context,
    1.62 +                 int fp_register,
    1.63 +                 MemoryRegion* memory,
    1.64 +                 const CodeModules* modules,
    1.65 +                 StackFrameSymbolizer* frame_symbolizer);
    1.66 +
    1.67 +  // Change the context validity mask of the frame returned by
    1.68 +  // GetContextFrame to VALID. This is only for use by unit tests; the
    1.69 +  // default behavior is correct for all application code.
    1.70 +  void SetContextFrameValidity(int valid) { context_frame_validity_ = valid; }
    1.71 +
    1.72 + private:
    1.73 +  // Implementation of Stackwalker, using arm context and stack conventions.
    1.74 +  virtual StackFrame* GetContextFrame();
    1.75 +  virtual StackFrame* GetCallerFrame(const CallStack* stack,
    1.76 +                                     bool stack_scan_allowed);
    1.77 +
    1.78 +  // Use cfi_frame_info (derived from STACK CFI records) to construct
    1.79 +  // the frame that called frames.back(). The caller takes ownership
    1.80 +  // of the returned frame. Return NULL on failure.
    1.81 +  StackFrameARM* GetCallerByCFIFrameInfo(const vector<StackFrame*> &frames,
    1.82 +                                         CFIFrameInfo* cfi_frame_info);
    1.83 +
    1.84 +  // Use the frame pointer. The caller takes ownership of the returned frame.
    1.85 +  // Return NULL on failure.
    1.86 +  StackFrameARM* GetCallerByFramePointer(const vector<StackFrame*> &frames);
    1.87 +
    1.88 +  // Scan the stack for plausible return addresses. The caller takes ownership
    1.89 +  // of the returned frame. Return NULL on failure.
    1.90 +  StackFrameARM* GetCallerByStackScan(const vector<StackFrame*> &frames);
    1.91 +
    1.92 +  // Stores the CPU context corresponding to the youngest stack frame, to
    1.93 +  // be returned by GetContextFrame.
    1.94 +  const MDRawContextARM* context_;
    1.95 +
    1.96 +  // The register to use a as frame pointer. The value is -1 if frame pointer
    1.97 +  // cannot be used.
    1.98 +  int fp_register_;
    1.99 +
   1.100 +  // Validity mask for youngest stack frame. This is always
   1.101 +  // CONTEXT_VALID_ALL in real use; it is only changeable for the sake of
   1.102 +  // unit tests.
   1.103 +  int context_frame_validity_;
   1.104 +};
   1.105 +
   1.106 +
   1.107 +}  // namespace google_breakpad
   1.108 +
   1.109 +
   1.110 +#endif  // PROCESSOR_STACKWALKER_ARM_H__

mercurial