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/CommandObjectWatchpointCommand.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/CommandObjectWatchpointCommand.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectWatchpointCommand.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp index aaf1454..b4743eb 100644 --- a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp @@ -355,7 +355,7 @@ are no syntax errors may indicate that a function was declared but never called. protected: void DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = &GetSelectedTarget(); + Target *target = &GetTarget(); const WatchpointList &watchpoints = target->GetWatchpointList(); size_t num_watchpoints = watchpoints.GetSize(); @@ -450,7 +450,7 @@ public: protected: void DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = &GetSelectedTarget(); + Target *target = &GetTarget(); const WatchpointList &watchpoints = target->GetWatchpointList(); size_t num_watchpoints = watchpoints.GetSize(); @@ -505,7 +505,7 @@ public: protected: void DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = &GetSelectedTarget(); + Target *target = &GetTarget(); const WatchpointList &watchpoints = target->GetWatchpointList(); size_t num_watchpoints = watchpoints.GetSize(); |