summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Core/ModuleSpec.h9
-rw-r--r--lldb/include/lldb/Utility/FileSpec.h2
-rw-r--r--lldb/source/Core/Module.cpp3
-rw-r--r--lldb/source/Host/common/Host.cpp4
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp4
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp3
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp3
-rw-r--r--lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp7
-rw-r--r--lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp7
-rw-r--r--lldb/source/Symbol/ObjectFile.cpp5
-rw-r--r--lldb/source/Target/ModuleCache.cpp3
-rw-r--r--lldb/source/Utility/FileSpec.cpp7
-rw-r--r--lldb/unittests/Target/ModuleCacheTest.cpp4
13 files changed, 33 insertions, 28 deletions
diff --git a/lldb/include/lldb/Core/ModuleSpec.h b/lldb/include/lldb/Core/ModuleSpec.h
index 16a35a18778..4c73e69bb8d 100644
--- a/lldb/include/lldb/Core/ModuleSpec.h
+++ b/lldb/include/lldb/Core/ModuleSpec.h
@@ -11,6 +11,7 @@
#define liblldb_ModuleSpec_h_
// Project includes
+#include "lldb/Host/FileSystem.h"
#include "lldb/Target/PathMappingList.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
@@ -34,15 +35,17 @@ public:
m_object_name(), m_object_offset(0), m_object_size(0),
m_source_mappings() {}
- ModuleSpec(const FileSpec &file_spec, const UUID& uuid = UUID())
+ ModuleSpec(const FileSpec &file_spec, const UUID &uuid = UUID())
: m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(),
m_uuid(uuid), m_object_name(), m_object_offset(0),
- m_object_size(file_spec.GetByteSize()), m_source_mappings() {}
+ m_object_size(FileSystem::Instance().GetByteSize(file_spec)),
+ m_source_mappings() {}
ModuleSpec(const FileSpec &file_spec, const ArchSpec &arch)
: m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(arch),
m_uuid(), m_object_name(), m_object_offset(0),
- m_object_size(file_spec.GetByteSize()), m_source_mappings() {}
+ m_object_size(FileSystem::Instance().GetByteSize(file_spec)),
+ m_source_mappings() {}
ModuleSpec(const ModuleSpec &rhs)
: m_file(rhs.m_file), m_platform_file(rhs.m_platform_file),
diff --git a/lldb/include/lldb/Utility/FileSpec.h b/lldb/include/lldb/Utility/FileSpec.h
index de735e48405..467e7b6f05b 100644
--- a/lldb/include/lldb/Utility/FileSpec.h
+++ b/lldb/include/lldb/Utility/FileSpec.h
@@ -311,8 +311,6 @@ public:
//------------------------------------------------------------------
bool ResolvePath();
- uint64_t GetByteSize() const;
-
Style GetPathStyle() const;
//------------------------------------------------------------------
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index a08c1808b33..710b251a7e8 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1252,7 +1252,8 @@ ObjectFile *Module::GetObjectFile() {
GetFileSpec().GetFilename().AsCString(""));
DataBufferSP data_sp;
lldb::offset_t data_offset = 0;
- const lldb::offset_t file_size = m_file.GetByteSize();
+ const lldb::offset_t file_size =
+ FileSystem::Instance().GetByteSize(m_file);
if (file_size > m_object_offset) {
m_did_load_objfile = true;
m_objfile_sp = ObjectFile::FindPlugin(
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index f1556a54349..609168055cf 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -48,6 +48,7 @@
// C++ Includes
#include <csignal>
+#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/HostProcess.h"
@@ -554,7 +555,8 @@ Status Host::RunShellCommand(const Args &args, const FileSpec &working_dir,
if (command_output_ptr) {
command_output_ptr->clear();
- uint64_t file_size = output_file_spec.GetByteSize();
+ uint64_t file_size =
+ FileSystem::Instance().GetByteSize(output_file_spec);
if (file_size > 0) {
if (file_size > command_output_ptr->max_size()) {
error.SetErrorStringWithFormat(
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index d7ca18cd2c9..0f056329e49 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -18,6 +18,7 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
+#include "lldb/Host/FileSystem.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/SectionLoadList.h"
@@ -713,7 +714,8 @@ size_t ObjectFileELF::GetModuleSpecifications(
func_cat,
"Calculating module crc32 %s with size %" PRIu64 " KiB",
file.GetLastPathComponent().AsCString(),
- (file.GetByteSize() - file_offset) / 1024);
+ (FileSystem::Instance().GetByteSize(file) - file_offset) /
+ 1024);
// For core files - which usually don't happen to have a
// gnu_debuglink, and are pretty bulky - calculating whole
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 0dcf668bf56..2a2448c3b8f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1648,7 +1648,8 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(
lldb::offset_t dwo_file_data_offset = 0;
ObjectFileSP dwo_obj_file = ObjectFile::FindPlugin(
GetObjectFile()->GetModule(), &dwo_file, file_offset,
- dwo_file.GetByteSize(), dwo_file_data_sp, dwo_file_data_offset);
+ FileSystem::Instance().GetByteSize(dwo_file), dwo_file_data_sp,
+ dwo_file_data_offset);
if (dwo_obj_file == nullptr)
return nullptr;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp
index 2c18355c2a2..35508b5b489 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp
@@ -50,7 +50,8 @@ SymbolFileDWARFDwp::Create(lldb::ModuleSP module_sp,
lldb::DataBufferSP file_data_sp;
lldb::offset_t file_data_offset = 0;
lldb::ObjectFileSP obj_file = lldb_private::ObjectFile::FindPlugin(
- module_sp, &file_spec, file_offset, file_spec.GetByteSize(), file_data_sp,
+ module_sp, &file_spec, file_offset,
+ lldb_private::FileSystem::Instance().GetByteSize(file_spec), file_data_sp,
file_data_offset);
if (obj_file == nullptr)
return nullptr;
diff --git a/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
index d2451096687..a679f609c58 100644
--- a/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
+++ b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
@@ -108,9 +108,10 @@ SymbolVendorELF::CreateInstance(const lldb::ModuleSP &module_sp,
if (dsym_fspec) {
DataBufferSP dsym_file_data_sp;
lldb::offset_t dsym_file_data_offset = 0;
- ObjectFileSP dsym_objfile_sp = ObjectFile::FindPlugin(
- module_sp, &dsym_fspec, 0, dsym_fspec.GetByteSize(),
- dsym_file_data_sp, dsym_file_data_offset);
+ ObjectFileSP dsym_objfile_sp =
+ ObjectFile::FindPlugin(module_sp, &dsym_fspec, 0,
+ FileSystem::Instance().GetByteSize(dsym_fspec),
+ dsym_file_data_sp, dsym_file_data_offset);
if (dsym_objfile_sp) {
// This objfile is for debugging purposes. Sadly, ObjectFileELF won't
// be able to figure this out consistently as the symbol file may not
diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
index c69eb7fd51c..36d7e1eafc1 100644
--- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -153,9 +153,10 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
if (dsym_fspec) {
DataBufferSP dsym_file_data_sp;
lldb::offset_t dsym_file_data_offset = 0;
- dsym_objfile_sp = ObjectFile::FindPlugin(
- module_sp, &dsym_fspec, 0, dsym_fspec.GetByteSize(),
- dsym_file_data_sp, dsym_file_data_offset);
+ dsym_objfile_sp =
+ ObjectFile::FindPlugin(module_sp, &dsym_fspec, 0,
+ FileSystem::Instance().GetByteSize(dsym_fspec),
+ dsym_file_data_sp, dsym_file_data_offset);
if (UUIDsMatch(module_sp.get(), dsym_objfile_sp.get(), feedback_strm)) {
// We need a XML parser if we hope to parse a plist...
if (XMLDocument::XMLEnabled()) {
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp
index 937766d492e..a5cd36d6e65 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -91,7 +91,7 @@ ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file,
const bool must_exist = true;
if (ObjectFile::SplitArchivePathWithObject(
path_with_object, archive_file, archive_object, must_exist)) {
- file_size = archive_file.GetByteSize();
+ file_size = FileSystem::Instance().GetByteSize(archive_file);
if (file_size > 0) {
file = &archive_file;
module_sp->SetFileSpecAndObjectName(archive_file, archive_object);
@@ -212,7 +212,8 @@ size_t ObjectFile::GetModuleSpecifications(const FileSpec &file,
DataBufferSP data_sp = DataBufferLLVM::CreateSliceFromPath(file.GetPath(), 512, file_offset);
if (data_sp) {
if (file_size == 0) {
- const lldb::offset_t actual_file_size = file.GetByteSize();
+ const lldb::offset_t actual_file_size =
+ FileSystem::Instance().GetByteSize(file);
if (actual_file_size > file_offset)
file_size = actual_file_size - file_offset;
}
diff --git a/lldb/source/Target/ModuleCache.cpp b/lldb/source/Target/ModuleCache.cpp
index 19adfbabe27..4f4683290aa 100644
--- a/lldb/source/Target/ModuleCache.cpp
+++ b/lldb/source/Target/ModuleCache.cpp
@@ -227,7 +227,8 @@ Status ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname,
if (!module_file_path.Exists())
return Status("Module %s not found", module_file_path.GetPath().c_str());
- if (module_file_path.GetByteSize() != module_spec.GetObjectSize())
+ if (FileSystem::Instance().GetByteSize(module_file_path) !=
+ module_spec.GetObjectSize())
return Status("Module %s has invalid file size",
module_file_path.GetPath().c_str());
diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp
index 9b82c08d703..f94f8dd6c53 100644
--- a/lldb/source/Utility/FileSpec.cpp
+++ b/lldb/source/Utility/FileSpec.cpp
@@ -507,13 +507,6 @@ bool FileSpec::ResolvePath() {
return m_is_resolved;
}
-uint64_t FileSpec::GetByteSize() const {
- uint64_t Size = 0;
- if (llvm::sys::fs::file_size(GetPath(), Size))
- return 0;
- return Size;
-}
-
FileSpec::Style FileSpec::GetPathStyle() const { return m_style; }
uint32_t FileSpec::GetPermissions() const {
diff --git a/lldb/unittests/Target/ModuleCacheTest.cpp b/lldb/unittests/Target/ModuleCacheTest.cpp
index 59abe8e6c12..5d2d8a732c6 100644
--- a/lldb/unittests/Target/ModuleCacheTest.cpp
+++ b/lldb/unittests/Target/ModuleCacheTest.cpp
@@ -83,12 +83,12 @@ void ModuleCacheTest::TearDownTestCase() {
static void VerifyDiskState(const FileSpec &cache_dir, const char *hostname) {
FileSpec uuid_view = GetUuidView(cache_dir);
EXPECT_TRUE(uuid_view.Exists()) << "uuid_view is: " << uuid_view.GetCString();
- EXPECT_EQ(module_size, uuid_view.GetByteSize());
+ EXPECT_EQ(module_size, FileSystem::Instance().GetByteSize(uuid_view));
FileSpec sysroot_view = GetSysrootView(cache_dir, hostname);
EXPECT_TRUE(sysroot_view.Exists()) << "sysroot_view is: "
<< sysroot_view.GetCString();
- EXPECT_EQ(module_size, sysroot_view.GetByteSize());
+ EXPECT_EQ(module_size, FileSystem::Instance().GetByteSize(sysroot_view));
}
void ModuleCacheTest::TryGetAndPut(const FileSpec &cache_dir,
OpenPOWER on IntegriCloud