/thirdparty/breakpad/client/linux/minidump_writer/minidump_writer.h

http://github.com/tomahawk-player/tomahawk · C Header · 78 lines · 25 code · 13 blank · 40 comment · 0 complexity · 2c8dd8d09c626b65c08e84d85ee6b7a1 MD5 · raw file

  1. // Copyright (c) 2009, 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. #ifndef CLIENT_LINUX_MINIDUMP_WRITER_MINIDUMP_WRITER_H_
  30. #define CLIENT_LINUX_MINIDUMP_WRITER_MINIDUMP_WRITER_H_
  31. #include <stdint.h>
  32. #include <unistd.h>
  33. #include <list>
  34. #include <utility>
  35. #include "client/linux/minidump_writer/linux_dumper.h"
  36. #include "google_breakpad/common/minidump_format.h"
  37. namespace google_breakpad {
  38. class ExceptionHandler;
  39. struct MappingEntry {
  40. MappingInfo first;
  41. u_int8_t second[sizeof(MDGUID)];
  42. };
  43. // A list of <MappingInfo, GUID>
  44. typedef std::list<MappingEntry> MappingList;
  45. // Write a minidump to the filesystem. This function does not malloc nor use
  46. // libc functions which may. Thus, it can be used in contexts where the state
  47. // of the heap may be corrupt.
  48. // filename: the filename to write to. This is opened O_EXCL and fails if
  49. // open fails.
  50. // crashing_process: the pid of the crashing process. This must be trusted.
  51. // blob: a blob of data from the crashing process. See exception_handler.h
  52. // blob_size: the length of |blob|, in bytes
  53. //
  54. // Returns true iff successful.
  55. bool WriteMinidump(const char* filename, pid_t crashing_process,
  56. const void* blob, size_t blob_size);
  57. // This overload also allows passing a list of known mappings.
  58. bool WriteMinidump(const char* filename, pid_t crashing_process,
  59. const void* blob, size_t blob_size,
  60. const MappingList& mappings);
  61. bool WriteMinidump(const char* filename,
  62. const MappingList& mappings,
  63. LinuxDumper* dumper);
  64. } // namespace google_breakpad
  65. #endif // CLIENT_LINUX_MINIDUMP_WRITER_MINIDUMP_WRITER_H_