Fix for issues 296, 297. Various symbol supplier classes need to be updated with new overload('make check' was failing, as well as crash_report), and remove logging that was flooding output

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@318 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
nealsid 2009-02-27 23:59:40 +00:00
parent 02c244f1b2
commit 2ad976ef0b
7 changed files with 88 additions and 11 deletions

View File

@ -67,14 +67,14 @@ class SymbolSupplier {
const SystemInfo *system_info, const SystemInfo *system_info,
string *symbol_file) = 0; string *symbol_file) = 0;
// Same as above, except also places symbol data into symbol_data. // Same as above, except also places symbol data into symbol_data.
// If symbol_data is NULL, the data is not returned. // If symbol_data is NULL, the data is not returned.
// TODO(nealsid) Once we have symbol data caching behavior implemented // TODO(nealsid) Once we have symbol data caching behavior implemented
// investigate making all symbol suppliers implement all methods, // investigate making all symbol suppliers implement all methods,
// and make this pure virtual // and make this pure virtual
virtual SymbolResult GetSymbolFile(const CodeModule *module, virtual SymbolResult GetSymbolFile(const CodeModule *module,
const SystemInfo *system_info, const SystemInfo *system_info,
string *symbol_file, string *symbol_file,
string *symbol_data) { assert(0); } string *symbol_data) = 0;
}; };
} // namespace google_breakpad } // namespace google_breakpad

View File

