PageRenderTime 28ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/thirdparty/breakpad/processor/basic_code_modules.h

http://github.com/tomahawk-player/tomahawk
C Header | 85 lines | 24 code | 13 blank | 48 comment | 0 complexity | adf997846e374dbb53ada85e62723644 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, GPL-3.0, GPL-2.0
  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.
  29. // basic_code_modules.h: Contains all of the CodeModule objects that
  30. // were loaded into a single process.
  31. //
  32. // This is a basic concrete implementation of CodeModules. It cannot be
  33. // instantiated directly, only based on other objects that implement
  34. // the CodeModules interface. It exists to provide a CodeModules
  35. // implementation a place to store information when the life of the original
  36. // object (such as a MinidumpModuleList) cannot be guaranteed.
  37. //
  38. // Author: Mark Mentovai
  39. #ifndef PROCESSOR_BASIC_CODE_MODULES_H__
  40. #define PROCESSOR_BASIC_CODE_MODULES_H__
  41. #include "google_breakpad/processor/code_modules.h"
  42. namespace google_breakpad {
  43. template<typename T> class linked_ptr;
  44. template<typename AddressType, typename EntryType> class RangeMap;
  45. class BasicCodeModules : public CodeModules {
  46. public:
  47. // Creates a new BasicCodeModules object given any existing CodeModules
  48. // implementation. This is useful to make a copy of the data relevant to
  49. // the CodeModules and CodeModule interfaces without requiring all of the
  50. // resources that other implementations may require. A copy will be
  51. // made of each contained CodeModule using CodeModule::Copy.
  52. explicit BasicCodeModules(const CodeModules *that);
  53. virtual ~BasicCodeModules();
  54. // See code_modules.h for descriptions of these methods.
  55. virtual unsigned int module_count() const;
  56. virtual const CodeModule* GetModuleForAddress(u_int64_t address) const;
  57. virtual const CodeModule* GetMainModule() const;
  58. virtual const CodeModule* GetModuleAtSequence(unsigned int sequence) const;
  59. virtual const CodeModule* GetModuleAtIndex(unsigned int index) const;
  60. virtual const CodeModules* Copy() const;
  61. private:
  62. // The base address of the main module.
  63. u_int64_t main_address_;
  64. // The map used to contain each CodeModule, keyed by each CodeModule's
  65. // address range.
  66. RangeMap<u_int64_t, linked_ptr<const CodeModule> > *map_;
  67. // Disallow copy constructor and assignment operator.
  68. BasicCodeModules(const BasicCodeModules &that);
  69. void operator=(const BasicCodeModules &that);
  70. };
  71. } // namespace google_breakpad
  72. #endif // PROCESSOR_BASIC_CODE_MODULES_H__