aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectExpression.cpp
diff options
context:
space:
mode:
authorTatyana Krasnukha <21970096+tkrasnukha@users.noreply.github.com>2020-12-10 19:30:04 +0300
committerTatyana Krasnukha <tatyana@synopsys.com>2020-12-12 16:40:59 +0300
commita01b26fb51c710a3a8ef88cc83b0701461f5b9ab (patch)
tree448aa6405f4bd8f98f14db61c21452ce368ff2c6 /lldb/source/Commands/CommandObjectExpression.cpp
parent7832d7e95ace589b2275bafe701ccb377a16b1b2 (diff)
downloadllvm-a01b26fb51c710a3a8ef88cc83b0701461f5b9ab.zip
llvm-a01b26fb51c710a3a8ef88cc83b0701461f5b9ab.tar.gz
llvm-a01b26fb51c710a3a8ef88cc83b0701461f5b9ab.tar.bz2
[lldb] Make CommandInterpreter's execution context the same as debugger's one.
Currently, the interpreter's context is not updated until a command is executed. This has resulted in the behavior of SB-interface functions and some commands depends on previous user actions. The interpreter's context can stay uninitialized, point to a currently selected target, or point to one of previously selected targets. This patch removes any usages of CommandInterpreter::UpdateExecutionContext. CommandInterpreter::HandleCommand* functions still may override context temporarily, but now they always restore it before exiting. CommandInterpreter saves overriden contexts to the stack, that makes nesting commands possible. Added test reproduces one of the issues. Without this fix, the last assertion fails because interpreter's execution context is empty until running "target list", so, the value of the global property was updated instead of process's local instance. Differential Revision: https://reviews.llvm.org/D92164
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index 58eaa3f..c7866f9 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -292,18 +292,12 @@ void CommandObjectExpression::HandleCompletion(CompletionRequest &request) {
options.SetAutoApplyFixIts(false);
options.SetGenerateDebugInfo(false);
- // We need a valid execution context with a frame pointer for this
- // completion, so if we don't have one we should try to make a valid
- // execution context.
- if (m_interpreter.GetExecutionContext().GetFramePtr() == nullptr)
- m_interpreter.UpdateExecutionContext(nullptr);
-
- // This didn't work, so let's get out before we start doing things that
- // expect a valid frame pointer.
- if (m_interpreter.GetExecutionContext().GetFramePtr() == nullptr)
+ ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
+
+ // Get out before we start doing things that expect a valid frame pointer.
+ if (exe_ctx.GetFramePtr() == nullptr)
return;
- ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
Target *exe_target = exe_ctx.GetTargetPtr();
Target &target = exe_target ? *exe_target : GetDummyTarget();