[Lldb-commits] [PATCH] D93052: "target create" shouldn't save target if the command failed

Tatyana Krasnukha via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 10 09:42:16 PST 2020


tatyana-krasnukha created this revision.
tatyana-krasnukha added reviewers: clayborg, JDevlieghere, jingham, teemperor.
tatyana-krasnukha added a project: LLDB.
Herald added a subscriber: emaste.
tatyana-krasnukha requested review of this revision.
Herald added a subscriber: lldb-commits.

TargetList::CreateTarget automatically adds created target to the list, however, CommandObjectTargetCreate does some additional preparation after creating a target and which can fail.
The command should remove the created target if it failed. Since the function has many ways to return, scope guard does this safer.

Changes to the TargetList make target adding and selection more transparent by splitting CreateTarget into two parts: creation and adding to the list.

Other changes remove unnecessary SetSelectedTarget calls after CreateTarget.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93052

Files:
  lldb/include/lldb/Target/TargetList.h
  lldb/source/API/SBDebugger.cpp
  lldb/source/Commands/CommandObjectProcess.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
  lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/TargetList.cpp
  lldb/source/Target/TraceSessionFileParser.cpp
  lldb/unittests/Process/ProcessEventDataTest.cpp
  lldb/unittests/Thread/ThreadTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93052.310936.patch
Type: text/x-patch
Size: 22957 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201210/93787851/attachment-0001.bin>


More information about the lldb-commits mailing list