Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 // Copyright (c) 2006, 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 // basic_code_modules.h: Contains all of the CodeModule objects that
31 // were loaded into a single process.
32 //
33 // This is a basic concrete implementation of CodeModules. It cannot be
34 // instantiated directly, only based on other objects that implement
35 // the CodeModules interface. It exists to provide a CodeModules
36 // implementation a place to store information when the life of the original
37 // object (such as a MinidumpModuleList) cannot be guaranteed.
38 //
39 // Author: Mark Mentovai
41 #ifndef PROCESSOR_BASIC_CODE_MODULES_H__
42 #define PROCESSOR_BASIC_CODE_MODULES_H__
44 #include "google_breakpad/processor/code_modules.h"
46 namespace google_breakpad {
48 template<typename T> class linked_ptr;
49 template<typename AddressType, typename EntryType> class RangeMap;
51 class BasicCodeModules : public CodeModules {
52 public:
53 // Creates a new BasicCodeModules object given any existing CodeModules
54 // implementation. This is useful to make a copy of the data relevant to
55 // the CodeModules and CodeModule interfaces without requiring all of the
56 // resources that other implementations may require. A copy will be
57 // made of each contained CodeModule using CodeModule::Copy.
58 explicit BasicCodeModules(const CodeModules *that);
60 virtual ~BasicCodeModules();
62 // See code_modules.h for descriptions of these methods.
63 virtual unsigned int module_count() const;
64 virtual const CodeModule* GetModuleForAddress(uint64_t address) const;
65 virtual const CodeModule* GetMainModule() const;
66 virtual const CodeModule* GetModuleAtSequence(unsigned int sequence) const;
67 virtual const CodeModule* GetModuleAtIndex(unsigned int index) const;
68 virtual const CodeModules* Copy() const;
70 private:
71 // The base address of the main module.
72 uint64_t main_address_;
74 // The map used to contain each CodeModule, keyed by each CodeModule's
75 // address range.
76 RangeMap<uint64_t, linked_ptr<const CodeModule> > *map_;
78 // Disallow copy constructor and assignment operator.
79 BasicCodeModules(const BasicCodeModules &that);
80 void operator=(const BasicCodeModules &that);
81 };
83 } // namespace google_breakpad
85 #endif // PROCESSOR_BASIC_CODE_MODULES_H__