aboutsummaryrefslogtreecommitdiff
path: root/src/tools/windows/symupload/symupload.cc
diff options
context:
space:
mode:
authornealsid <nealsid@4c0a9323-5329-0410-9bdc-e9ce6186880e>2009-03-20 19:02:12 +0000
committernealsid <nealsid@4c0a9323-5329-0410-9bdc-e9ce6186880e>2009-03-20 19:02:12 +0000
commit3366749ee7fd0e6c94906efa817d257917e3bf82 (patch)
tree2bb8fa0d11b8d037c2b3b21ceeed901640add028 /src/tools/windows/symupload/symupload.cc
parentFix for issues 296, 297. Various symbol supplier classes need to be updated w... (diff)
downloadbreakpad-3366749ee7fd0e6c94906efa817d257917e3bf82.tar.xz
Fix for issue 304: symupload needs to support timeout specifications(wininet can timeout when sending large symbol files).
R=doshimun W=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@319 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/tools/windows/symupload/symupload.cc')
-rw-r--r--src/tools/windows/symupload/symupload.cc35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/tools/windows/symupload/symupload.cc b/src/tools/windows/symupload/symupload.cc
index e2ec640e..b858a63d 100644
--- a/src/tools/windows/symupload/symupload.cc
+++ b/src/tools/windows/symupload/symupload.cc
@@ -131,12 +131,13 @@ static bool DumpSymbolsToTempFile(const wchar_t *file,
FILE *temp_file = NULL;
#if _MSC_VER >= 1400 // MSVC 2005/8
- if (_wfopen_s(&temp_file, temp_filename, L"w") != 0) {
+ if (_wfopen_s(&temp_file, temp_filename, L"w") != 0)
#else // _MSC_VER >= 1400
// _wfopen_s was introduced in MSVC8. Use _wfopen for earlier environments.
// Don't use it with MSVC8 and later, because it's deprecated.
- if (!(temp_file = _wfopen(temp_filename, L"w"))) {
+ if (!(temp_file = _wfopen(temp_filename, L"w")))
#endif // _MSC_VER >= 1400
+ {
return false;
}
@@ -152,12 +153,33 @@ static bool DumpSymbolsToTempFile(const wchar_t *file,
return writer.GetModuleInfo(pdb_info);
}
+void printUsageAndExit() {
+ wprintf(L"Usage: symupload [--timeout NN] <file.exe|file.dll> <symbol upload URL>\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");
+ exit(0);
+}
int wmain(int argc, wchar_t *argv[]) {
- if (argc < 3) {
- wprintf(L"Usage: %s <file.exe|file.dll> <symbol upload URL>\n", argv[0]);
- return 0;
+ if ((argc != 3) &&
+ (argc != 5)) {
+ 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();
+ }
}
- const wchar_t *module = argv[1], *url = argv[2];
wstring symbol_file;
PDBModuleInfo pdb_info;
@@ -186,6 +208,7 @@ int wmain(int argc, wchar_t *argv[]) {
bool success = HTTPUpload::SendRequest(url, parameters,
symbol_file, L"symbol_file",
+ timeout == -1 ? NULL : &timeout,
NULL, NULL);
_wunlink(symbol_file.c_str());