diff options
Diffstat (limited to 'src/tools/windows/symupload')
-rw-r--r-- | src/tools/windows/symupload/symupload.cc | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/tools/windows/symupload/symupload.cc b/src/tools/windows/symupload/symupload.cc index b528c322..33f8e51f 100644 --- a/src/tools/windows/symupload/symupload.cc +++ b/src/tools/windows/symupload/symupload.cc @@ -95,11 +95,13 @@ static bool GetFileVersionString(const wchar_t *filename, wstring *version) { // Creates a new temporary file and writes the symbol data from the given // exe/dll file to it. Returns the path to the temp file in temp_file_path, // and the unique identifier (GUID) for the pdb in module_guid. -static bool DumpSymbolsToTempFile(const wchar_t *exe_file, +static bool DumpSymbolsToTempFile(const wchar_t *file, wstring *temp_file_path, - wstring *module_guid) { + wstring *module_guid, + int *module_age, + wstring *module_filename) { google_airbag::PDBSourceLineWriter writer; - if (!writer.Open(exe_file, PDBSourceLineWriter::EXE_FILE)) { + if (!writer.Open(file, PDBSourceLineWriter::ANY_FILE)) { return false; } @@ -126,37 +128,33 @@ static bool DumpSymbolsToTempFile(const wchar_t *exe_file, } *temp_file_path = temp_filename; - *module_guid = writer.GetModuleGUID(); - return true; -} -// Returns the base name of a file, e.g. strips off the path. -static wstring GetBaseName(const wstring &filename) { - wstring base_name(filename); - size_t slash_pos = base_name.find_last_of(L"/\\"); - if (slash_pos != string::npos) { - base_name.erase(0, slash_pos + 1); - } - return base_name; + return writer.GetModuleInfo(module_guid, module_age, module_filename); } int wmain(int argc, wchar_t *argv[]) { if (argc < 3) { - wprintf(L"Usage: %s file.[exe|dll] <symbol upload URL>\n", argv[0]); + wprintf(L"Usage: %s file.[pdb|exe|dll] <symbol upload URL>\n", argv[0]); return 0; } const wchar_t *module = argv[1], *url = argv[2]; - wstring module_basename = GetBaseName(module); - wstring symbol_file, module_guid; - if (!DumpSymbolsToTempFile(module, &symbol_file, &module_guid)) { + wstring symbol_file, module_guid, module_basename; + int module_age; + if (!DumpSymbolsToTempFile(module, &symbol_file, + &module_guid, &module_age, &module_basename)) { fwprintf(stderr, L"Could not get symbol data from %s\n", module); return 1; } + wchar_t module_age_string[11]; + _snwprintf_s(module_age_string, sizeof(module_age_string) / sizeof(wchar_t), + _TRUNCATE, L"0x%x", module_age); + map<wstring, wstring> parameters; parameters[L"module"] = module_basename; parameters[L"guid"] = module_guid; + parameters[L"age"] = module_age_string; // Don't make a missing version a hard error. Issue a warning, and let the // server decide whether to reject files without versions. |