Chromium Code Reviews| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 | 46 |
| 47 class MinidumpDescriptor { | 47 class MinidumpDescriptor { |
| 48 public: | 48 public: |
| 49 struct MicrodumpOnConsole {}; | 49 struct MicrodumpOnConsole {}; |
| 50 static const MicrodumpOnConsole kMicrodumpOnConsole; | 50 static const MicrodumpOnConsole kMicrodumpOnConsole; |
| 51 | 51 |
| 52 MinidumpDescriptor() : mode_(kUninitialized), | 52 MinidumpDescriptor() : mode_(kUninitialized), |
| 53 fd_(-1), | 53 fd_(-1), |
| 54 size_limit_(-1), | 54 size_limit_(-1), |
| 55 microdump_build_fingerprint_(NULL), | 55 microdump_build_fingerprint_(NULL), |
| 56 microdump_product_info_(NULL) {} | 56 microdump_product_info_(NULL), |
| 57 microdump_gpu_fingerprint_(NULL) {} | |
| 57 | 58 |
| 58 explicit MinidumpDescriptor(const string& directory) | 59 explicit MinidumpDescriptor(const string& directory) |
| 59 : mode_(kWriteMinidumpToFile), | 60 : mode_(kWriteMinidumpToFile), |
| 60 fd_(-1), | 61 fd_(-1), |
| 61 directory_(directory), | 62 directory_(directory), |
| 62 c_path_(NULL), | 63 c_path_(NULL), |
| 63 size_limit_(-1), | 64 size_limit_(-1), |
| 64 microdump_build_fingerprint_(NULL), | 65 microdump_build_fingerprint_(NULL), |
| 65 microdump_product_info_(NULL) { | 66 microdump_product_info_(NULL), |
| 67 microdump_gpu_fingerprint_(NULL) { | |
| 66 assert(!directory.empty()); | 68 assert(!directory.empty()); |
| 67 } | 69 } |
| 68 | 70 |
| 69 explicit MinidumpDescriptor(int fd) | 71 explicit MinidumpDescriptor(int fd) |
| 70 : mode_(kWriteMinidumpToFd), | 72 : mode_(kWriteMinidumpToFd), |
| 71 fd_(fd), | 73 fd_(fd), |
| 72 c_path_(NULL), | 74 c_path_(NULL), |
| 73 size_limit_(-1), | 75 size_limit_(-1), |
| 74 microdump_build_fingerprint_(NULL), | 76 microdump_build_fingerprint_(NULL), |
| 75 microdump_product_info_(NULL) { | 77 microdump_product_info_(NULL), |
| 78 microdump_gpu_fingerprint_(NULL) { | |
| 76 assert(fd != -1); | 79 assert(fd != -1); |
| 77 } | 80 } |
| 78 | 81 |
| 79 explicit MinidumpDescriptor(const MicrodumpOnConsole&) | 82 explicit MinidumpDescriptor(const MicrodumpOnConsole&) |
| 80 : mode_(kWriteMicrodumpToConsole), | 83 : mode_(kWriteMicrodumpToConsole), |
| 81 fd_(-1), | 84 fd_(-1), |
| 82 size_limit_(-1), | 85 size_limit_(-1), |
| 83 microdump_build_fingerprint_(NULL), | 86 microdump_build_fingerprint_(NULL), |
| 84 microdump_product_info_(NULL) {} | 87 microdump_product_info_(NULL), |
| 88 microdump_gpu_fingerprint_(NULL) {} | |
| 85 | 89 |
| 86 explicit MinidumpDescriptor(const MinidumpDescriptor& descriptor); | 90 explicit MinidumpDescriptor(const MinidumpDescriptor& descriptor); |
| 87 MinidumpDescriptor& operator=(const MinidumpDescriptor& descriptor); | 91 MinidumpDescriptor& operator=(const MinidumpDescriptor& descriptor); |
| 88 | 92 |
| 89 static MinidumpDescriptor getMicrodumpDescriptor(); | 93 static MinidumpDescriptor getMicrodumpDescriptor(); |
| 90 | 94 |
| 91 bool IsFD() const { return mode_ == kWriteMinidumpToFd; } | 95 bool IsFD() const { return mode_ == kWriteMinidumpToFd; } |
| 92 | 96 |
| 93 int fd() const { return fd_; } | 97 int fd() const { return fd_; } |
| 94 | 98 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 112 void SetMicrodumpBuildFingerprint(const char* build_fingerprint); | 116 void SetMicrodumpBuildFingerprint(const char* build_fingerprint); |
| 113 const char* microdump_build_fingerprint() const { | 117 const char* microdump_build_fingerprint() const { |
| 114 return microdump_build_fingerprint_; | 118 return microdump_build_fingerprint_; |
| 115 } | 119 } |
| 116 | 120 |
| 117 void SetMicrodumpProductInfo(const char* product_info); | 121 void SetMicrodumpProductInfo(const char* product_info); |
| 118 const char* microdump_product_info() const { | 122 const char* microdump_product_info() const { |
| 119 return microdump_product_info_; | 123 return microdump_product_info_; |
| 120 } | 124 } |
| 121 | 125 |
| 126 void SetMicrodumpGPUFingerprint(const char* gpu_fingerprint); | |
|
Primiano Tucci (use gerrit)
2015/09/09 18:59:34
At this point feels like we should just have one m
Tobias Sargeant
2015/09/10 10:45:04
Done.
| |
| 127 const char* microdump_gpu_fingerprint() const { | |
| 128 return microdump_gpu_fingerprint_; | |
| 129 } | |
| 130 | |
| 122 private: | 131 private: |
| 123 enum DumpMode { | 132 enum DumpMode { |
| 124 kUninitialized = 0, | 133 kUninitialized = 0, |
| 125 kWriteMinidumpToFile, | 134 kWriteMinidumpToFile, |
| 126 kWriteMinidumpToFd, | 135 kWriteMinidumpToFd, |
| 127 kWriteMicrodumpToConsole | 136 kWriteMicrodumpToConsole |
| 128 }; | 137 }; |
| 129 | 138 |
| 130 // Specifies the dump mode (see DumpMode). | 139 // Specifies the dump mode (see DumpMode). |
| 131 DumpMode mode_; | 140 DumpMode mode_; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 147 | 156 |
| 148 // The product name/version and build fingerprint that should be appended to | 157 // The product name/version and build fingerprint that should be appended to |
| 149 // the dump (microdump only). Microdumps don't have the ability of appending | 158 // the dump (microdump only). Microdumps don't have the ability of appending |
| 150 // extra metadata after the dump is generated (as opposite to minidumps | 159 // extra metadata after the dump is generated (as opposite to minidumps |
| 151 // MIME fields), therefore the product details must be provided upfront. | 160 // MIME fields), therefore the product details must be provided upfront. |
| 152 // The string pointers are supposed to be valid through all the lifetime of | 161 // The string pointers are supposed to be valid through all the lifetime of |
| 153 // the process (read: the caller has to guarantee that they are stored in | 162 // the process (read: the caller has to guarantee that they are stored in |
| 154 // global static storage). | 163 // global static storage). |
| 155 const char* microdump_build_fingerprint_; | 164 const char* microdump_build_fingerprint_; |
| 156 const char* microdump_product_info_; | 165 const char* microdump_product_info_; |
| 166 const char* microdump_gpu_fingerprint_; | |
| 157 }; | 167 }; |
| 158 | 168 |
| 159 } // namespace google_breakpad | 169 } // namespace google_breakpad |
| 160 | 170 |
| 161 #endif // CLIENT_LINUX_HANDLER_MINIDUMP_DESCRIPTOR_H_ | 171 #endif // CLIENT_LINUX_HANDLER_MINIDUMP_DESCRIPTOR_H_ |
| OLD | NEW |