diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-06-13 22:08:14 +0000 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-06-13 22:08:14 +0000 |
| commit | 937348cd1359b30359b958ca81b7e7d8711b443e (patch) | |
| tree | f4249e96df7ff194b336fdbf8cbd6c690d5a39f2 | |
| parent | 07570f55e4ad104a474efff4ae1a3c3b49145fed (diff) | |
| download | bcm5719-llvm-937348cd1359b30359b958ca81b7e7d8711b443e.tar.gz bcm5719-llvm-937348cd1359b30359b958ca81b7e7d8711b443e.zip | |
[FileSpec] Make style argument mandatory for SetFile. NFC
SetFile has an optional style argument which defaulted to the native
style. This patch makes that argument mandatory so clients of the
FileSpec class are forced to think about the correct syntax.
At the same time this introduces a (protected) convenience method to
update the file from within the FileSpec class that keeps the current
style.
These two changes together prevent a potential pitfall where the style
might be forgotten, leading to the path being updated and the style
unintentionally being changed to the host style.
llvm-svn: 334663
50 files changed, 153 insertions, 109 deletions
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index b09c31d0ff2..976698479d7 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -318,7 +318,8 @@ public: NameMatch process_name_match_type) : m_match_info(), m_name_match_type(process_name_match_type), m_match_all_users(false) { - m_match_info.GetExecutableFile().SetFile(process_name, false); + m_match_info.GetExecutableFile().SetFile(process_name, false, + FileSpec::Style::native); } ProcessInstanceInfo &GetProcessInfo() { return m_match_info; } diff --git a/lldb/include/lldb/Utility/FileSpec.h b/lldb/include/lldb/Utility/FileSpec.h index df21472bbf0..d062ba598cc 100644 --- a/lldb/include/lldb/Utility/FileSpec.h +++ b/lldb/include/lldb/Utility/FileSpec.h @@ -490,8 +490,7 @@ public: /// If \b true, then we will try to resolve links the path using /// the static FileSpec::Resolve. //------------------------------------------------------------------ - void SetFile(llvm::StringRef path, bool resolve_path, - Style style = Style::native); + void SetFile(llvm::StringRef path, bool resolve_path, Style style); void SetFile(llvm::StringRef path, bool resolve_path, const llvm::Triple &Triple); @@ -566,6 +565,11 @@ public: protected: //------------------------------------------------------------------ + // Convenience method for setting the file without changing the style. + //------------------------------------------------------------------ + void SetFile(llvm::StringRef path, bool resolve_path); + + //------------------------------------------------------------------ // Member variables //------------------------------------------------------------------ ConstString m_directory; ///< The uniqued directory path diff --git a/lldb/source/API/SBAttachInfo.cpp b/lldb/source/API/SBAttachInfo.cpp index e6500c468ec..d6cb212dedf 100644 --- a/lldb/source/API/SBAttachInfo.cpp +++ b/lldb/source/API/SBAttachInfo.cpp @@ -26,14 +26,16 @@ SBAttachInfo::SBAttachInfo(lldb::pid_t pid) SBAttachInfo::SBAttachInfo(const char *path, bool wait_for) : m_opaque_sp(new ProcessAttachInfo()) { if (path && path[0]) - m_opaque_sp->GetExecutableFile().SetFile(path, false); + m_opaque_sp->GetExecutableFile().SetFile(path, false, + FileSpec::Style::native); m_opaque_sp->SetWaitForLaunch(wait_for); } SBAttachInfo::SBAttachInfo(const char *path, bool wait_for, bool async) : m_opaque_sp(new ProcessAttachInfo()) { if (path && path[0]) - m_opaque_sp->GetExecutableFile().SetFile(path, false); + m_opaque_sp->GetExecutableFile().SetFile(path, false, + FileSpec::Style::native); m_opaque_sp->SetWaitForLaunch(wait_for); m_opaque_sp->SetAsync(async); } @@ -77,7 +79,8 @@ void SBAttachInfo::SetProcessPluginName(const char *plugin_name) { void SBAttachInfo::SetExecutable(const char *path) { if (path && path[0]) - m_opaque_sp->GetExecutableFile().SetFile(path, false); + m_opaque_sp->GetExecutableFile().SetFile(path, false, + FileSpec::Style::native); else m_opaque_sp->GetExecutableFile().Clear(); } diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index a265e64ec07..27880e8399b 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -501,7 +501,8 @@ lldb::SBProcess SBTarget::AttachToProcessWithName( if (name && target_sp) { ProcessAttachInfo attach_info; - attach_info.GetExecutableFile().SetFile(name, false); + attach_info.GetExecutableFile().SetFile(name, false, + FileSpec::Style::native); attach_info.SetWaitForLaunch(wait_for); if (listener.IsValid()) attach_info.SetListener(listener.GetSP()); @@ -1468,7 +1469,7 @@ lldb::SBModule SBTarget::AddModule(const char *path, const char *triple, if (target_sp) { ModuleSpec module_spec; if (path) - module_spec.GetFileSpec().SetFile(path, false); + module_spec.GetFileSpec().SetFile(path, false, FileSpec::Style::native); if (uuid_cstr) module_spec.GetUUID().SetFromCString(uuid_cstr); @@ -1480,7 +1481,8 @@ lldb::SBModule SBTarget::AddModule(const char *path, const char *triple, module_spec.GetArchitecture() = target_sp->GetArchitecture(); if (symfile) - module_spec.GetSymbolFileSpec().SetFile(symfile, false); + module_spec.GetSymbolFileSpec().SetFile(symfile, false, + FileSpec::Style::native); sb_module.SetSP(target_sp->GetSharedModule(module_spec)); } diff --git a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp index f89e332c60d..d4647e2c589 100644 --- a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp @@ -66,7 +66,7 @@ BreakpointResolver *BreakpointResolverAddress::CreateFromStructuredData( error.SetErrorString("BRA::CFSD: Couldn't read module name entry."); return nullptr; } - module_filespec.SetFile(module_name, false); + module_filespec.SetFile(module_name, false, FileSpec::Style::native); } return new BreakpointResolverAddress(bkpt, address, module_filespec); } diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp index 8d6b1cd1854..1389ff2bde0 100644 --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/source/Commands/CommandObjectLog.cpp @@ -101,7 +101,7 @@ public: switch (short_option) { case 'f': - log_file.SetFile(option_arg, true); + log_file.SetFile(option_arg, true, FileSpec::Style::native); break; case 't': log_options |= LLDB_LOG_OPTION_THREADSAFE; diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index a77c41579dc..e4a49e55857 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -1209,7 +1209,7 @@ public: switch (short_option) { case 'i': - m_infile.SetFile(option_value, true); + m_infile.SetFile(option_value, true, FileSpec::Style::native); if (!m_infile.Exists()) { m_infile.Clear(); error.SetErrorStringWithFormat("input file does not exist: '%s'", diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index 0c979032708..3c44e8f252f 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -1342,32 +1342,32 @@ protected: } break; case 'n': - match_info.GetProcessInfo().GetExecutableFile().SetFile(option_arg, - false); + match_info.GetProcessInfo().GetExecutableFile().SetFile( + option_arg, false, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::Equals); break; case 'e': - match_info.GetProcessInfo().GetExecutableFile().SetFile(option_arg, - false); + match_info.GetProcessInfo().GetExecutableFile().SetFile( + option_arg, false, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::EndsWith); break; case 's': - match_info.GetProcessInfo().GetExecutableFile().SetFile(option_arg, - false); + match_info.GetProcessInfo().GetExecutableFile().SetFile( + option_arg, false, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::StartsWith); break; case 'c': - match_info.GetProcessInfo().GetExecutableFile().SetFile(option_arg, - false); + match_info.GetProcessInfo().GetExecutableFile().SetFile( + option_arg, false, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::Contains); break; case 'r': - match_info.GetProcessInfo().GetExecutableFile().SetFile(option_arg, - false); + match_info.GetProcessInfo().GetExecutableFile().SetFile( + option_arg, false, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::RegularExpression); break; @@ -1536,7 +1536,8 @@ public: break; case 'n': - attach_info.GetExecutableFile().SetFile(option_arg, false); + attach_info.GetExecutableFile().SetFile(option_arg, false, + FileSpec::Style::native); break; case 'w': @@ -1585,7 +1586,7 @@ public: ProcessInstanceInfoMatch match_info; if (partial_name) { match_info.GetProcessInfo().GetExecutableFile().SetFile( - partial_name, false); + partial_name, false, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::StartsWith); } platform_sp->FindProcesses(match_info, process_infos); diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 0be1dd18235..9deb2e64940 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -358,7 +358,8 @@ public: break; case 'n': - attach_info.GetExecutableFile().SetFile(option_arg, false); + attach_info.GetExecutableFile().SetFile(option_arg, false, + FileSpec::Style::native); break; case 'w': @@ -411,7 +412,7 @@ public: ProcessInstanceInfoMatch match_info; if (partial_name) { match_info.GetProcessInfo().GetExecutableFile().SetFile( - partial_name, false); + partial_name, false, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::StartsWith); } platform_sp->FindProcesses(match_info, process_infos); @@ -983,7 +984,7 @@ public: case 'i': do_install = true; if (!option_arg.empty()) - install_path.SetFile(option_arg, false); + install_path.SetFile(option_arg, false, FileSpec::Style::native); break; default: error.SetErrorStringWithFormat("invalid short option character '%c'", diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index b383b55c1fa..feeecf5517c 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -258,7 +258,7 @@ protected: FileSpec file_spec; if (file_path) - file_spec.SetFile(file_path, true); + file_spec.SetFile(file_path, true, FileSpec::Style::native); bool must_set_platform_path = false; @@ -3581,7 +3581,7 @@ public: break; case 'f': - m_file.SetFile(option_arg, false); + m_file.SetFile(option_arg, false, FileSpec::Style::native); m_type = eLookupTypeFileLine; break; @@ -4319,7 +4319,8 @@ protected: for (auto &entry : args.entries()) { if (!entry.ref.empty()) { - module_spec.GetSymbolFileSpec().SetFile(entry.ref, true); + module_spec.GetSymbolFileSpec().SetFile(entry.ref, true, + FileSpec::Style::native); if (file_option_set) { module_spec.GetFileSpec() = m_file_option.GetOptionValue().GetCurrentValue(); diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp index 52fe6764699..3c3d55df220 100644 --- a/lldb/source/Host/common/File.cpp +++ b/lldb/source/Host/common/File.cpp @@ -315,7 +315,7 @@ Status File::GetFileSpec(FileSpec &file_spec) const { if (::fcntl(GetDescriptor(), F_GETPATH, path) == -1) error.SetErrorToErrno(); else - file_spec.SetFile(path, false); + file_spec.SetFile(path, false, FileSpec::Style::native); } else { error.SetErrorString("invalid file handle"); } @@ -330,7 +330,7 @@ Status File::GetFileSpec(FileSpec &file_spec) const { error.SetErrorToErrno(); else { path[len] = '\0'; - file_spec.SetFile(path, false); + file_spec.SetFile(path, false, FileSpec::Style::native); } } #else diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 1b779449b5f..53252258274 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -420,7 +420,7 @@ FileSpec Host::GetModuleFileSpecForHostAddress(const void *host_addr) { Dl_info info; if (::dladdr(host_addr, &info)) { if (info.dli_fname) - module_filespec.SetFile(info.dli_fname, true); + module_filespec.SetFile(info.dli_fname, true, FileSpec::Style::native); } #endif return module_filespec; diff --git a/lldb/source/Host/common/Symbols.cpp b/lldb/source/Host/common/Symbols.cpp index 89bc1bd6ad7..d7e0c13112a 100644 --- a/lldb/source/Host/common/Symbols.cpp +++ b/lldb/source/Host/common/Symbols.cpp @@ -91,7 +91,7 @@ static bool LocateDSYMInVincinityOfExecutable(const ModuleSpec &module_spec, ::strncat(path, exec_fspec->GetFilename().AsCString(), sizeof(path) - strlen(path) - 1); - dsym_fspec.SetFile(path, false); + dsym_fspec.SetFile(path, false, FileSpec::Style::native); ModuleSpecList module_specs; ModuleSpec matched_module_spec; diff --git a/lldb/source/Host/macosx/Symbols.cpp b/lldb/source/Host/macosx/Symbols.cpp index 01f2714fe59..b82fea5ef3e 100644 --- a/lldb/source/Host/macosx/Symbols.cpp +++ b/lldb/source/Host/macosx/Symbols.cpp @@ -309,7 +309,8 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict, (CFDictionaryRef)uuid_dict, CFSTR("DBGSymbolRichExecutable")); if (cf_str && CFGetTypeID(cf_str) == CFStringGetTypeID()) { if (CFCString::FileSystemRepresentation(cf_str, str)) { - module_spec.GetFileSpec().SetFile(str.c_str(), true); + module_spec.GetFileSpec().SetFile(str.c_str(), true, + FileSpec::Style::native); if (log) { log->Printf( "From dsymForUUID plist: Symbol rich executable is at '%s'", @@ -322,7 +323,8 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict, CFSTR("DBGDSYMPath")); if (cf_str && CFGetTypeID(cf_str) == CFStringGetTypeID()) { if (CFCString::FileSystemRepresentation(cf_str, str)) { - module_spec.GetSymbolFileSpec().SetFile(str.c_str(), true); + module_spec.GetSymbolFileSpec().SetFile(str.c_str(), true, + FileSpec::Style::native); success = true; if (log) { log->Printf("From dsymForUUID plist: dSYM is at '%s'", str.c_str()); @@ -504,12 +506,14 @@ bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec, getenv("LLDB_APPLE_DSYMFORUUID_EXECUTABLE"); FileSpec dsym_for_uuid_exe_spec; if (dsym_for_uuid_exe_path_cstr) { - dsym_for_uuid_exe_spec.SetFile(dsym_for_uuid_exe_path_cstr, true); + dsym_for_uuid_exe_spec.SetFile(dsym_for_uuid_exe_path_cstr, true, + FileSpec::Style::native); g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists(); } if (!g_dsym_for_uuid_exe_exists) { - dsym_for_uuid_exe_spec.SetFile("/usr/local/bin/dsymForUUID", false); + dsym_for_uuid_exe_spec.SetFile("/usr/local/bin/dsymForUUID", false, + FileSpec::Style::native); g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists(); if (!g_dsym_for_uuid_exe_exists) { long bufsize; @@ -523,14 +527,16 @@ bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec, tilde_rc && tilde_rc->pw_dir) { std::string dsymforuuid_path(tilde_rc->pw_dir); dsymforuuid_path += "/bin/dsymForUUID"; - dsym_for_uuid_exe_spec.SetFile(dsymforuuid_path.c_str(), false); + dsym_for_uuid_exe_spec.SetFile(dsymforuuid_path.c_str(), false, + FileSpec::Style::native); g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists(); } } } } if (!g_dsym_for_uuid_exe_exists && g_dbgshell_command != NULL) { - dsym_for_uuid_exe_spec.SetFile(g_dbgshell_command, true); + dsym_for_uuid_exe_spec.SetFile(g_dbgshell_command, true, + FileSpec::Style::native); g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists(); } diff --git a/lldb/source/Host/macosx/objcxx/Host.mm b/lldb/source/Host/macosx/objcxx/Host.mm index f432a2f3f31..c8d441b72f0 100644 --- a/lldb/source/Host/macosx/objcxx/Host.mm +++ b/lldb/source/Host/macosx/objcxx/Host.mm @@ -105,7 +105,7 @@ bool Host::GetBundleDirectory(const FileSpec &file, if (file.GetPath(path, sizeof(path))) { CFCBundle bundle(path); if (bundle.GetPath(path, sizeof(path))) { - bundle_directory.SetFile(path, false); + bundle_directory.SetFile(path, false, FileSpec::Style::native); return true; } } @@ -125,7 +125,7 @@ bool Host::ResolveExecutableInBundle(FileSpec &file) { if (url.get()) { if (::CFURLGetFileSystemRepresentation(url.get(), YES, (UInt8 *)path, sizeof(path))) { - file.SetFile(path, false); + file.SetFile(path, false, FileSpec::Style::native); return true; } } @@ -542,7 +542,8 @@ static bool GetMacOSXProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr, triple_arch == llvm::Triple::x86_64); const char *cstr = data.GetCStr(&offset); if (cstr) { - process_info.GetExecutableFile().SetFile(cstr, false); + process_info.GetExecutableFile().SetFile(cstr, false, + FileSpec::Style::native); if (match_info_ptr == NULL || NameMatches( diff --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm index 7647e722536..dbb74822e78 100644 --- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm +++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm @@ -112,13 +112,15 @@ FileSpec HostInfoMacOSX::GetProgramFileSpec() { uint32_t len = sizeof(program_fullpath); int err = _NSGetExecutablePath(program_fullpath, &len); if (err == 0) - g_program_filespec.SetFile(program_fullpath, false); + g_program_filespec.SetFile(program_fullpath, false, + FileSpec::Style::native); else if (err == -1) { char *large_program_fullpath = (char *)::malloc(len + 1); err = _NSGetExecutablePath(large_program_fullpath, &len); if (err == 0) - g_program_filespec.SetFile(large_program_fullpath, false); + g_program_filespec.SetFile(large_program_fullpath, false, + FileSpec::Style::native); ::free(large_program_fullpath); } diff --git a/lldb/source/Host/posix/FileSystem.cpp b/lldb/source/Host/posix/FileSystem.cpp index df4884e55ec..60be642df60 100644 --- a/lldb/source/Host/posix/FileSystem.cpp +++ b/lldb/source/Host/posix/FileSystem.cpp @@ -47,7 +47,7 @@ Status FileSystem::Readlink(const FileSpec &src, FileSpec &dst) { error.SetErrorToErrno(); else { buf[count] = '\0'; // Success - dst.SetFile(buf, false); + dst.SetFile(buf, false, FileSpec::Style::native); } return error; } diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 8f309512172..bb8da85390f 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -2102,7 +2102,7 @@ void CommandInterpreter::SourceInitFile(bool in_cwd, return; } } else if (should_load == eLoadCWDlldbinitTrue) { - init_file.SetFile("./.lldbinit", true); + init_file.SetFile("./.lldbinit", true, FileSpec::Style::native); } } } else { @@ -2126,14 +2126,15 @@ void CommandInterpreter::SourceInitFile(bool in_cwd, char program_init_file_name[PATH_MAX]; ::snprintf(program_init_file_name, sizeof(program_init_file_name), "%s-%s", init_file_path.c_str(), program_name); - init_file.SetFile(program_init_file_name, true); + init_file.SetFile(program_init_file_name, true, + FileSpec::Style::native); if (!init_file.Exists()) init_file.Clear(); } } if (!init_file && !m_skip_lldbinit_files) - init_file.SetFile(init_file_path, false); + init_file.SetFile(init_file_path, false, FileSpec::Style::native); } // If the file exists, tell HandleCommand to 'source' it; this will do the diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp index fe654a1d1a3..d3abf3fb5d2 100644 --- a/lldb/source/Interpreter/OptionValueFileSpec.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp @@ -75,7 +75,7 @@ Status OptionValueFileSpec::SetValueFromString(llvm::StringRef value, // or whitespace. value = value.trim("\"' \t"); m_value_was_set = true; - m_current_value.SetFile(value.str(), m_resolve); + m_current_value.SetFile(value.str(), m_resolve, FileSpec::Style::native); m_data_sp.reset(); m_data_mod_time = llvm::sys::TimePoint<>(); NotifyValueChanged(); diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index e02d6920b21..fbf255a3c0d 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -637,7 +637,7 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::ReadMemoryModule( return false; FileSpec file_spec; - file_spec.SetFile(m_name.c_str(), false); + file_spec.SetFile(m_name.c_str(), false, FileSpec::Style::native); ModuleSP memory_module_sp = process->ReadModuleFromMemory(file_spec, m_load_address); diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index 3a43751398d..96242fd958d 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -374,7 +374,8 @@ bool DynamicLoaderDarwin::JSONImageInformationIntoImageInfo( image_infos[i].mod_date = image->GetValueForKey("mod_date")->GetAsInteger()->GetValue(); image_infos[i].file_spec.SetFile( - image->GetValueForKey("pathname")->GetAsString()->GetValue(), false); + image->GetValueForKey("pathname")->GetAsString()->GetValue(), false, + FileSpec::Style::native); StructuredData::Dictionary *mh = image->GetValueForKey("mach_header")->GetAsDictionary(); diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index 6cabbef0a25..864ad7dea70 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -693,7 +693,8 @@ bool DynamicLoaderMacOSXDYLD::ReadImageInfos( // don't resolve the path if (error.Success()) { const bool resolve_path = false; - image_infos[i].file_spec.SetFile(raw_path, resolve_path); + image_infos[i].file_spec.SetFile(raw_path, resolve_path, + FileSpec::Style::native); } } return true; @@ -892,7 +893,7 @@ uint32_t DynamicLoaderMacOSXDYLD::ParseLoadCommands(const DataExtractor &data, const lldb::offset_t name_offset = load_cmd_offset + data.GetU32(&offset); const char *path = data.PeekCStr(name_offset); - lc_id_dylinker->SetFile(path, true); + lc_id_dylinker->SetFile(path, true, FileSpec::Style::native); } break; diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp index effef9e3eb8..68df4335c9e 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp @@ -243,7 +243,7 @@ bool DYLDRendezvous::FillSOEntryFromModuleInfo( entry.base_addr = base_addr; entry.dyn_addr = dyn_addr; - entry.file_spec.SetFile(name, false); + entry.file_spec.SetFile(name, false, FileSpec::Style::native); UpdateBaseAddrIfNecessary(entry, name); @@ -518,7 +518,7 @@ bool DYLDRendezvous::ReadSOEntryFromMemory(lldb::addr_t addr, SOEntry &entry) { return false; std::string file_path = ReadStringFromMemory(entry.path_addr); - entry.file_spec.SetFile(file_path, false); + entry.file_spec.SetFile(file_path, false, FileSpec::Style::native); UpdateBaseAddrIfNecessary(entry, file_path); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp index ffc5120dc41..c3599859732 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp @@ -84,7 +84,7 @@ bool lldb_private::ComputeClangDirectory(FileSpec &lldb_shlib_spec, "Developer/Toolchains/XcodeDefault.xctoolchain", swift_clang_resource_dir); if (!verify || VerifyClangPath(clang_path)) { - file_spec.SetFile(clang_path.c_str(), true); + file_spec.SetFile(clang_path.c_str(), true, FileSpec::Style::native); return true; } } else if (parent != r_end && *parent == "PrivateFrameworks" && @@ -98,7 +98,7 @@ bool lldb_private::ComputeClangDirectory(FileSpec &lldb_shlib_spec, raw_path.resize(parent - r_end); llvm::sys::path::append(clang_path, raw_path, swift_clang_resource_dir); if (!verify || VerifyClangPath(clang_path)) { - file_spec.SetFile(clang_path.c_str(), true); + file_spec.SetFile(clang_path.c_str(), true, FileSpec::Style::native); return true; } raw_path = lldb_shlib_spec.GetPath(); @@ -110,7 +110,7 @@ bool lldb_private::ComputeClangDirectory(FileSpec &lldb_shlib_spec, // Fall back to the Clang resource directory inside the framework. raw_path.append("LLDB.framework/Resources/Clang"); - file_spec.SetFile(raw_path.c_str(), true); + file_spec.SetFile(raw_path.c_str(), true, FileSpec::Style::native); return true; } diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index 62e08830b35..4eb15369aa1 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -4650,7 +4650,7 @@ public: switch (short_option) { case 'f': - m_outfile.SetFile(option_arg, true); + m_outfile.SetFile(option_arg, true, FileSpec::Style::native); if (m_outfile.Exists()) { m_outfile.Clear(); err.SetErrorStringWithFormat("file already exists: '%s'", diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index d7ca32427aa..ce62077f125 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -4005,8 +4005,8 @@ size_t ObjectFileMachO::ParseSymtab() { // that looks like "/tmp/src//tmp/src/" FileSpec so_dir(so_path, false); if (!so_dir.Exists()) { - so_dir.SetFile(&full_so_path[double_slash_pos + 1], - false); + so_dir.SetFile(&full_so_path[double_slash_pos + 1], false, + FileSpec::Style::native); if (so_dir.Exists()) { // Trim off the incorrect path full_so_path.erase(0, double_slash_pos + 1); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp index 2fcd22b0d41..e55cc0f4f6a 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp @@ -315,12 +315,12 @@ Status PlatformAppleTVSimulator::GetSymbolFile(const FileSpec &platform_file, platform_file_path); // First try in the SDK and see if the file is in there - local_file.SetFile(resolved_path, true); + local_file.SetFile(resolved_path, true, FileSpec::Style::native); if (local_file.Exists()) return error; // Else fall back to the actual path itself - local_file.SetFile(platform_file_path, true); + local_file.SetFile(platform_file_path, true, FileSpec::Style::native); if (local_file.Exists()) return error; } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp index 39bd2dc377d..8bbe0af0aec 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp @@ -315,12 +315,12 @@ Status PlatformAppleWatchSimulator::GetSymbolFile(const FileSpec &platform_file, platform_file_path); // First try in the SDK and see if the file is in there - local_file.SetFile(resolved_path, true); + local_file.SetFile(resolved_path, true, FileSpec::Style::native); if (local_file.Exists()) return error; // Else fall back to the actual path itself - local_file.SetFile(platform_file_path, true); + local_file.SetFile(platform_file_path, true, FileSpec::Style::native); if (local_file.Exists()) return error; } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index fa4a16b7671..9e2b721b67f 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -1167,7 +1167,7 @@ const char *PlatformDarwin::GetDeveloperDirectory() { if (xcode_select_prefix_dir) xcode_dir_path.append(xcode_select_prefix_dir); xcode_dir_path.append("/usr/share/xcode-select/xcode_dir_path"); - temp_file_spec.SetFile(xcode_dir_path, false); + temp_file_spec.SetFile(xcode_dir_path, false, FileSpec::Style::native); auto dir_buffer = DataBufferLLVM::CreateFromPath(temp_file_spec.GetPath()); if (dir_buffer && dir_buffer->GetByteSize() > 0) { @@ -1215,7 +1215,8 @@ const char *PlatformDarwin::GetDeveloperDirectory() { } if (developer_dir_path_valid) { - temp_file_spec.SetFile(developer_dir_path, false); + temp_file_spec.SetFile(developer_dir_path, false, + FileSpec::Style::native); if (temp_file_spec.Exists()) { m_developer_directory.assign(developer_dir_path); return m_developer_directory.c_str(); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp index 9aa7995e553..6b938a584cc 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -623,7 +623,7 @@ bool PlatformDarwinKernel::KextHasdSYMSibling( kext_bundle_filepath.GetPath() + "/Contents/MacOS/"; deep_bundle_str += executable_name.AsCString(); deep_bundle_str += ".dSYM"; - dsym_fspec.SetFile(deep_bundle_str, true); + dsym_fspec.SetFile(deep_bundle_str, true, FileSpec::Style::native); if (llvm::sys::fs::is_directory(dsym_fspec.GetPath())) { return true; } @@ -633,7 +633,7 @@ bool PlatformDarwinKernel::KextHasdSYMSibling( std::string shallow_bundle_str = kext_bundle_filepath.GetPath() + "/"; shallow_bundle_str += executable_name.AsCString(); shallow_bundle_str += ".dSYM"; - dsym_fspec.SetFile(shallow_bundle_str, true); + dsym_fspec.SetFile(shallow_bundle_str, true, FileSpec::Style::native); if (llvm::sys::fs::is_directory(dsym_fspec.GetPath())) { return true; } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp index 50b5988b48a..c24a0ee2a82 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -217,13 +217,13 @@ ConstString PlatformMacOSX::GetSDKDirectory(lldb_private::Target &target) { "SDKs/MacOSX%u.%u.sdk", xcode_contents_path.c_str(), versions[0], versions[1]); - fspec.SetFile(sdk_path.GetString(), false); + fspec.SetFile(sdk_path.GetString(), false, FileSpec::Style::native); if (fspec.Exists()) return ConstString(sdk_path.GetString()); } if (!default_xcode_sdk.empty()) { - fspec.SetFile(default_xcode_sdk, false); + fspec.SetFile(default_xcode_sdk, false, FileSpec::Style::native); if (fspec.Exists()) return ConstString(default_xcode_sdk); } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp index 01a4c8858c7..7b78c674c26 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp @@ -409,7 +409,7 @@ bool PlatformRemoteDarwinDevice::GetFileInSDK(const char *platform_file_path, const char *paths_to_try[] = {"Symbols", "", "Symbols.Internal", nullptr}; for (size_t i = 0; paths_to_try[i] != nullptr; i++) { - local_file.SetFile(sdkroot_path, false); + local_file.SetFile(sdkroot_path, false, FileSpec::Style::native); if (paths_to_try[i][0] != '\0') local_file.AppendPathComponent(paths_to_try[i]); local_file.AppendPathComponent(platform_file_path); @@ -442,7 +442,7 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file, ::snprintf(resolved_path, sizeof(resolved_path), "%s/%s", os_version_dir, platform_file_path); - local_file.SetFile(resolved_path, true); + local_file.SetFile(resolved_path, true, FileSpec::Style::native); if (local_file.Exists()) { if (log) { log->Printf("Found a copy of %s in the DeviceSupport dir %s", @@ -454,7 +454,7 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file, ::snprintf(resolved_path, sizeof(resolved_path), "%s/Symbols.Internal/%s", os_version_dir, platform_file_path); - local_file.SetFile(resolved_path, true); + local_file.SetFile(resolved_path, true, FileSpec::Style::native); if (local_file.Exists()) { if (log) { log->Printf( @@ -466,7 +466,7 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file, ::snprintf(resolved_path, sizeof(resolved_path), "%s/Symbols/%s", os_version_dir, platform_file_path); - local_file.SetFile(resolved_path, true); + local_file.SetFile(resolved_path, true, FileSpec::Style::native); if (local_file.Exists()) { if (log) { log->Printf("Found a copy of %s in the DeviceSupport dir %s/Symbols", diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp index 9cd294455e2..26feec28232 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp @@ -320,12 +320,12 @@ Status PlatformiOSSimulator::GetSymbolFile(const FileSpec &platform_file, platform_file_path); // First try in the SDK and see if the file is in there - local_file.SetFile(resolved_path, true); + local_file.SetFile(resolved_path, true, FileSpec::Style::native); if (local_file.Exists()) return error; // Else fall back to the actual path itself - local_file.SetFile(platform_file_path, true); + local_file.SetFile(platform_file_path, true, FileSpec::Style::native); if (local_file.Exists()) return error; } diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp index eeff8f3518a..d3f43399a0e 100644 --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -130,7 +130,8 @@ PlatformPOSIX::ResolveExecutable(const ModuleSpec &module_spec, // on the current path variables if (!resolved_module_spec.GetFileSpec().Exists()) { resolved_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path)); - resolved_module_spec.GetFileSpec().SetFile(exe_path, true); + resolved_module_spec.GetFileSpec().SetFile(exe_path, true, + FileSpec::Style::native); } if (!resolved_module_spec.GetFileSpec().Exists()) diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp index fdbcd37baea..5501710a235 100644 --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -194,7 +194,8 @@ Status PlatformWindows::ResolveExecutable( // variables if (!resolved_module_spec.GetFileSpec().Exists()) { resolved_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path)); - resolved_module_spec.GetFileSpec().SetFile(exe_path, true); + resolved_module_spec.GetFileSpec().SetFile(exe_path, true, + FileSpec::Style::native); } if (!resolved_module_spec.GetFileSpec().Exists()) diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp index e68025bea79..7bb7b72eaac 100644 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -249,7 +249,8 @@ Status ProcessElfCore::DoLoadCore() { ModuleSpec exe_module_spec; exe_module_spec.GetArchitecture() = arch; exe_module_spec.GetFileSpec().SetFile( - m_nt_file_entries[0].path.GetCString(), false); + m_nt_file_entries[0].path.GetCString(), false, + FileSpec::Style::native); if (exe_module_spec.GetFileSpec()) { exe_module_sp = GetTarget().GetSharedModule(exe_module_spec); if (exe_module_sp) diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index eb8ce5af42a..14f05531479 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -997,7 +997,8 @@ Status GDBRemoteCommunication::StartDebugserverProcess( // debugserver to use and use it if we do. const char *env_debugserver_path = getenv("LLDB_DEBUGSERVER_PATH"); if (env_debugserver_path) { - debugserver_file_spec.SetFile(env_debugserver_path, false); + debugserver_file_spec.SetFile(env_debugserver_path, false, + FileSpec::Style::native); if (log) log->Printf("GDBRemoteCommunication::%s() gdb-remote stub exe path set " "from environment variable: %s", diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 844e248dd0a..6948339c676 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -1939,7 +1939,8 @@ bool GDBRemoteCommunicationClient::DecodeProcessInfoResponse( // characters in a process name std::string name; extractor.GetHexByteString(name); - process_info.GetExecutableFile().SetFile(name, false); + process_info.GetExecutableFile().SetFile(name, false, + FileSpec::Style::native); } else if (name.equals("cputype")) { value.getAsInteger(0, cpu); } else if (name.equals("cpusubtype")) { diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp index c73fc56119c..d0cdbf3e292 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -361,7 +361,8 @@ GDBRemoteCommunicationServerCommon::Handle_qfProcessInfo( StringExtractor extractor(value); std::string file; extractor.GetHexByteString(file); - match_info.GetProcessInfo().GetExecutableFile().SetFile(file, false); + match_info.GetProcessInfo().GetExecutableFile().SetFile( + file, false, FileSpec::Style::native); } else if (key.equals("name_match")) { NameMatch name_match = llvm::StringSwitch<NameMatch>(value) .Case("equals", NameMatch::Equals) @@ -1031,7 +1032,8 @@ GDBRemoteCommunicationServerCommon::Handle_A(StringExtractorGDBRemote &packet) { if (success) { if (arg_idx == 0) - m_process_launch_info.GetExecutableFile().SetFile(arg, false); + m_process_launch_info.GetExecutableFile().SetFile( + arg, false, FileSpec::Style::native); m_process_launch_info.GetArguments().AppendArgument(arg); if (log) log->Printf("LLGSPacketHandler::%s added arg %d: \"%s\"", diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index b3338f3b4b7..e65f2f3e3b1 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -824,11 +824,14 @@ Status ProcessGDBRemote::DoLaunch(Module *exe_module, if (disable_stdio) { // set to /dev/null unless redirected to a file above if (!stdin_file_spec) - stdin_file_spec.SetFile(FileSystem::DEV_NULL, false); + stdin_file_spec.SetFile(FileSystem::DEV_NULL, false, + FileSpec::Style::native); if (!stdout_file_spec) - stdout_file_spec.SetFile(FileSystem::DEV_NULL, false); + stdout_file_spec.SetFile(FileSystem::DEV_NULL, false, + FileSpec::Style::native); if (!stderr_file_spec) - stderr_file_spec.SetFile(FileSystem::DEV_NULL, false); + stderr_file_spec.SetFile(FileSystem::DEV_NULL, false, + FileSpec::Style::native); } else if (platform_sp && platform_sp->IsHost()) { // If the debugserver is local and we aren't disabling STDIO, lets use // a pseudo terminal to instead of relying on the 'O' packets for stdio diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp index 1f66d8a23d8..317ea4c22c6 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp @@ -463,7 +463,7 @@ bool DWARFDebugLine::ParseSupportFiles( for (uint32_t file_idx = 1; prologue.GetFile(file_idx, cu_comp_dir, file_spec); ++file_idx) { if (module_sp->RemapSourceFile(file_spec.GetPath(), remapped_file)) - file_spec.SetFile(remapped_file, false); + file_spec.SetFile(remapped_file, false, FileSpec::Style::native); support_files.Append(file_spec); } return true; @@ -866,7 +866,7 @@ bool DWARFDebugLine::Prologue::GetFile(uint32_t file_idx, const lldb_private::FileSpec &comp_dir, FileSpec &file) const { uint32_t idx = file_idx - 1; // File indexes are 1 based... if (idx < file_names.size()) { - file.SetFile(file_names[idx].name, false); + file.SetFile(file_names[idx].name, false, FileSpec::Style::native); if (file.IsRelative()) { if (file_names[idx].dir_idx > 0) { const uint32_t dir_idx = file_names[idx].dir_idx - 1; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 203c22ee8b1..ac320ac52b0 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -801,7 +801,8 @@ lldb::CompUnitSP SymbolFileDWARF::ParseCompileUnit(DWARFUnit *dwarf_cu, std::string remapped_file; if (module_sp->RemapSourceFile(cu_file_spec.GetPath(), remapped_file)) - cu_file_spec.SetFile(remapped_file, false); + cu_file_spec.SetFile(remapped_file, false, + FileSpec::Style::native); } LanguageType cu_language = DWARFUnit::LanguageTypeFromDWARF( @@ -1584,7 +1585,7 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit( if (!comp_dir) return nullptr; - dwo_file.SetFile(comp_dir, true); + dwo_file.SetFile(comp_dir, true, FileSpec::Style::native); dwo_file.AppendPathComponent(dwo_name); } @@ -1627,12 +1628,14 @@ void SymbolFileDWARF::UpdateExternalModuleListIfNeeded() { die.GetAttributeValueAsString(DW_AT_GNU_dwo_name, nullptr); if (dwo_path) { ModuleSpec dwo_module_spec; - dwo_module_spec.GetFileSpec().SetFile(dwo_path, false); + dwo_module_spec.GetFileSpec().SetFile(dwo_path, false, + FileSpec::Style::native); if (dwo_module_spec.GetFileSpec().IsRelative()) { const char *comp_dir = die.GetAttributeValueAsString(DW_AT_comp_dir, nullptr); if (comp_dir) { - dwo_module_spec.GetFileSpec().SetFile(comp_dir, true); + dwo_module_spec.GetFileSpec().SetFile(comp_dir, true, + FileSpec::Style::native); dwo_module_spec.GetFileSpec().AppendPathComponent(dwo_path); } } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index d25e2c61200..39c70d14652 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -351,7 +351,7 @@ void SymbolFileDWARFDebugMap::InitOSO() { so_symbol->GetType() == eSymbolTypeSourceFile && oso_symbol->GetType() == eSymbolTypeObjectFile) { m_compile_unit_infos[i].so_file.SetFile( - so_symbol->GetName().AsCString(), false); + so_symbol->GetName().AsCString(), false, FileSpec::Style::native); m_compile_unit_infos[i].oso_path = oso_symbol->GetName(); m_compile_unit_infos[i].oso_mod_time = llvm::sys::toTimePoint(oso_symbol->GetIntegerValue(0)); diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index 68a5058670b..f282bf4dc8d 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -578,7 +578,7 @@ bool ObjectFile::SplitArchivePathWithObject(const char *path_with_object, std::string obj; if (regex_match.GetMatchAtIndex(path_with_object, 1, path) && regex_match.GetMatchAtIndex(path_with_object, 2, obj)) { - archive_file.SetFile(path, false); + archive_file.SetFile(path, false, FileSpec::Style::native); archive_object.SetCString(obj.c_str()); if (must_exist && !archive_file.Exists()) return false; diff --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp index 9b8250e7ee6..778728eebb0 100644 --- a/lldb/source/Target/PathMappingList.cpp +++ b/lldb/source/Target/PathMappingList.cpp @@ -196,7 +196,7 @@ bool PathMappingList::ReverseRemapPath(const FileSpec &file, FileSpec &fixed) co for (const auto &it : m_pairs) { if (!path_ref.consume_front(it.second.GetStringRef())) continue; - fixed.SetFile(it.first.GetStringRef(), false); + fixed.SetFile(it.first.GetStringRef(), false, FileSpec::Style::native); fixed.AppendPathComponent(path_ref); return true; } @@ -216,7 +216,8 @@ bool PathMappingList::FindFile(const FileSpec &orig_spec, if (orig_path_len >= prefix_len) { if (::strncmp(pos->first.GetCString(), orig_path, prefix_len) == 0) { - new_spec.SetFile(pos->second.GetCString(), false); + new_spec.SetFile(pos->second.GetCString(), false, + FileSpec::Style::native); new_spec.AppendPathComponent(orig_path + prefix_len); if (new_spec.Exists()) return true; diff --git a/lldb/source/Target/ProcessInfo.cpp b/lldb/source/Target/ProcessInfo.cpp index 3b4fdf69618..ac035068670 100644 --- a/lldb/source/Target/ProcessInfo.cpp +++ b/lldb/source/Target/ProcessInfo.cpp @@ -97,7 +97,7 @@ void ProcessInfo::SetArguments(char const **argv, // the launch options. Don't resolve the file path as the path could be a // remote platform path const bool resolve = false; - m_executable.SetFile(first_arg, resolve); + m_executable.SetFile(first_arg, resolve, FileSpec::Style::native); } } } @@ -114,7 +114,7 @@ void ProcessInfo::SetArguments(const Args &args, bool first_arg_is_executable) { // the launch options. Don't resolve the file path as the path could be a // remote platform path const bool resolve = false; - m_executable.SetFile(first_arg, resolve); + m_executable.SetFile(first_arg, resolve, FileSpec::Style::native); } } } diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp index 280e6e39ac7..b9c852b414e 100644 --- a/lldb/source/Target/TargetList.cpp +++ b/lldb/source/Target/TargetList.cpp @@ -120,7 +120,8 @@ Status TargetList::CreateTargetInternal( if (!user_exe_path.empty()) { ModuleSpecList module_specs; ModuleSpec module_spec; - module_spec.GetFileSpec().SetFile(user_exe_path, true); + module_spec.GetFileSpec().SetFile(user_exe_path, true, + FileSpec::Style::native); // Resolve the executable in case we are given a path to a application // bundle like a .app bundle on MacOSX diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp index ebb18d58f00..25519b6e7c7 100644 --- a/lldb/source/Utility/FileSpec.cpp +++ b/lldb/source/Utility/FileSpec.cpp @@ -230,6 +230,10 @@ const FileSpec &FileSpec::operator=(const FileSpec &rhs) { return *this; } +void FileSpec::SetFile(llvm::StringRef pathname, bool resolve) { + SetFile(pathname, resolve, m_style); +} + //------------------------------------------------------------------ // Update the contents of this object with a new path. The path will be split // up into a directory and filename and stored as uniqued string values for @@ -502,7 +506,7 @@ bool FileSpec::ResolvePath() { return true; // We have already resolved this path // SetFile(...) will set m_is_resolved correctly if it can resolve the path - SetFile(GetPath(false), true, m_style); + SetFile(GetPath(false), true); return m_is_resolved; } @@ -719,14 +723,14 @@ void FileSpec::PrependPathComponent(llvm::StringRef component) { const bool resolve = false; if (m_filename.IsEmpty() && m_directory.IsEmpty()) { - SetFile(component, resolve, m_style); + SetFile(component, resolve); return; } std::string result = join_path_components(m_style, {component, m_directory.GetStringRef(), m_filename.GetStringRef()}); - SetFile(result, resolve, m_style); + SetFile(result, resolve); } void FileSpec::PrependPathComponent(const FileSpec &new_path) { @@ -744,7 +748,7 @@ void FileSpec::AppendPathComponent(llvm::StringRef component) { join_path_components(m_style, {m_directory.GetStringRef(), m_filename.GetStringRef(), component}); - SetFile(result, false, m_style); + SetFile(result, false); } void FileSpec::AppendPathComponent(const FileSpec &new_path) { @@ -755,8 +759,7 @@ bool FileSpec::RemoveLastPathComponent() { llvm::SmallString<64> current_path; GetPath(current_path, false); if (llvm::sys::path::has_parent_path(current_path, m_style)) { - SetFile(llvm::sys::path::parent_path(current_path, m_style), false, - m_style); + SetFile(llvm::sys::path::parent_path(current_path, m_style), false); return true; } return false; diff --git a/lldb/tools/lldb-server/lldb-platform.cpp b/lldb/tools/lldb-server/lldb-platform.cpp index ec5b781dac4..cfaf5550d09 100644 --- a/lldb/tools/lldb-server/lldb-platform.cpp +++ b/lldb/tools/lldb-server/lldb-platform.cpp @@ -193,7 +193,7 @@ int main_platform(int argc, char *argv[]) { case 'f': // Socket file if (optarg && optarg[0]) - socket_file.SetFile(optarg, false); + socket_file.SetFile(optarg, false, FileSpec::Style::native); break; case 'p': { diff --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp index a5e06113c22..e41c066f9ab 100644 --- a/lldb/tools/lldb-test/lldb-test.cpp +++ b/lldb/tools/lldb-test/lldb-test.cpp @@ -562,7 +562,7 @@ int opts::symbols::dumpSymbols(Debugger &Dbg) { for (const auto &File : InputFilenames) { outs() << "Module: " << File << "\n"; ModuleSpec Spec{FileSpec(File, false)}; - Spec.GetSymbolFileSpec().SetFile(File, false); + Spec.GetSymbolFileSpec().SetFile(File, false, FileSpec::Style::native); auto ModulePtr = std::make_shared<lldb_private::Module>(Spec); SymbolVendor *Vendor = ModulePtr->GetSymbolVendor(); |

