toolkit/crashreporter/google-breakpad/src/processor/simple_symbol_supplier.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.

michael@0 1 // Copyright (c) 2006, Google Inc.
michael@0 2 // All rights reserved.
michael@0 3 //
michael@0 4 // Redistribution and use in source and binary forms, with or without
michael@0 5 // modification, are permitted provided that the following conditions are
michael@0 6 // met:
michael@0 7 //
michael@0 8 // * Redistributions of source code must retain the above copyright
michael@0 9 // notice, this list of conditions and the following disclaimer.
michael@0 10 // * Redistributions in binary form must reproduce the above
michael@0 11 // copyright notice, this list of conditions and the following disclaimer
michael@0 12 // in the documentation and/or other materials provided with the
michael@0 13 // distribution.
michael@0 14 // * Neither the name of Google Inc. nor the names of its
michael@0 15 // contributors may be used to endorse or promote products derived from
michael@0 16 // this software without specific prior written permission.
michael@0 17 //
michael@0 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
michael@0 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
michael@0 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
michael@0 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
michael@0 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@0 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@0 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
michael@0 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
michael@0 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
michael@0 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
michael@0 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
michael@0 29
michael@0 30 // simple_symbol_supplier.h: A simple SymbolSupplier implementation
michael@0 31 //
michael@0 32 // SimpleSymbolSupplier is a straightforward implementation of SymbolSupplier
michael@0 33 // that stores symbol files in a filesystem tree. A SimpleSymbolSupplier is
michael@0 34 // created with one or more base directories, which are the root paths for all
michael@0 35 // symbol files. Each symbol file contained therein has a directory entry in
michael@0 36 // the base directory with a name identical to the corresponding debugging
michael@0 37 // file (pdb). Within each of these directories, there are subdirectories
michael@0 38 // named for the debugging file's identifier. For recent pdb files, this is
michael@0 39 // a concatenation of the pdb's uuid and age, presented in hexadecimal form,
michael@0 40 // without any dashes or separators. The uuid is in uppercase hexadecimal
michael@0 41 // and the age is in lowercase hexadecimal. Within that subdirectory,
michael@0 42 // SimpleSymbolSupplier expects to find the symbol file, which is named
michael@0 43 // identically to the debug file, but with a .sym extension. If the original
michael@0 44 // debug file had a name ending in .pdb, the .pdb extension will be replaced
michael@0 45 // with .sym. This sample hierarchy is rooted at the "symbols" base
michael@0 46 // directory:
michael@0 47 //
michael@0 48 // symbols
michael@0 49 // symbols/test_app.pdb
michael@0 50 // symbols/test_app.pdb/63FE4780728D49379B9D7BB6460CB42A1
michael@0 51 // symbols/test_app.pdb/63FE4780728D49379B9D7BB6460CB42A1/test_app.sym
michael@0 52 // symbols/kernel32.pdb
michael@0 53 // symbols/kernel32.pdb/BCE8785C57B44245A669896B6A19B9542
michael@0 54 // symbols/kernel32.pdb/BCE8785C57B44245A669896B6A19B9542/kernel32.sym
michael@0 55 //
michael@0 56 // In this case, the uuid of test_app.pdb is
michael@0 57 // 63fe4780-728d-4937-9b9d-7bb6460cb42a and its age is 1.
michael@0 58 //
michael@0 59 // This scheme was chosen to be roughly analogous to the way that
michael@0 60 // symbol files may be accessed from Microsoft Symbol Server. A hierarchy
michael@0 61 // used for Microsoft Symbol Server storage is usable as a hierarchy for
michael@0 62 // SimpleSymbolServer, provided that the pdb files are transformed to dumped
michael@0 63 // format using a tool such as dump_syms, and given a .sym extension.
michael@0 64 //
michael@0 65 // SimpleSymbolSupplier will iterate over all root paths searching for
michael@0 66 // a symbol file existing in that path.
michael@0 67 //
michael@0 68 // SimpleSymbolSupplier supports any debugging file which can be identified
michael@0 69 // by a CodeModule object's debug_file and debug_identifier accessors. The
michael@0 70 // expected ultimate source of these CodeModule objects are MinidumpModule
michael@0 71 // objects; it is this class that is responsible for assigning appropriate
michael@0 72 // values for debug_file and debug_identifier.
michael@0 73 //
michael@0 74 // Author: Mark Mentovai
michael@0 75
michael@0 76 #ifndef PROCESSOR_SIMPLE_SYMBOL_SUPPLIER_H__
michael@0 77 #define PROCESSOR_SIMPLE_SYMBOL_SUPPLIER_H__
michael@0 78
michael@0 79 #include <map>
michael@0 80 #include <string>
michael@0 81 #include <vector>
michael@0 82
michael@0 83 #include "common/using_std_string.h"
michael@0 84 #include "google_breakpad/processor/symbol_supplier.h"
michael@0 85
michael@0 86 namespace google_breakpad {
michael@0 87
michael@0 88 using std::map;
michael@0 89 using std::vector;
michael@0 90
michael@0 91 class CodeModule;
michael@0 92
michael@0 93 class SimpleSymbolSupplier : public SymbolSupplier {
michael@0 94 public:
michael@0 95 // Creates a new SimpleSymbolSupplier, using path as the root path where
michael@0 96 // symbols are stored.
michael@0 97 explicit SimpleSymbolSupplier(const string &path) : paths_(1, path) {}
michael@0 98
michael@0 99 // Creates a new SimpleSymbolSupplier, using paths as a list of root
michael@0 100 // paths where symbols may be stored.
michael@0 101 explicit SimpleSymbolSupplier(const vector<string> &paths) : paths_(paths) {}
michael@0 102
michael@0 103 virtual ~SimpleSymbolSupplier() {}
michael@0 104
michael@0 105 // Returns the path to the symbol file for the given module. See the
michael@0 106 // description above.
michael@0 107 virtual SymbolResult GetSymbolFile(const CodeModule *module,
michael@0 108 const SystemInfo *system_info,
michael@0 109 string *symbol_file);
michael@0 110
michael@0 111 virtual SymbolResult GetSymbolFile(const CodeModule *module,
michael@0 112 const SystemInfo *system_info,
michael@0 113 string *symbol_file,
michael@0 114 string *symbol_data);
michael@0 115
michael@0 116 // Allocates data buffer on heap and writes symbol data into buffer.
michael@0 117 // Symbol supplier ALWAYS takes ownership of the data buffer.
michael@0 118 virtual SymbolResult GetCStringSymbolData(const CodeModule *module,
michael@0 119 const SystemInfo *system_info,
michael@0 120 string *symbol_file,
michael@0 121 char **symbol_data);
michael@0 122
michael@0 123 // Free the data buffer allocated in the above GetCStringSymbolData();
michael@0 124 virtual void FreeSymbolData(const CodeModule *module);
michael@0 125
michael@0 126 protected:
michael@0 127 SymbolResult GetSymbolFileAtPathFromRoot(const CodeModule *module,
michael@0 128 const SystemInfo *system_info,
michael@0 129 const string &root_path,
michael@0 130 string *symbol_file);
michael@0 131
michael@0 132 private:
michael@0 133 map<string, char *> memory_buffers_;
michael@0 134 vector<string> paths_;
michael@0 135 };
michael@0 136
michael@0 137 } // namespace google_breakpad
michael@0 138
michael@0 139 #endif // PROCESSOR_SIMPLE_SYMBOL_SUPPLIER_H__

mercurial