diff options
author | Adrian Prantl <aprantl@apple.com> | 2018-04-30 16:49:04 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2018-04-30 16:49:04 +0000 |
commit | 05097246f352eca76207c9ebb08656c88bdf751a (patch) | |
tree | bfc4ec8250a939aaf4ade6fc6c528726183e5367 /lldb/source/Plugins/Platform/MacOSX | |
parent | add59c052dd6768fd54431e6a3bf045e7f25cb59 (diff) | |
download | bcm5719-llvm-05097246f352eca76207c9ebb08656c88bdf751a.tar.gz bcm5719-llvm-05097246f352eca76207c9ebb08656c88bdf751a.zip |
Reflow paragraphs in comments.
This is intended as a clean up after the big clang-format commit
(r280751), which unfortunately resulted in many of the comment
paragraphs in LLDB being very hard to read.
FYI, the script I used was:
import textwrap
import commands
import os
import sys
import re
tmp = "%s.tmp"%sys.argv[1]
out = open(tmp, "w+")
with open(sys.argv[1], "r") as f:
header = ""
text = ""
comment = re.compile(r'^( *//) ([^ ].*)$')
special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$')
for line in f:
match = comment.match(line)
if match and not special.match(match.group(2)):
# skip intentionally short comments.
if not text and len(match.group(2)) < 40:
out.write(line)
continue
if text:
text += " " + match.group(2)
else:
header = match.group(1)
text = match.group(2)
continue
if text:
filled = textwrap.wrap(text, width=(78-len(header)),
break_long_words=False)
for l in filled:
out.write(header+" "+l+'\n')
text = ""
out.write(line)
os.rename(tmp, sys.argv[1])
Differential Revision: https://reviews.llvm.org/D46144
llvm-svn: 331197
Diffstat (limited to 'lldb/source/Plugins/Platform/MacOSX')
11 files changed, 190 insertions, 221 deletions
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp index a216e3839dd..6852097117a 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -84,8 +84,8 @@ lldb_private::Status PlatformAppleSimulator::LaunchProcess( void PlatformAppleSimulator::GetStatus(Stream &strm) { #if defined(__APPLE__) - // This will get called by subclasses, so just output status on the - // current simulator + // This will get called by subclasses, so just output status on the current + // simulator PlatformAppleSimulator::LoadCoreSimulator(); CoreSimulatorSupport::DeviceSet devices = @@ -183,8 +183,8 @@ lldb::ProcessSP PlatformAppleSimulator::DebugProcess( // Make sure we stop at the entry point launch_info.GetFlags().Set(eLaunchFlagDebug); // We always launch the process we are going to debug in a separate process - // group, since then we can handle ^C interrupts ourselves w/o having to worry - // about the target getting them as well. + // group, since then we can handle ^C interrupts ourselves w/o having to + // worry about the target getting them as well. launch_info.SetLaunchInSeparateProcessGroup(true); error = LaunchProcess(launch_info); @@ -201,10 +201,10 @@ lldb::ProcessSP PlatformAppleSimulator::DebugProcess( // process if this happens. process_sp->SetShouldDetach(false); - // If we didn't have any file actions, the pseudo terminal might - // have been used where the slave side was given as the file to - // open for stdin/out/err after we have already opened the master - // so we can read/write stdin/out/err. + // If we didn't have any file actions, the pseudo terminal might have + // been used where the slave side was given as the file to open for + // stdin/out/err after we have already opened the master so we can + // read/write stdin/out/err. int pty_fd = launch_info.GetPTY().ReleaseMasterFileDescriptor(); if (pty_fd != PseudoTerminal::invalid_fd) { process_sp->SetSTDIOFileDescriptor(pty_fd); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp index e0558f8b200..2fcd22b0d41 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp @@ -90,9 +90,9 @@ PlatformSP PlatformAppleTVSimulator::CreateInstance(bool force, break; #if defined(__APPLE__) - // Only accept "unknown" for the vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the vendor if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; @@ -107,9 +107,9 @@ PlatformSP PlatformAppleTVSimulator::CreateInstance(bool force, break; #if defined(__APPLE__) - // Only accept "unknown" for the OS if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the OS if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownOS: create = !arch->TripleOSWasSpecified(); break; @@ -199,9 +199,9 @@ Status PlatformAppleTVSimulator::ResolveExecutable( return error; exe_module_sp.reset(); } - // No valid architecture was specified or the exact ARM slice wasn't - // found so ask the platform for the architectures that we should be - // using (in the correct order) and see if we can find a match that way + // No valid architecture was specified or the exact ARM slice wasn't found + // so ask the platform for the architectures that we should be using (in + // the correct order) and see if we can find a match that way StreamString arch_names; ArchSpec platform_arch; for (uint32_t idx = 0; GetSupportedArchitectureAtIndex( @@ -293,8 +293,8 @@ const char *PlatformAppleTVSimulator::GetSDKDirectoryAsCString() { m_sdk_directory.assign(1, '\0'); } - // We should have put a single NULL character into m_sdk_directory - // or it should have a valid path if the code gets here + // We should have put a single NULL character into m_sdk_directory or it + // should have a valid path if the code gets here assert(m_sdk_directory.empty() == false); if (m_sdk_directory[0]) return m_sdk_directory.c_str(); @@ -337,10 +337,9 @@ Status PlatformAppleTVSimulator::GetSharedModule( const ModuleSpec &module_spec, lldb_private::Process *process, ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { - // For AppleTV, the SDK files are all cached locally on the host - // system. So first we ask for the file in the cached SDK, - // then we attempt to get a shared module for the right architecture - // with the right UUID. + // For AppleTV, the SDK files are all cached locally on the host system. So + // first we ask for the file in the cached SDK, then we attempt to get a + // shared module for the right architecture with the right UUID. Status error; ModuleSpec platform_module_spec(module_spec); const FileSpec &platform_file = module_spec.GetFileSpec(); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp index 9b2608f6862..39bd2dc377d 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp @@ -89,9 +89,9 @@ PlatformSP PlatformAppleWatchSimulator::CreateInstance(bool force, break; #if defined(__APPLE__) - // Only accept "unknown" for the vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the vendor if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; @@ -106,9 +106,9 @@ PlatformSP PlatformAppleWatchSimulator::CreateInstance(bool force, break; #if defined(__APPLE__) - // Only accept "unknown" for the OS if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the OS if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownOS: create = !arch->TripleOSWasSpecified(); break; @@ -199,9 +199,9 @@ Status PlatformAppleWatchSimulator::ResolveExecutable( return error; exe_module_sp.reset(); } - // No valid architecture was specified or the exact ARM slice wasn't - // found so ask the platform for the architectures that we should be - // using (in the correct order) and see if we can find a match that way + // No valid architecture was specified or the exact ARM slice wasn't found + // so ask the platform for the architectures that we should be using (in + // the correct order) and see if we can find a match that way StreamString arch_names; ArchSpec platform_arch; for (uint32_t idx = 0; GetSupportedArchitectureAtIndex( @@ -293,8 +293,8 @@ const char *PlatformAppleWatchSimulator::GetSDKDirectoryAsCString() { m_sdk_directory.assign(1, '\0'); } - // We should have put a single NULL character into m_sdk_directory - // or it should have a valid path if the code gets here + // We should have put a single NULL character into m_sdk_directory or it + // should have a valid path if the code gets here assert(m_sdk_directory.empty() == false); if (m_sdk_directory[0]) return m_sdk_directory.c_str(); @@ -337,10 +337,9 @@ Status PlatformAppleWatchSimulator::GetSharedModule( const ModuleSpec &module_spec, lldb_private::Process *process, ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { - // For AppleWatch, the SDK files are all cached locally on the host - // system. So first we ask for the file in the cached SDK, - // then we attempt to get a shared module for the right architecture - // with the right UUID. + // For AppleWatch, the SDK files are all cached locally on the host system. + // So first we ask for the file in the cached SDK, then we attempt to get a + // shared module for the right architecture with the right UUID. Status error; ModuleSpec platform_module_spec(module_spec); const FileSpec &platform_file = module_spec.GetFileSpec(); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 8e031680214..e6ed57ac716 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -73,10 +73,9 @@ FileSpecList PlatformDarwin::LocateExecutableScriptingResources( // NB some extensions might be meaningful and should not be stripped - // "this.binary.file" // should not lose ".file" but GetFileNameStrippingExtension() will do - // precisely that. - // Ideally, we should have a per-platform list of extensions (".exe", - // ".app", ".dSYM", ".framework") - // which should be stripped while leaving "this.binary.file" as-is. + // precisely that. Ideally, we should have a per-platform list of + // extensions (".exe", ".app", ".dSYM", ".framework") which should be + // stripped while leaving "this.binary.file" as-is. ScriptInterpreter *script_interpreter = target->GetDebugger().GetCommandInterpreter().GetScriptInterpreter(); @@ -101,14 +100,11 @@ FileSpecList PlatformDarwin::LocateExecutableScriptingResources( // FIXME: for Python, we cannot allow certain characters in // module // filenames we import. Theoretically, different scripting - // languages may - // have different sets of forbidden tokens in filenames, and - // that should - // be dealt with by each ScriptInterpreter. For now, we just - // replace dots - // with underscores, but if we ever support anything other than - // Python - // we will need to rework this + // languages may have different sets of forbidden tokens in + // filenames, and that should be dealt with by each + // ScriptInterpreter. For now, we just replace dots with + // underscores, but if we ever support anything other than + // Python we will need to rework this std::replace(module_basename.begin(), module_basename.end(), '.', '_'); std::replace(module_basename.begin(), module_basename.end(), @@ -125,9 +121,9 @@ FileSpecList PlatformDarwin::LocateExecutableScriptingResources( StreamString path_string; StreamString original_path_string; // for OSX we are going to be in - // .dSYM/Contents/Resources/DWARF/<basename> - // let us go to .dSYM/Contents/Resources/Python/<basename>.py - // and see if the file exists + // .dSYM/Contents/Resources/DWARF/<basename> let us go to + // .dSYM/Contents/Resources/Python/<basename>.py and see if the + // file exists path_string.Printf("%s/../Python/%s.py", symfile_spec.GetDirectory().GetCString(), module_basename.c_str()); @@ -140,9 +136,8 @@ FileSpecList PlatformDarwin::LocateExecutableScriptingResources( true); // if we did some replacements of reserved characters, and a - // file with the untampered name - // exists, then warn the user that the file as-is shall not be - // loaded + // file with the untampered name exists, then warn the user + // that the file as-is shall not be loaded if (feedback_stream) { if (module_basename != original_module_basename && orig_script_fspec.Exists()) { @@ -178,8 +173,8 @@ FileSpecList PlatformDarwin::LocateExecutableScriptingResources( break; } - // If we didn't find the python file, then keep - // stripping the extensions and try again + // If we didn't find the python file, then keep stripping the + // extensions and try again ConstString filename_no_extension( module_spec.GetFileNameStrippingExtension()); if (module_spec.GetFilename() == filename_no_extension) @@ -270,8 +265,8 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache( FileSpec module_cache_spec(cache_path, false); // if rsync is supported, always bring in the file - rsync will be very - // efficient - // when files are the same on the local and remote end of the connection + // efficient when files are the same on the local and remote end of the + // connection if (this->GetSupportsRSync()) { err = BringInRemoteFile(this, module_spec, module_cache_spec); if (err.Fail()) @@ -370,8 +365,8 @@ Status PlatformDarwin::GetSharedModule( module_sp.reset(); if (IsRemote()) { - // If we have a remote platform always, let it try and locate - // the shared module first. + // If we have a remote platform always, let it try and locate the shared + // module first. if (m_remote_platform_sp) { error = m_remote_platform_sp->GetSharedModule( module_spec, process, module_sp, module_search_paths_ptr, @@ -453,8 +448,8 @@ PlatformDarwin::GetSoftwareBreakpointTrapOpcode(Target &target, switch (machine) { case llvm::Triple::aarch64: { // TODO: fix this with actual darwin breakpoint opcode for arm64. - // right now debugging uses the Z packets with GDB remote so this - // is not needed, but the size needs to be correct... + // right now debugging uses the Z packets with GDB remote so this is not + // needed, but the size needs to be correct... static const uint8_t g_arm64_breakpoint_opcode[] = {0xFE, 0xDE, 0xFF, 0xE7}; trap_opcode = g_arm64_breakpoint_opcode; trap_opcode_size = sizeof(g_arm64_breakpoint_opcode); @@ -548,8 +543,8 @@ bool PlatformDarwin::x86GetSupportedArchitectureAtIndex(uint32_t idx, HostInfo::GetArchitecture(HostInfo::eArchKind64)); if (platform_arch.IsExactMatch(platform_arch64)) { // This macosx platform supports both 32 and 64 bit. Since we already - // returned the 64 bit arch for idx == 0, return the 32 bit arch - // for idx == 1 + // returned the 64 bit arch for idx == 0, return the 32 bit arch for + // idx == 1 arch = HostInfo::GetArchitecture(HostInfo::eArchKind32); return arch.IsValid(); } @@ -558,9 +553,9 @@ bool PlatformDarwin::x86GetSupportedArchitectureAtIndex(uint32_t idx, return false; } -// The architecture selection rules for arm processors -// These cpu subtypes have distinct names (e.g. armv7f) but armv7 binaries run -// fine on an armv7f processor. +// The architecture selection rules for arm processors These cpu subtypes have +// distinct names (e.g. armv7f) but armv7 binaries run fine on an armv7f +// processor. bool PlatformDarwin::ARMGetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) { @@ -1145,7 +1140,8 @@ const char *PlatformDarwin::GetDeveloperDirectory() { if (HostInfo::GetLLDBPath(ePathTypeLLDBShlibDir, temp_file_spec)) { if (temp_file_spec.GetPath(developer_dir_path, sizeof(developer_dir_path))) { - // e.g. /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework + // e.g. + // /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework char *shared_frameworks = strstr(developer_dir_path, "/SharedFrameworks/LLDB.framework"); if (shared_frameworks) { @@ -1153,7 +1149,8 @@ const char *PlatformDarwin::GetDeveloperDirectory() { strncat (developer_dir_path, "/Developer", sizeof (developer_dir_path) - 1); // add /Developer on developer_dir_path_valid = true; } else { - // e.g. /Applications/Xcode.app/Contents/Developer/Toolchains/iOS11.2.xctoolchain/System/Library/PrivateFrameworks/LLDB.framework + // e.g. + // /Applications/Xcode.app/Contents/Developer/Toolchains/iOS11.2.xctoolchain/System/Library/PrivateFrameworks/LLDB.framework char *developer_toolchains = strstr(developer_dir_path, "/Contents/Developer/Toolchains/"); if (developer_toolchains) { @@ -1230,8 +1227,8 @@ const char *PlatformDarwin::GetDeveloperDirectory() { m_developer_directory.assign(1, '\0'); } - // We should have put a single NULL character into m_developer_directory - // or it should have a valid path if the code gets here + // We should have put a single NULL character into m_developer_directory or + // it should have a valid path if the code gets here assert(m_developer_directory.empty() == false); if (m_developer_directory[0]) return m_developer_directory.c_str(); @@ -1279,9 +1276,9 @@ PlatformDarwin::GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) { shell_name++; if (strcmp(shell_name, "sh") == 0) { - // /bin/sh re-exec's itself as /bin/bash requiring another resume. - // But it only does this if the COMMAND_MODE environment variable - // is set to "legacy". + // /bin/sh re-exec's itself as /bin/bash requiring another resume. But it + // only does this if the COMMAND_MODE environment variable is set to + // "legacy". if (launch_info.GetEnvironment().lookup("COMMAND_MODE") == "legacy") return 2; return 1; @@ -1333,9 +1330,8 @@ static FileSpec GetXcodeContentsPath() { // First get the program file spec. If lldb.so or LLDB.framework is running // in a program and that program is Xcode, the path returned with be the - // path - // to Xcode.app/Contents/MacOS/Xcode, so this will be the correct Xcode to - // use. + // path to Xcode.app/Contents/MacOS/Xcode, so this will be the correct + // Xcode to use. fspec = HostInfo::GetProgramFileSpec(); if (fspec) { @@ -1679,10 +1675,8 @@ bool PlatformDarwin::GetOSVersion(uint32_t &major, uint32_t &minor, } } // For simulator platforms, do NOT call back through - // Platform::GetOSVersion() - // as it might call Process::GetHostOSVersion() which we don't want as it - // will be - // incorrect + // Platform::GetOSVersion() as it might call Process::GetHostOSVersion() + // which we don't want as it will be incorrect return false; } @@ -1695,8 +1689,8 @@ lldb_private::FileSpec PlatformDarwin::LocateExecutable(const char *basename) { // any executable directories that should be searched. static std::vector<FileSpec> g_executable_dirs; - // Find the global list of directories that we will search for - // executables once so we don't keep doing the work over and over. + // Find the global list of directories that we will search for executables + // once so we don't keep doing the work over and over. static llvm::once_flag g_once_flag; llvm::call_once(g_once_flag, []() { @@ -1730,19 +1724,18 @@ lldb_private::FileSpec PlatformDarwin::LocateExecutable(const char *basename) { lldb_private::Status PlatformDarwin::LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) { - // Starting in Fall 2016 OSes, NSLog messages only get mirrored to stderr - // if the OS_ACTIVITY_DT_MODE environment variable is set. (It doesn't - // require any specific value; rather, it just needs to exist). - // We will set it here as long as the IDE_DISABLED_OS_ACTIVITY_DT_MODE flag - // is not set. Xcode makes use of IDE_DISABLED_OS_ACTIVITY_DT_MODE to tell + // Starting in Fall 2016 OSes, NSLog messages only get mirrored to stderr if + // the OS_ACTIVITY_DT_MODE environment variable is set. (It doesn't require + // any specific value; rather, it just needs to exist). We will set it here + // as long as the IDE_DISABLED_OS_ACTIVITY_DT_MODE flag is not set. Xcode + // makes use of IDE_DISABLED_OS_ACTIVITY_DT_MODE to tell // LLDB *not* to muck with the OS_ACTIVITY_DT_MODE flag when they // specifically want it unset. const char *disable_env_var = "IDE_DISABLED_OS_ACTIVITY_DT_MODE"; auto &env_vars = launch_info.GetEnvironment(); if (!env_vars.count(disable_env_var)) { - // We want to make sure that OS_ACTIVITY_DT_MODE is set so that - // we get os_log and NSLog messages mirrored to the target process - // stderr. + // We want to make sure that OS_ACTIVITY_DT_MODE is set so that we get + // os_log and NSLog messages mirrored to the target process stderr. env_vars.try_emplace("OS_ACTIVITY_DT_MODE", "enable"); } @@ -1757,15 +1750,16 @@ PlatformDarwin::FindBundleBinaryInExecSearchPaths (const ModuleSpec &module_spec ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { const FileSpec &platform_file = module_spec.GetFileSpec(); - // See if the file is present in any of the module_search_paths_ptr directories. + // See if the file is present in any of the module_search_paths_ptr + // directories. if (!module_sp && module_search_paths_ptr && platform_file) { - // create a vector of all the file / directory names in platform_file - // e.g. this might be + // create a vector of all the file / directory names in platform_file e.g. + // this might be // /System/Library/PrivateFrameworks/UIFoundation.framework/UIFoundation // - // We'll need to look in the module_search_paths_ptr directories for - // both "UIFoundation" and "UIFoundation.framework" -- most likely the - // latter will be the one we find there. + // We'll need to look in the module_search_paths_ptr directories for both + // "UIFoundation" and "UIFoundation.framework" -- most likely the latter + // will be the one we find there. FileSpec platform_pull_apart(platform_file); std::vector<std::string> path_parts; @@ -1784,25 +1778,24 @@ PlatformDarwin::FindBundleBinaryInExecSearchPaths (const ModuleSpec &module_spec Log *log_verbose = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); if (log_verbose) log_verbose->Printf ("PlatformRemoteDarwinDevice::GetSharedModule searching for binary in search-path %s", module_search_paths_ptr->GetFileSpecAtIndex(i).GetPath().c_str()); - // Create a new FileSpec with this module_search_paths_ptr - // plus just the filename ("UIFoundation"), then the parent - // dir plus filename ("UIFoundation.framework/UIFoundation") - // etc - up to four names (to handle "Foo.framework/Contents/MacOS/Foo") + // Create a new FileSpec with this module_search_paths_ptr plus just the + // filename ("UIFoundation"), then the parent dir plus filename + // ("UIFoundation.framework/UIFoundation") etc - up to four names (to + // handle "Foo.framework/Contents/MacOS/Foo") for (size_t j = 0; j < 4 && j < path_parts_size - 1; ++j) { FileSpec path_to_try(module_search_paths_ptr->GetFileSpecAtIndex(i)); // Add the components backwards. For - // .../PrivateFrameworks/UIFoundation.framework/UIFoundation - // path_parts is + // .../PrivateFrameworks/UIFoundation.framework/UIFoundation path_parts + // is // [0] UIFoundation // [1] UIFoundation.framework // [2] PrivateFrameworks // // and if 'j' is 2, we want to append path_parts[1] and then - // path_parts[0], aka - // 'UIFoundation.framework/UIFoundation', to the module_search_paths_ptr - // path. + // path_parts[0], aka 'UIFoundation.framework/UIFoundation', to the + // module_search_paths_ptr path. for (int k = j; k >= 0; --k) { path_to_try.AppendPathComponent(path_parts[k]); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp index e5d27fc2894..f411ae59963 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -92,11 +92,9 @@ PlatformSP PlatformDarwinKernel::CreateInstance(bool force, } // This is a special plugin that we don't want to activate just based on an - // ArchSpec for normal - // userland debugging. It is only useful in kernel debug sessions and the - // DynamicLoaderDarwinPlugin - // (or a user doing 'platform select') will force the creation of this - // Platform plugin. + // ArchSpec for normal userland debugging. It is only useful in kernel debug + // sessions and the DynamicLoaderDarwinPlugin (or a user doing 'platform + // select') will force the creation of this Platform plugin. if (force == false) { if (log) log->Printf("PlatformDarwinKernel::%s() aborting creation of platform " @@ -115,9 +113,8 @@ PlatformSP PlatformDarwinKernel::CreateInstance(bool force, create = true; break; - // Only accept "unknown" for vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for vendor if the host is Apple and it "unknown" + // wasn't specified (it was just returned because it was NOT specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; @@ -133,9 +130,8 @@ PlatformSP PlatformDarwinKernel::CreateInstance(bool force, case llvm::Triple::WatchOS: case llvm::Triple::TvOS: break; - // Only accept "vendor" for vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "vendor" for vendor if the host is Apple and it "unknown" + // wasn't specified (it was just returned because it was NOT specified) case llvm::Triple::UnknownOS: create = !arch->TripleOSWasSpecified(); break; @@ -341,11 +337,9 @@ void PlatformDarwinKernel::GetStatus(Stream &strm) { void PlatformDarwinKernel::CollectKextAndKernelDirectories() { // Differentiate between "ios debug session" and "mac debug session" so we - // don't index - // kext bundles that won't be used in this debug session. If this is an ios - // kext debug - // session, looking in /System/Library/Extensions is a waste of stat()s, for - // example. + // don't index kext bundles that won't be used in this debug session. If + // this is an ios kext debug session, looking in /System/Library/Extensions + // is a waste of stat()s, for example. // DeveloperDirectory is something like // "/Applications/Xcode.app/Contents/Developer" @@ -368,9 +362,8 @@ void PlatformDarwinKernel::CollectKextAndKernelDirectories() { AddSDKSubdirsToSearchPaths("/Volumes/KernelDebugKit"); AddSDKSubdirsToSearchPaths("/AppleInternal/Developer/KDKs"); - // The KDKs distributed from Apple installed on external - // developer systems may be in directories like - // /Library/Developer/KDKs/KDK_10.10_14A298i.kdk + // The KDKs distributed from Apple installed on external developer systems + // may be in directories like /Library/Developer/KDKs/KDK_10.10_14A298i.kdk AddSDKSubdirsToSearchPaths("/Library/Developer/KDKs"); if (m_ios_debug_session != eLazyBoolNo) { @@ -450,9 +443,8 @@ PlatformDarwinKernel::FindKDKandSDKDirectoriesInDirectory( return FileSpec::eEnumerateDirectoryResultNext; } -// Recursively search trough m_search_directories looking for -// kext and kernel binaries, adding files found to the appropriate -// lists. +// Recursively search trough m_search_directories looking for kext and kernel +// binaries, adding files found to the appropriate lists. void PlatformDarwinKernel::SearchForKextsAndKernelsRecursively() { const uint32_t num_dirs = m_search_directories.size(); for (uint32_t i = 0; i < num_dirs; i++) { @@ -476,13 +468,11 @@ void PlatformDarwinKernel::SearchForKextsAndKernelsRecursively() { } } -// We're only doing a filename match here. We won't try opening the file to see -// if it's really -// a kernel or not until we need to find a kernel of a given UUID. There's no -// cheap way to find -// the UUID of a file (or if it's a Mach-O binary at all) without creating a -// whole Module for -// the file and throwing it away if it's not wanted. +// We're only doing a filename match here. We won't try opening the file to +// see if it's really a kernel or not until we need to find a kernel of a given +// UUID. There's no cheap way to find the UUID of a file (or if it's a Mach-O +// binary at all) without creating a whole Module for the file and throwing it +// away if it's not wanted. // // Recurse into any subdirectories found. @@ -650,8 +640,8 @@ bool PlatformDarwinKernel::KextHasdSYMSibling( return false; } -// Given a FileSpec of /dir/dir/mach.development.t7004 -// Return true if a dSYM exists next to it: +// Given a FileSpec of /dir/dir/mach.development.t7004 Return true if a dSYM +// exists next to it: // /dir/dir/mach.development.t7004.dSYM bool PlatformDarwinKernel::KernelHasdSYMSibling(const FileSpec &kernel_binary) { FileSpec kernel_dsym = kernel_binary; @@ -694,8 +684,8 @@ Status PlatformDarwinKernel::GetSharedModule( } } - // Give the generic methods, including possibly calling into - // DebugSymbols framework on macOS systems, a chance. + // Give the generic methods, including possibly calling into DebugSymbols + // framework on macOS systems, a chance. error = PlatformDarwin::GetSharedModule(module_spec, process, module_sp, module_search_paths_ptr, old_module_sp_ptr, did_create_ptr); @@ -749,8 +739,8 @@ Status PlatformDarwinKernel::GetSharedModule( } } - // Give the generic methods, including possibly calling into - // DebugSymbols framework on macOS systems, a chance. + // Give the generic methods, including possibly calling into DebugSymbols + // framework on macOS systems, a chance. error = PlatformDarwin::GetSharedModule(module_spec, process, module_sp, module_search_paths_ptr, old_module_sp_ptr, did_create_ptr); @@ -803,11 +793,9 @@ Status PlatformDarwinKernel::ExamineKextForMatchingUUID( } // First try to create a ModuleSP with the file / arch and see if the UUID - // matches. - // If that fails (this exec file doesn't have the correct uuid), don't call - // GetSharedModule - // (which may call in to the DebugSymbols framework and therefore can be - // slow.) + // matches. If that fails (this exec file doesn't have the correct uuid), + // don't call GetSharedModule (which may call in to the DebugSymbols + // framework and therefore can be slow.) ModuleSP module_sp(new Module(exe_spec)); if (module_sp && module_sp->GetObjectFile() && module_sp->MatchesModuleSpec(exe_spec)) { @@ -851,17 +839,13 @@ void PlatformDarwinKernel::CalculateTrapHandlerSymbolNames() { #else // __APPLE__ -// Since DynamicLoaderDarwinKernel is compiled in for all systems, and relies on -// PlatformDarwinKernel for the plug-in name, we compile just the plug-in name -// in -// here to avoid issues. We are tracking an internal bug to resolve this issue -// by -// either not compiling in DynamicLoaderDarwinKernel for non-apple builds, or to -// make -// PlatformDarwinKernel build on all systems. PlatformDarwinKernel is currently -// not -// compiled on other platforms due to the use of the Mac-specific -// source/Host/macosx/cfcpp utilities. +// Since DynamicLoaderDarwinKernel is compiled in for all systems, and relies +// on PlatformDarwinKernel for the plug-in name, we compile just the plug-in +// name in here to avoid issues. We are tracking an internal bug to resolve +// this issue by either not compiling in DynamicLoaderDarwinKernel for non- +// apple builds, or to make PlatformDarwinKernel build on all systems. +// PlatformDarwinKernel is currently not compiled on other platforms due to the +// use of the Mac-specific source/Host/macosx/cfcpp utilities. lldb_private::ConstString PlatformDarwinKernel::GetPluginNameStatic() { static lldb_private::ConstString g_name("darwin-kernel"); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp index 43f4d8bbf02..e6311abfc04 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -91,9 +91,8 @@ PlatformSP PlatformMacOSX::CreateInstance(bool force, const ArchSpec *arch) { break; #if defined(__APPLE__) - // Only accept "unknown" for vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for vendor if the host is Apple and it "unknown" + // wasn't specified (it was just returned because it was NOT specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; @@ -109,9 +108,8 @@ PlatformSP PlatformMacOSX::CreateInstance(bool force, const ArchSpec *arch) { case llvm::Triple::MacOSX: break; #if defined(__APPLE__) - // Only accept "vendor" for vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "vendor" for vendor if the host is Apple and it "unknown" + // wasn't specified (it was just returned because it was NOT specified) case llvm::Triple::UnknownOS: create = !arch->TripleOSWasSpecified(); break; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp index 1eef643d390..0d6278a5f1a 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp @@ -98,9 +98,9 @@ PlatformSP PlatformRemoteAppleTV::CreateInstance(bool force, break; #if defined(__APPLE__) - // Only accept "unknown" for the vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the vendor if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp index 17ae67bc28d..3260588d09c 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp @@ -93,9 +93,9 @@ PlatformSP PlatformRemoteAppleWatch::CreateInstance(bool force, break; #if defined(__APPLE__) - // Only accept "unknown" for the vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the vendor if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; @@ -123,8 +123,8 @@ PlatformSP PlatformRemoteAppleWatch::CreateInstance(bool force, #if defined(__APPLE__) && \ (defined(__arm__) || defined(__arm64__) || defined(__aarch64__)) - // If lldb is running on a watch, this isn't a RemoteWatch environment; it's a - // local system environment. + // If lldb is running on a watch, this isn't a RemoteWatch environment; it's + // a local system environment. if (force == false) { create = false; } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp index cb064aad615..01a4c8858c7 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp @@ -97,9 +97,9 @@ Status PlatformRemoteDarwinDevice::ResolveExecutable( return error; exe_module_sp.reset(); } - // No valid architecture was specified or the exact ARM slice wasn't - // found so ask the platform for the architectures that we should be - // using (in the correct order) and see if we can find a match that way + // No valid architecture was specified or the exact ARM slice wasn't found + // so ask the platform for the architectures that we should be using (in + // the correct order) and see if we can find a match that way StreamString arch_names; for (uint32_t idx = 0; GetSupportedArchitectureAtIndex( idx, resolved_module_spec.GetArchitecture()); @@ -183,8 +183,8 @@ bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() { &builtin_sdk_directory_infos); // Only add SDK directories that have symbols in them, some SDKs only - // contain - // developer disk images and no symbols, so they aren't useful to us. + // contain developer disk images and no symbols, so they aren't useful to + // us. FileSpec sdk_symbols_symlink_fspec; for (const auto &sdk_directory_info : builtin_sdk_directory_infos) { sdk_symbols_symlink_fspec = sdk_directory_info.directory; @@ -244,8 +244,8 @@ PlatformRemoteDarwinDevice::GetSDKDirectoryForCurrentOSVersion() { if (UpdateSDKDirectoryInfosIfNeeded()) { const uint32_t num_sdk_infos = m_sdk_directory_infos.size(); - // Check to see if the user specified a build string. If they did, then - // be sure to match it. + // Check to see if the user specified a build string. If they did, then be + // sure to match it. std::vector<bool> check_sdk_info(num_sdk_infos, true); ConstString build(m_sdk_build); if (build) { @@ -253,8 +253,8 @@ PlatformRemoteDarwinDevice::GetSDKDirectoryForCurrentOSVersion() { check_sdk_info[i] = m_sdk_directory_infos[i].build == build; } - // If we are connected we can find the version of the OS the platform - // us running on and select the right SDK + // If we are connected we can find the version of the OS the platform us + // running on and select the right SDK uint32_t major, minor, update; if (GetOSVersion(major, minor, update)) { if (UpdateSDKDirectoryInfosIfNeeded()) { @@ -366,8 +366,8 @@ const char *PlatformRemoteDarwinDevice::GetDeviceSupportDirectoryForOSVersion() } } // We should have put a single NULL character into - // m_device_support_directory_for_os_version - // or it should have a valid path if the code gets here + // m_device_support_directory_for_os_version or it should have a valid path + // if the code gets here assert(m_device_support_directory_for_os_version.empty() == false); if (m_device_support_directory_for_os_version[0]) return m_device_support_directory_for_os_version.c_str(); @@ -492,10 +492,9 @@ Status PlatformRemoteDarwinDevice::GetSharedModule( const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { - // For iOS, the SDK files are all cached locally on the host - // system. So first we ask for the file in the cached SDK, - // then we attempt to get a shared module for the right architecture - // with the right UUID. + // For iOS, the SDK files are all cached locally on the host system. So first + // we ask for the file in the cached SDK, then we attempt to get a shared + // module for the right architecture with the right UUID. const FileSpec &platform_file = module_spec.GetFileSpec(); Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); @@ -510,8 +509,7 @@ Status PlatformRemoteDarwinDevice::GetSharedModule( const uint32_t num_sdk_infos = m_sdk_directory_infos.size(); // If we are connected we migth be able to correctly deduce the SDK - // directory - // using the OS build. + // directory using the OS build. const uint32_t connected_sdk_idx = GetConnectedSDKIndex(); if (connected_sdk_idx < num_sdk_infos) { LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file, @@ -528,8 +526,8 @@ Status PlatformRemoteDarwinDevice::GetSharedModule( } } - // Try the last SDK index if it is set as most files from an SDK - // will tend to be valid in that same SDK. + // Try the last SDK index if it is set as most files from an SDK will tend + // to be valid in that same SDK. if (m_last_module_sdk_idx < num_sdk_infos) { LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file, m_sdk_directory_infos[m_last_module_sdk_idx].directory); @@ -544,9 +542,9 @@ Status PlatformRemoteDarwinDevice::GetSharedModule( } } - // First try for an exact match of major, minor and update: - // If a particalar SDK version was specified via --version or --build, look - // for a match on disk. + // First try for an exact match of major, minor and update: If a particalar + // SDK version was specified via --version or --build, look for a match on + // disk. const SDKDirectoryInfo *current_sdk_info = GetSDKDirectoryForCurrentOSVersion(); const uint32_t current_sdk_idx = @@ -570,8 +568,7 @@ Status PlatformRemoteDarwinDevice::GetSharedModule( // Second try all SDKs that were found. for (uint32_t sdk_idx = 0; sdk_idx < num_sdk_infos; ++sdk_idx) { if (m_last_module_sdk_idx == sdk_idx) { - // Skip the last module SDK index if we already searched - // it above + // Skip the last module SDK index if we already searched it above continue; } LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file, @@ -582,8 +579,8 @@ Status PlatformRemoteDarwinDevice::GetSharedModule( error = ResolveExecutable(platform_module_spec, module_sp, NULL); if (module_sp) { - // Remember the index of the last SDK that we found a file - // in in case the wrong SDK was selected. + // Remember the index of the last SDK that we found a file in in case + // the wrong SDK was selected. m_last_module_sdk_idx = sdk_idx; error.Clear(); return error; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp index 5bff792525b..c210271d6fd 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -88,9 +88,9 @@ PlatformSP PlatformRemoteiOS::CreateInstance(bool force, const ArchSpec *arch) { break; #if defined(__APPLE__) - // Only accept "unknown" for the vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the vendor if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp index ee1f90311e7..9cd294455e2 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp @@ -91,9 +91,9 @@ PlatformSP PlatformiOSSimulator::CreateInstance(bool force, break; #if defined(__APPLE__) - // Only accept "unknown" for the vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the vendor if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; @@ -112,9 +112,9 @@ PlatformSP PlatformiOSSimulator::CreateInstance(bool force, break; #if defined(__APPLE__) - // Only accept "unknown" for the OS if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the OS if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownOS: create = !arch->TripleOSWasSpecified(); break; @@ -205,9 +205,9 @@ Status PlatformiOSSimulator::ResolveExecutable( return error; exe_module_sp.reset(); } - // No valid architecture was specified or the exact ARM slice wasn't - // found so ask the platform for the architectures that we should be - // using (in the correct order) and see if we can find a match that way + // No valid architecture was specified or the exact ARM slice wasn't found + // so ask the platform for the architectures that we should be using (in + // the correct order) and see if we can find a match that way StreamString arch_names; ArchSpec platform_arch; for (uint32_t idx = 0; GetSupportedArchitectureAtIndex( @@ -298,8 +298,8 @@ const char *PlatformiOSSimulator::GetSDKDirectoryAsCString() { m_sdk_directory.assign(1, '\0'); } - // We should have put a single NULL character into m_sdk_directory - // or it should have a valid path if the code gets here + // We should have put a single NULL character into m_sdk_directory or it + // should have a valid path if the code gets here assert(m_sdk_directory.empty() == false); if (m_sdk_directory[0]) return m_sdk_directory.c_str(); @@ -342,10 +342,9 @@ Status PlatformiOSSimulator::GetSharedModule( const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { - // For iOS, the SDK files are all cached locally on the host - // system. So first we ask for the file in the cached SDK, - // then we attempt to get a shared module for the right architecture - // with the right UUID. + // For iOS, the SDK files are all cached locally on the host system. So first + // we ask for the file in the cached SDK, then we attempt to get a shared + // module for the right architecture with the right UUID. Status error; ModuleSpec platform_module_spec(module_spec); const FileSpec &platform_file = module_spec.GetFileSpec(); @@ -409,14 +408,14 @@ bool PlatformiOSSimulator::GetSupportedArchitectureAtIndex(uint32_t idx, if (arch.IsValid()) { if (idx == 2) arch.GetTriple().setOS(llvm::Triple::IOS); - // 32/64: return "i386-apple-ios" for architecture 2 - // 32/64: return "i386-apple-macosx" for architecture 3 + // 32/64: return "i386-apple-ios" for architecture 2 32/64: return + // "i386-apple-macosx" for architecture 3 return true; } } } else if (idx == 1) { - // This macosx platform supports only 32 bit, so return the *-apple-macosx - // version + // This macosx platform supports only 32 bit, so return the *-apple- + // macosx version arch = platform_arch; return true; } |