summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/posix/FileSystem.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rename posix/FileSystem.cpp to FileSystemPosix.cppAdrian Prantl2019-11-151-80/+0
| | | | to avoid a linker warning on Darwin about two files having the same name.
* [lldb] Add missing EINTR handlingMichal Gorny2019-03-211-2/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D59606 llvm-svn: 356703
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [FileSystme] Move ::open abstraction into FileSystem.Jonas Devlieghere2018-11-021-0/+5
| | | | | | | This moves the abstraction around ::open into the FileSystem, as is already the case for ::fopen. llvm-svn: 346002
* [FileSystem] Move path resolution logic out of FileSpecJonas Devlieghere2018-11-011-2/+2
| | | | | | | | | This patch removes the logic for resolving paths out of FileSpec and updates call sites to rely on the FileSystem class instead. Differential revision: https://reviews.llvm.org/D53915 llvm-svn: 345890
* [FileSpec] Make style argument mandatory for SetFile. NFCJonas Devlieghere2018-06-131-1/+1
| | | | | | | | | | | | | | | | 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
* Remove Linux-specific includes for posix/FileSystem.cppBruce Mitchener2018-05-291-5/+0
| | | | | | | | | | | | | | Summary: This improves the process of cross-compiling from macOS to Linux since these files aren't used / needed at all. Reviewers: clayborg, labath Subscribers: lldb-commits, krytarowski Differential Revision: https://reviews.llvm.org/D47420 llvm-svn: 333400
* Clean up lldb-types.hPavel Labath2017-07-181-0/+1
| | | | | | | | | | | | | | | | | | | | Summary: It defined a couple of types (condition_t) which we don't use anymore, as we have c++11 goodies now. I remove these definitions. Also it unnecessarily included a couple of headers which weren't necessary for it's operation. I remove these, and place the includes in the relevant files (usually .cpp, usually in Host code) which use them. This allows us to reduce namespace pollution in most of the lldb files which don't need the OS-specific definitions. Reviewers: zturner, jingham Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D35113 llvm-svn: 308304
* Rename Error -> Status.Zachary Turner2017-05-121-9/+9
| | | | | | | | | | | | | | | This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. llvm-svn: 302872
* Resubmit r298334 after fixing OSX build errors.Zachary Turner2017-03-211-78/+0
| | | | | | | Hopefully this works, I can't test since I don't have Mac hardware, however. llvm-svn: 298340
* Revert r298334 until Zachary has a chance to fix the buildbot failureJason Molenda2017-03-211-0/+78
| | | | | | on macosx. llvm-svn: 298338
* Delete various lldb FileSystem functions.Zachary Turner2017-03-211-78/+0
| | | | | | | | Use LLVM's equivalent versions instead. Differential Revision: https://reviews.llvm.org/D31111 llvm-svn: 298334
* Remove FileSystem::Get/SetFilePermissionsZachary Turner2017-03-191-22/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D31089 llvm-svn: 298205
* Remove FileSystem::MakeDirectory.Zachary Turner2017-03-191-33/+0
| | | | | | | | Have callers use llvm::sys::fs::create_directory() instead. Differential Revision: https://reviews.llvm.org/D31086 llvm-svn: 298203
* Remove LLDB's recursive directory deletion function.Zachary Turner2017-03-091-52/+0
| | | | | | LLVM now has such a function, so we use that instead. llvm-svn: 297360
* Resubmit FileSystem changes.Zachary Turner2017-03-081-3/+5
| | | | | | | | | | This was originall reverted due to some test failures in ModuleCache and TestCompDirSymlink. These issues have all been resolved and the code now passes all tests. Differential Revision: https://reviews.llvm.org/D30698 llvm-svn: 297300
* Revert "Use LLVM for all stat-related functionality."Pavel Labath2017-03-071-5/+3
| | | | | | | | | | | | | | | this reverts r297116 because it breaks the unittests and TestCompDirSymlink. The ModuleCache unit test is trivially fixable, but the CompDirSymlink failure is a symptom of a deeper problem: llvm's stat functionality is not a drop-in replacement for lldb's. The former is based on stat(2) (which does symlink resolution), while the latter is based on lstat(2) (which does not). This also reverts subsequent build fixes (r297128, r297120, 297117) and r297119 (Remove FileSpec dependency on FileSystem) which builds on top of this. llvm-svn: 297139
* Use LLVM for all stat-related functionality.Zachary Turner2017-03-071-3/+5
| | | | | | | | | | This deletes LLDB's FileType enumeration and replaces all users, and all calls to functions that check whether a file exists etc with corresponding calls to LLVM. Differential Revision: https://reviews.llvm.org/D30624 llvm-svn: 297116
* Move classes from Core -> Utility.Zachary Turner2017-02-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | This moves the following classes from Core -> Utility. ConstString Error RegularExpression Stream StreamString The goal here is to get lldbUtility into a state where it has no dependendencies except on itself and LLVM, so it can be the starting point at which to start untangling LLDB's dependencies. These are all low level and very widely used classes, and previously lldbUtility had dependencies up to lldbCore in order to use these classes. So moving then down to lldbUtility makes sense from both the short term and long term perspective in solving this problem. Differential Revision: https://reviews.llvm.org/D29427 llvm-svn: 293941
* Prevent at compile time converting from Error::success() to Expected<T>Mehdi Amini2016-11-111-2/+2
| | | | | | | | This would trigger an assertion at runtime otherwise. Differential Revision: https://reviews.llvm.org/D26482 llvm-svn: 286562
* Make the Error class constructor protectedMehdi Amini2016-11-111-2/+2
| | | | | | | | | This is forcing to use Error::success(), which is in a wide majority of cases a lot more readable. Differential Revision: https://reviews.llvm.org/D26481 llvm-svn: 286561
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-226/+175
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* Unicode support on Win32.Zachary Turner2016-03-221-0/+12
| | | | | | | | | | | | | Win32 API calls that are Unicode aware require wide character strings, but LLDB uses UTF8 everywhere. This patch does conversions wherever necessary when passing strings into and out of Win32 API calls. Patch by Cameron Differential Revision: http://reviews.llvm.org/D17107 Reviewed By: zturner, amccarth llvm-svn: 264074
* Fix all of the unannotated switch cases to annotate the fall through or do ↵Greg Clayton2016-02-261-16/+18
| | | | | | the right thing and break. llvm-svn: 261950
* Make uses of /dev/null portable across OSes.Zachary Turner2015-10-141-0/+3
| | | | | | | | | Most platforms have "/dev/null". Windows has "nul". Instead of hardcoding the string /dev/null at various places, make a constant that contains the correct value depending on the platform, and use that everywhere instead. llvm-svn: 250331
* Moved ResolveSymbolicLink() to the FileSystem where it belongs, thanksSean Callanan2015-09-181-0/+22
| | | | | | | | zturner! http://reviews.llvm.org/D12984 llvm-svn: 248055
* Remove unused modules from module cache.Oleksiy Vyalov2015-09-181-0/+10
| | | | | | http://reviews.llvm.org/D12971 llvm-svn: 248017
* NetBSD doesn't provide struct statfs, make use of struct statvfsStephane Sezer2015-09-091-0/+22
| | | | | | | | | | | | Reviewers: joerg, sas Subscribers: labath, lldb-commits Differential Revision: http://reviews.llvm.org/D12661 Change by Kamil Rytarowski <n54@gmx.com> llvm-svn: 247115
* Avoid a recursive function call that could run LLDB out of file descriptors ↵Greg Clayton2015-06-291-18/+34
| | | | | | | | | | | | | | | | | in FileSystem::DeleteDirectory(...). Fixes include: - use FileSystem::Unlink() instead of a direct call to ::unlink(...) when deleting files when iterating through the current directory - save directories from current directory in a list and iterate through those _after_ the current directory has been iterated - Use new FileSpec::ForEachItemInDirectory() instead of manually iterating across directories with opendir()/readdir()/closedir() We should switch all code over to using FileSpec::ForEachItemInDirectory(...) in the near future and get rid of FileSpec::EnumerateDirectory(). This is a follow up patch to: http://reviews.llvm.org/D10787 llvm-svn: 240978
* Replace `rm -rf` with more portable implementation.Chaoren Lin2015-06-271-5/+20
| | | | | | | | | | Reviewers: clayborg, vharron Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10787 llvm-svn: 240895
* Refactor many file functions to use FileSpec over strings.Chaoren Lin2015-05-291-46/+39
| | | | | | | | | | | | | | | | | Summary: This should solve the issue of sending denormalized paths over gdb-remote if we stick to GetPath(false) in GDBRemoteCommunicationClient, and let the server handle any denormalization. Reviewers: ovyalov, zturner, vharron, clayborg Reviewed By: clayborg Subscribers: tberghammer, emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D9728 llvm-svn: 238604
* Use hard links to link sysroot files within ModuleCache.Oleksiy Vyalov2015-05-081-0/+9
| | | | | | http://reviews.llvm.org/D9587 llvm-svn: 236917
* Fix LLDB ARM build error on ubuntu precise with gcc4.7Omair Javaid2015-04-271-1/+1
| | | | | | Differential revision: http://reviews.llvm.org/D9100 llvm-svn: 235865
* Fix typo that breaks FileSystem::IsLocalVince Harron2015-02-241-1/+1
| | | | llvm-svn: 230312
* Compile fix for FileSystem::IsLocal on LinuxVince Harron2015-02-241-2/+25
| | | | llvm-svn: 230311
* Avoid crashing by not mmap'ing files on network mounted file systems.Greg Clayton2015-02-231-0/+12
| | | | | | | | | | | | | | | | | | | | This is implemented by making a new FileSystem function: bool FileSystem::IsLocal(const FileSpec &spec) Then using this in a new function: DataBufferSP FileSpec::MemoryMapFileContentsIfLocal(off_t file_offset, size_t file_size) const; This function only mmaps data if the file is a local file since that means we can reliably page in data. We were experiencing crashes where people would use debug info files on network mounted file systems and that mount would go away and cause the next access to a page that wasn't paged in to crash LLDB. We now avoid this by just copying the data into a heap buffer and keeping a permanent copy to avoid the crash. Updated all previous users of FileSpec::MemoryMapFileContentsIfLocal() in ObjectFile subclasses over to use the new FileSpec::MemoryMapFileContentsIfLocal() function. <rdar://problem/19470249> llvm-svn: 230283
* Introduce FileSystem::CalculateMD5AsString that supports any platform and ↵Oleksiy Vyalov2015-02-201-27/+0
| | | | | | | | make existing FileSystem::CalculateMD5 to use it. http://reviews.llvm.org/D7771 llvm-svn: 230036
* Move FileSystem functions out of Host and into their own classes.Zachary Turner2014-08-151-0/+201
More specifically, this change can be summarized as follows: 1) Makes an lldbHostPosix library which contains code common to all posix platforms. 2) Creates Host/FileSystem.h which defines a common FileSystem interface. 3) Implements FileSystem.h in Host/windows and Host/posix. 4) Creates Host/FileCache.h, implemented in Host/common, which defines a class useful for storing handles to open files needed by the debugger. Differential Revision: http://reviews.llvm.org/D4889 llvm-svn: 215775
OpenPOWER on IntegriCloud