From 7cc286a5a726f4d522d0ce7be9d301e538d70329 Mon Sep 17 00:00:00 2001 From: "wfh@chromium.org" Date: Wed, 16 Apr 2014 16:03:57 +0000 Subject: [PATCH] Allow symupload to upload to multiple URLs on the same command line. R=mark@chromium.org Review URL: https://breakpad.appspot.com/1554002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1315 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/tools/windows/symupload/symupload.cc | 69 +++++++++++++----------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/src/tools/windows/symupload/symupload.cc b/src/tools/windows/symupload/symupload.cc index c9d624e8..e0d78f4f 100644 --- a/src/tools/windows/symupload/symupload.cc +++ b/src/tools/windows/symupload/symupload.cc @@ -154,32 +154,30 @@ static bool DumpSymbolsToTempFile(const wchar_t *file, } __declspec(noreturn) void printUsageAndExit() { - wprintf(L"Usage: symupload [--timeout NN] \n\n"); + wprintf(L"Usage: symupload [--timeout NN] " + L" [...]\n\n"); wprintf(L"Timeout is in milliseconds, or can be 0 to be unlimited\n\n"); - wprintf(L"Example:\n\n\tsymupload.exe --timeout 0 chrome.dll http://no.free.symbol.server.for.you\n"); + wprintf(L"Example:\n\n\tsymupload.exe --timeout 0 chrome.dll " + L"http://no.free.symbol.server.for.you\n"); exit(0); } int wmain(int argc, wchar_t *argv[]) { - if ((argc != 3) && - (argc != 5)) { + const wchar_t *module; + int timeout = -1; + int currentarg = 1; + if (argc > 2) { + if (!wcscmp(L"--timeout", argv[1])) { + timeout = _wtoi(argv[2]); + currentarg = 3; + } + } else { printUsageAndExit(); } - const wchar_t *module, *url; - int timeout = -1; - if (argc == 3) { - module = argv[1]; - url = argv[2]; - } else { - // check for timeout flag - if (!wcscmp(L"--timeout", argv[1])) { - timeout = _wtoi(argv[2]); - module = argv[3]; - url = argv[4]; - } else { - printUsageAndExit(); - } - } + if (argc >= currentarg + 2) + module = argv[currentarg++]; + else + printUsageAndExit(); wstring symbol_file; PDBModuleInfo pdb_info; @@ -206,20 +204,27 @@ int wmain(int argc, wchar_t *argv[]) { fwprintf(stderr, L"Warning: Could not get file version for %s\n", module); } - bool success = HTTPUpload::SendRequest(url, parameters, - symbol_file, L"symbol_file", - timeout == -1 ? NULL : &timeout, - NULL, NULL); - _wunlink(symbol_file.c_str()); + bool success = true; - if (!success) { - fwprintf(stderr, L"Symbol file upload failed\n"); - return 1; + while (currentarg < argc) { + if (!HTTPUpload::SendRequest(argv[currentarg], parameters, + symbol_file, L"symbol_file", + timeout == -1 ? NULL : &timeout, + NULL, NULL)) { + success = false; + fwprintf(stderr, L"Symbol file upload to %s failed\n", argv[currentarg]); + } + currentarg++; } - wprintf(L"Uploaded symbols for windows-%s/%s/%s (%s %s)\n", - pdb_info.cpu.c_str(), pdb_info.debug_file.c_str(), - pdb_info.debug_identifier.c_str(), code_file.c_str(), - file_version.c_str()); - return 0; + _wunlink(symbol_file.c_str()); + + if (success) { + wprintf(L"Uploaded symbols for windows-%s/%s/%s (%s %s)\n", + pdb_info.cpu.c_str(), pdb_info.debug_file.c_str(), + pdb_info.debug_identifier.c_str(), code_file.c_str(), + file_version.c_str()); + } + + return success ? 0 : 1; }