mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2025-12-22 05:36:26 +01:00
[microdump] Add build fingerprint and product info metadata.
This is to add build fingerprint and product name/version to microdumps. Conversely to what happens in the case of minidumps with MIME fields, due to the nature of minidumps, extra metadata cannot be reliably injected after the dump is completed. This CL adds the plumbing to inject two optional fields plus the corresponding tests. BUG=chromium:410294 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1125153008 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1456 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
f1ca06a079
commit
90cbb27528
6 changed files with 163 additions and 50 deletions
|
|
@ -51,14 +51,18 @@ class MinidumpDescriptor {
|
|||
|
||||
MinidumpDescriptor() : mode_(kUninitialized),
|
||||
fd_(-1),
|
||||
size_limit_(-1) {}
|
||||
size_limit_(-1),
|
||||
microdump_build_fingerprint_(NULL),
|
||||
microdump_product_info_(NULL) {}
|
||||
|
||||
explicit MinidumpDescriptor(const string& directory)
|
||||
: mode_(kWriteMinidumpToFile),
|
||||
fd_(-1),
|
||||
directory_(directory),
|
||||
c_path_(NULL),
|
||||
size_limit_(-1) {
|
||||
size_limit_(-1),
|
||||
microdump_build_fingerprint_(NULL),
|
||||
microdump_product_info_(NULL) {
|
||||
assert(!directory.empty());
|
||||
}
|
||||
|
||||
|
|
@ -66,14 +70,18 @@ class MinidumpDescriptor {
|
|||
: mode_(kWriteMinidumpToFd),
|
||||
fd_(fd),
|
||||
c_path_(NULL),
|
||||
size_limit_(-1) {
|
||||
size_limit_(-1),
|
||||
microdump_build_fingerprint_(NULL),
|
||||
microdump_product_info_(NULL) {
|
||||
assert(fd != -1);
|
||||
}
|
||||
|
||||
explicit MinidumpDescriptor(const MicrodumpOnConsole&)
|
||||
: mode_(kWriteMicrodumpToConsole),
|
||||
fd_(-1),
|
||||
size_limit_(-1) {}
|
||||
size_limit_(-1),
|
||||
microdump_build_fingerprint_(NULL),
|
||||
microdump_product_info_(NULL) {}
|
||||
|
||||
explicit MinidumpDescriptor(const MinidumpDescriptor& descriptor);
|
||||
MinidumpDescriptor& operator=(const MinidumpDescriptor& descriptor);
|
||||
|
|
@ -99,6 +107,18 @@ class MinidumpDescriptor {
|
|||
off_t size_limit() const { return size_limit_; }
|
||||
void set_size_limit(off_t limit) { size_limit_ = limit; }
|
||||
|
||||
// TODO(primiano): make this and product info (below) just part of the
|
||||
// microdump ctor once it is rolled stably into Chrome. ETA: June 2015.
|
||||
void SetMicrodumpBuildFingerprint(const char* build_fingerprint);
|
||||
const char* microdump_build_fingerprint() const {
|
||||
return microdump_build_fingerprint_;
|
||||
}
|
||||
|
||||
void SetMicrodumpProductInfo(const char* product_info);
|
||||
const char* microdump_product_info() const {
|
||||
return microdump_product_info_;
|
||||
}
|
||||
|
||||
private:
|
||||
enum DumpMode {
|
||||
kUninitialized = 0,
|
||||
|
|
@ -115,13 +135,25 @@ class MinidumpDescriptor {
|
|||
|
||||
// The directory where the minidump should be generated.
|
||||
string directory_;
|
||||
|
||||
// The full path to the generated minidump.
|
||||
string path_;
|
||||
|
||||
// The C string of |path_|. Precomputed so it can be access from a compromised
|
||||
// context.
|
||||
const char* c_path_;
|
||||
|
||||
off_t size_limit_;
|
||||
|
||||
// The product name/version and build fingerprint that should be appended to
|
||||
// the dump (microdump only). Microdumps don't have the ability of appending
|
||||
// extra metadata after the dump is generated (as opposite to minidumps
|
||||
// MIME fields), therefore the product details must be provided upfront.
|
||||
// The string pointers are supposed to be valid through all the lifetime of
|
||||
// the process (read: the caller has to guarantee that they are stored in
|
||||
// global static storage).
|
||||
const char* microdump_build_fingerprint_;
|
||||
const char* microdump_product_info_;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue