PageRenderTime 31ms CodeModel.GetById 22ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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