Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Side by Side Diff: src/client/linux/handler/minidump_descriptor.h

Issue 1334473003: Add GPU fingerprint information to breakpad microdumps. (Closed) Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: Resolve TODO. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 17 matching lines...) Expand all
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 #ifndef CLIENT_LINUX_HANDLER_MINIDUMP_DESCRIPTOR_H_ 30 #ifndef CLIENT_LINUX_HANDLER_MINIDUMP_DESCRIPTOR_H_
31 #define CLIENT_LINUX_HANDLER_MINIDUMP_DESCRIPTOR_H_ 31 #define CLIENT_LINUX_HANDLER_MINIDUMP_DESCRIPTOR_H_
32 32
33 #include <assert.h> 33 #include <assert.h>
34 #include <sys/types.h> 34 #include <sys/types.h>
35 35
36 #include <string> 36 #include <string>
37 37
38 #include "client/linux/handler/microdump_extra_info.h"
38 #include "common/using_std_string.h" 39 #include "common/using_std_string.h"
39 40
40 // This class describes how a crash dump should be generated, either: 41 // This class describes how a crash dump should be generated, either:
41 // - Writing a full minidump to a file in a given directory (the actual path, 42 // - Writing a full minidump to a file in a given directory (the actual path,
42 // inside the directory, is determined by this class). 43 // inside the directory, is determined by this class).
43 // - Writing a full minidump to a given fd. 44 // - Writing a full minidump to a given fd.
44 // - Writing a reduced microdump to the console (logcat on Android). 45 // - Writing a reduced microdump to the console (logcat on Android).
45 namespace google_breakpad { 46 namespace google_breakpad {
46 47
47 class MinidumpDescriptor { 48 class MinidumpDescriptor {
48 public: 49 public:
49 struct MicrodumpOnConsole {}; 50 struct MicrodumpOnConsole {};
50 static const MicrodumpOnConsole kMicrodumpOnConsole; 51 static const MicrodumpOnConsole kMicrodumpOnConsole;
51 52
52 MinidumpDescriptor() : mode_(kUninitialized), 53 MinidumpDescriptor()
53 fd_(-1), 54 : mode_(kUninitialized),
54 size_limit_(-1), 55 fd_(-1),
55 microdump_build_fingerprint_(NULL), 56 size_limit_(-1),
56 microdump_product_info_(NULL) {} 57 microdump_extra_info_() {}
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_extra_info_() {
65 microdump_product_info_(NULL) {
66 assert(!directory.empty()); 66 assert(!directory.empty());
67 } 67 }
68 68
69 explicit MinidumpDescriptor(int fd) 69 explicit MinidumpDescriptor(int fd)
70 : mode_(kWriteMinidumpToFd), 70 : mode_(kWriteMinidumpToFd),
71 fd_(fd), 71 fd_(fd),
72 c_path_(NULL), 72 c_path_(NULL),
73 size_limit_(-1), 73 size_limit_(-1),
74 microdump_build_fingerprint_(NULL), 74 microdump_extra_info_() {
75 microdump_product_info_(NULL) {
76 assert(fd != -1); 75 assert(fd != -1);
77 } 76 }
78 77
78 // TODO(tobiasjs): remove this ctor and associated struct once the
Primiano Tucci (use gerrit) 2015/09/10 12:38:58 I think you can already remove this here and fix t
Tobias Sargeant 2015/09/10 13:18:38 Done.
79 // MicrodumpExtraInfo ctor is used in Chromium.
79 explicit MinidumpDescriptor(const MicrodumpOnConsole&) 80 explicit MinidumpDescriptor(const MicrodumpOnConsole&)
80 : mode_(kWriteMicrodumpToConsole), 81 : mode_(kWriteMicrodumpToConsole),
81 fd_(-1), 82 fd_(-1),
82 size_limit_(-1), 83 size_limit_(-1),
83 microdump_build_fingerprint_(NULL), 84 microdump_extra_info_() {}
84 microdump_product_info_(NULL) {} 85
86 explicit MinidumpDescriptor(const MicrodumpExtraInfo &microdump_extra_info)
87 : mode_(kWriteMicrodumpToConsole),
88 fd_(-1),
89 size_limit_(-1),
90 microdump_extra_info_(microdump_extra_info) {}
85 91
86 explicit MinidumpDescriptor(const MinidumpDescriptor& descriptor); 92 explicit MinidumpDescriptor(const MinidumpDescriptor& descriptor);
87 MinidumpDescriptor& operator=(const MinidumpDescriptor& descriptor); 93 MinidumpDescriptor& operator=(const MinidumpDescriptor& descriptor);
88 94
89 static MinidumpDescriptor getMicrodumpDescriptor(); 95 static MinidumpDescriptor getMicrodumpDescriptor();
90 96
91 bool IsFD() const { return mode_ == kWriteMinidumpToFd; } 97 bool IsFD() const { return mode_ == kWriteMinidumpToFd; }
92 98
93 int fd() const { return fd_; } 99 int fd() const { return fd_; }
94 100
95 string directory() const { return directory_; } 101 string directory() const { return directory_; }
96 102
97 const char* path() const { return c_path_; } 103 const char* path() const { return c_path_; }
98 104
99 bool IsMicrodumpOnConsole() const { 105 bool IsMicrodumpOnConsole() const {
100 return mode_ == kWriteMicrodumpToConsole; 106 return mode_ == kWriteMicrodumpToConsole;
101 } 107 }
102 108
103 // Updates the path so it is unique. 109 // Updates the path so it is unique.
104 // Should be called from a normal context: this methods uses the heap. 110 // Should be called from a normal context: this methods uses the heap.
105 void UpdatePath(); 111 void UpdatePath();
106 112
107 off_t size_limit() const { return size_limit_; } 113 off_t size_limit() const { return size_limit_; }
108 void set_size_limit(off_t limit) { size_limit_ = limit; } 114 void set_size_limit(off_t limit) { size_limit_ = limit; }
109 115
110 // TODO(primiano): make this and product info (below) just part of the 116 void SetMicrodumpExtraInfo(const MicrodumpExtraInfo &microdump_extra_info);
Primiano Tucci (use gerrit) 2015/09/10 12:38:58 Similarly, you could remove this also
Tobias Sargeant 2015/09/10 13:18:39 Done.
111 // microdump ctor once it is rolled stably into Chrome. ETA: June 2015. 117 MicrodumpExtraInfo& microdump_extra_info() { return microdump_extra_info_; };
112 void SetMicrodumpBuildFingerprint(const char* build_fingerprint); 118 const MicrodumpExtraInfo& microdump_extra_info() const {
113 const char* microdump_build_fingerprint() const { 119 return microdump_extra_info_;
114 return microdump_build_fingerprint_; 120 };
115 }
116
117 void SetMicrodumpProductInfo(const char* product_info);
118 const char* microdump_product_info() const {
119 return microdump_product_info_;
120 }
121 121
122 private: 122 private:
123 enum DumpMode { 123 enum DumpMode {
124 kUninitialized = 0, 124 kUninitialized = 0,
125 kWriteMinidumpToFile, 125 kWriteMinidumpToFile,
126 kWriteMinidumpToFd, 126 kWriteMinidumpToFd,
127 kWriteMicrodumpToConsole 127 kWriteMicrodumpToConsole
128 }; 128 };
129 129
130 // Specifies the dump mode (see DumpMode). 130 // Specifies the dump mode (see DumpMode).
131 DumpMode mode_; 131 DumpMode mode_;
132 132
133 // The file descriptor where the minidump is generated. 133 // The file descriptor where the minidump is generated.
134 int fd_; 134 int fd_;
135 135
136 // The directory where the minidump should be generated. 136 // The directory where the minidump should be generated.
137 string directory_; 137 string directory_;
138 138
139 // The full path to the generated minidump. 139 // The full path to the generated minidump.
140 string path_; 140 string path_;
141 141
142 // The C string of |path_|. Precomputed so it can be access from a compromised 142 // The C string of |path_|. Precomputed so it can be access from a compromised
143 // context. 143 // context.
144 const char* c_path_; 144 const char* c_path_;
145 145
146 off_t size_limit_; 146 off_t size_limit_;
147 147
148 // The product name/version and build fingerprint that should be appended to 148 // The product name/version and build fingerprint that should be appended to
Primiano Tucci (use gerrit) 2015/09/10 12:38:58 Fix the comment plz, maybe just say The extra micr
Tobias Sargeant 2015/09/10 13:18:39 Done.
149 // the dump (microdump only). Microdumps don't have the ability of appending 149 // the dump (microdump only). Microdumps don't have the ability of appending
150 // extra metadata after the dump is generated (as opposite to minidumps 150 // extra metadata after the dump is generated (as opposite to minidumps
151 // MIME fields), therefore the product details must be provided upfront. 151 // MIME fields), therefore the product details must be provided upfront.
152 // The string pointers are supposed to be valid through all the lifetime of 152 // 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 153 // the process (read: the caller has to guarantee that they are stored in
154 // global static storage). 154 // global static storage).
155 const char* microdump_build_fingerprint_; 155 MicrodumpExtraInfo microdump_extra_info_;
156 const char* microdump_product_info_;
157 }; 156 };
158 157
159 } // namespace google_breakpad 158 } // namespace google_breakpad
160 159
161 #endif // CLIENT_LINUX_HANDLER_MINIDUMP_DESCRIPTOR_H_ 160 #endif // CLIENT_LINUX_HANDLER_MINIDUMP_DESCRIPTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698