@ -60,8 +60,12 @@ bool ContainedRangeMap<AddressType, EntryType>::StoreRange(
// Check for undersize or overflow. // Check for undersize or overflow.
if (size <= 0 || high < base) { if (size <= 0 || high < base) {
BPLOG(INFO) << "StoreRange failed, " << HexString(base) << "+" << //TODO(nealsid) We are commenting this out in order to prevent
HexString(size) << ", " << HexString(high); // excessive logging. We plan to move to better logging as this
// failure happens quite often and is expected(see comment in
// basic_source_line_resolver.cc:671).
// BPLOG(INFO) << "StoreRange failed, " << HexString(base) << "+"
// << HexString(size) << ", " << HexString(high);
return false; return false;
} }
@ -81,8 +85,9 @@ bool ContainedRangeMap<AddressType, EntryType>::StoreRange(
// it must fail. iterator_base->first contains the key, which was the // it must fail. iterator_base->first contains the key, which was the
// containing child's high address. // containing child's high address.
if (iterator_base->second->base_ == base && iterator_base->first == high) { if (iterator_base->second->base_ == base && iterator_base->first == high) {
BPLOG(INFO) << "StoreRange failed, identical range is already " // TODO(nealsid): See the TODO above on why this is commented out.
"present: " << HexString(base) << "+" << HexString(size); // BPLOG(INFO) << "StoreRange failed, identical range is already "
// "present: " << HexString(base) << "+" << HexString(size);
return false; return false;
} }

View File

@ -32,6 +32,8 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <iostream>
#include <fstream>
#include "google_breakpad/processor/basic_source_line_resolver.h" #include "google_breakpad/processor/basic_source_line_resolver.h"
#include "google_breakpad/processor/call_stack.h" #include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/code_module.h" #include "google_breakpad/processor/code_module.h"
@ -89,6 +91,11 @@ class TestSymbolSupplier : public SymbolSupplier {
const SystemInfo *system_info, const SystemInfo *system_info,
string *symbol_file); string *symbol_file);
virtual SymbolResult GetSymbolFile(const CodeModule *module,
const SystemInfo *system_info,
string *symbol_file,
string *symbol_data);
// When set to true, causes the SymbolSupplier to return INTERRUPT // When set to true, causes the SymbolSupplier to return INTERRUPT
void set_interrupt(bool interrupt) { interrupt_ = interrupt; } void set_interrupt(bool interrupt) { interrupt_ = interrupt; }
@ -123,6 +130,23 @@ SymbolSupplier::SymbolResult TestSymbolSupplier::GetSymbolFile(
return NOT_FOUND; return NOT_FOUND;
} }
SymbolSupplier::SymbolResult TestSymbolSupplier::GetSymbolFile(
const CodeModule *module,
const SystemInfo *system_info,
string *symbol_file,
string *symbol_data) {
SymbolSupplier::SymbolResult s = GetSymbolFile(module, system_info,
symbol_file);
if (s == FOUND) {
std::ifstream in(symbol_file->c_str());
std::getline(in, *symbol_data, std::string::traits_type::to_char_type(
std::string::traits_type::eof()));
in.close();
}
return s;
}
static bool RunTests() { static bool RunTests() {
TestSymbolSupplier supplier; TestSymbolSupplier supplier;
BasicSourceLineResolver resolver; BasicSourceLineResolver resolver;

View File

@ -38,6 +38,8 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <iostream>
#include <fstream>
#include "processor/simple_symbol_supplier.h" #include "processor/simple_symbol_supplier.h"
#include "google_breakpad/processor/code_module.h" #include "google_breakpad/processor/code_module.h"
@ -71,6 +73,25 @@ SymbolSupplier::SymbolResult SimpleSymbolSupplier::GetSymbolFile(
return NOT_FOUND; return NOT_FOUND;
} }
SymbolSupplier::SymbolResult SimpleSymbolSupplier::GetSymbolFile(
const CodeModule *module,
const SystemInfo *system_info,
string *symbol_file,
string *symbol_data) {
assert(symbol_data);
symbol_data->clear();
SymbolSupplier::SymbolResult s = GetSymbolFile(module, system_info, symbol_file);
if (s == FOUND) {
std::ifstream in(symbol_file->c_str());
std::getline(in, *symbol_data, std::string::traits_type::to_char_type(
std::string::traits_type::eof()));
in.close();
}
return s;
}
SymbolSupplier::SymbolResult SimpleSymbolSupplier::GetSymbolFileAtPathFromRoot( SymbolSupplier::SymbolResult SimpleSymbolSupplier::GetSymbolFileAtPathFromRoot(
const CodeModule *module, const SystemInfo *system_info, const CodeModule *module, const SystemInfo *system_info,
const string &root_path, string *symbol_file) { const string &root_path, string *symbol_file) {

View File

@ -107,9 +107,9 @@ class SimpleSymbolSupplier : public SymbolSupplier {
string *symbol_file); string *symbol_file);
virtual SymbolResult GetSymbolFile(const CodeModule *module, virtual SymbolResult GetSymbolFile(const CodeModule *module,
const SystemInfo *system_info, const SystemInfo *system_info,
string *symbol_file, string *symbol_file,
string *symbol_data) { assert(0); } string *symbol_data);
protected: protected:
SymbolResult GetSymbolFileAtPathFromRoot(const CodeModule *module, SymbolResult GetSymbolFileAtPathFromRoot(const CodeModule *module,
const SystemInfo *system_info, const SystemInfo *system_info,

View File

@ -47,7 +47,7 @@ class OnDemandSymbolSupplier : public SymbolSupplier {
public: public:
// |search_dir| is the directory to search for alternative symbols with // |search_dir| is the directory to search for alternative symbols with
// the same name as the module in the minidump // the same name as the module in the minidump
OnDemandSymbolSupplier(const string &search_dir, OnDemandSymbolSupplier(const string &search_dir,
const string &symbol_search_dir); const string &symbol_search_dir);
virtual ~OnDemandSymbolSupplier() {} virtual ~OnDemandSymbolSupplier() {}
@ -56,11 +56,16 @@ class OnDemandSymbolSupplier : public SymbolSupplier {
const SystemInfo *system_info, const SystemInfo *system_info,
string *symbol_file); string *symbol_file);
// Returns the path to the symbol file for the given module.
virtual SymbolResult GetSymbolFile(const CodeModule *module,
const SystemInfo *system_info,
string *symbol_file,
string *symbol_data);
protected: protected:
// Search directory // Search directory
string search_dir_; string search_dir_;
string symbol_search_dir_; string symbol_search_dir_;
// When we create a symbol file for a module, save the name of the module // When we create a symbol file for a module, save the name of the module
// and the path to that module's symbol file. // and the path to that module's symbol file.
map<string, string> module_file_map_; map<string, string> module_file_map_;

View File

@ -30,6 +30,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <map> #include <map>
#include <string> #include <string>
#include <iostream>
#include <fstream>
#include "google_breakpad/processor/basic_source_line_resolver.h" #include "google_breakpad/processor/basic_source_line_resolver.h"
#include "google_breakpad/processor/minidump.h" #include "google_breakpad/processor/minidump.h"
@ -136,6 +138,26 @@ OnDemandSymbolSupplier::GetSymbolFile(const CodeModule *module,
return FOUND; return FOUND;
} }
SymbolSupplier::SymbolResult
OnDemandSymbolSupplier::GetSymbolFile(const CodeModule *module,
const SystemInfo *system_info,
string *symbol_file,
string *symbol_data) {
SymbolSupplier::SymbolResult s = GetSymbolFile(module,
system_info,
symbol_file);
if (s == FOUND) {
ifstream in(symbol_file->c_str());
getline(in, *symbol_data, std::string::traits_type::to_char_type(
std::string::traits_type::eof()));
in.close();
}
return s;
}
string OnDemandSymbolSupplier::GetLocalModulePath(const CodeModule *module) { string OnDemandSymbolSupplier::GetLocalModulePath(const CodeModule *module) {
NSFileManager *mgr = [NSFileManager defaultManager]; NSFileManager *mgr = [NSFileManager defaultManager];
const char *moduleStr = module->code_file().c_str(); const char *moduleStr = module->code_file().c_str();