| OLD | NEW |
| 1 // Copyright (c) 2006, Google Inc. | 1 // Copyright (c) 2006, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // instantiated directly, only based on other objects that implement | 34 // instantiated directly, only based on other objects that implement |
| 35 // the CodeModules interface. It exists to provide a CodeModules | 35 // the CodeModules interface. It exists to provide a CodeModules |
| 36 // implementation a place to store information when the life of the original | 36 // implementation a place to store information when the life of the original |
| 37 // object (such as a MinidumpModuleList) cannot be guaranteed. | 37 // object (such as a MinidumpModuleList) cannot be guaranteed. |
| 38 // | 38 // |
| 39 // Author: Mark Mentovai | 39 // Author: Mark Mentovai |
| 40 | 40 |
| 41 #ifndef PROCESSOR_BASIC_CODE_MODULES_H__ | 41 #ifndef PROCESSOR_BASIC_CODE_MODULES_H__ |
| 42 #define PROCESSOR_BASIC_CODE_MODULES_H__ | 42 #define PROCESSOR_BASIC_CODE_MODULES_H__ |
| 43 | 43 |
| 44 #include <stddef.h> |
| 45 |
| 44 #include "google_breakpad/processor/code_modules.h" | 46 #include "google_breakpad/processor/code_modules.h" |
| 47 #include "processor/linked_ptr.h" |
| 48 #include "processor/range_map.h" |
| 45 | 49 |
| 46 namespace google_breakpad { | 50 namespace google_breakpad { |
| 47 | 51 |
| 48 template<typename T> class linked_ptr; | |
| 49 template<typename AddressType, typename EntryType> class RangeMap; | |
| 50 | |
| 51 class BasicCodeModules : public CodeModules { | 52 class BasicCodeModules : public CodeModules { |
| 52 public: | 53 public: |
| 53 // Creates a new BasicCodeModules object given any existing CodeModules | 54 // Creates a new BasicCodeModules object given any existing CodeModules |
| 54 // implementation. This is useful to make a copy of the data relevant to | 55 // 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 // the CodeModules and CodeModule interfaces without requiring all of the |
| 56 // resources that other implementations may require. A copy will be | 57 // resources that other implementations may require. A copy will be |
| 57 // made of each contained CodeModule using CodeModule::Copy. | 58 // made of each contained CodeModule using CodeModule::Copy. |
| 58 explicit BasicCodeModules(const CodeModules *that); | 59 explicit BasicCodeModules(const CodeModules *that); |
| 59 | 60 |
| 60 virtual ~BasicCodeModules(); | 61 virtual ~BasicCodeModules(); |
| 61 | 62 |
| 62 // See code_modules.h for descriptions of these methods. | 63 // See code_modules.h for descriptions of these methods. |
| 63 virtual unsigned int module_count() const; | 64 virtual unsigned int module_count() const; |
| 64 virtual const CodeModule* GetModuleForAddress(uint64_t address) const; | 65 virtual const CodeModule* GetModuleForAddress(uint64_t address) const; |
| 65 virtual const CodeModule* GetMainModule() const; | 66 virtual const CodeModule* GetMainModule() const; |
| 66 virtual const CodeModule* GetModuleAtSequence(unsigned int sequence) const; | 67 virtual const CodeModule* GetModuleAtSequence(unsigned int sequence) const; |
| 67 virtual const CodeModule* GetModuleAtIndex(unsigned int index) const; | 68 virtual const CodeModule* GetModuleAtIndex(unsigned int index) const; |
| 68 virtual const CodeModules* Copy() const; | 69 virtual const CodeModules* Copy() const; |
| 69 | 70 |
| 70 protected: | 71 protected: |
| 71 BasicCodeModules(); | 72 BasicCodeModules(); |
| 72 | 73 |
| 73 // The base address of the main module. | 74 // The base address of the main module. |
| 74 uint64_t main_address_; | 75 uint64_t main_address_; |
| 75 | 76 |
| 76 // The map used to contain each CodeModule, keyed by each CodeModule's | 77 // The map used to contain each CodeModule, keyed by each CodeModule's |
| 77 // address range. | 78 // address range. |
| 78 RangeMap<uint64_t, linked_ptr<const CodeModule> > *map_; | 79 RangeMap<uint64_t, linked_ptr<const CodeModule> > map_; |
| 79 | 80 |
| 80 private: | 81 private: |
| 81 // Disallow copy constructor and assignment operator. | 82 // Disallow copy constructor and assignment operator. |
| 82 BasicCodeModules(const BasicCodeModules &that); | 83 BasicCodeModules(const BasicCodeModules &that); |
| 83 void operator=(const BasicCodeModules &that); | 84 void operator=(const BasicCodeModules &that); |
| 84 }; | 85 }; |
| 85 | 86 |
| 86 } // namespace google_breakpad | 87 } // namespace google_breakpad |
| 87 | 88 |
| 88 #endif // PROCESSOR_BASIC_CODE_MODULES_H__ | 89 #endif // PROCESSOR_BASIC_CODE_MODULES_H__ |
| OLD | NEW |