[all-commits] [llvm/llvm-project] 0642cd: [lldb] Turn lldb_private::Status into a value type...

Adrian Prantl via All-commits all-commits at lists.llvm.org
Tue Aug 27 10:59:52 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0642cd768b80665585c8500bed2933a3b99123dc
      https://github.com/llvm/llvm-project/commit/0642cd768b80665585c8500bed2933a3b99123dc
  Author: Adrian Prantl <aprantl at apple.com>
  Date:   2024-08-27 (Tue, 27 Aug 2024)

  Changed paths:
    M lldb/bindings/python/python-wrapper.swig
    M lldb/include/lldb/Core/StructuredDataImpl.h
    M lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h
    M lldb/include/lldb/Interpreter/Interfaces/ScriptedPlatformInterface.h
    M lldb/include/lldb/Interpreter/Interfaces/ScriptedProcessInterface.h
    M lldb/include/lldb/Interpreter/OptionValue.h
    M lldb/include/lldb/Interpreter/ScriptInterpreter.h
    M lldb/include/lldb/Target/Process.h
    M lldb/include/lldb/Target/ProcessTrace.h
    M lldb/include/lldb/Utility/Status.h
    M lldb/source/API/SBBreakpoint.cpp
    M lldb/source/API/SBBreakpointLocation.cpp
    M lldb/source/API/SBBreakpointName.cpp
    M lldb/source/API/SBDebugger.cpp
    M lldb/source/API/SBError.cpp
    M lldb/source/API/SBFile.cpp
    M lldb/source/API/SBFrame.cpp
    M lldb/source/API/SBPlatform.cpp
    M lldb/source/API/SBProcess.cpp
    M lldb/source/API/SBStructuredData.cpp
    M lldb/source/API/SBTarget.cpp
    M lldb/source/API/SBThread.cpp
    M lldb/source/API/SBTrace.cpp
    M lldb/source/API/SBValue.cpp
    M lldb/source/Breakpoint/Breakpoint.cpp
    M lldb/source/Breakpoint/BreakpointID.cpp
    M lldb/source/Breakpoint/BreakpointLocation.cpp
    M lldb/source/Breakpoint/BreakpointOptions.cpp
    M lldb/source/Breakpoint/BreakpointPrecondition.cpp
    M lldb/source/Breakpoint/BreakpointResolver.cpp
    M lldb/source/Breakpoint/BreakpointResolverAddress.cpp
    M lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
    M lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
    M lldb/source/Breakpoint/BreakpointResolverName.cpp
    M lldb/source/Breakpoint/BreakpointResolverScripted.cpp
    M lldb/source/Commands/CommandObjectBreakpointCommand.cpp
    M lldb/source/Commands/CommandObjectCommands.cpp
    M lldb/source/Commands/CommandObjectDisassemble.cpp
    M lldb/source/Commands/CommandObjectExpression.cpp
    M lldb/source/Commands/CommandObjectFrame.cpp
    M lldb/source/Commands/CommandObjectLog.cpp
    M lldb/source/Commands/CommandObjectMemory.cpp
    M lldb/source/Commands/CommandObjectPlatform.cpp
    M lldb/source/Commands/CommandObjectProcess.cpp
    M lldb/source/Commands/CommandObjectScripting.cpp
    M lldb/source/Commands/CommandObjectSource.cpp
    M lldb/source/Commands/CommandObjectTarget.cpp
    M lldb/source/Commands/CommandObjectThread.cpp
    M lldb/source/Commands/CommandObjectType.cpp
    M lldb/source/Commands/CommandObjectWatchpoint.cpp
    M lldb/source/Commands/CommandObjectWatchpointCommand.cpp
    M lldb/source/Commands/CommandOptionsProcessAttach.cpp
    M lldb/source/Commands/CommandOptionsProcessLaunch.cpp
    M lldb/source/Core/Communication.cpp
    M lldb/source/Core/Debugger.cpp
    M lldb/source/Core/FormatEntity.cpp
    M lldb/source/Core/Module.cpp
    M lldb/source/Core/ModuleList.cpp
    M lldb/source/Core/PluginManager.cpp
    M lldb/source/Core/SearchFilter.cpp
    M lldb/source/Core/ThreadedCommunication.cpp
    M lldb/source/Core/UserSettingsController.cpp
    M lldb/source/Core/Value.cpp
    M lldb/source/Core/ValueObject.cpp
    M lldb/source/Core/ValueObjectChild.cpp
    M lldb/source/Core/ValueObjectDynamicValue.cpp
    M lldb/source/Core/ValueObjectMemory.cpp
    M lldb/source/Core/ValueObjectRegister.cpp
    M lldb/source/Core/ValueObjectVTable.cpp
    M lldb/source/Core/ValueObjectVariable.cpp
    M lldb/source/Expression/ExpressionParser.cpp
    M lldb/source/Expression/IRExecutionUnit.cpp
    M lldb/source/Expression/IRInterpreter.cpp
    M lldb/source/Expression/IRMemoryMap.cpp
    M lldb/source/Expression/Materializer.cpp
    M lldb/source/Expression/UserExpression.cpp
    M lldb/source/Expression/UtilityFunction.cpp
    M lldb/source/Host/common/File.cpp
    M lldb/source/Host/common/FileCache.cpp
    M lldb/source/Host/common/Host.cpp
    M lldb/source/Host/common/LockFileBase.cpp
    M lldb/source/Host/common/MonitoringProcessLauncher.cpp
    M lldb/source/Host/common/NativeProcessProtocol.cpp
    M lldb/source/Host/common/NativeRegisterContext.cpp
    M lldb/source/Host/common/ProcessLaunchInfo.cpp
    M lldb/source/Host/common/Socket.cpp
    M lldb/source/Host/common/TCPSocket.cpp
    M lldb/source/Host/common/UDPSocket.cpp
    M lldb/source/Host/freebsd/Host.cpp
    M lldb/source/Host/linux/Host.cpp
    M lldb/source/Host/macosx/objcxx/Host.mm
    M lldb/source/Host/netbsd/HostNetBSD.cpp
    M lldb/source/Host/openbsd/Host.cpp
    M lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
    M lldb/source/Host/posix/DomainSocket.cpp
    M lldb/source/Host/posix/FileSystemPosix.cpp
    M lldb/source/Host/posix/HostProcessPosix.cpp
    M lldb/source/Host/posix/HostThreadPosix.cpp
    M lldb/source/Host/posix/LockFilePosix.cpp
    M lldb/source/Host/posix/MainLoopPosix.cpp
    M lldb/source/Host/posix/PipePosix.cpp
    M lldb/source/Host/posix/ProcessLauncherPosixFork.cpp
    M lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
    M lldb/source/Host/windows/FileSystem.cpp
    M lldb/source/Host/windows/Host.cpp
    M lldb/source/Host/windows/LockFileWindows.cpp
    M lldb/source/Host/windows/MainLoopWindows.cpp
    M lldb/source/Interpreter/CommandInterpreter.cpp
    M lldb/source/Interpreter/OptionArgParser.cpp
    M lldb/source/Interpreter/OptionGroupFormat.cpp
    M lldb/source/Interpreter/OptionGroupPlatform.cpp
    M lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp
    M lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
    M lldb/source/Interpreter/OptionGroupVariable.cpp
    M lldb/source/Interpreter/OptionGroupWatchpoint.cpp
    M lldb/source/Interpreter/OptionValue.cpp
    M lldb/source/Interpreter/OptionValueArch.cpp
    M lldb/source/Interpreter/OptionValueArray.cpp
    M lldb/source/Interpreter/OptionValueBoolean.cpp
    M lldb/source/Interpreter/OptionValueChar.cpp
    M lldb/source/Interpreter/OptionValueDictionary.cpp
    M lldb/source/Interpreter/OptionValueEnumeration.cpp
    M lldb/source/Interpreter/OptionValueFileColonLine.cpp
    M lldb/source/Interpreter/OptionValueFileSpec.cpp
    M lldb/source/Interpreter/OptionValueFileSpecList.cpp
    M lldb/source/Interpreter/OptionValueFormatEntity.cpp
    M lldb/source/Interpreter/OptionValueLanguage.cpp
    M lldb/source/Interpreter/OptionValuePathMappings.cpp
    M lldb/source/Interpreter/OptionValueProperties.cpp
    M lldb/source/Interpreter/OptionValueRegex.cpp
    M lldb/source/Interpreter/OptionValueSInt64.cpp
    M lldb/source/Interpreter/OptionValueString.cpp
    M lldb/source/Interpreter/OptionValueUInt64.cpp
    M lldb/source/Interpreter/OptionValueUUID.cpp
    M lldb/source/Interpreter/Options.cpp
    M lldb/source/Interpreter/ScriptInterpreter.cpp
    M lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
    M lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
    M lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
    M lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
    M lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
    M lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
    M lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
    M lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
    M lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
    M lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
    M lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
    M lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
    M lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
    M lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
    M lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
    M lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
    M lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
    M lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
    M lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    M lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
    M lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
    M lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
    M lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    M lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    M lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
    M lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
    M lldb/source/Plugins/Platform/Android/AdbClient.cpp
    M lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
    M lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
    M lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
    M lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
    M lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp
    M lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
    M lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
    M lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
    M lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
    M lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
    M lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
    M lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
    M lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
    M lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm.cpp
    M lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp
    M lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.cpp
    M lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.cpp
    M lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp
    M lldb/source/Plugins/Process/FreeBSD/NativeThreadFreeBSD.cpp
    M lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
    M lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
    M lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
    M lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
    M lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
    M lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
    M lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp
    M lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_riscv64.cpp
    M lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp
    M lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
    M lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
    M lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
    M lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
    M lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
    M lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
    M lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
    M lldb/source/Plugins/Process/Utility/NativeProcessSoftwareSingleStep.cpp
    M lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.cpp
    M lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp
    M lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
    M lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp
    M lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm.cpp
    M lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
    M lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp
    M lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp
    M lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp
    M lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
    M lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
    M lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
    M lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
    M lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
    M lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    M lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
    M lldb/source/Plugins/Process/minidump/MinidumpTypes.h
    M lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
    M lldb/source/Plugins/Process/minidump/ProcessMinidump.h
    M lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
    M lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
    M lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
    M lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
    M lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    M lldb/source/Plugins/SymbolLocator/DebugSymbols/SymbolLocatorDebugSymbols.cpp
    M lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
    M lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
    M lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
    M lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
    M lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
    M lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
    M lldb/source/Symbol/SaveCoreOptions.cpp
    M lldb/source/Symbol/SymbolContext.cpp
    M lldb/source/Symbol/Variable.cpp
    M lldb/source/Target/Memory.cpp
    M lldb/source/Target/ModuleCache.cpp
    M lldb/source/Target/Platform.cpp
    M lldb/source/Target/Process.cpp
    M lldb/source/Target/RegisterContext.cpp
    M lldb/source/Target/ScriptedThreadPlan.cpp
    M lldb/source/Target/StackFrame.cpp
    M lldb/source/Target/Target.cpp
    M lldb/source/Target/TargetList.cpp
    M lldb/source/Target/Thread.cpp
    M lldb/source/Utility/RegisterValue.cpp
    M lldb/source/Utility/Scalar.cpp
    M lldb/source/Utility/SelectHelper.cpp
    M lldb/source/Utility/Status.cpp
    M lldb/source/Utility/StringExtractorGDBRemote.cpp
    M lldb/source/Utility/StructuredData.cpp
    M lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/lldb-minimize-processes.patch
    M lldb/tools/lldb-server/Acceptor.cpp
    M lldb/tools/lldb-server/lldb-platform.cpp
    M lldb/unittests/Platform/Android/PlatformAndroidTest.cpp
    M lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationServerTest.cpp
    M lldb/unittests/Target/LocateModuleCallbackTest.cpp
    M lldb/unittests/Target/ModuleCacheTest.cpp
    M lldb/unittests/Utility/StatusTest.cpp

  Log Message:
  -----------
  [lldb] Turn lldb_private::Status into a value type. (#106163)

This patch removes all of the Set.* methods from Status.

This cleanup is part of a series of patches that make it harder use the
anti-pattern of keeping a long-lives Status object around and updating
it while dropping any errors it contains on the floor.

This patch is largely NFC, the more interesting next steps this enables
is to:
1. remove Status.Clear()
2. assert that Status::operator=() never overwrites an error
3. remove Status::operator=()

Note that step (2) will bring 90% of the benefits for users, and step
(3) will dramatically clean up the error handling code in various
places. In the end my goal is to convert all APIs that are of the form

`    ResultTy DoFoo(Status& error)
`
to

`    llvm::Expected<ResultTy> DoFoo()
`
How to read this patch?

The interesting changes are in Status.h and Status.cpp, all other
changes are mostly

` perl -pi -e 's/\.SetErrorString/ = Status::FromErrorString/g' $(git
grep -l SetErrorString lldb/source)
`
plus the occasional manual cleanup.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list