From 3032cf8100fb795c2429bb97a5d8624e817a5971 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 24 Mar 2014 09:27:46 +0100 Subject: [PATCH] Make it easier to call AExpression::Dump from GDB. Refs #5846 --- lib/config/aexpression.cpp | 7 ++++++- lib/config/aexpression.h | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/config/aexpression.cpp b/lib/config/aexpression.cpp index 0a1dabb2b..e09be8de8 100644 --- a/lib/config/aexpression.cpp +++ b/lib/config/aexpression.cpp @@ -129,7 +129,7 @@ void AExpression::DumpOperand(std::ostream& stream, const Value& operand, int in } } -void AExpression::Dump(std::ostream& stream, int indent) +void AExpression::Dump(std::ostream& stream, int indent) const { String sym = Utility::GetSymbolName(reinterpret_cast(m_Operator)); stream << String(indent, ' ') << "op: " << Utility::DemangleSymbolName(sym) << "\n"; @@ -140,6 +140,11 @@ void AExpression::Dump(std::ostream& stream, int indent) DumpOperand(stream, m_Operand2, indent + 1); } +void AExpression::Dump(void) const +{ + Dump(std::cerr); +} + Value AExpression::EvaluateOperand1(const Dictionary::Ptr& locals) const { return static_cast(m_Operand1)->Evaluate(locals); diff --git a/lib/config/aexpression.h b/lib/config/aexpression.h index 35ff57c49..181ba5740 100644 --- a/lib/config/aexpression.h +++ b/lib/config/aexpression.h @@ -47,7 +47,8 @@ public: void MakeInline(void); - void Dump(std::ostream& stream, int indent = 0); + void Dump(std::ostream& stream, int indent = 0) const; + void Dump(void) const; static Value OpLiteral(const AExpression *expr, const Dictionary::Ptr& locals); static Value OpVariable(const AExpression *expr, const Dictionary::Ptr& locals);