aboutsummaryrefslogtreecommitdiff
path: root/src/google_breakpad
diff options
context:
space:
mode:
authorted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e>2009-12-09 01:24:37 +0000
committerted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e>2009-12-09 01:24:37 +0000
commit0cbd50c975c1680a6cd0f1ce2760e157e2bfd46f (patch)
tree087407aaa36763ad53ad94ddbbf94517a99a0655 /src/google_breakpad
parentremove trailing comma from enum definition to make it compile with -pedantic (diff)
downloadbreakpad-0cbd50c975c1680a6cd0f1ce2760e157e2bfd46f.tar.xz
Allow Minidump class to be instantiated with stream instead of file. r=mark at http://breakpad.appspot.com/46001
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@438 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/google_breakpad')
-rw-r--r--src/google_breakpad/processor/minidump.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/google_breakpad/processor/minidump.h b/src/google_breakpad/processor/minidump.h
index d3a7b92b..695a7254 100644
--- a/src/google_breakpad/processor/minidump.h
+++ b/src/google_breakpad/processor/minidump.h
@@ -81,6 +81,7 @@
#include <unistd.h>
+#include <iostream>
#include <map>
#include <string>
#include <vector>
@@ -796,9 +797,14 @@ class Minidump {
public:
// path is the pathname of a file containing the minidump.
explicit Minidump(const string& path);
+ // input is an istream wrapping minidump data. Minidump holds a
+ // weak pointer to input, and the caller must ensure that the stream
+ // is valid as long as the Minidump object is.
+ explicit Minidump(std::istream& input);
virtual ~Minidump();
+ // path may be empty if the minidump was not opened from a file
virtual string path() const {
return path_;
}
@@ -854,7 +860,7 @@ class Minidump {
bool SeekSet(off_t offset);
// Returns the current position of the minidump file.
- off_t Tell() { return valid_ ? lseek(fd_, 0, SEEK_CUR) : (off_t)-1; }
+ off_t Tell();
// The next 2 methods are medium-level I/O routines.
@@ -925,11 +931,12 @@ class Minidump {
MinidumpStreamMap* stream_map_;
// The pathname of the minidump file to process, set in the constructor.
+ // This may be empty if the minidump was opened directly from a stream.
const string path_;
- // The file descriptor for all file I/O. Used by ReadBytes and SeekSet.
- // Set based on the |path_| member by Open, which is called by Read.
- int fd_;
+ // The stream for all file I/O. Used by ReadBytes and SeekSet.
+ // Set based on the path in Open, or directly in the constructor.
+ std::istream* stream_;
// swap_ is true if the minidump file should be byte-swapped. If the
// minidump was produced by a CPU that is other-endian than the CPU