Author: Raphael Isemann Date: 2020-10-27T16:25:01+01:00 New Revision: 45c3fc97a2a5af760a55e72eb081aa5f977e9609
URL: https://github.com/llvm/llvm-project/commit/45c3fc97a2a5af760a55e72eb081aa5f977e9609 DIFF: https://github.com/llvm/llvm-project/commit/45c3fc97a2a5af760a55e72eb081aa5f977e9609.diff LOG: [lldb][NFC] Make GetResumeCountForLaunchInfo return an unsigned. The number of resumes should always be positive to let's make this an unsigned everywhere. Also remove the unused 'localhost' parameter from ConvertArgumentsForLaunchingInShell. Added: Modified: lldb/include/lldb/Host/ProcessLaunchInfo.h lldb/include/lldb/Target/Platform.h lldb/source/Host/common/Host.cpp lldb/source/Host/common/ProcessLaunchInfo.cpp lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp lldb/source/Plugins/Platform/Linux/PlatformLinux.h lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h lldb/source/Target/Platform.cpp Removed: ################################################################################ diff --git a/lldb/include/lldb/Host/ProcessLaunchInfo.h b/lldb/include/lldb/Host/ProcessLaunchInfo.h index e83d8396e9f2..ee9755580825 100644 --- a/lldb/include/lldb/Host/ProcessLaunchInfo.h +++ b/lldb/include/lldb/Host/ProcessLaunchInfo.h @@ -94,10 +94,9 @@ class ProcessLaunchInfo : public ProcessInfo { void Clear(); - bool ConvertArgumentsForLaunchingInShell(Status &error, bool localhost, - bool will_debug, + bool ConvertArgumentsForLaunchingInShell(Status &error, bool will_debug, bool first_arg_is_full_shell_command, - int32_t num_resumes); + uint32_t num_resumes); void SetMonitorProcessCallback(const Host::MonitorChildProcessCallback &callback, diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h index f371b8153144..3c480641a275 100644 --- a/lldb/include/lldb/Target/Platform.h +++ b/lldb/include/lldb/Target/Platform.h @@ -651,7 +651,7 @@ class Platform : public PluginInterface { virtual bool CalculateMD5(const FileSpec &file_spec, uint64_t &low, uint64_t &high); - virtual int32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) { + virtual uint32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) { return 1; } diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 958fca07850b..99316660908e 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -514,11 +514,10 @@ Status Host::RunShellCommand(llvm::StringRef shell_path, const Args &args, launch_info.SetShell(shell); launch_info.GetArguments().AppendArguments(args); - const bool localhost = true; const bool will_debug = false; const bool first_arg_is_full_shell_command = false; launch_info.ConvertArgumentsForLaunchingInShell( - error, localhost, will_debug, first_arg_is_full_shell_command, 0); + error, will_debug, first_arg_is_full_shell_command, 0); } else { // No shell, just run it const bool first_arg_is_executable = true; diff --git a/lldb/source/Host/common/ProcessLaunchInfo.cpp b/lldb/source/Host/common/ProcessLaunchInfo.cpp index 01cf3d76314e..1b4b2c6c3ac2 100644 --- a/lldb/source/Host/common/ProcessLaunchInfo.cpp +++ b/lldb/source/Host/common/ProcessLaunchInfo.cpp @@ -241,8 +241,8 @@ llvm::Error ProcessLaunchInfo::SetUpPtyRedirection() { } bool ProcessLaunchInfo::ConvertArgumentsForLaunchingInShell( - Status &error, bool localhost, bool will_debug, - bool first_arg_is_full_shell_command, int32_t num_resumes) { + Status &error, bool will_debug, bool first_arg_is_full_shell_command, + uint32_t num_resumes) { error.Clear(); if (GetFlags().Test(eLaunchFlagLaunchInShell)) { diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp index 5eb0508de32c..2cb671fd4dc3 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -216,9 +216,9 @@ void PlatformLinux::GetStatus(Stream &strm) { #endif } -int32_t +uint32_t PlatformLinux::GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) { - int32_t resume_count = 0; + uint32_t resume_count = 0; // Always resume past the initial stop when we use eLaunchFlagDebug if (launch_info.GetFlags().Test(eLaunchFlagDebug)) { diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h index 81175d7c5cab..cbbd226c13a8 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h @@ -42,7 +42,7 @@ class PlatformLinux : public PlatformPOSIX { bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override; - int32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) override; + uint32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) override; bool CanDebugProcess() override; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index e0f52598e1e1..a3dff361b9e9 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -1197,7 +1197,7 @@ BreakpointSP PlatformDarwin::SetThreadCreationBreakpoint(Target &target) { return bp_sp; } -int32_t +uint32_t PlatformDarwin::GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) { const FileSpec &shell = launch_info.GetShell(); if (!shell) diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h index 64360b439d10..255945a98b00 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h @@ -66,7 +66,7 @@ class PlatformDarwin : public PlatformPOSIX { bool x86GetSupportedArchitectureAtIndex(uint32_t idx, lldb_private::ArchSpec &arch); - int32_t GetResumeCountForLaunchInfo( + uint32_t GetResumeCountForLaunchInfo( lldb_private::ProcessLaunchInfo &launch_info) override; lldb::ProcessSP DebugProcess(lldb_private::ProcessLaunchInfo &launch_info, diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp index 00674b7471dd..a5d73c942830 100644 --- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp +++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp @@ -185,9 +185,9 @@ void PlatformNetBSD::GetStatus(Stream &strm) { #endif } -int32_t +uint32_t PlatformNetBSD::GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) { - int32_t resume_count = 0; + uint32_t resume_count = 0; // Always resume past the initial stop when we use eLaunchFlagDebug if (launch_info.GetFlags().Test(eLaunchFlagDebug)) { diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h index 63b8dd619822..e664f5181123 100644 --- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h +++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h @@ -42,7 +42,7 @@ class PlatformNetBSD : public PlatformPOSIX { bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override; - int32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) override; + uint32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) override; bool CanDebugProcess() override; diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index 7e1b7450de0e..68bba5bfea4b 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -1021,7 +1021,6 @@ Status Platform::LaunchProcess(ProcessLaunchInfo &launch_info) { launch_info.GetFlags().Set(eLaunchFlagLaunchInTTY); if (launch_info.GetFlags().Test(eLaunchFlagLaunchInShell)) { - const bool is_localhost = true; const bool will_debug = launch_info.GetFlags().Test(eLaunchFlagDebug); const bool first_arg_is_full_shell_command = false; uint32_t num_resumes = GetResumeCountForLaunchInfo(launch_info); @@ -1035,8 +1034,7 @@ Status Platform::LaunchProcess(ProcessLaunchInfo &launch_info) { } if (!launch_info.ConvertArgumentsForLaunchingInShell( - error, is_localhost, will_debug, first_arg_is_full_shell_command, - num_resumes)) + error, will_debug, first_arg_is_full_shell_command, num_resumes)) return error; } else if (launch_info.GetFlags().Test(eLaunchFlagShellExpandArguments)) { error = ShellExpandArguments(launch_info); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits