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