aboutsummaryrefslogtreecommitdiffstats
path: root/source/Expression/UserExpression.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Expression/UserExpression.cpp')
-rw-r--r--source/Expression/UserExpression.cpp43
1 files changed, 23 insertions, 20 deletions
diff --git a/source/Expression/UserExpression.cpp b/source/Expression/UserExpression.cpp
index a72e2a07599e..e2d1d2f2b3d2 100644
--- a/source/Expression/UserExpression.cpp
+++ b/source/Expression/UserExpression.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+#include "lldb/Host/Config.h"
+
#include <stdio.h>
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -165,9 +167,8 @@ lldb::ExpressionResults UserExpression::Evaluate(
Target *target = exe_ctx.GetTargetPtr();
if (!target) {
- if (log)
- log->Printf("== [UserExpression::Evaluate] Passed a NULL target, can't "
- "run expressions.");
+ LLDB_LOGF(log, "== [UserExpression::Evaluate] Passed a NULL target, can't "
+ "run expressions.");
error.SetErrorString("expression passed a null target");
return lldb::eExpressionSetupError;
}
@@ -176,9 +177,9 @@ lldb::ExpressionResults UserExpression::Evaluate(
if (process == nullptr || process->GetState() != lldb::eStateStopped) {
if (execution_policy == eExecutionPolicyAlways) {
- if (log)
- log->Printf("== [UserExpression::Evaluate] Expression may not run, but "
- "is not constant ==");
+ LLDB_LOGF(log,
+ "== [UserExpression::Evaluate] Expression may not run, but "
+ "is not constant ==");
error.SetErrorString("expression needed to run but couldn't");
@@ -224,14 +225,14 @@ lldb::ExpressionResults UserExpression::Evaluate(
error));
if (error.Fail()) {
if (log)
- log->Printf("== [UserExpression::Evaluate] Getting expression: %s ==",
- error.AsCString());
+ LLDB_LOGF(log, "== [UserExpression::Evaluate] Getting expression: %s ==",
+ error.AsCString());
return lldb::eExpressionSetupError;
}
if (log)
- log->Printf("== [UserExpression::Evaluate] Parsing expression %s ==",
- expr.str().c_str());
+ LLDB_LOGF(log, "== [UserExpression::Evaluate] Parsing expression %s ==",
+ expr.str().c_str());
const bool keep_expression_in_memory = true;
const bool generate_debug_info = options.GetGenerateDebugInfo();
@@ -310,8 +311,9 @@ lldb::ExpressionResults UserExpression::Evaluate(
if (execution_policy == eExecutionPolicyNever &&
!user_expression_sp->CanInterpret()) {
if (log)
- log->Printf("== [UserExpression::Evaluate] Expression may not run, but "
- "is not constant ==");
+ LLDB_LOGF(log,
+ "== [UserExpression::Evaluate] Expression may not run, but "
+ "is not constant ==");
if (!diagnostic_manager.Diagnostics().size())
error.SetExpressionError(lldb::eExpressionSetupError,
@@ -332,7 +334,7 @@ lldb::ExpressionResults UserExpression::Evaluate(
diagnostic_manager.Clear();
if (log)
- log->Printf("== [UserExpression::Evaluate] Executing expression ==");
+ LLDB_LOGF(log, "== [UserExpression::Evaluate] Executing expression ==");
execution_results =
user_expression_sp->Execute(diagnostic_manager, exe_ctx, options,
@@ -340,8 +342,8 @@ lldb::ExpressionResults UserExpression::Evaluate(
if (execution_results != lldb::eExpressionCompleted) {
if (log)
- log->Printf("== [UserExpression::Evaluate] Execution completed "
- "abnormally ==");
+ LLDB_LOGF(log, "== [UserExpression::Evaluate] Execution completed "
+ "abnormally ==");
if (!diagnostic_manager.Diagnostics().size())
error.SetExpressionError(
@@ -354,13 +356,14 @@ lldb::ExpressionResults UserExpression::Evaluate(
result_valobj_sp = expr_result->GetValueObject();
if (log)
- log->Printf("== [UserExpression::Evaluate] Execution completed "
- "normally with result %s ==",
- result_valobj_sp->GetValueAsCString());
+ LLDB_LOGF(log,
+ "== [UserExpression::Evaluate] Execution completed "
+ "normally with result %s ==",
+ result_valobj_sp->GetValueAsCString());
} else {
if (log)
- log->Printf("== [UserExpression::Evaluate] Execution completed "
- "normally with no result ==");
+ LLDB_LOGF(log, "== [UserExpression::Evaluate] Execution completed "
+ "normally with no result ==");
error.SetError(UserExpression::kNoResult, lldb::eErrorTypeGeneric);
}