Symbol file should contain module GUID at beginning (#66). r=bryner

- The dumped symbol format now begins with a MODULE line identifying the
   uuid, age, and name of the source pdb file.
 - The processor ignores MODULE lines, but they are useful in figuring out
   how to index symbol files in a symbol store.
 - dump_syms and symupload now both accept either a pdb or exe/dll and
   will read the pdb regardless.
 - Figured out that MSSS always represents a module's age in pathnames in
   hexadecimal, and updated SimpleSymbolSupplier to match.

http://groups.google.com/group/airbag-dev/browse_thread/thread/572108d6567edd58


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@59 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
mmentovai 2006-11-06 19:34:19 +00:00
parent e47047b383
commit 80866e7945
14 changed files with 1718 additions and 1635 deletions

View file

@ -52,7 +52,7 @@ int main(int argc, char **argv) {
}
PDBSourceLineWriter writer;
if (!writer.Open(wstring(filename), PDBSourceLineWriter::PDB_FILE)) {
if (!writer.Open(wstring(filename), PDBSourceLineWriter::ANY_FILE)) {
fprintf(stderr, "Open failed\n");
return 1;
}

View file

@ -29,10 +29,25 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Release/dump_syms.exe testdata/dump_syms_regtest.pdb > testdata/dump_syms_regtest.new
if diff -u testdata/dump_syms_regtest.new testdata/dump_syms_regtest.out >& testdata/dump_syms_regtest.diff; then
Release/dump_syms.exe testdata/dump_syms_regtest.pdb | \
tr -d '\015' > \
testdata/dump_syms_regtest.new
status=$?
if [ $status -ne 0 ] ; then
echo "FAIL, dump_syms.exe failed"
exit $status
fi
diff -u testdata/dump_syms_regtest.new testdata/dump_syms_regtest.out > \
testdata/dump_syms_regtest.diff
status=$?
if [ $status -eq 0 ] ; then
rm testdata/dump_syms_regtest.diff testdata/dump_syms_regtest.new
echo "PASS"
else
echo "FAIL, see testdata/dump_syms_regtest.[new|diff]"
fi
exit $status

File diff suppressed because it is too large Load diff

View file

@ -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.