| OLD | NEW |
| 1 // Copyright (c) 2012 Google Inc. | 1 // Copyright (c) 2012 Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 //static | 38 //static |
| 39 const MinidumpDescriptor::MicrodumpOnConsole | 39 const MinidumpDescriptor::MicrodumpOnConsole |
| 40 MinidumpDescriptor::kMicrodumpOnConsole = {}; | 40 MinidumpDescriptor::kMicrodumpOnConsole = {}; |
| 41 | 41 |
| 42 MinidumpDescriptor::MinidumpDescriptor(const MinidumpDescriptor& descriptor) | 42 MinidumpDescriptor::MinidumpDescriptor(const MinidumpDescriptor& descriptor) |
| 43 : mode_(descriptor.mode_), | 43 : mode_(descriptor.mode_), |
| 44 fd_(descriptor.fd_), | 44 fd_(descriptor.fd_), |
| 45 directory_(descriptor.directory_), | 45 directory_(descriptor.directory_), |
| 46 c_path_(NULL), | 46 c_path_(NULL), |
| 47 size_limit_(descriptor.size_limit_) { | 47 size_limit_(descriptor.size_limit_), |
| 48 microdump_build_fingerprint_(descriptor.microdump_build_fingerprint_), |
| 49 microdump_product_info_(descriptor.microdump_product_info_) { |
| 48 // The copy constructor is not allowed to be called on a MinidumpDescriptor | 50 // The copy constructor is not allowed to be called on a MinidumpDescriptor |
| 49 // with a valid path_, as getting its c_path_ would require the heap which | 51 // with a valid path_, as getting its c_path_ would require the heap which |
| 50 // can cause problems in compromised environments. | 52 // can cause problems in compromised environments. |
| 51 assert(descriptor.path_.empty()); | 53 assert(descriptor.path_.empty()); |
| 52 } | 54 } |
| 53 | 55 |
| 54 MinidumpDescriptor& MinidumpDescriptor::operator=( | 56 MinidumpDescriptor& MinidumpDescriptor::operator=( |
| 55 const MinidumpDescriptor& descriptor) { | 57 const MinidumpDescriptor& descriptor) { |
| 56 assert(descriptor.path_.empty()); | 58 assert(descriptor.path_.empty()); |
| 57 | 59 |
| 58 mode_ = descriptor.mode_; | 60 mode_ = descriptor.mode_; |
| 59 fd_ = descriptor.fd_; | 61 fd_ = descriptor.fd_; |
| 60 directory_ = descriptor.directory_; | 62 directory_ = descriptor.directory_; |
| 61 path_.clear(); | 63 path_.clear(); |
| 62 if (c_path_) { | 64 if (c_path_) { |
| 63 // This descriptor already had a path set, so generate a new one. | 65 // This descriptor already had a path set, so generate a new one. |
| 64 c_path_ = NULL; | 66 c_path_ = NULL; |
| 65 UpdatePath(); | 67 UpdatePath(); |
| 66 } | 68 } |
| 67 size_limit_ = descriptor.size_limit_; | 69 size_limit_ = descriptor.size_limit_; |
| 70 microdump_build_fingerprint_ = descriptor.microdump_build_fingerprint_; |
| 71 microdump_product_info_ = descriptor.microdump_product_info_; |
| 68 return *this; | 72 return *this; |
| 69 } | 73 } |
| 70 | 74 |
| 71 void MinidumpDescriptor::UpdatePath() { | 75 void MinidumpDescriptor::UpdatePath() { |
| 72 assert(mode_ == kWriteMinidumpToFile && !directory_.empty()); | 76 assert(mode_ == kWriteMinidumpToFile && !directory_.empty()); |
| 73 | 77 |
| 74 GUID guid; | 78 GUID guid; |
| 75 char guid_str[kGUIDStringLength + 1]; | 79 char guid_str[kGUIDStringLength + 1]; |
| 76 if (!CreateGUID(&guid) || !GUIDToString(&guid, guid_str, sizeof(guid_str))) { | 80 if (!CreateGUID(&guid) || !GUIDToString(&guid, guid_str, sizeof(guid_str))) { |
| 77 assert(false); | 81 assert(false); |
| 78 } | 82 } |
| 79 | 83 |
| 80 path_.clear(); | 84 path_.clear(); |
| 81 path_ = directory_ + "/" + guid_str + ".dmp"; | 85 path_ = directory_ + "/" + guid_str + ".dmp"; |
| 82 c_path_ = path_.c_str(); | 86 c_path_ = path_.c_str(); |
| 83 } | 87 } |
| 84 | 88 |
| 89 void MinidumpDescriptor::SetMicrodumpBuildFingerprint( |
| 90 const char* build_fingerprint) { |
| 91 assert(mode_ == kWriteMicrodumpToConsole); |
| 92 microdump_build_fingerprint_ = build_fingerprint; |
| 93 } |
| 94 |
| 95 void MinidumpDescriptor::SetMicrodumpProductInfo(const char* product_info) { |
| 96 assert(mode_ == kWriteMicrodumpToConsole); |
| 97 microdump_product_info_ = product_info; |
| 98 } |
| 99 |
| 85 } // namespace google_breakpad | 100 } // namespace google_breakpad |
| OLD | NEW |