PageRenderTime 23ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/thirdparty/breakpad/google_breakpad/processor/symbol_supplier.h

http://github.com/tomahawk-player/tomahawk
C Header | 98 lines | 30 code | 14 blank | 54 comment | 0 complexity | e85033c17af34ba84596d80a39845b2a 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. // The caller may implement the SymbolSupplier abstract base class
  30. // to provide symbols for a given module.
  31. #ifndef GOOGLE_BREAKPAD_PROCESSOR_SYMBOL_SUPPLIER_H__
  32. #define GOOGLE_BREAKPAD_PROCESSOR_SYMBOL_SUPPLIER_H__
  33. #include <string>
  34. namespace google_breakpad {
  35. using std::string;
  36. class CodeModule;
  37. struct SystemInfo;
  38. class SymbolSupplier {
  39. public:
  40. // Result type for GetSymbolFile
  41. enum SymbolResult {
  42. // no symbols were found, but continue processing
  43. NOT_FOUND,
  44. // symbols were found, and the path has been placed in symbol_file
  45. FOUND,
  46. // stops processing the minidump immediately
  47. INTERRUPT
  48. };
  49. virtual ~SymbolSupplier() {}
  50. // Retrieves the symbol file for the given CodeModule, placing the
  51. // path in symbol_file if successful. system_info contains strings
  52. // identifying the operating system and CPU; SymbolSupplier may use
  53. // to help locate the symbol file. system_info may be NULL or its
  54. // fields may be empty if these values are unknown. symbol_file
  55. // must be a pointer to a valid string
  56. virtual SymbolResult GetSymbolFile(const CodeModule *module,
  57. const SystemInfo *system_info,
  58. string *symbol_file) = 0;
  59. // Same as above, except also places symbol data into symbol_data.
  60. // If symbol_data is NULL, the data is not returned.
  61. // TODO(nealsid) Once we have symbol data caching behavior implemented
  62. // investigate making all symbol suppliers implement all methods,
  63. // and make this pure virtual
  64. virtual SymbolResult GetSymbolFile(const CodeModule *module,
  65. const SystemInfo *system_info,
  66. string *symbol_file,
  67. string *symbol_data) = 0;
  68. // Same as above, except allocates data buffer on heap and then places the
  69. // symbol data into the buffer as C-string.
  70. // SymbolSupplier is responsible for deleting the data buffer. After the call
  71. // to GetCStringSymbolData(), the caller should call FreeSymbolData(const
  72. // Module *module) once the data buffer is no longer needed.
  73. // If symbol_data is not NULL, symbol supplier won't return FOUND unless it
  74. // returns a valid buffer in symbol_data, e.g., returns INTERRUPT on memory
  75. // allocation failure.
  76. virtual SymbolResult GetCStringSymbolData(const CodeModule *module,
  77. const SystemInfo *system_info,
  78. string *symbol_file,
  79. char **symbol_data) = 0;
  80. // Frees the data buffer allocated for the module in GetCStringSymbolData.
  81. virtual void FreeSymbolData(const CodeModule *module) = 0;
  82. };
  83. } // namespace google_breakpad
  84. #endif // GOOGLE_BREAKPAD_PROCESSOR_SYMBOL_SUPPLIER_H__