symupload parameters don't match processor expectations (#91). r=bryner

- Interface change: the "guid" and "age" parameters supplied to a symbol
   server by symupload have been merged into "debug_identifier".  Some
   other parameters have had their names changed.  Additional code_file,
   os, and cpu parameters have been added.
 - Interface change: the format of the MODULE line at the top of dumped .sym
   files has changed slightly.  The fields used for uuid and age have
   merged into a debug_identifier-type field.
 - debug_identifier is formatted the same way as CodeModule::debug_identifier
   for ease of server-side processing.

http://groups.google.com/group/airbag-dev/browse_thread/thread/8022f504cf01f994


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@77 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
mmentovai 2006-12-06 20:18:26 +00:00
parent 28e5990b57
commit 93fa375b58
9 changed files with 177 additions and 86 deletions

View file

@ -211,6 +211,10 @@
RelativePath="..\..\..\common\windows\pdb_source_line_writer.cc"
>
</File>
<File
RelativePath="..\..\..\common\windows\string_utils.cc"
>
</File>
</Filter>
</Files>
<Globals>

View file

@ -31,11 +31,16 @@
// The PDB file is located automatically, using the path embedded in the
// executable. The upload is sent as a multipart/form-data POST request,
// with the following parameters:
// module: the name of the module, e.g. app.exe
// ver: the file version of the module, e.g. 1.2.3.4
// guid: the GUID string embedded in the module pdb,
// e.g. 11111111-2222-3333-4444-555555555555
// symbol_file: the airbag-format symbol file
// code_file: the basename of the module, e.g. "app.exe"
// debug_file: the basename of the debugging file, e.g. "app.pdb"
// debug_identifier: the debug file's identifier, usually consisting of
// the guid and age embedded in the pdb, e.g.
// "11111111BBBB3333DDDD555555555555F"
// version: the file version of the module, e.g. "1.2.3.4"
// os: the operating system that the module was built for, always
// "windows" in this implementation.
// cpu: the CPU that the module was built for, typically "x86".
// symbol_file: the contents of the airbag-format symbol file
#include <Windows.h>
#include <DbgHelp.h>
@ -56,6 +61,7 @@ using std::wstring;
using std::vector;
using std::map;
using google_airbag::HTTPUpload;
using google_airbag::PDBModuleInfo;
using google_airbag::PDBSourceLineWriter;
using google_airbag::WindowsStringUtils;
@ -97,15 +103,16 @@ 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.
// exe/dll file to it. Returns the path to the temp file in temp_file_path
// and information about the pdb in pdb_info.
static bool DumpSymbolsToTempFile(const wchar_t *file,
wstring *temp_file_path,
wstring *module_guid,
int *module_age,
wstring *module_filename) {
PDBModuleInfo *pdb_info) {
google_airbag::PDBSourceLineWriter writer;
if (!writer.Open(file, PDBSourceLineWriter::ANY_FILE)) {
// Use EXE_FILE to get information out of the exe/dll in addition to the
// pdb. The name and version number of the exe/dll are of value, and
// there's no way to locate an exe/dll given a pdb.
if (!writer.Open(file, PDBSourceLineWriter::EXE_FILE)) {
return false;
}
@ -139,34 +146,31 @@ static bool DumpSymbolsToTempFile(const wchar_t *file,
*temp_file_path = temp_filename;
return writer.GetModuleInfo(module_guid, module_age, module_filename, NULL);
return writer.GetModuleInfo(pdb_info);
}
int wmain(int argc, wchar_t *argv[]) {
if (argc < 3) {
wprintf(L"Usage: %s file.[pdb|exe|dll] <symbol upload URL>\n", argv[0]);
wprintf(L"Usage: %s <file.exe|file.dll> <symbol upload URL>\n", argv[0]);
return 0;
}
const wchar_t *module = argv[1], *url = argv[2];
wstring symbol_file, module_guid, module_basename;
int module_age;
if (!DumpSymbolsToTempFile(module, &symbol_file,
&module_guid, &module_age, &module_basename)) {
wstring symbol_file;
PDBModuleInfo pdb_info;
if (!DumpSymbolsToTempFile(module, &symbol_file, &pdb_info)) {
fwprintf(stderr, L"Could not get symbol data from %s\n", module);
return 1;
}
wchar_t module_age_string[11];
WindowsStringUtils::safe_swprintf(
module_age_string,
sizeof(module_age_string) / sizeof(module_age_string[0]),
L"0x%x", module_age);
wstring code_file = WindowsStringUtils::GetBaseName(wstring(module));
map<wstring, wstring> parameters;
parameters[L"module"] = module_basename;
parameters[L"guid"] = module_guid;
parameters[L"age"] = module_age_string;
parameters[L"code_file"] = code_file;
parameters[L"debug_file"] = pdb_info.debug_file;
parameters[L"debug_identifier"] = pdb_info.debug_identifier;
parameters[L"os"] = L"windows"; // This version of symupload is Windows-only
parameters[L"cpu"] = pdb_info.cpu;
// Don't make a missing version a hard error. Issue a warning, and let the
// server decide whether to reject files without versions.
@ -186,7 +190,9 @@ int wmain(int argc, wchar_t *argv[]) {
return 1;
}
wprintf(L"Uploaded symbols for %s/%s/%s\n",
module_basename.c_str(), file_version.c_str(), module_guid.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;
}

View file

@ -216,6 +216,10 @@
RelativePath="..\..\..\common\windows\pdb_source_line_writer.cc"
>
</File>
<File
RelativePath="..\..\..\common\windows\string_utils.cc"
>
</File>
<File
RelativePath=".\symupload.cc"
>