Decide on the expression language inside UserExpression

When the target settings are consulted to decide the expression language
is decided in CommandObjectExpression, this doesn't help if you're running
SBFrame::EvaluateExpression().  Moving the logic into UserExpression fixes
this.

Based on patch from scallanan@apple.com
Reviewed by: dawn
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13267

llvm-svn: 249624
This commit is contained in:
Dawn Perchik
2015-10-07 22:01:12 +00:00
parent 6df48a97d2
commit 1bbaede5b9
2 changed files with 13 additions and 11 deletions

View File

@@ -470,7 +470,7 @@ UserExpression::Evaluate (ExecutionContext &exe_ctx,
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP));
lldb_private::ExecutionPolicy execution_policy = options.GetExecutionPolicy();
const lldb::LanguageType language = options.GetLanguage();
lldb::LanguageType language = options.GetLanguage();
const ResultType desired_type = options.DoesCoerceToId() ? UserExpression::eResultTypeId : UserExpression::eResultTypeAny;
lldb::ExpressionResults execution_results = lldb::eExpressionSetupError;
@@ -515,6 +515,17 @@ UserExpression::Evaluate (ExecutionContext &exe_ctx,
else
full_prefix = option_prefix;
// If the language was not specified in the expression command,
// set it to the language in the target's properties if
// specified, else default to the langage for the frame.
if (language == lldb::eLanguageTypeUnknown)
{
if (target->GetLanguage() != lldb::eLanguageTypeUnknown)
language = target->GetLanguage();
else if (StackFrame *frame = exe_ctx.GetFramePtr())
language = frame->GetLanguage();
}
lldb::UserExpressionSP user_expression_sp(target->GetUserExpressionForLanguage (expr_cstr,
full_prefix,
language,