Index: handler/mac/crash_report_upload_thread.cc |
diff --git a/handler/mac/crash_report_upload_thread.cc b/handler/mac/crash_report_upload_thread.cc |
index 17c5a8bea3c7fdcd62acce04f8066e20058e7c5c..0e77ee730a0d585338830b7ba80a33e7a52b905f 100644 |
--- a/handler/mac/crash_report_upload_thread.cc |
+++ b/handler/mac/crash_report_upload_thread.cc |
@@ -27,6 +27,7 @@ |
#include "snapshot/minidump/process_snapshot_minidump.h" |
#include "snapshot/module_snapshot.h" |
#include "util/file/file_reader.h" |
+#include "util/misc/uuid.h" |
#include "util/net/http_body.h" |
#include "util/net/http_multipart_builder.h" |
#include "util/net/http_transport.h" |
@@ -35,6 +36,19 @@ namespace crashpad { |
namespace { |
+void InsertOrReplaceMapEntry(std::map<std::string, std::string>* map, |
+ const std::string& key, |
+ const std::string& value) { |
+ auto it = map->find(key); |
+ if (it != map->end()) { |
+ LOG(WARNING) << "duplicate key " << key << ", discarding value " |
+ << it->second; |
+ it->second = value; |
+ } else { |
+ map->insert(std::make_pair(key, value)); |
+ } |
+} |
+ |
// Given a minidump file readable by |minidump_file_reader|, returns a map of |
// key-value pairs to use as HTTP form parameters for upload to a Breakpad |
// server. The map is built by combining the process simple annotations map with |
@@ -43,6 +57,8 @@ namespace { |
// discarded values. Each module’s annotations vector is also examined and built |
// into a single string value, with distinct elements separated by newlines, and |
// stored at the key named “list_annotations”, which supersedes any other key |
+// found by that name. The client ID stored in the minidump is converted to |
+// a string and stored at the key named “guid”, which supersedes any other key |
// found by that name. |
// |
// In the event of an error reading the minidump file, a message will be logged. |
@@ -77,17 +93,13 @@ std::map<std::string, std::string> BreakpadHTTPFormParametersFromMinidump( |
// Remove the final newline character. |
list_annotations.resize(list_annotations.size() - 1); |
- const char kListAnnotationsKey[] = "list_annotations"; |
- auto it = parameters.find(kListAnnotationsKey); |
- if (it != parameters.end()) { |
- LOG(WARNING) << "duplicate key " << kListAnnotationsKey |
- << ", discarding value " << it->second; |
- it->second = list_annotations; |
- } else { |
- parameters.insert(std::make_pair(kListAnnotationsKey, list_annotations)); |
- } |
+ InsertOrReplaceMapEntry(¶meters, "list_annotations", list_annotations); |
} |
+ UUID client_id; |
+ minidump_process_snapshot.ClientID(&client_id); |
+ InsertOrReplaceMapEntry(¶meters, "guid", client_id.ToString()); |
+ |
return parameters; |
} |