From 7cc286a5a726f4d522d0ce7be9d301e538d70329 Mon Sep 17 00:00:00 2001 From: "wfh@chromium.org" Date: Wed, 16 Apr 2014 16:03:57 +0000 Subject: 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 | 65 +++++++++++++++++--------------- 1 file changed, 35 insertions(+), 30 deletions(-) (limited to 'src/tools') 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,33 +154,31 @@ 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)) { - printUsageAndExit(); - } - - const wchar_t *module, *url; + const wchar_t *module; int timeout = -1; - if (argc == 3) { - module = argv[1]; - url = argv[2]; - } else { - // check for timeout flag + int currentarg = 1; + if (argc > 2) { if (!wcscmp(L"--timeout", argv[1])) { - timeout = _wtoi(argv[2]); - module = argv[3]; - url = argv[4]; - } else { - printUsageAndExit(); + timeout = _wtoi(argv[2]); + currentarg = 3; } + } else { + printUsageAndExit(); } + if (argc >= currentarg + 2) + module = argv[currentarg++]; + else + printUsageAndExit(); + wstring symbol_file; PDBModuleInfo pdb_info; if (!DumpSymbolsToTempFile(module, &symbol_file, &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); + bool success = true; + + 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++; + } + _wunlink(symbol_file.c_str()); - if (!success) { - fwprintf(stderr, L"Symbol file upload failed\n"); - return 1; + 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()); } - 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; + return success ? 0 : 1; } -- cgit v1.2.1