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

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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_READER_H__
    59 #define COMMON_ARM_EX_READER_H__
    61 #include "common/arm_ex_to_module.h"
    62 #include "common/memory_range.h"
    64 namespace arm_ex_reader {
    66 // This class is a reader for ARM unwind information
    67 // from .ARM.exidx and .ARM.extab sections.
    68 class ExceptionTableInfo {
    69  public:
    70   ExceptionTableInfo(const char* exidx, size_t exidx_size,
    71                      const char* extab, size_t extab_size,
    72                      uint32_t text_last_svma,
    73                      arm_ex_to_module::ARMExToModule* handler,
    74                      const char* mapping_addr,
    75                      uint32_t loading_addr)
    76       : mr_exidx_(google_breakpad::MemoryRange(exidx, exidx_size)),
    77         mr_extab_(google_breakpad::MemoryRange(extab, extab_size)),
    78         text_last_svma_(text_last_svma),
    79         handler_(handler), mapping_addr_(mapping_addr),
    80         loading_addr_(loading_addr) { }
    82   ~ExceptionTableInfo() { }
    84   // Parses the entries in .ARM.exidx and possibly
    85   // in .ARM.extab tables, reports what we find to
    86   // arm_ex_to_module::ARMExToModule.
    87   void Start();
    89  private:
    90   google_breakpad::MemoryRange mr_exidx_;
    91   google_breakpad::MemoryRange mr_extab_;
    92   uint32_t text_last_svma_;
    93   arm_ex_to_module::ARMExToModule* handler_;
    94   const char* mapping_addr_;
    95   uint32_t loading_addr_;
    97   enum ExExtractResult {
    98     ExSuccess,        // success
    99     ExInBufOverflow,  // out-of-range while reading .exidx
   100     ExOutBufOverflow, // output buffer is too small
   101     ExCantUnwind,     // this function is marked CANT_UNWIND
   102     ExCantRepresent,  // entry valid, but we can't represent it
   103     ExInvalid         // entry is invalid
   104   };
   105   ExExtractResult
   106     ExtabEntryExtract(const struct arm_ex_to_module::exidx_entry* entry,
   107                       uint8_t* buf, size_t buf_size,
   108                       /*OUT*/size_t* buf_used);
   110   int ExtabEntryDecode(const uint8_t* buf, size_t buf_size);
   111 };
   113 } // namespace arm_ex_reader
   115 #endif // COMMON_ARM_EX_READER_H__

mercurial