diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2024-07-31 09:57:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-31 09:57:10 -0700 |
commit | 8398ad9cb21736dc57ee4dd766bd0859ef9bd000 (patch) | |
tree | 928489616eb403b4328eb66656664c83ff9f1241 /lldb/source/Commands/CommandObjectExpression.cpp | |
parent | faf3333510e0c2c3f319af40456e10c471e11ce8 (diff) | |
download | llvm-8398ad9cb21736dc57ee4dd766bd0859ef9bd000.zip llvm-8398ad9cb21736dc57ee4dd766bd0859ef9bd000.tar.gz llvm-8398ad9cb21736dc57ee4dd766bd0859ef9bd000.tar.bz2 |
[lldb] Unify the way we get the Target in CommandObject (#101208)
Currently, CommandObjects are obtaining a target in a variety of ways.
Often the command incorrectly operates on the selected target. As an
example, when a breakpoint command is running, the current target is
passed into the command but the target that hit the breakpoint is not
the selected target. In other places we use the CommandObject's
execution context, which is frozen during the execution of the command,
and comes with its own limitations. Finally, we often want to fall back
to the dummy target if no real target is available.
Instead of having to guess how to get the target, this patch introduces
one helper function in CommandObject to get the most relevant target. In
order of priority, that's the target from the command object's execution
context, from the interpreter's execution context, the selected target
or the dummy target.
rdar://110846511
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index eb76753..769f01d 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -605,7 +605,7 @@ void CommandObjectExpression::DoExecute(llvm::StringRef command, return; if (m_repl_option.GetOptionValue().GetCurrentValue()) { - Target &target = GetSelectedOrDummyTarget(); + Target &target = GetTarget(); // Drop into REPL m_expr_lines.clear(); m_expr_line_count = 0; @@ -665,7 +665,7 @@ void CommandObjectExpression::DoExecute(llvm::StringRef command, } } - Target &target = GetSelectedOrDummyTarget(); + Target &target = GetTarget(); if (EvaluateExpression(expr, result.GetOutputStream(), result.GetErrorStream(), result)) { |