toolkit/crashreporter/google-breakpad/src/common/arm_ex_to_module.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     2 /* libunwind - a platform-independent unwind library
     3    Copyright 2011 Linaro Limited
     5 This file is part of libunwind.
     7 Permission is hereby granted, free of charge, to any person obtaining
     8 a copy of this software and associated documentation files (the
     9 "Software"), to deal in the Software without restriction, including
    10 without limitation the rights to use, copy, modify, merge, publish,
    11 distribute, sublicense, and/or sell copies of the Software, and to
    12 permit persons to whom the Software is furnished to do so, subject to
    13 the following conditions:
    15 The above copyright notice and this permission notice shall be
    16 included in all copies or substantial portions of the Software.
    18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    21 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    22 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    23 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    24 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
    26 // Copyright (c) 2010 Google Inc.
    27 // All rights reserved.
    28 //
    29 // Redistribution and use in source and binary forms, with or without
    30 // modification, are permitted provided that the following conditions are
    31 // met:
    32 //
    33 //     * Redistributions of source code must retain the above copyright
    34 // notice, this list of conditions and the following disclaimer.
    35 //     * Redistributions in binary form must reproduce the above
    36 // copyright notice, this list of conditions and the following disclaimer
    37 // in the documentation and/or other materials provided with the
    38 // distribution.
    39 //     * Neither the name of Google Inc. nor the names of its
    40 // contributors may be used to endorse or promote products derived from
    41 // this software without specific prior written permission.
    42 //
    43 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    44 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    45 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    46 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    47 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    48 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    49 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    50 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    51 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    52 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    53 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    56 // Derived from libunwind, with extensive modifications.
    58 #ifndef COMMON_ARM_EX_TO_MODULE__
    59 #define COMMON_ARM_EX_TO_MODULE__
    61 #include "common/module.h"
    63 #include <string.h>
    65 namespace arm_ex_to_module {
    67 using google_breakpad::Module;
    69 typedef enum extab_cmd {
    70   ARM_EXIDX_CMD_FINISH,
    71   ARM_EXIDX_CMD_SUB_FROM_VSP,
    72   ARM_EXIDX_CMD_ADD_TO_VSP,
    73   ARM_EXIDX_CMD_REG_POP,
    74   ARM_EXIDX_CMD_REG_TO_SP,
    75   ARM_EXIDX_CMD_VFP_POP,
    76   ARM_EXIDX_CMD_WREG_POP,
    77   ARM_EXIDX_CMD_WCGR_POP,
    78   ARM_EXIDX_CMD_RESERVED,
    79   ARM_EXIDX_CMD_REFUSED,
    80 } extab_cmd_t;
    82 struct exidx_entry {
    83   uint32_t addr;
    84   uint32_t data;
    85 };
    87 struct extab_data {
    88   extab_cmd_t cmd;
    89   uint32_t data;
    90 };
    92 enum extab_cmd_flags {
    93   ARM_EXIDX_VFP_SHIFT_16 = 1 << 16,
    94   ARM_EXIDX_VFP_FSTMD = 1 << 17, // distinguishes FSTMxxD from FSTMxxX
    95 };
    97 static const char* const regnames[] = {
    98  "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
    99  "r8", "r9", "r10", "r11", "r12", "sp", "lr", "pc",
   100  "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
   101  "fps", "cpsr"
   102 };
   104 // Receives information from arm_ex_reader::ExceptionTableInfo
   105 // and adds it to the Module object
   106 class ARMExToModule {
   107  public:
   108   ARMExToModule(Module* module)
   109       : module_(module) { }
   110   ~ARMExToModule() { }
   111   void AddStackFrame(uintptr_t addr, size_t size);
   112   int ImproveStackFrame(const struct extab_data* edata);
   113   void DeleteStackFrame();
   114   void SubmitStackFrame();
   115  private:
   116   Module* module_;
   117   Module::StackFrameEntry* stack_frame_entry_;
   118   Module::Expr vsp_;
   119   int TranslateCmd(const struct extab_data* edata,
   120                    Module::StackFrameEntry* entry,
   121                    Module::Expr& vsp);
   122 };
   124 } // namespace arm_ex_to_module
   126 #endif // COMMON_ARM_EX_TO_MODULE__

mercurial