diff options
author | Dawn Perchik <dawn@burble.org> | 2015-09-04 01:02:30 +0000 |
---|---|---|
committer | Dawn Perchik <dawn@burble.org> | 2015-09-04 01:02:30 +0000 |
commit | 009d110de476e6a1c9581b1e57a90dd73593b8aa (patch) | |
tree | b3c21aba02ef7872b0b88463b77f5a96d9c92ba8 /lldb/source/Commands/CommandObjectExpression.cpp | |
parent | b2e9897644383e7e535a3f4465706760b336ca49 (diff) | |
download | llvm-009d110de476e6a1c9581b1e57a90dd73593b8aa.zip llvm-009d110de476e6a1c9581b1e57a90dd73593b8aa.tar.gz llvm-009d110de476e6a1c9581b1e57a90dd73593b8aa.tar.bz2 |
Set the default language to use when evaluating to that of the frame's CU.
* Use the frame's context (instead of just the target's) when evaluating,
so that the language of the frame's CU can be used to select the
compiler and/or compiler options to use when parsing the expression.
This allows for modules built with mixed languages to be parsed in
the context of their frame.
* Add all C and C++ language variants when determining the language options
to set.
* Enable C++ language options when language is C or ObjC as a workaround since
the expression parser uses features of C++ to capture values.
* Enable ObjC language options when language is C++ as a workaround for ObjC
requirements.
* Disable C++11 language options when language is C++03.
* Add test TestMixedLanguages.py to check that the language being used
for evaluation is that of the frame.
* Fix test TestExprOptions.py to check for C++11 instead of C++ since C++ has
to be enabled for C, and remove redundant expr --language test for ObjC.
* Fix TestPersistentPtrUpdate.py to not require C++11 in C.
Reviewed by: clayborg, spyffe, jingham
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D11102
llvm-svn: 246829
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 4aa486c..7e787bc 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -289,8 +289,8 @@ CommandObjectExpression::EvaluateExpression if (target) { lldb::ValueObjectSP result_valobj_sp; - bool keep_in_memory = true; + StackFrame *frame = exe_ctx.GetFramePtr(); EvaluateExpressionOptions options; options.SetCoerceToId(m_varobj_options.use_objc); @@ -301,11 +301,15 @@ CommandObjectExpression::EvaluateExpression options.SetTryAllThreads(m_command_options.try_all_threads); options.SetDebug(m_command_options.debug); - // If the language was not specified, set it from target's properties + // 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 (m_command_options.language != eLanguageTypeUnknown) options.SetLanguage(m_command_options.language); - else + else if (target->GetLanguage() != eLanguageTypeUnknown) options.SetLanguage(target->GetLanguage()); + else if (frame) + options.SetLanguage(frame->GetLanguage()); // 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 @@ -318,8 +322,7 @@ CommandObjectExpression::EvaluateExpression else options.SetTimeoutUsec(0); - target->EvaluateExpression(expr, exe_ctx.GetFramePtr(), - result_valobj_sp, options); + target->EvaluateExpression(expr, frame, result_valobj_sp, options); if (result_valobj_sp) { |