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
This commit is contained in:
wfh@chromium.org 2014-04-16 16:03:57 +00:00
parent be38be57e1
commit 7cc286a5a7

View file

@ -154,32 +154,30 @@ static bool DumpSymbolsToTempFile(const wchar_t *file,
} }
__declspec(noreturn) void printUsageAndExit() { __declspec(noreturn) void printUsageAndExit() {
wprintf(L"Usage: symupload [--timeout NN] <file.exe|file.dll> <symbol upload URL>\n\n"); wprintf(L"Usage: symupload [--timeout NN] <file.exe|file.dll> "
L"<symbol upload URL> [...<symbol upload URLs>]\n\n");
wprintf(L"Timeout is in milliseconds, or can be 0 to be unlimited\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); exit(0);
} }
int wmain(int argc, wchar_t *argv[]) { int wmain(int argc, wchar_t *argv[]) {
if ((argc != 3) && const wchar_t *module;
(argc != 5)) { int timeout = -1;
int currentarg = 1;
if (argc > 2) {
if (!wcscmp(L"--timeout", argv[1])) {
timeout = _wtoi(argv[2]);
currentarg = 3;
}
} else {
printUsageAndExit(); printUsageAndExit();
} }
const wchar_t *module, *url; if (argc >= currentarg + 2)
int timeout = -1; module = argv[currentarg++];
if (argc == 3) { else
module = argv[1]; printUsageAndExit();
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();
}
}
wstring symbol_file; wstring symbol_file;
PDBModuleInfo pdb_info; 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); fwprintf(stderr, L"Warning: Could not get file version for %s\n", module);
} }
bool success = HTTPUpload::SendRequest(url, parameters, bool success = true;
symbol_file, L"symbol_file",
timeout == -1 ? NULL : &timeout,
NULL, NULL);
_wunlink(symbol_file.c_str());
if (!success) { while (currentarg < argc) {
fwprintf(stderr, L"Symbol file upload failed\n"); if (!HTTPUpload::SendRequest(argv[currentarg], parameters,
return 1; 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", _wunlink(symbol_file.c_str());
pdb_info.cpu.c_str(), pdb_info.debug_file.c_str(),
pdb_info.debug_identifier.c_str(), code_file.c_str(), if (success) {
file_version.c_str()); wprintf(L"Uploaded symbols for windows-%s/%s/%s (%s %s)\n",
return 0; 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;
} }