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 /lldb/source/Plugins/DynamicLoader | |
| 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
Diffstat (limited to 'lldb/source/Plugins/DynamicLoader')
4 files changed, 8 insertions, 6 deletions
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); |

