diff --git a/src/common/windows/sym_upload_v2_protocol.cc b/src/common/windows/sym_upload_v2_protocol.cc index bcc1a1a9..ad2b83a3 100644 --- a/src/common/windows/sym_upload_v2_protocol.cc +++ b/src/common/windows/sym_upload_v2_protocol.cc @@ -21,6 +21,7 @@ static bool SymUploadV2ProtocolSend(const wchar_t* api_url, const wstring& debug_id, const wstring& symbol_filename, const wstring& symbol_type, + const wstring& product_name, bool force) { wstring url(api_url); wstring key(api_key); @@ -70,7 +71,8 @@ static bool SymUploadV2ProtocolSend(const wchar_t* api_url, CompleteUploadResult completeUploadResult = SymbolCollectorClient::CompleteUpload(url, key, timeout_ms, upload_key, - debug_file, debug_id, symbol_type); + debug_file, debug_id, symbol_type, + product_name); if (completeUploadResult == CompleteUploadResult::Error) { wprintf(L"Failed to complete upload.\n"); return false; diff --git a/src/common/windows/sym_upload_v2_protocol.h b/src/common/windows/sym_upload_v2_protocol.h index 389fa586..3c345a4d 100644 --- a/src/common/windows/sym_upload_v2_protocol.h +++ b/src/common/windows/sym_upload_v2_protocol.h @@ -48,6 +48,8 @@ namespace google_breakpad { // "DSYM" // "PDB" // "SOURCE_MAP" +// If |product_name| is non-empty then it will be sent as part of the symbol +// metadata. // If |force| is set then it will overwrite an existing file with the // same |debug_file| and |debug_id| in the store. bool SymUploadV2ProtocolSend(const wchar_t* api_url, @@ -57,6 +59,7 @@ bool SymUploadV2ProtocolSend(const wchar_t* api_url, const std::wstring& debug_id, const std::wstring& symbol_filename, const std::wstring& symbol_type, + const std::wstring& product_name, bool force); } // namespace google_breakpad diff --git a/src/common/windows/symbol_collector_client.cc b/src/common/windows/symbol_collector_client.cc index 0831b22c..187b100e 100644 --- a/src/common/windows/symbol_collector_client.cc +++ b/src/common/windows/symbol_collector_client.cc @@ -71,7 +71,8 @@ namespace google_breakpad { const wstring& upload_key, const wstring& debug_file, const wstring& debug_id, - const wstring& type) { + const wstring& type, + const wstring& product_name) { wstring url = api_url + L"/v1/uploads/" + upload_key + L":complete" L"?key=" + api_key; @@ -83,11 +84,18 @@ namespace google_breakpad { L"debug_id: \"" + debug_id + L"\" " - L"}, " - L"symbol_upload_type: \"" + - type + - L"\", " - L"use_async_processing: true }"; + L"}, "; + if (!product_name.empty()) { + body += + L"metadata: {" + L"product_name: \"" + + product_name + + L"\"" + L"},"; + } + body += L"symbol_upload_type: \"" + type + + L"\", " + L"use_async_processing: true }"; wstring response; int response_code; diff --git a/src/common/windows/symbol_collector_client.h b/src/common/windows/symbol_collector_client.h index bdf9f7cb..61ee997d 100644 --- a/src/common/windows/symbol_collector_client.h +++ b/src/common/windows/symbol_collector_client.h @@ -75,7 +75,8 @@ namespace google_breakpad { const wstring& upload_key, const wstring& debug_file, const wstring& debug_id, - const wstring& type); + const wstring& type, + const wstring& product_name); // Returns whether or not a symbol file corresponding to the debug_file/ // debug_id pair is already present in symbol storage. diff --git a/src/tools/windows/converter_exe/converter.cc b/src/tools/windows/converter_exe/converter.cc index bb0d091e..b433dff0 100644 --- a/src/tools/windows/converter_exe/converter.cc +++ b/src/tools/windows/converter_exe/converter.cc @@ -69,6 +69,7 @@ const char* kNoExeMSSSServer = "http://msdl.microsoft.com/download/symbols/"; const wchar_t* kSymbolUploadTypeBreakpad = L"BREAKPAD"; const wchar_t* kSymbolUploadTypePE = L"PE"; const wchar_t* kSymbolUploadTypePDB = L"PDB"; +const wchar_t* kConverterProductName = L"WinSymConv"; // Windows stdio doesn't do line buffering. Use this function to flush after // writing to stdout and stderr so that a log will be available if the @@ -242,7 +243,7 @@ static bool UploadSymbolFile(const wstring& upload_symbol_url, FprintfFlush(stderr, "Uploading %s\n", symbol_file.c_str()); if (!google_breakpad::SymUploadV2ProtocolSend( upload_symbol_url.c_str(), api_key.c_str(), &timeout_ms, debug_file_w, - debug_id_w, symbol_file_w, symbol_type, + debug_id_w, symbol_file_w, symbol_type, kConverterProductName, /*force=*/true)) { FprintfFlush(stderr, "UploadSymbolFile: HTTPUpload::SendRequest failed " @@ -647,7 +648,7 @@ static bool ReadFile(string file_name, string* contents) { static bool ConvertMissingSymbolsList(const ConverterOptions& options) { // Set param to indicate requesting for encoded response. map parameters; - parameters[L"product"] = L"WinSymConv"; + parameters[L"product"] = kConverterProductName; parameters[L"encoded"] = L"true"; // Get the missing symbol list. string missing_symbol_list; diff --git a/src/tools/windows/symupload/symupload.cc b/src/tools/windows/symupload/symupload.cc index 6c1d1981..11e38438 100644 --- a/src/tools/windows/symupload/symupload.cc +++ b/src/tools/windows/symupload/symupload.cc @@ -250,11 +250,12 @@ int wmain(int argc, wchar_t* argv[]) { if (argc >= currentarg + 2) { api_url = argv[currentarg++]; api_key = argv[currentarg++]; + wstring product_name = product ? wstring(product) : L""; success = google_breakpad::SymUploadV2ProtocolSend( api_url, api_key, timeout == -1 ? nullptr : &timeout, pdb_info.debug_file, pdb_info.debug_identifier, symbol_file, - kSymbolUploadTypeBreakpad, force); + kSymbolUploadTypeBreakpad, product_name, force); } else { printUsageAndExit(); }