diff options
Diffstat (limited to 'src/client/minidump_file_writer.h')
-rw-r--r-- | src/client/minidump_file_writer.h | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/client/minidump_file_writer.h b/src/client/minidump_file_writer.h index 21d4ce68..313b250b 100644 --- a/src/client/minidump_file_writer.h +++ b/src/client/minidump_file_writer.h @@ -55,6 +55,16 @@ template<typename MDType> class TypedMDRVA; // header->get()->signature = MD_HEADER_SIGNATURE; // : // writer.Close(); +// +// An alternative is to use SetFile and provide a file descriptor: +// MinidumpFileWriter writer; +// writer.SetFile(minidump_fd); +// TypedMDRVA<MDRawHeader> header(&writer_); +// header.Allocate(); +// header->get()->signature = MD_HEADER_SIGNATURE; +// : +// writer.Close(); + class MinidumpFileWriter { public: // Invalid MDRVA (Minidump Relative Virtual Address) @@ -66,11 +76,19 @@ public: // Open |path| as the destination of the minidump data. Any existing file // will be overwritten. - // Return true on success, or false on failure + // Return true on success, or false on failure. bool Open(const char *path); - // Close the current file - // Return true on success, or false on failure + // Sets the file descriptor |file| as the destination of the minidump data. + // Can be used as an alternative to Open() when a file descriptor is + // available. + // Note that |fd| is not closed when the instance of MinidumpFileWriter is + // destroyed. + void SetFile(const int file); + + // Close the current file (that was either created when Open was called, or + // specified with SetFile). + // Return true on success, or false on failure. bool Close(); // Copy the contents of |str| to a MDString and write it to the file. @@ -106,9 +124,12 @@ public: // unable to allocate the bytes. MDRVA Allocate(size_t size); - // The file descriptor for the output file + // The file descriptor for the output file. int file_; + // Whether |file_| should be closed when the instance is destroyed. + bool close_file_when_destroyed_; + // Current position in buffer MDRVA position_; |