[Lldb-commits] [lldb] r249624 - Decide on the expression language inside UserExpression
Dawn Perchik via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 7 15:01:13 PDT 2015
Author: dperchik
Date: Wed Oct 7 17:01:12 2015
New Revision: 249624
URL: http://llvm.org/viewvc/llvm-project?rev=249624&view=rev
Log:
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 at apple.com
Reviewed by: dawn
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13267
Modified:
lldb/trunk/source/Commands/CommandObjectExpression.cpp
lldb/trunk/source/Expression/UserExpression.cpp
Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=249624&r1=249623&r2=249624&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Wed Oct 7 17:01:12 2015
@@ -299,16 +299,7 @@ CommandObjectExpression::EvaluateExpress
options.SetUseDynamic(m_varobj_options.use_dynamic);
options.SetTryAllThreads(m_command_options.try_all_threads);
options.SetDebug(m_command_options.debug);
-
- // 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 language for the frame.
- if (m_command_options.language != eLanguageTypeUnknown)
- options.SetLanguage(m_command_options.language);
- else if (target->GetLanguage() != eLanguageTypeUnknown)
- options.SetLanguage(target->GetLanguage());
- else if (frame)
- options.SetLanguage(frame->GetLanguage());
+ options.SetLanguage(m_command_options.language);
// If there is any chance we are going to stop and want to see
// what went wrong with our expression, we should generate debug info
Modified: lldb/trunk/source/Expression/UserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/UserExpression.cpp?rev=249624&r1=249623&r2=249624&view=diff
==============================================================================
--- lldb/trunk/source/Expression/UserExpression.cpp (original)
+++ lldb/trunk/source/Expression/UserExpression.cpp Wed Oct 7 17:01:12 2015
@@ -470,7 +470,7 @@ UserExpression::Evaluate (ExecutionConte
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 (ExecutionConte
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,
More information about the lldb-commits
mailing list