[all-commits] [llvm/llvm-project] 2634ec: [lldb] "target create" shouldn't save target if th...

Tatyana Krasnukha via All-commits all-commits at lists.llvm.org
Sat Dec 12 05:46:15 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2634ec6ce9007f2406545ca28b4c72961f1e8f67
      https://github.com/llvm/llvm-project/commit/2634ec6ce9007f2406545ca28b4c72961f1e8f67
  Author: Tatyana Krasnukha <21970096+tkrasnukha at users.noreply.github.com>
  Date:   2020-12-12 (Sat, 12 Dec 2020)

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

  Log Message:
  -----------
  [lldb] "target create" shouldn't save target if the command failed

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 created target if it failed. Since
the function has many ways to return, scope guard does this work safely.

Changes to the TargetList make target adding and selection more transparent.

Other changes remove unnecessary SetSelectedTarget after CreateTarget.

Differential Revision: https://reviews.llvm.org/D93052


  Commit: 7832d7e95ace589b2275bafe701ccb377a16b1b2
      https://github.com/llvm/llvm-project/commit/7832d7e95ace589b2275bafe701ccb377a16b1b2
  Author: Tatyana Krasnukha <tatyana at synopsys.com>
  Date:   2020-12-12 (Sat, 12 Dec 2020)

  Changed paths:
    M lldb/source/Target/TargetList.cpp

  Log Message:
  -----------
  [lldb] Modernize TargetList for-loops, NFC

Replace loops with standard algorithms or range-based loops.


  Commit: a01b26fb51c710a3a8ef88cc83b0701461f5b9ab
      https://github.com/llvm/llvm-project/commit/a01b26fb51c710a3a8ef88cc83b0701461f5b9ab
  Author: Tatyana Krasnukha <21970096+tkrasnukha at users.noreply.github.com>
  Date:   2020-12-12 (Sat, 12 Dec 2020)

  Changed paths:
    M lldb/include/lldb/Interpreter/CommandInterpreter.h
    M lldb/source/API/SBCommandInterpreter.cpp
    M lldb/source/Breakpoint/BreakpointOptions.cpp
    M lldb/source/Commands/CommandObjectCommands.cpp
    M lldb/source/Commands/CommandObjectExpression.cpp
    M lldb/source/Commands/CommandObjectProcess.cpp
    M lldb/source/Commands/CommandObjectRegexCommand.cpp
    M lldb/source/Commands/CommandObjectSettings.cpp
    M lldb/source/Commands/CommandObjectWatchpointCommand.cpp
    M lldb/source/Core/IOHandlerCursesGUI.cpp
    M lldb/source/Interpreter/CommandInterpreter.cpp
    M lldb/source/Target/Target.cpp
    A lldb/test/API/python_api/debugger/Makefile
    M lldb/test/API/python_api/debugger/TestDebuggerAPI.py
    A lldb/test/API/python_api/debugger/main.cpp

  Log Message:
  -----------
  [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


Compare: https://github.com/llvm/llvm-project/compare/e52bc1d2bba7...a01b26fb51c7


More information about the All-commits mailing list