aboutsummaryrefslogtreecommitdiff
path: root/src/processor/postfix_evaluator-inl.h
diff options
context:
space:
mode:
authormmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2007-05-21 20:09:33 +0000
committermmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2007-05-21 20:09:33 +0000
commit65571f17edb82d122b5f6dc741bd7d4b9e315e1b (patch)
treed86645589367b1997044ebd5138f21eb467c8097 /src/processor/postfix_evaluator-inl.h
parentAdd an optional per-day limit to the number of crash reports sent. The state (diff)
downloadbreakpad-65571f17edb82d122b5f6dc741bd7d4b9e315e1b.tar.xz
Add logging to minidump processor (#82). Part 2: add messages to the rest of
the processor. r=ted.mielczarek http://groups.google.com/group/google-breakpad-dev/browse_thread/thread/cf56b767383a5d4b git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@172 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/processor/postfix_evaluator-inl.h')
-rw-r--r--src/processor/postfix_evaluator-inl.h40
1 files changed, 33 insertions, 7 deletions
diff --git a/src/processor/postfix_evaluator-inl.h b/src/processor/postfix_evaluator-inl.h
index 54796df1..0b5f9c9b 100644
--- a/src/processor/postfix_evaluator-inl.h
+++ b/src/processor/postfix_evaluator-inl.h
@@ -27,6 +27,7 @@
#include "processor/postfix_evaluator.h"
#include "google_breakpad/processor/memory_region.h"
+#include "processor/logging.h"
namespace google_breakpad {
@@ -83,8 +84,11 @@ bool PostfixEvaluator<ValueType>::Evaluate(const string &expression,
if (operation != BINARY_OP_NONE) {
// Get the operands.
ValueType operand1, operand2;
- if (!PopValues(&operand1, &operand2))
+ if (!PopValues(&operand1, &operand2)) {
+ BPLOG(ERROR) << "Could not PopValues to get two values for binary "
+ "operation " << token << ": " << expression;
return false;
+ }
// Perform the operation.
ValueType result;
@@ -107,6 +111,7 @@ bool PostfixEvaluator<ValueType>::Evaluate(const string &expression,
case BINARY_OP_NONE:
// This will not happen, but compilers will want a default or
// BINARY_OP_NONE case.
+ BPLOG(ERROR) << "Not reached!";
return false;
break;
}
@@ -115,32 +120,51 @@ bool PostfixEvaluator<ValueType>::Evaluate(const string &expression,
PushValue(result);
} else if (token == "^") {
// ^ for unary dereference. Can't dereference without memory.
- if (!memory_)
+ if (!memory_) {
+ BPLOG(ERROR) << "Attempt to dereference without memory: " <<
+ expression;
return false;
+ }
ValueType address;
- if (!PopValue(&address))
+ if (!PopValue(&address)) {
+ BPLOG(ERROR) << "Could not PopValue to get value to derefence: " <<
+ expression;
return false;
+ }
ValueType value;
- if (!memory_->GetMemoryAtAddress(address, &value))
+ if (!memory_->GetMemoryAtAddress(address, &value)) {
+ BPLOG(ERROR) << "Could not dereference memory at address " <<
+ HexString(address) << ": " << expression;
return false;
+ }
PushValue(value);
} else if (token == "=") {
// = for assignment.
ValueType value;
- if (!PopValue(&value))
+ if (!PopValue(&value)) {
+ BPLOG(ERROR) << "Could not PopValue to get value to assign: " <<
+ expression;
return false;
+ }
// Assignment is only meaningful when assigning into an identifier.
// The identifier must name a variable, not a constant. Variables
// begin with '$'.
string identifier;
- if (PopValueOrIdentifier(NULL, &identifier) != POP_RESULT_IDENTIFIER)
+ if (PopValueOrIdentifier(NULL, &identifier) != POP_RESULT_IDENTIFIER) {
+ BPLOG(ERROR) << "PopValueOrIdentifier returned a value, but an "
+ "identifier is needed to assign " <<
+ HexString(value) << ": " << expression;
return false;
- if (identifier.empty() || identifier[0] != '$')
+ }
+ if (identifier.empty() || identifier[0] != '$') {
+ BPLOG(ERROR) << "Can't assign " << HexString(value) << " to " <<
+ identifier << ": " << expression;
return false;
+ }
(*dictionary_)[identifier] = value;
if (assigned)
@@ -157,6 +181,7 @@ bool PostfixEvaluator<ValueType>::Evaluate(const string &expression,
// If there's anything left on the stack, it indicates incomplete execution.
// This is a failure case. If the stack is empty, evalution was complete
// and successful.
+ BPLOG_IF(ERROR, !stack_.empty()) << "Incomplete execution: " << expression;
return stack_.empty();
}
@@ -210,6 +235,7 @@ bool PostfixEvaluator<ValueType>::PopValue(ValueType *value) {
if (iterator == dictionary_->end()) {
// The identifier wasn't found in the dictionary. Don't imply any
// default value, just fail.
+ BPLOG(ERROR) << "Identifier " << token << " not in dictionary";
return false;
}