summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common/FileSpec.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2014-08-15 18:00:45 +0000
committerGreg Clayton <gclayton@apple.com>2014-08-15 18:00:45 +0000
commit5acc12550f8d94cad2b5498a4842a5079c69ac04 (patch)
tree8e417d278cd0528b521c02c27028a22ec94d9c70 /lldb/source/Host/common/FileSpec.cpp
parentd2308ea5fd583e8d342d9e8baa00486b57c6a9a9 (diff)
downloadbcm5719-llvm-5acc12550f8d94cad2b5498a4842a5079c69ac04.tar.gz
bcm5719-llvm-5acc12550f8d94cad2b5498a4842a5079c69ac04.zip
Don't crash when specifying a core file that isn't readable.
Fixes include: 1 - added new FileSpec method: bool FileSpec::Readable() 2 - detect when an executable is not readable and give an appropriate error for: (lldb) file /tmp/unreadablefile 3 - detect when a core file is not readable and give an appropriate error 4 - detect when a specified core file doesn't exist and give an appropriate error <rdar://problem/17727734> llvm-svn: 215741
Diffstat (limited to 'lldb/source/Host/common/FileSpec.cpp')
-rw-r--r--lldb/source/Host/common/FileSpec.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp
index 9ce4e99d769..56179a38f36 100644
--- a/lldb/source/Host/common/FileSpec.cpp
+++ b/lldb/source/Host/common/FileSpec.cpp
@@ -483,6 +483,15 @@ FileSpec::Exists () const
}
bool
+FileSpec::Readable () const
+{
+ const uint32_t permissions = GetPermissions();
+ if (permissions & eFilePermissionsEveryoneR)
+ return true;
+ return false;
+}
+
+bool
FileSpec::ResolveExecutableLocation ()
{
if (!m_directory)
OpenPOWER on IntegriCloud