| 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 28 matching lines...) Expand all Loading... |
| 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_), | 48 microdump_build_fingerprint_(descriptor.microdump_build_fingerprint_), |
| 49 microdump_product_info_(descriptor.microdump_product_info_) { | 49 microdump_product_info_(descriptor.microdump_product_info_), |
| 50 microdump_gpu_fingerprint_(descriptor.microdump_gpu_fingerprint_) { |
| 50 // The copy constructor is not allowed to be called on a MinidumpDescriptor | 51 // The copy constructor is not allowed to be called on a MinidumpDescriptor |
| 51 // with a valid path_, as getting its c_path_ would require the heap which | 52 // with a valid path_, as getting its c_path_ would require the heap which |
| 52 // can cause problems in compromised environments. | 53 // can cause problems in compromised environments. |
| 53 assert(descriptor.path_.empty()); | 54 assert(descriptor.path_.empty()); |
| 54 } | 55 } |
| 55 | 56 |
| 56 MinidumpDescriptor& MinidumpDescriptor::operator=( | 57 MinidumpDescriptor& MinidumpDescriptor::operator=( |
| 57 const MinidumpDescriptor& descriptor) { | 58 const MinidumpDescriptor& descriptor) { |
| 58 assert(descriptor.path_.empty()); | 59 assert(descriptor.path_.empty()); |
| 59 | 60 |
| 60 mode_ = descriptor.mode_; | 61 mode_ = descriptor.mode_; |
| 61 fd_ = descriptor.fd_; | 62 fd_ = descriptor.fd_; |
| 62 directory_ = descriptor.directory_; | 63 directory_ = descriptor.directory_; |
| 63 path_.clear(); | 64 path_.clear(); |
| 64 if (c_path_) { | 65 if (c_path_) { |
| 65 // This descriptor already had a path set, so generate a new one. | 66 // This descriptor already had a path set, so generate a new one. |
| 66 c_path_ = NULL; | 67 c_path_ = NULL; |
| 67 UpdatePath(); | 68 UpdatePath(); |
| 68 } | 69 } |
| 69 size_limit_ = descriptor.size_limit_; | 70 size_limit_ = descriptor.size_limit_; |
| 70 microdump_build_fingerprint_ = descriptor.microdump_build_fingerprint_; | 71 microdump_build_fingerprint_ = descriptor.microdump_build_fingerprint_; |
| 71 microdump_product_info_ = descriptor.microdump_product_info_; | 72 microdump_product_info_ = descriptor.microdump_product_info_; |
| 73 microdump_gpu_fingerprint_ = descriptor.microdump_gpu_fingerprint_; |
| 72 return *this; | 74 return *this; |
| 73 } | 75 } |
| 74 | 76 |
| 75 void MinidumpDescriptor::UpdatePath() { | 77 void MinidumpDescriptor::UpdatePath() { |
| 76 assert(mode_ == kWriteMinidumpToFile && !directory_.empty()); | 78 assert(mode_ == kWriteMinidumpToFile && !directory_.empty()); |
| 77 | 79 |
| 78 GUID guid; | 80 GUID guid; |
| 79 char guid_str[kGUIDStringLength + 1]; | 81 char guid_str[kGUIDStringLength + 1]; |
| 80 if (!CreateGUID(&guid) || !GUIDToString(&guid, guid_str, sizeof(guid_str))) { | 82 if (!CreateGUID(&guid) || !GUIDToString(&guid, guid_str, sizeof(guid_str))) { |
| 81 assert(false); | 83 assert(false); |
| 82 } | 84 } |
| 83 | 85 |
| 84 path_.clear(); | 86 path_.clear(); |
| 85 path_ = directory_ + "/" + guid_str + ".dmp"; | 87 path_ = directory_ + "/" + guid_str + ".dmp"; |
| 86 c_path_ = path_.c_str(); | 88 c_path_ = path_.c_str(); |
| 87 } | 89 } |
| 88 | 90 |
| 89 void MinidumpDescriptor::SetMicrodumpBuildFingerprint( | 91 void MinidumpDescriptor::SetMicrodumpBuildFingerprint( |
| 90 const char* build_fingerprint) { | 92 const char* build_fingerprint) { |
| 91 assert(mode_ == kWriteMicrodumpToConsole); | 93 assert(mode_ == kWriteMicrodumpToConsole); |
| 92 microdump_build_fingerprint_ = build_fingerprint; | 94 microdump_build_fingerprint_ = build_fingerprint; |
| 93 } | 95 } |
| 94 | 96 |
| 95 void MinidumpDescriptor::SetMicrodumpProductInfo(const char* product_info) { | 97 void MinidumpDescriptor::SetMicrodumpProductInfo(const char* product_info) { |
| 96 assert(mode_ == kWriteMicrodumpToConsole); | 98 assert(mode_ == kWriteMicrodumpToConsole); |
| 97 microdump_product_info_ = product_info; | 99 microdump_product_info_ = product_info; |
| 98 } | 100 } |
| 99 | 101 |
| 102 void MinidumpDescriptor::SetMicrodumpGPUFingerprint( |
| 103 const char* gpu_fingerprint) { |
| 104 assert(mode_ == kWriteMicrodumpToConsole); |
| 105 microdump_gpu_fingerprint_ = gpu_fingerprint; |
| 106 } |
| 107 |
| 100 } // namespace google_breakpad | 108 } // namespace google_breakpad |
| OLD | NEW |