Work around Windows headers #defining ERROR by renaming enum values in StackFrameSymbolizer

Patch by Julian Seward <jseward@acm.org>, R=ted

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1120 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ted.mielczarek@gmail.com 2013-03-04 15:42:50 +00:00
parent cd04fe2c88
commit c02002a581
3 changed files with 17 additions and 17 deletions

View file

@ -56,13 +56,13 @@ class StackFrameSymbolizer {
enum SymbolizerResult { enum SymbolizerResult {
// Symbol data was found and successfully loaded in resolver. // Symbol data was found and successfully loaded in resolver.
// This does NOT guarantee source line info is found within symbol file. // This does NOT guarantee source line info is found within symbol file.
NO_ERROR, kNoError,
// This indicates non-critical error, such as, no code module found for // This indicates non-critical error, such as, no code module found for
// frame's instruction, no symbol file, or resolver failed to load symbol. // frame's instruction, no symbol file, or resolver failed to load symbol.
ERROR, kError,
// This indicates error for which stack walk should be interrupted // This indicates error for which stack walk should be interrupted
// and retried in future. // and retried in future.
INTERRUPT kInterrupt
}; };
StackFrameSymbolizer(SymbolSupplier* supplier, StackFrameSymbolizer(SymbolSupplier* supplier,

View file

@ -59,27 +59,27 @@ StackFrameSymbolizer::SymbolizerResult StackFrameSymbolizer::FillSourceLineInfo(
StackFrame* frame) { StackFrame* frame) {
assert(frame); assert(frame);
if (!modules) return ERROR; if (!modules) return kError;
const CodeModule* module = modules->GetModuleForAddress(frame->instruction); const CodeModule* module = modules->GetModuleForAddress(frame->instruction);
if (!module) return ERROR; if (!module) return kError;
frame->module = module; frame->module = module;
if (!resolver_) return ERROR; // no resolver. if (!resolver_) return kError; // no resolver.
// If module is known to have missing symbol file, return. // If module is known to have missing symbol file, return.
if (no_symbol_modules_.find(module->code_file()) != if (no_symbol_modules_.find(module->code_file()) !=
no_symbol_modules_.end()) { no_symbol_modules_.end()) {
return ERROR; return kError;
} }
// If module is already loaded, go ahead to fill source line info and return. // If module is already loaded, go ahead to fill source line info and return.
if (resolver_->HasModule(frame->module)) { if (resolver_->HasModule(frame->module)) {
resolver_->FillSourceLineInfo(frame); resolver_->FillSourceLineInfo(frame);
return NO_ERROR; return kNoError;
} }
// Module needs to fetch symbol file. First check to see if supplier exists. // Module needs to fetch symbol file. First check to see if supplier exists.
if (!supplier_) { if (!supplier_) {
return ERROR; return kError;
} }
// Start fetching symbol from supplier. // Start fetching symbol from supplier.
@ -98,26 +98,26 @@ StackFrameSymbolizer::SymbolizerResult StackFrameSymbolizer::FillSourceLineInfo(
if (load_success) { if (load_success) {
resolver_->FillSourceLineInfo(frame); resolver_->FillSourceLineInfo(frame);
return NO_ERROR; return kNoError;
} else { } else {
BPLOG(ERROR) << "Failed to load symbol file in resolver."; BPLOG(ERROR) << "Failed to load symbol file in resolver.";
no_symbol_modules_.insert(module->code_file()); no_symbol_modules_.insert(module->code_file());
return ERROR; return kError;
} }
} }
case SymbolSupplier::NOT_FOUND: case SymbolSupplier::NOT_FOUND:
no_symbol_modules_.insert(module->code_file()); no_symbol_modules_.insert(module->code_file());
return ERROR; return kError;
case SymbolSupplier::INTERRUPT: case SymbolSupplier::INTERRUPT:
return INTERRUPT; return kInterrupt;
default: default:
BPLOG(ERROR) << "Unknown SymbolResult enum: " << symbol_result; BPLOG(ERROR) << "Unknown SymbolResult enum: " << symbol_result;
return ERROR; return kError;
} }
return ERROR; return kError;
} }
WindowsFrameInfo* StackFrameSymbolizer::FindWindowsFrameInfo( WindowsFrameInfo* StackFrameSymbolizer::FindWindowsFrameInfo(

View file

@ -90,7 +90,7 @@ bool Stackwalker::Walk(CallStack* stack) {
StackFrameSymbolizer::SymbolizerResult symbolizer_result = StackFrameSymbolizer::SymbolizerResult symbolizer_result =
frame_symbolizer_->FillSourceLineInfo(modules_, system_info_, frame_symbolizer_->FillSourceLineInfo(modules_, system_info_,
frame.get()); frame.get());
if (symbolizer_result == StackFrameSymbolizer::INTERRUPT) { if (symbolizer_result == StackFrameSymbolizer::kInterrupt) {
BPLOG(INFO) << "Stack walk is interrupted."; BPLOG(INFO) << "Stack walk is interrupted.";
return false; return false;
} }
@ -185,7 +185,7 @@ bool Stackwalker::InstructionAddressSeemsValid(u_int64_t address) {
return true; return true;
} }
if (symbolizer_result != StackFrameSymbolizer::NO_ERROR) { if (symbolizer_result != StackFrameSymbolizer::kNoError) {
// Some error occurred during symbolization, but the address is within a // Some error occurred during symbolization, but the address is within a
// known module // known module
return true; return true;