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

     1 // Copyright (c) 2012, Google Inc.
     2 // All rights reserved.
     3 //
     4 // Redistribution and use in source and binary forms, with or without
     5 // modification, are permitted provided that the following conditions are
     6 // met:
     7 //
     8 //     * Redistributions of source code must retain the above copyright
     9 // notice, this list of conditions and the following disclaimer.
    10 //     * Redistributions in binary form must reproduce the above
    11 // copyright notice, this list of conditions and the following disclaimer
    12 // in the documentation and/or other materials provided with the
    13 // distribution.
    14 //     * Neither the name of Google Inc. nor the names of its
    15 // contributors may be used to endorse or promote products derived from
    16 // this software without specific prior written permission.
    17 //
    18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    30 #ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H
    31 #define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H
    33 #include <stdint.h>
    34 #include <libgen.h>
    36 #ifdef __cplusplus
    37 extern "C" {
    38 #endif  // __cplusplus
    40 // The Android <elf.h> provides BSD-based definitions for the ElfXX_Nhdr
    41 // types 
    42 // always source-compatible with the GLibc/kernel ones. To overcome this
    43 // issue without modifying a lot of code in Breakpad, use an ugly macro
    44 // renaming trick with #include_next
    46 // Avoid conflict with BSD-based definition of ElfXX_Nhdr.
    47 // Unfortunately, their field member names do not use a 'n_' prefix.
    48 #define Elf32_Nhdr   __bsd_Elf32_Nhdr
    49 #define Elf64_Nhdr   __bsd_Elf64_Nhdr
    51 // In case they are defined by the NDK version
    52 #define Elf32_auxv_t  __bionic_Elf32_auxv_t
    53 #define Elf64_auxv_t  __bionic_Elf64_auxv_t
    55 #define Elf32_Dyn     __bionic_Elf32_Dyn
    56 #define Elf64_Dyn     __bionic_Elf64_Dyn
    58 #include_next <elf.h>
    60 #undef Elf32_Nhdr
    61 #undef Elf64_Nhdr
    63 typedef struct {
    64   Elf32_Word n_namesz;
    65   Elf32_Word n_descsz;
    66   Elf32_Word n_type;
    67 } Elf32_Nhdr;
    69 typedef struct {
    70   Elf64_Word n_namesz;
    71   Elf64_Word n_descsz;
    72   Elf64_Word n_type;
    73 } Elf64_Nhdr;
    75 #undef Elf32_auxv_t
    76 #undef Elf64_auxv_t
    78 typedef struct {
    79     uint32_t a_type;
    80     union {
    81       uint32_t a_val;
    82     } a_un;
    83 } Elf32_auxv_t;
    85 typedef struct {
    86     uint64_t a_type;
    87     union {
    88       uint64_t a_val;
    89     } a_un;
    90 } Elf64_auxv_t;
    92 #undef Elf32_Dyn
    93 #undef Elf64_Dyn
    95 typedef struct {
    96   Elf32_Sword   d_tag;
    97   union {
    98     Elf32_Word  d_val;
    99     Elf32_Addr  d_ptr;
   100   } d_un;
   101 } Elf32_Dyn;
   103 typedef struct {
   104   Elf64_Sxword   d_tag;
   105   union {
   106     Elf64_Xword  d_val;
   107     Elf64_Addr   d_ptr;
   108   } d_un;
   109 } Elf64_Dyn;
   112 // __WORDSIZE is GLibc-specific and used by Google Breakpad on Linux.
   113 // All Android platforms are 32-bit for now.
   114 #ifndef __WORDSIZE
   115 #define __WORDSIZE 32
   116 #endif
   118 // The Android headers don't always define this constant.
   119 #ifndef EM_X86_64
   120 #define EM_X86_64  62
   121 #endif
   123 #ifndef EM_PPC64
   124 #define EM_PPC64   21
   125 #endif
   127 #ifndef EM_S390
   128 #define EM_S390    22
   129 #endif
   131 #if !defined(AT_SYSINFO_EHDR)
   132 #define AT_SYSINFO_EHDR 33
   133 #endif
   135 #if !defined(NT_PRSTATUS)
   136 #define NT_PRSTATUS 1
   137 #endif
   139 #if !defined(NT_PRPSINFO)
   140 #define NT_PRPSINFO 3
   141 #endif
   143 #if !defined(NT_AUXV)
   144 #define NT_AUXV   6
   145 #endif
   147 #if !defined(NT_PRXFPREG)
   148 #define NT_PRXFPREG 0x46e62b7f
   149 #endif
   151 #if !defined(NT_FPREGSET)
   152 #define NT_FPREGSET 2
   153 #endif
   155 #ifdef __cplusplus
   156 }  // extern "C"
   157 #endif  // __cplusplus
   159 #endif  // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H

mercurial