toolkit/crashreporter/google-breakpad/src/common/arm_ex_reader.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.

michael@0 1
michael@0 2 /* libunwind - a platform-independent unwind library
michael@0 3 Copyright 2011 Linaro Limited
michael@0 4
michael@0 5 This file is part of libunwind.
michael@0 6
michael@0 7 Permission is hereby granted, free of charge, to any person obtaining
michael@0 8 a copy of this software and associated documentation files (the
michael@0 9 "Software"), to deal in the Software without restriction, including
michael@0 10 without limitation the rights to use, copy, modify, merge, publish,
michael@0 11 distribute, sublicense, and/or sell copies of the Software, and to
michael@0 12 permit persons to whom the Software is furnished to do so, subject to
michael@0 13 the following conditions:
michael@0 14
michael@0 15 The above copyright notice and this permission notice shall be
michael@0 16 included in all copies or substantial portions of the Software.
michael@0 17
michael@0 18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
michael@0 19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
michael@0 20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
michael@0 21 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
michael@0 22 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
michael@0 23 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
michael@0 24 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
michael@0 25
michael@0 26 // Copyright (c) 2010 Google Inc.
michael@0 27 // All rights reserved.
michael@0 28 //
michael@0 29 // Redistribution and use in source and binary forms, with or without
michael@0 30 // modification, are permitted provided that the following conditions are
michael@0 31 // met:
michael@0 32 //
michael@0 33 // * Redistributions of source code must retain the above copyright
michael@0 34 // notice, this list of conditions and the following disclaimer.
michael@0 35 // * Redistributions in binary form must reproduce the above
michael@0 36 // copyright notice, this list of conditions and the following disclaimer
michael@0 37 // in the documentation and/or other materials provided with the
michael@0 38 // distribution.
michael@0 39 // * Neither the name of Google Inc. nor the names of its
michael@0 40 // contributors may be used to endorse or promote products derived from
michael@0 41 // this software without specific prior written permission.
michael@0 42 //
michael@0 43 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
michael@0 44 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
michael@0 45 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
michael@0 46 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
michael@0 47 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@0 48 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@0 49 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
michael@0 50 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
michael@0 51 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
michael@0 52 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
michael@0 53 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
michael@0 54
michael@0 55
michael@0 56 // Derived from libunwind, with extensive modifications.
michael@0 57
michael@0 58 #ifndef COMMON_ARM_EX_READER_H__
michael@0 59 #define COMMON_ARM_EX_READER_H__
michael@0 60
michael@0 61 #include "common/arm_ex_to_module.h"
michael@0 62 #include "common/memory_range.h"
michael@0 63
michael@0 64 namespace arm_ex_reader {
michael@0 65
michael@0 66 // This class is a reader for ARM unwind information
michael@0 67 // from .ARM.exidx and .ARM.extab sections.
michael@0 68 class ExceptionTableInfo {
michael@0 69 public:
michael@0 70 ExceptionTableInfo(const char* exidx, size_t exidx_size,
michael@0 71 const char* extab, size_t extab_size,
michael@0 72 uint32_t text_last_svma,
michael@0 73 arm_ex_to_module::ARMExToModule* handler,
michael@0 74 const char* mapping_addr,
michael@0 75 uint32_t loading_addr)
michael@0 76 : mr_exidx_(google_breakpad::MemoryRange(exidx, exidx_size)),
michael@0 77 mr_extab_(google_breakpad::MemoryRange(extab, extab_size)),
michael@0 78 text_last_svma_(text_last_svma),
michael@0 79 handler_(handler), mapping_addr_(mapping_addr),
michael@0 80 loading_addr_(loading_addr) { }
michael@0 81
michael@0 82 ~ExceptionTableInfo() { }
michael@0 83
michael@0 84 // Parses the entries in .ARM.exidx and possibly
michael@0 85 // in .ARM.extab tables, reports what we find to
michael@0 86 // arm_ex_to_module::ARMExToModule.
michael@0 87 void Start();
michael@0 88
michael@0 89 private:
michael@0 90 google_breakpad::MemoryRange mr_exidx_;
michael@0 91 google_breakpad::MemoryRange mr_extab_;
michael@0 92 uint32_t text_last_svma_;
michael@0 93 arm_ex_to_module::ARMExToModule* handler_;
michael@0 94 const char* mapping_addr_;
michael@0 95 uint32_t loading_addr_;
michael@0 96
michael@0 97 enum ExExtractResult {
michael@0 98 ExSuccess, // success
michael@0 99 ExInBufOverflow, // out-of-range while reading .exidx
michael@0 100 ExOutBufOverflow, // output buffer is too small
michael@0 101 ExCantUnwind, // this function is marked CANT_UNWIND
michael@0 102 ExCantRepresent, // entry valid, but we can't represent it
michael@0 103 ExInvalid // entry is invalid
michael@0 104 };
michael@0 105 ExExtractResult
michael@0 106 ExtabEntryExtract(const struct arm_ex_to_module::exidx_entry* entry,
michael@0 107 uint8_t* buf, size_t buf_size,
michael@0 108 /*OUT*/size_t* buf_used);
michael@0 109
michael@0 110 int ExtabEntryDecode(const uint8_t* buf, size_t buf_size);
michael@0 111 };
michael@0 112
michael@0 113 } // namespace arm_ex_reader
michael@0 114
michael@0 115 #endif // COMMON_ARM_EX_READER_H__

mercurial